stabilize-orm 1.3.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +1097 -561
  2. package/dist/auto-migrate.d.ts +34 -0
  3. package/dist/auto-migrate.d.ts.map +1 -0
  4. package/dist/auto-migrate.js +3003 -0
  5. package/dist/auto-migrate.js.map +163 -0
  6. package/dist/cache.d.ts +90 -0
  7. package/dist/cache.d.ts.map +1 -0
  8. package/dist/cache.js +166 -0
  9. package/dist/cache.js.map +64 -0
  10. package/dist/client.d.ts +73 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +2997 -0
  13. package/dist/client.js.map +162 -0
  14. package/dist/hooks.d.ts +31 -0
  15. package/dist/hooks.d.ts.map +1 -0
  16. package/dist/hooks.js +4 -0
  17. package/dist/hooks.js.map +11 -0
  18. package/dist/index.d.ts +101 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +3183 -0
  21. package/dist/index.js.map +222 -0
  22. package/dist/logger.d.ts +40 -0
  23. package/dist/logger.d.ts.map +1 -0
  24. package/dist/logger.js +8 -0
  25. package/dist/logger.js.map +11 -0
  26. package/dist/migrations.d.ts +31 -0
  27. package/dist/migrations.d.ts.map +1 -0
  28. package/dist/migrations.js +3009 -0
  29. package/dist/migrations.js.map +164 -0
  30. package/{model.ts → dist/model.d.ts} +124 -189
  31. package/dist/model.d.ts.map +1 -0
  32. package/dist/model.js +4 -0
  33. package/dist/model.js.map +10 -0
  34. package/dist/query-builder.d.ts +91 -0
  35. package/dist/query-builder.d.ts.map +1 -0
  36. package/dist/query-builder.js +14 -0
  37. package/dist/query-builder.js.map +12 -0
  38. package/dist/repository.d.ts +165 -0
  39. package/dist/repository.d.ts.map +1 -0
  40. package/dist/repository.js +176 -0
  41. package/dist/repository.js.map +69 -0
  42. package/dist/tsconfig.tsbuildinfo +1 -0
  43. package/dist/types.d.ts +110 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +4 -0
  46. package/dist/types.js.map +10 -0
  47. package/dist/utils/encryption.d.ts +13 -0
  48. package/dist/utils/encryption.d.ts.map +1 -0
  49. package/dist/utils/encryption.js +4 -0
  50. package/dist/utils/encryption.js.map +10 -0
  51. package/package.json +96 -17
  52. package/.eslintrc.json +0 -10
  53. package/.github/ISSUE_TEMPLATE/PULL_REQUEST_TEMPLATE.md +0 -23
  54. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
  55. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  56. package/.github/workflows/ci-cd.yml +0 -22
  57. package/CHANGELOG.md +0 -75
  58. package/CODE_OF_CONDUCT.md +0 -87
  59. package/CONTRIBUTING.md +0 -48
  60. package/FUNDING.md +0 -14
  61. package/SECURITY.md +0 -35
  62. package/SUPPORT.md +0 -18
  63. package/bun.lock +0 -667
  64. package/cache.ts +0 -181
  65. package/client.ts +0 -249
  66. package/docker-compose.yml +0 -22
  67. package/hooks.ts +0 -76
  68. package/index.ts +0 -158
  69. package/logger.ts +0 -127
  70. package/migrations.ts +0 -318
  71. package/public/logo_both-transparent.png +0 -0
  72. package/public/logo_iamge-transparent.png +0 -0
  73. package/public/logo_text-transparent.png +0 -0
  74. package/query-builder.ts +0 -209
  75. package/repository.ts +0 -1096
  76. package/tests/migrations.test.ts +0 -141
  77. package/tsconfig.json +0 -32
  78. package/types.ts +0 -106
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @file cache.ts
3
+ * @description Provides a Redis-backed caching layer for the ORM.
4
+ * @author ElectronSz
5
+ */
6
+ import { type CacheConfig, type CacheStats } from "./types";
7
+ import { type Logger } from "./logger";
8
+ /**
9
+ * A caching client that uses Redis to store and retrieve query results.
10
+ * It supports cache-aside and write-through strategies and keeps track of basic stats.
11
+ */
12
+ export declare class Cache {
13
+ private redis;
14
+ private logger;
15
+ private hits;
16
+ private misses;
17
+ /** The configuration object the cache was initialized with. */
18
+ readonly config: CacheConfig;
19
+ /**
20
+ * Creates an instance of the Cache client.
21
+ * @param config The configuration for the cache, including Redis URL and TTL.
22
+ * @param logger A logger instance for logging messages.
23
+ */
24
+ constructor(config: CacheConfig, logger?: Logger);
25
+ /**
26
+ * Gets the caching strategy being used.
27
+ * @returns The caching strategy, either 'cache-aside' or 'write-through'.
28
+ */
29
+ getStrategy(): "cache-aside" | "write-through";
30
+ /**
31
+ * Retrieves an item from the cache.
32
+ * @template T The expected type of the cached item.
33
+ * @param key The key of the item to retrieve.
34
+ * @returns A promise that resolves to the cached item or `null` if not found.
35
+ * @example
36
+ * ```
37
+ * const user = await cache.get<User>('user:1');
38
+ * ```
39
+ */
40
+ get<T>(key: string): Promise<T | null>;
41
+ /**
42
+ * Stores an item in the cache.
43
+ * @template T The type of the item being stored.
44
+ * @param key The key to store the item under.
45
+ * @param value The value to store.
46
+ * @param ttl Optional: The time-to-live for this specific item in seconds. Defaults to the global TTL.
47
+ * @returns A promise that resolves when the item is set.
48
+ * @example
49
+ * ```
50
+ * await cache.set('user:1', user, 3600); // Cache for 1 hour
51
+ * ```
52
+ */
53
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
54
+ /**
55
+ * Removes one or more items from the cache by their exact keys.
56
+ * @param keys An array of keys to invalidate.
57
+ * @returns A promise that resolves when the keys are invalidated.
58
+ * @example
59
+ * ```
60
+ * await cache.invalidate(['user:1', 'all_users']);
61
+ * ```
62
+ */
63
+ invalidate(keys: string[]): Promise<void>;
64
+ /**
65
+ * Invalidates all keys matching a given pattern.
66
+ * @param pattern The pattern to match against (e.g., 'user:*').
67
+ * @returns A promise that resolves when the operation is complete.
68
+ * @example
69
+ * ```
70
+ * await cache.invalidatePattern('user:*'); // Invalidates all user-related cache
71
+ * ```
72
+ */
73
+ invalidatePattern(pattern: string): Promise<void>;
74
+ /**
75
+ * Retrieves statistics about the cache, including hits, misses, and total key count.
76
+ * @returns A promise that resolves to a `CacheStats` object.
77
+ * @example
78
+ * ```
79
+ * const stats = await cache.getStats();
80
+ * console.log(`Cache Hits: ${stats.hits}, Misses: ${stats.misses}`);
81
+ * ```
82
+ */
83
+ getStats(): Promise<CacheStats>;
84
+ /**
85
+ * Disconnects the Redis client gracefully.
86
+ * @returns A promise that resolves when the client has disconnected.
87
+ */
88
+ disconnect(): Promise<void>;
89
+ }
90
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAmB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAExD;;;GAGG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAa;IAE3B,+DAA+D;IAC/D,SAAgB,MAAM,EAAE,WAAW,CAAC;IAEpC;;;;OAIG;gBACS,MAAM,EAAE,WAAW,EAAE,MAAM,GAAE,MAA8B;IAavE;;;OAGG;IACH,WAAW;IAIX;;;;;;;;;OASG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAmB5C;;;;;;;;;;;OAWG;IACG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBhE;;;;;;;;OAQG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAe/C;;;;;;;;OAQG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvD;;;;;;;;OAQG;IACG,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC;IAWrC;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAMlC"}
package/dist/cache.js ADDED
@@ -0,0 +1,166 @@
1
+ // @bun
2
+ var nw=Object.create;var{getPrototypeOf:sw,defineProperty:_S,getOwnPropertyNames:rw}=Object;var ew=Object.prototype.hasOwnProperty;var S3=(S,y,w)=>{w=S!=null?nw(sw(S)):{};let k=y||!S||!S.__esModule?_S(w,"default",{value:S,enumerable:!0}):w;for(let $ of rw(S))if(!ew.call(k,$))_S(k,$,{get:()=>S[$],enumerable:!0});return k};var q=(S,y)=>()=>(y||S((y={exports:{}}).exports,y),y.exports);var G=import.meta.require;var fS=q((M7,Z3)=>{Z3.exports={acl:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},append:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},asking:{arity:1,flags:["fast"],keyStart:0,keyStop:0,step:0},auth:{arity:-2,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},bgrewriteaof:{arity:1,flags:["admin","noscript","no_async_loading"],keyStart:0,keyStop:0,step:0},bgsave:{arity:-1,flags:["admin","noscript","no_async_loading"],keyStart:0,keyStop:0,step:0},bitcount:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},bitfield:{arity:-2,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},bitfield_ro:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},bitop:{arity:-4,flags:["write","denyoom"],keyStart:2,keyStop:-1,step:1},bitpos:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},blmove:{arity:6,flags:["write","denyoom","noscript","blocking"],keyStart:1,keyStop:2,step:1},blmpop:{arity:-5,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},blpop:{arity:-3,flags:["write","noscript","blocking"],keyStart:1,keyStop:-2,step:1},brpop:{arity:-3,flags:["write","noscript","blocking"],keyStart:1,keyStop:-2,step:1},brpoplpush:{arity:4,flags:["write","denyoom","noscript","blocking"],keyStart:1,keyStop:2,step:1},bzmpop:{arity:-5,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},bzpopmax:{arity:-3,flags:["write","noscript","blocking","fast"],keyStart:1,keyStop:-2,step:1},bzpopmin:{arity:-3,flags:["write","noscript","blocking","fast"],keyStart:1,keyStop:-2,step:1},client:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},cluster:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},command:{arity:-1,flags:["loading","stale"],keyStart:0,keyStop:0,step:0},config:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},copy:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},dbsize:{arity:1,flags:["readonly","fast"],keyStart:0,keyStop:0,step:0},debug:{arity:-2,flags:["admin","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},decr:{arity:2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},decrby:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},del:{arity:-2,flags:["write"],keyStart:1,keyStop:-1,step:1},discard:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},dump:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},echo:{arity:2,flags:["fast"],keyStart:0,keyStop:0,step:0},eval:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},eval_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},evalsha:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},evalsha_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},exec:{arity:1,flags:["noscript","loading","stale","skip_slowlog"],keyStart:0,keyStop:0,step:0},exists:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},expire:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},expireat:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},expiretime:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},failover:{arity:-1,flags:["admin","noscript","stale"],keyStart:0,keyStop:0,step:0},fcall:{arity:-3,flags:["noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},fcall_ro:{arity:-3,flags:["readonly","noscript","stale","skip_monitor","no_mandatory_keys","movablekeys"],keyStart:0,keyStop:0,step:0},flushall:{arity:-1,flags:["write"],keyStart:0,keyStop:0,step:0},flushdb:{arity:-1,flags:["write"],keyStart:0,keyStop:0,step:0},function:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},geoadd:{arity:-5,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},geodist:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},geohash:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},geopos:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},georadius:{arity:-6,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},georadius_ro:{arity:-6,flags:["readonly"],keyStart:1,keyStop:1,step:1},georadiusbymember:{arity:-5,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},georadiusbymember_ro:{arity:-5,flags:["readonly"],keyStart:1,keyStop:1,step:1},geosearch:{arity:-7,flags:["readonly"],keyStart:1,keyStop:1,step:1},geosearchstore:{arity:-8,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},get:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},getbit:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},getdel:{arity:2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},getex:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},getrange:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},getset:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hdel:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},hello:{arity:-1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},hexists:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hexpire:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},hpexpire:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},hget:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hgetall:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hincrby:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hincrbyfloat:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hkeys:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hmget:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hmset:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hrandfield:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},hscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},hset:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hsetnx:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},hstrlen:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},hvals:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},incr:{arity:2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},incrby:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},incrbyfloat:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},info:{arity:-1,flags:["loading","stale"],keyStart:0,keyStop:0,step:0},keys:{arity:2,flags:["readonly"],keyStart:0,keyStop:0,step:0},lastsave:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},latency:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},lcs:{arity:-3,flags:["readonly"],keyStart:1,keyStop:2,step:1},lindex:{arity:3,flags:["readonly"],keyStart:1,keyStop:1,step:1},linsert:{arity:5,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},llen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},lmove:{arity:5,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},lmpop:{arity:-4,flags:["write","movablekeys"],keyStart:0,keyStop:0,step:0},lolwut:{arity:-1,flags:["readonly","fast"],keyStart:0,keyStop:0,step:0},lpop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},lpos:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},lpush:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},lpushx:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},lrange:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},lrem:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},lset:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},ltrim:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},memory:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},mget:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},migrate:{arity:-6,flags:["write","movablekeys"],keyStart:3,keyStop:3,step:1},module:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},monitor:{arity:1,flags:["admin","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},move:{arity:3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},mset:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:2},msetnx:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:2},multi:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},object:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},persist:{arity:2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpire:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpireat:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},pexpiretime:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},pfadd:{arity:-2,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},pfcount:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},pfdebug:{arity:3,flags:["write","denyoom","admin"],keyStart:2,keyStop:2,step:1},pfmerge:{arity:-2,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},pfselftest:{arity:1,flags:["admin"],keyStart:0,keyStop:0,step:0},ping:{arity:-1,flags:["fast"],keyStart:0,keyStop:0,step:0},psetex:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},psubscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},psync:{arity:-3,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},pttl:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},publish:{arity:3,flags:["pubsub","loading","stale","fast"],keyStart:0,keyStop:0,step:0},pubsub:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},punsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},quit:{arity:-1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},randomkey:{arity:1,flags:["readonly"],keyStart:0,keyStop:0,step:0},readonly:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},readwrite:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},rename:{arity:3,flags:["write"],keyStart:1,keyStop:2,step:1},renamenx:{arity:3,flags:["write","fast"],keyStart:1,keyStop:2,step:1},replconf:{arity:-1,flags:["admin","noscript","loading","stale","allow_busy"],keyStart:0,keyStop:0,step:0},replicaof:{arity:3,flags:["admin","noscript","stale","no_async_loading"],keyStart:0,keyStop:0,step:0},reset:{arity:1,flags:["noscript","loading","stale","fast","no_auth","allow_busy"],keyStart:0,keyStop:0,step:0},restore:{arity:-4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},"restore-asking":{arity:-4,flags:["write","denyoom","asking"],keyStart:1,keyStop:1,step:1},role:{arity:1,flags:["noscript","loading","stale","fast"],keyStart:0,keyStop:0,step:0},rpop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},rpoplpush:{arity:3,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},rpush:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},rpushx:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},sadd:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},save:{arity:1,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},scan:{arity:-2,flags:["readonly"],keyStart:0,keyStop:0,step:0},scard:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},script:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},sdiff:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sdiffstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},select:{arity:2,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},set:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setbit:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setex:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},setnx:{arity:3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},setrange:{arity:4,flags:["write","denyoom"],keyStart:1,keyStop:1,step:1},shutdown:{arity:-1,flags:["admin","noscript","loading","stale","no_multi","allow_busy"],keyStart:0,keyStop:0,step:0},sinter:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sintercard:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},sinterstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},sismember:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},slaveof:{arity:3,flags:["admin","noscript","stale","no_async_loading"],keyStart:0,keyStop:0,step:0},slowlog:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},smembers:{arity:2,flags:["readonly"],keyStart:1,keyStop:1,step:1},smismember:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},smove:{arity:4,flags:["write","fast"],keyStart:1,keyStop:2,step:1},sort:{arity:-2,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},sort_ro:{arity:-2,flags:["readonly","movablekeys"],keyStart:1,keyStop:1,step:1},spop:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},spublish:{arity:3,flags:["pubsub","loading","stale","fast"],keyStart:1,keyStop:1,step:1},srandmember:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},srem:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},sscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},ssubscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:1,keyStop:-1,step:1},strlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},subscribe:{arity:-2,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},substr:{arity:4,flags:["readonly"],keyStart:1,keyStop:1,step:1},sunion:{arity:-2,flags:["readonly"],keyStart:1,keyStop:-1,step:1},sunionstore:{arity:-3,flags:["write","denyoom"],keyStart:1,keyStop:-1,step:1},sunsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:1,keyStop:-1,step:1},swapdb:{arity:3,flags:["write","fast"],keyStart:0,keyStop:0,step:0},sync:{arity:1,flags:["admin","noscript","no_async_loading","no_multi"],keyStart:0,keyStop:0,step:0},time:{arity:1,flags:["loading","stale","fast"],keyStart:0,keyStop:0,step:0},touch:{arity:-2,flags:["readonly","fast"],keyStart:1,keyStop:-1,step:1},ttl:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},type:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},unlink:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:-1,step:1},unsubscribe:{arity:-1,flags:["pubsub","noscript","loading","stale"],keyStart:0,keyStop:0,step:0},unwatch:{arity:1,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:0,keyStop:0,step:0},wait:{arity:3,flags:["noscript"],keyStart:0,keyStop:0,step:0},watch:{arity:-2,flags:["noscript","loading","stale","fast","allow_busy"],keyStart:1,keyStop:-1,step:1},xack:{arity:-4,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xadd:{arity:-5,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},xautoclaim:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xclaim:{arity:-6,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xdel:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xdelex:{arity:-5,flags:["write","fast"],keyStart:1,keyStop:1,step:1},xgroup:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},xinfo:{arity:-2,flags:[],keyStart:0,keyStop:0,step:0},xlen:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},xpending:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},xrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},xread:{arity:-4,flags:["readonly","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},xreadgroup:{arity:-7,flags:["write","blocking","movablekeys"],keyStart:0,keyStop:0,step:0},xrevrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},xsetid:{arity:-3,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},xtrim:{arity:-4,flags:["write"],keyStart:1,keyStop:1,step:1},zadd:{arity:-4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},zcard:{arity:2,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zcount:{arity:4,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zdiff:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zdiffstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},zincrby:{arity:4,flags:["write","denyoom","fast"],keyStart:1,keyStop:1,step:1},zinter:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zintercard:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zinterstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1},zlexcount:{arity:4,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zmpop:{arity:-4,flags:["write","movablekeys"],keyStart:0,keyStop:0,step:0},zmscore:{arity:-3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zpopmax:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zpopmin:{arity:-2,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zrandmember:{arity:-2,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangebylex:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangebyscore:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrangestore:{arity:-5,flags:["write","denyoom"],keyStart:1,keyStop:2,step:1},zrank:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zrem:{arity:-3,flags:["write","fast"],keyStart:1,keyStop:1,step:1},zremrangebylex:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zremrangebyrank:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zremrangebyscore:{arity:4,flags:["write"],keyStart:1,keyStop:1,step:1},zrevrange:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrangebylex:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrangebyscore:{arity:-4,flags:["readonly"],keyStart:1,keyStop:1,step:1},zrevrank:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zscan:{arity:-3,flags:["readonly"],keyStart:1,keyStop:1,step:1},zscore:{arity:3,flags:["readonly","fast"],keyStart:1,keyStop:1,step:1},zunion:{arity:-3,flags:["readonly","movablekeys"],keyStart:0,keyStop:0,step:0},zunionstore:{arity:-4,flags:["write","denyoom","movablekeys"],keyStart:1,keyStop:1,step:1}}});var r=q((L)=>{var Y3=L&&L.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(L,"__esModule",{value:!0});L.getKeyIndexes=L.hasFlag=L.exists=L.list=void 0;var I1=Y3(fS());L.list=Object.keys(I1.default);var i1={};L.list.forEach((S)=>{i1[S]=I1.default[S].flags.reduce(function(y,w){return y[w]=!0,y},{})});function J3(S){return Boolean(I1.default[S])}L.exists=J3;function U3(S,y){if(!i1[S])throw Error("Unknown command "+S);return Boolean(i1[S][y])}L.hasFlag=U3;function W3(S,y,w){let k=I1.default[S];if(!k)throw Error("Unknown command "+S);if(!Array.isArray(y))throw Error("Expect args to be an array");let $=[],Z=Boolean(w&&w.parseExternalKey),Y=(U,z)=>{let W=[],X=Number(U[z]);for(let Q=0;Q<X;Q++)W.push(Q+z+1);return W},J=(U,z,W)=>{for(let X=z;X<U.length-1;X+=1)if(String(U[X]).toLowerCase()===W.toLowerCase())return X+1;return null};switch(S){case"zunionstore":case"zinterstore":case"zdiffstore":$.push(0,...Y(y,1));break;case"eval":case"evalsha":case"eval_ro":case"evalsha_ro":case"fcall":case"fcall_ro":case"blmpop":case"bzmpop":$.push(...Y(y,1));break;case"sintercard":case"lmpop":case"zunion":case"zinter":case"zmpop":case"zintercard":case"zdiff":{$.push(...Y(y,0));break}case"georadius":{$.push(0);let U=J(y,5,"STORE");if(U)$.push(U);let z=J(y,5,"STOREDIST");if(z)$.push(z);break}case"georadiusbymember":{$.push(0);let U=J(y,4,"STORE");if(U)$.push(U);let z=J(y,4,"STOREDIST");if(z)$.push(z);break}case"sort":case"sort_ro":$.push(0);for(let U=1;U<y.length-1;U++){let z=y[U];if(typeof z!=="string")continue;let W=z.toUpperCase();if(W==="GET"){if(U+=1,z=y[U],z!=="#")if(Z)$.push([U,hS(z)]);else $.push(U)}else if(W==="BY")if(U+=1,Z)$.push([U,hS(y[U])]);else $.push(U);else if(W==="STORE")U+=1,$.push(U)}break;case"migrate":if(y[2]==="")for(let U=5;U<y.length-1;U++){let z=y[U];if(typeof z==="string"&&z.toUpperCase()==="KEYS"){for(let W=U+1;W<y.length;W++)$.push(W);break}}else $.push(2);break;case"xreadgroup":case"xread":for(let U=S==="xread"?0:3;U<y.length-1;U++)if(String(y[U]).toUpperCase()==="STREAMS"){for(let z=U+1;z<=U+(y.length-1-U)/2;z++)$.push(z);break}break;default:if(k.step>0){let U=k.keyStart-1,z=k.keyStop>0?k.keyStop:y.length+k.keyStop+1;for(let W=U;W<z;W+=k.step)$.push(W)}break}return $}L.getKeyIndexes=W3;function hS(S){if(typeof S!=="string")S=String(S);let y=S.indexOf("->");return y===-1?S.length:y}});var gS=q((vS)=>{Object.defineProperty(vS,"__esModule",{value:!0});vS.tryCatch=vS.errorObj=void 0;vS.errorObj={e:{}};var m1;function X3(S,y){try{let w=m1;return m1=null,w.apply(this,arguments)}catch(w){return vS.errorObj.e=w,vS.errorObj}}function z3(S){return m1=S,X3}vS.tryCatch=z3});var f=q((tS)=>{Object.defineProperty(tS,"__esModule",{value:!0});var e=gS();function pS(S){setTimeout(function(){throw S},0)}function Q3(S,y,w){if(typeof y==="function")S.then((k)=>{let $;if(w!==void 0&&Object(w).spread&&Array.isArray(k))$=e.tryCatch(y).apply(void 0,[null].concat(k));else $=k===void 0?e.tryCatch(y)(null):e.tryCatch(y)(null,k);if($===e.errorObj)pS($.e)},(k)=>{if(!k){let Z=Error(k+"");Object.assign(Z,{cause:k}),k=Z}let $=e.tryCatch(y)(k);if($===e.errorObj)pS($.e)});return S}tS.default=Q3});var cS=q((P7,dS)=>{var uS=G("assert"),J1=G("util");function S1(S){Object.defineProperty(this,"message",{value:S||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}J1.inherits(S1,Error);Object.defineProperty(S1.prototype,"name",{value:"RedisError",configurable:!0,writable:!0});function o1(S,y,w){uS(y),uS.strictEqual(typeof w,"number"),Object.defineProperty(this,"message",{value:S||"",configurable:!0,writable:!0});let k=Error.stackTraceLimit;Error.stackTraceLimit=2,Error.captureStackTrace(this,this.constructor),Error.stackTraceLimit=k,this.offset=w,this.buffer=y}J1.inherits(o1,S1);Object.defineProperty(o1.prototype,"name",{value:"ParserError",configurable:!0,writable:!0});function a1(S){Object.defineProperty(this,"message",{value:S||"",configurable:!0,writable:!0});let y=Error.stackTraceLimit;Error.stackTraceLimit=2,Error.captureStackTrace(this,this.constructor),Error.stackTraceLimit=y}J1.inherits(a1,S1);Object.defineProperty(a1.prototype,"name",{value:"ReplyError",configurable:!0,writable:!0});function L1(S){Object.defineProperty(this,"message",{value:S||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}J1.inherits(L1,S1);Object.defineProperty(L1.prototype,"name",{value:"AbortError",configurable:!0,writable:!0});function n1(S){Object.defineProperty(this,"message",{value:S||"",configurable:!0,writable:!0}),Error.captureStackTrace(this,this.constructor)}J1.inherits(n1,L1);Object.defineProperty(n1.prototype,"name",{value:"InterruptError",configurable:!0,writable:!0});dS.exports={RedisError:S1,ParserError:o1,ReplyError:a1,AbortError:L1,InterruptError:n1}});var nS=q((I7,aS)=>{var iS=G("assert");class U1 extends Error{get name(){return this.constructor.name}}class mS extends U1{constructor(S,y,w){iS(y),iS.strictEqual(typeof w,"number");let k=Error.stackTraceLimit;Error.stackTraceLimit=2;super(S);Error.stackTraceLimit=k,this.offset=w,this.buffer=y}get name(){return this.constructor.name}}class lS extends U1{constructor(S){let y=Error.stackTraceLimit;Error.stackTraceLimit=2;super(S);Error.stackTraceLimit=y}get name(){return this.constructor.name}}class s1 extends U1{get name(){return this.constructor.name}}class oS extends s1{get name(){return this.constructor.name}}aS.exports={RedisError:U1,ParserError:mS,ReplyError:lS,AbortError:s1,InterruptError:oS}});var i=q((L7,sS)=>{var q3=process.version.charCodeAt(1)<55&&process.version.charCodeAt(2)===46?cS():nS();sS.exports=q3});var W1=q((K7,r1)=>{var rS=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920],G3=function(y){var w,k=0,$=0,Z=[],Y=y.length;for(;k<Y;k++)if(w=y.charCodeAt(k),w<128)Z[$++]=w;else if(w<2048)Z[$++]=w>>6|192,Z[$++]=w&63|128;else if((w&64512)===55296&&k+1<y.length&&(y.charCodeAt(k+1)&64512)===56320)w=65536+((w&1023)<<10)+(y.charCodeAt(++k)&1023),Z[$++]=w>>18|240,Z[$++]=w>>12&63|128,Z[$++]=w>>6&63|128,Z[$++]=w&63|128;else Z[$++]=w>>12|224,Z[$++]=w>>6&63|128,Z[$++]=w&63|128;return Z},eS=r1.exports=function(y){var w,k=0,$=-1,Z=0,Y=0,J=typeof y==="string"?G3(y):y,U=J.length;while(k<U){if(w=J[k++],$===-1){if(w===123)$=k}else if(w!==125)Y=rS[(w^Y>>8)&255]^Y<<8;else if(k-1!==$)return Y&16383;Z=rS[(w^Z>>8)&255]^Z<<8}return Z&16383};r1.exports.generateMulti=function(y){var w=1,k=y.length,$=eS(y[0]);while(w<k)if(eS(y[w++])!==$)return-1;return $}});var Jy=q((R7,Yy)=>{var yy=9007199254740991,H3="[object Arguments]",B3="[object Function]",M3="[object GeneratorFunction]",F3=/^(?:0|[1-9]\d*)$/;function wy(S,y,w){switch(w.length){case 0:return S.call(y);case 1:return S.call(y,w[0]);case 2:return S.call(y,w[0],w[1]);case 3:return S.call(y,w[0],w[1],w[2])}return S.apply(y,w)}function E3(S,y){var w=-1,k=Array(S);while(++w<S)k[w]=y(w);return k}var X1=Object.prototype,z1=X1.hasOwnProperty,ky=X1.toString,O3=X1.propertyIsEnumerable,Sy=Math.max;function P3(S,y){var w=x3(S)||N3(S)?E3(S.length,String):[],k=w.length,$=!!k;for(var Z in S)if((y||z1.call(S,Z))&&!($&&(Z=="length"||Zy(Z,k))))w.push(Z);return w}function I3(S,y,w,k){if(S===void 0||e1(S,X1[w])&&!z1.call(k,w))return y;return S}function L3(S,y,w){var k=S[y];if(!(z1.call(S,y)&&e1(k,w))||w===void 0&&!(y in S))S[y]=w}function K3(S){if(!yS(S))return j3(S);var y=D3(S),w=[];for(var k in S)if(!(k=="constructor"&&(y||!z1.call(S,k))))w.push(k);return w}function $y(S,y){return y=Sy(y===void 0?S.length-1:y,0),function(){var w=arguments,k=-1,$=Sy(w.length-y,0),Z=Array($);while(++k<$)Z[k]=w[y+k];k=-1;var Y=Array(y+1);while(++k<y)Y[k]=w[k];return Y[y]=Z,wy(S,this,Y)}}function R3(S,y,w,k){w||(w={});var $=-1,Z=y.length;while(++$<Z){var Y=y[$],J=k?k(w[Y],S[Y],Y,w,S):void 0;L3(w,Y,J===void 0?S[Y]:J)}return w}function A3(S){return $y(function(y,w){var k=-1,$=w.length,Z=$>1?w[$-1]:void 0,Y=$>2?w[2]:void 0;if(Z=S.length>3&&typeof Z=="function"?($--,Z):void 0,Y&&T3(w[0],w[1],Y))Z=$<3?void 0:Z,$=1;y=Object(y);while(++k<$){var J=w[k];if(J)S(y,J,k,Z)}return y})}function Zy(S,y){return y=y==null?yy:y,!!y&&(typeof S=="number"||F3.test(S))&&(S>-1&&S%1==0&&S<y)}function T3(S,y,w){if(!yS(w))return!1;var k=typeof y;if(k=="number"?SS(w)&&Zy(y,w.length):k=="string"&&(y in w))return e1(w[y],S);return!1}function D3(S){var y=S&&S.constructor,w=typeof y=="function"&&y.prototype||X1;return S===w}function j3(S){var y=[];if(S!=null)for(var w in Object(S))y.push(w);return y}function e1(S,y){return S===y||S!==S&&y!==y}function N3(S){return C3(S)&&z1.call(S,"callee")&&(!O3.call(S,"callee")||ky.call(S)==H3)}var x3=Array.isArray;function SS(S){return S!=null&&f3(S.length)&&!_3(S)}function C3(S){return h3(S)&&SS(S)}function _3(S){var y=yS(S)?ky.call(S):"";return y==B3||y==M3}function f3(S){return typeof S=="number"&&S>-1&&S%1==0&&S<=yy}function yS(S){var y=typeof S;return!!S&&(y=="object"||y=="function")}function h3(S){return!!S&&typeof S=="object"}var v3=A3(function(S,y,w,k){R3(y,g3(y),S,k)}),b3=$y(function(S){return S.push(void 0,I3),wy(v3,void 0,S)});function g3(S){return SS(S)?P3(S,!0):K3(S)}Yy.exports=b3});var Xy=q((A7,Wy)=>{var p3=9007199254740991,t3="[object Arguments]",u3="[object Function]",d3="[object GeneratorFunction]",wS=Object.prototype,c3=wS.hasOwnProperty,Uy=wS.toString,i3=wS.propertyIsEnumerable;function m3(S){return o3(S)&&c3.call(S,"callee")&&(!i3.call(S,"callee")||Uy.call(S)==t3)}function l3(S){return S!=null&&n3(S.length)&&!a3(S)}function o3(S){return r3(S)&&l3(S)}function a3(S){var y=s3(S)?Uy.call(S):"";return y==u3||y==d3}function n3(S){return typeof S=="number"&&S>-1&&S%1==0&&S<=p3}function s3(S){var y=typeof S;return!!S&&(y=="object"||y=="function")}function r3(S){return!!S&&typeof S=="object"}Wy.exports=m3});var K1=q((zy)=>{Object.defineProperty(zy,"__esModule",{value:!0});zy.isArguments=zy.defaults=zy.noop=void 0;var e3=Jy();zy.defaults=e3;var S4=Xy();zy.isArguments=S4;function y4(){}zy.noop=y4});var qy=q((D7,Vy)=>{var y1=1000,w1=y1*60,k1=w1*60,m=k1*24,$4=m*7,Z4=m*365.25;Vy.exports=function(S,y){y=y||{};var w=typeof S;if(w==="string"&&S.length>0)return Y4(S);else if(w==="number"&&isFinite(S))return y.long?U4(S):J4(S);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(S))};function Y4(S){if(S=String(S),S.length>100)return;var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(S);if(!y)return;var w=parseFloat(y[1]),k=(y[2]||"ms").toLowerCase();switch(k){case"years":case"year":case"yrs":case"yr":case"y":return w*Z4;case"weeks":case"week":case"w":return w*$4;case"days":case"day":case"d":return w*m;case"hours":case"hour":case"hrs":case"hr":case"h":return w*k1;case"minutes":case"minute":case"mins":case"min":case"m":return w*w1;case"seconds":case"second":case"secs":case"sec":case"s":return w*y1;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return w;default:return}}function J4(S){var y=Math.abs(S);if(y>=m)return Math.round(S/m)+"d";if(y>=k1)return Math.round(S/k1)+"h";if(y>=w1)return Math.round(S/w1)+"m";if(y>=y1)return Math.round(S/y1)+"s";return S+"ms"}function U4(S){var y=Math.abs(S);if(y>=m)return R1(S,y,m,"day");if(y>=k1)return R1(S,y,k1,"hour");if(y>=w1)return R1(S,y,w1,"minute");if(y>=y1)return R1(S,y,y1,"second");return S+" ms"}function R1(S,y,w,k){var $=y>=w*1.5;return Math.round(S/w)+" "+k+($?"s":"")}});var kS=q((j7,Gy)=>{function W4(S){w.debug=w,w.default=w,w.coerce=U,w.disable=Y,w.enable=$,w.enabled=J,w.humanize=qy(),w.destroy=z,Object.keys(S).forEach((W)=>{w[W]=S[W]}),w.names=[],w.skips=[],w.formatters={};function y(W){let X=0;for(let Q=0;Q<W.length;Q++)X=(X<<5)-X+W.charCodeAt(Q),X|=0;return w.colors[Math.abs(X)%w.colors.length]}w.selectColor=y;function w(W){let X,Q=null,V,s;function I(...A){if(!I.enabled)return;let c=I,E1=Number(new Date),lw=E1-(X||E1);if(c.diff=lw,c.prev=X,c.curr=E1,X=E1,A[0]=w.coerce(A[0]),typeof A[0]!=="string")A.unshift("%O");let O1=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(u1,ow)=>{if(u1==="%%")return"%";O1++;let CS=w.formatters[ow];if(typeof CS==="function"){let aw=A[O1];u1=CS.call(c,aw),A.splice(O1,1),O1--}return u1}),w.formatArgs.call(c,A),(c.log||w.log).apply(c,A)}if(I.namespace=W,I.useColors=w.useColors(),I.color=w.selectColor(W),I.extend=k,I.destroy=w.destroy,Object.defineProperty(I,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(Q!==null)return Q;if(V!==w.namespaces)V=w.namespaces,s=w.enabled(W);return s},set:(A)=>{Q=A}}),typeof w.init==="function")w.init(I);return I}function k(W,X){let Q=w(this.namespace+(typeof X>"u"?":":X)+W);return Q.log=this.log,Q}function $(W){w.save(W),w.namespaces=W,w.names=[],w.skips=[];let X=(typeof W==="string"?W:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let Q of X)if(Q[0]==="-")w.skips.push(Q.slice(1));else w.names.push(Q)}function Z(W,X){let Q=0,V=0,s=-1,I=0;while(Q<W.length)if(V<X.length&&(X[V]===W[Q]||X[V]==="*"))if(X[V]==="*")s=V,I=Q,V++;else Q++,V++;else if(s!==-1)V=s+1,I++,Q=I;else return!1;while(V<X.length&&X[V]==="*")V++;return V===X.length}function Y(){let W=[...w.names,...w.skips.map((X)=>"-"+X)].join(",");return w.enable(""),W}function J(W){for(let X of w.skips)if(Z(W,X))return!1;for(let X of w.names)if(Z(W,X))return!0;return!1}function U(W){if(W instanceof Error)return W.stack||W.message;return W}function z(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return w.enable(w.load()),w}Gy.exports=W4});var By=q((Hy,A1)=>{Hy.formatArgs=z4;Hy.save=Q4;Hy.load=V4;Hy.useColors=X4;Hy.storage=q4();Hy.destroy=(()=>{let S=!1;return()=>{if(!S)S=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();Hy.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function X4(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let S;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(S=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(S[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function z4(S){if(S[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+S[0]+(this.useColors?"%c ":" ")+"+"+A1.exports.humanize(this.diff),!this.useColors)return;let y="color: "+this.color;S.splice(1,0,y,"color: inherit");let w=0,k=0;S[0].replace(/%[a-zA-Z%]/g,($)=>{if($==="%%")return;if(w++,$==="%c")k=w}),S.splice(k,0,y)}Hy.log=console.debug||console.log||(()=>{});function Q4(S){try{if(S)Hy.storage.setItem("debug",S);else Hy.storage.removeItem("debug")}catch(y){}}function V4(){let S;try{S=Hy.storage.getItem("debug")||Hy.storage.getItem("DEBUG")}catch(y){}if(!S&&typeof process<"u"&&"env"in process)S=process.env.DEBUG;return S}function q4(){try{return localStorage}catch(S){}}A1.exports=kS()(Hy);var{formatters:G4}=A1.exports;G4.j=function(S){try{return JSON.stringify(S)}catch(y){return"[UnexpectedJSONParseError]: "+y.message}}});var Fy=q((x7,My)=>{My.exports=(S,y=process.argv)=>{let w=S.startsWith("-")?"":S.length===1?"-":"--",k=y.indexOf(w+S),$=y.indexOf("--");return k!==-1&&($===-1||k<$)}});var Py=q((C7,Oy)=>{var I4=G("os"),Ey=G("tty"),T=Fy(),{env:M}=process,h;if(T("no-color")||T("no-colors")||T("color=false")||T("color=never"))h=0;else if(T("color")||T("colors")||T("color=true")||T("color=always"))h=1;if("FORCE_COLOR"in M)if(M.FORCE_COLOR==="true")h=1;else if(M.FORCE_COLOR==="false")h=0;else h=M.FORCE_COLOR.length===0?1:Math.min(parseInt(M.FORCE_COLOR,10),3);function $S(S){if(S===0)return!1;return{level:S,hasBasic:!0,has256:S>=2,has16m:S>=3}}function ZS(S,y){if(h===0)return 0;if(T("color=16m")||T("color=full")||T("color=truecolor"))return 3;if(T("color=256"))return 2;if(S&&!y&&h===void 0)return 0;let w=h||0;if(M.TERM==="dumb")return w;if(process.platform==="win32"){let k=I4.release().split(".");if(Number(k[0])>=10&&Number(k[2])>=10586)return Number(k[2])>=14931?3:2;return 1}if("CI"in M){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((k)=>(k in M))||M.CI_NAME==="codeship")return 1;return w}if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let k=parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return k>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(M.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM))return 1;if("COLORTERM"in M)return 1;return w}function L4(S){let y=ZS(S,S&&S.isTTY);return $S(y)}Oy.exports={supportsColor:L4,stdout:$S(ZS(!0,Ey.isatty(1))),stderr:$S(ZS(!0,Ey.isatty(2)))}});var Ry=q((Ly,D1)=>{var K4=G("tty"),T1=G("util");Ly.init=x4;Ly.log=D4;Ly.formatArgs=A4;Ly.save=j4;Ly.load=N4;Ly.useColors=R4;Ly.destroy=T1.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");Ly.colors=[6,2,3,4,5,1];try{let S=Py();if(S&&(S.stderr||S).level>=2)Ly.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(S){}Ly.inspectOpts=Object.keys(process.env).filter((S)=>{return/^debug_/i.test(S)}).reduce((S,y)=>{let w=y.substring(6).toLowerCase().replace(/_([a-z])/g,($,Z)=>{return Z.toUpperCase()}),k=process.env[y];if(/^(yes|on|true|enabled)$/i.test(k))k=!0;else if(/^(no|off|false|disabled)$/i.test(k))k=!1;else if(k==="null")k=null;else k=Number(k);return S[w]=k,S},{});function R4(){return"colors"in Ly.inspectOpts?Boolean(Ly.inspectOpts.colors):K4.isatty(process.stderr.fd)}function A4(S){let{namespace:y,useColors:w}=this;if(w){let k=this.color,$="\x1B[3"+(k<8?k:"8;5;"+k),Z=` ${$};1m${y} \x1B[0m`;S[0]=Z+S[0].split(`
3
+ `).join(`
4
+ `+Z),S.push($+"m+"+D1.exports.humanize(this.diff)+"\x1B[0m")}else S[0]=T4()+y+" "+S[0]}function T4(){if(Ly.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function D4(...S){return process.stderr.write(T1.formatWithOptions(Ly.inspectOpts,...S)+`
5
+ `)}function j4(S){if(S)process.env.DEBUG=S;else delete process.env.DEBUG}function N4(){return process.env.DEBUG}function x4(S){S.inspectOpts={};let y=Object.keys(Ly.inspectOpts);for(let w=0;w<y.length;w++)S.inspectOpts[y[w]]=Ly.inspectOpts[y[w]]}D1.exports=kS()(Ly);var{formatters:Iy}=D1.exports;Iy.o=function(S){return this.inspectOpts.colors=this.useColors,T1.inspect(S,this.inspectOpts).split(`
6
+ `).map((y)=>y.trim()).join(" ")};Iy.O=function(S){return this.inspectOpts.colors=this.useColors,T1.inspect(S,this.inspectOpts)}});var Ay=q((f7,YS)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)YS.exports=By();else YS.exports=Ry()});var xy=q((jy)=>{Object.defineProperty(jy,"__esModule",{value:!0});jy.genRedactedString=jy.getStringValue=jy.MAX_ARGUMENT_LENGTH=void 0;var p4=Ay(),JS=200;jy.MAX_ARGUMENT_LENGTH=JS;var t4="ioredis";function Ty(S){if(S===null)return;switch(typeof S){case"boolean":return;case"number":return;case"object":if(Buffer.isBuffer(S))return S.toString("hex");if(Array.isArray(S))return S.join(",");try{return JSON.stringify(S)}catch(y){return}case"string":return S}}jy.getStringValue=Ty;function Dy(S,y){let{length:w}=S;return w<=y?S:S.slice(0,y)+' ... <REDACTED full-length="'+w+'">'}jy.genRedactedString=Dy;function u4(S){let y=(0,p4.default)(`${t4}:${S}`);function w(...k){if(!y.enabled)return;for(let $=1;$<k.length;$++){let Z=Ty(k[$]);if(typeof Z==="string"&&Z.length>JS)k[$]=Dy(Z,JS)}return y.apply(null,k)}return Object.defineProperties(w,{namespace:{get(){return y.namespace}},enabled:{get(){return y.enabled}},destroy:{get(){return y.destroy}},log:{get(){return y.log},set(k){y.log=k}}}),w}jy.default=u4});var fy=q((_y)=>{Object.defineProperty(_y,"__esModule",{value:!0});var Cy=`-----BEGIN CERTIFICATE-----
7
+ MIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAUBgNV
8
+ BAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1
9
+ dGhvcml0eTAeFw0xMzEwMDExMjE0NTVaFw0yMzA5MjkxMjE0NTVaMD4xFjAUBgNV
10
+ BAoMDUdhcmFudGlhIERhdGExJDAiBgNVBAMMG1NTTCBDZXJ0aWZpY2F0aW9uIEF1
11
+ dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALZqkh/DczWP
12
+ JnxnHLQ7QL0T4B4CDKWBKCcisriGbA6ZePWVNo4hfKQC6JrzfR+081NeD6VcWUiz
13
+ rmd+jtPhIY4c+WVQYm5PKaN6DT1imYdxQw7aqO5j2KUCEh/cznpLxeSHoTxlR34E
14
+ QwF28Wl3eg2vc5ct8LjU3eozWVk3gb7alx9mSA2SgmuX5lEQawl++rSjsBStemY2
15
+ BDwOpAMXIrdEyP/cVn8mkvi/BDs5M5G+09j0gfhyCzRWMQ7Hn71u1eolRxwVxgi3
16
+ TMn+/vTaFSqxKjgck6zuAYjBRPaHe7qLxHNr1So/Mc9nPy+3wHebFwbIcnUojwbp
17
+ 4nctkWbjb2cCAwEAAaNQME4wHQYDVR0OBBYEFP1whtcrydmW3ZJeuSoKZIKjze3w
18
+ MB8GA1UdIwQYMBaAFP1whtcrydmW3ZJeuSoKZIKjze3wMAwGA1UdEwQFMAMBAf8w
19
+ DQYJKoZIhvcNAQEFBQADggEBAG2erXhwRAa7+ZOBs0B6X57Hwyd1R4kfmXcs0rta
20
+ lbPpvgULSiB+TCbf3EbhJnHGyvdCY1tvlffLjdA7HJ0PCOn+YYLBA0pTU/dyvrN6
21
+ Su8NuS5yubnt9mb13nDGYo1rnt0YRfxN+8DM3fXIVr038A30UlPX2Ou1ExFJT0MZ
22
+ uFKY6ZvLdI6/1cbgmguMlAhM+DhKyV6Sr5699LM3zqeI816pZmlREETYkGr91q7k
23
+ BpXJu/dtHaGxg1ZGu6w/PCsYGUcECWENYD4VQPd8N32JjOfu6vEgoEAwfPP+3oGp
24
+ Z4m3ewACcWOAenqflb+cQYC4PsF7qbXDmRaWrbKntOlZ3n0=
25
+ -----END CERTIFICATE-----
26
+ -----BEGIN CERTIFICATE-----
27
+ MIIGMTCCBBmgAwIBAgICEAAwDQYJKoZIhvcNAQELBQAwajELMAkGA1UEBhMCVVMx
28
+ CzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAGA1UECgwJUmVkaXNMYWJzMS0w
29
+ KwYDVQQDDCRSZWRpc0xhYnMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN
30
+ MTgwMjI1MTUzNzM3WhcNMjgwMjIzMTUzNzM3WjBfMQswCQYDVQQGEwJVUzELMAkG
31
+ A1UECAwCQ0ExEjAQBgNVBAoMCVJlZGlzTGFiczEvMC0GA1UEAwwmUkNQIEludGVy
32
+ bWVkaWF0ZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA
33
+ A4ICDwAwggIKAoICAQDf9dqbxc8Bq7Ctq9rWcxrGNKKHivqLAFpPq02yLPx6fsOv
34
+ Tq7GsDChAYBBc4v7Y2Ap9RD5Vs3dIhEANcnolf27QwrG9RMnnvzk8pCvp1o6zSU4
35
+ VuOE1W66/O1/7e2rVxyrnTcP7UgK43zNIXu7+tiAqWsO92uSnuMoGPGpeaUm1jym
36
+ hjWKtkAwDFSqvHY+XL5qDVBEjeUe+WHkYUg40cAXjusAqgm2hZt29c2wnVrxW25W
37
+ P0meNlzHGFdA2AC5z54iRiqj57dTfBTkHoBczQxcyw6hhzxZQ4e5I5zOKjXXEhZN
38
+ r0tA3YC14CTabKRus/JmZieyZzRgEy2oti64tmLYTqSlAD78pRL40VNoaSYetXLw
39
+ hhNsXCHgWaY6d5bLOc/aIQMAV5oLvZQKvuXAF1IDmhPA+bZbpWipp0zagf1P1H3s
40
+ UzsMdn2KM0ejzgotbtNlj5TcrVwpmvE3ktvUAuA+hi3FkVx1US+2Gsp5x4YOzJ7u
41
+ P1WPk6ShF0JgnJH2ILdj6kttTWwFzH17keSFICWDfH/+kM+k7Y1v3EXMQXE7y0T9
42
+ MjvJskz6d/nv+sQhY04xt64xFMGTnZjlJMzfQNi7zWFLTZnDD0lPowq7l3YiPoTT
43
+ t5Xky83lu0KZsZBo0WlWaDG00gLVdtRgVbcuSWxpi5BdLb1kRab66JptWjxwXQID
44
+ AQABo4HrMIHoMDoGA1UdHwQzMDEwL6AtoCuGKWh0dHBzOi8vcmwtY2Etc2VydmVy
45
+ LnJlZGlzbGFicy5jb20vdjEvY3JsMEYGCCsGAQUFBwEBBDowODA2BggrBgEFBQcw
46
+ AYYqaHR0cHM6Ly9ybC1jYS1zZXJ2ZXIucmVkaXNsYWJzLmNvbS92MS9vY3NwMB0G
47
+ A1UdDgQWBBQHar5OKvQUpP2qWt6mckzToeCOHDAfBgNVHSMEGDAWgBQi42wH6hM4
48
+ L2sujEvLM0/u8lRXTzASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIB
49
+ hjANBgkqhkiG9w0BAQsFAAOCAgEAirEn/iTsAKyhd+pu2W3Z5NjCko4NPU0EYUbr
50
+ AP7+POK2rzjIrJO3nFYQ/LLuC7KCXG+2qwan2SAOGmqWst13Y+WHp44Kae0kaChW
51
+ vcYLXXSoGQGC8QuFSNUdaeg3RbMDYFT04dOkqufeWVccoHVxyTSg9eD8LZuHn5jw
52
+ 7QDLiEECBmIJHk5Eeo2TAZrx4Yx6ufSUX5HeVjlAzqwtAqdt99uCJ/EL8bgpWbe+
53
+ XoSpvUv0SEC1I1dCAhCKAvRlIOA6VBcmzg5Am12KzkqTul12/VEFIgzqu0Zy2Jbc
54
+ AUPrYVu/+tOGXQaijy7YgwH8P8n3s7ZeUa1VABJHcxrxYduDDJBLZi+MjheUDaZ1
55
+ jQRHYevI2tlqeSBqdPKG4zBY5lS0GiAlmuze5oENt0P3XboHoZPHiqcK3VECgTVh
56
+ /BkJcuudETSJcZDmQ8YfoKfBzRQNg2sv/hwvUv73Ss51Sco8GEt2lD8uEdib1Q6z
57
+ zDT5lXJowSzOD5ZA9OGDjnSRL+2riNtKWKEqvtEG3VBJoBzu9GoxbAc7wIZLxmli
58
+ iF5a/Zf5X+UXD3s4TMmy6C4QZJpAA2egsSQCnraWO2ULhh7iXMysSkF/nzVfZn43
59
+ iqpaB8++9a37hWq14ZmOv0TJIDz//b2+KC4VFXWQ5W5QC6whsjT+OlG4p5ZYG0jo
60
+ 616pxqo=
61
+ -----END CERTIFICATE-----
62
+ -----BEGIN CERTIFICATE-----
63
+ MIIFujCCA6KgAwIBAgIJAJ1aTT1lu2ScMA0GCSqGSIb3DQEBCwUAMGoxCzAJBgNV
64
+ BAYTAlVTMQswCQYDVQQIDAJDQTELMAkGA1UEBwwCQ0ExEjAQBgNVBAoMCVJlZGlz
65
+ TGFiczEtMCsGA1UEAwwkUmVkaXNMYWJzIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y
66
+ aXR5MB4XDTE4MDIyNTE1MjA0MloXDTM4MDIyMDE1MjA0MlowajELMAkGA1UEBhMC
67
+ VVMxCzAJBgNVBAgMAkNBMQswCQYDVQQHDAJDQTESMBAGA1UECgwJUmVkaXNMYWJz
68
+ MS0wKwYDVQQDDCRSZWRpc0xhYnMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw
69
+ ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDLEjXy7YrbN5Waau5cd6g1
70
+ G5C2tMmeTpZ0duFAPxNU4oE3RHS5gGiok346fUXuUxbZ6QkuzeN2/2Z+RmRcJhQY
71
+ Dm0ZgdG4x59An1TJfnzKKoWj8ISmoHS/TGNBdFzXV7FYNLBuqZouqePI6ReC6Qhl
72
+ pp45huV32Q3a6IDrrvx7Wo5ZczEQeFNbCeCOQYNDdTmCyEkHqc2AGo8eoIlSTutT
73
+ ULOC7R5gzJVTS0e1hesQ7jmqHjbO+VQS1NAL4/5K6cuTEqUl+XhVhPdLWBXJQ5ag
74
+ 54qhX4v+ojLzeU1R/Vc6NjMvVtptWY6JihpgplprN0Yh2556ewcXMeturcKgXfGJ
75
+ xeYzsjzXerEjrVocX5V8BNrg64NlifzTMKNOOv4fVZszq1SIHR8F9ROrqiOdh8iC
76
+ JpUbLpXH9hWCSEO6VRMB2xJoKu3cgl63kF30s77x7wLFMEHiwsQRKxooE1UhgS9K
77
+ 2sO4TlQ1eWUvFvHSTVDQDlGQ6zu4qjbOpb3Q8bQwoK+ai2alkXVR4Ltxe9QlgYK3
78
+ StsnPhruzZGA0wbXdpw0bnM+YdlEm5ffSTpNIfgHeaa7Dtb801FtA71ZlH7A6TaI
79
+ SIQuUST9EKmv7xrJyx0W1pGoPOLw5T029aTjnICSLdtV9bLwysrLhIYG5bnPq78B
80
+ cS+jZHFGzD7PUVGQD01nOQIDAQABo2MwYTAdBgNVHQ4EFgQUIuNsB+oTOC9rLoxL
81
+ yzNP7vJUV08wHwYDVR0jBBgwFoAUIuNsB+oTOC9rLoxLyzNP7vJUV08wDwYDVR0T
82
+ AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAHfg
83
+ z5pMNUAKdMzK1aS1EDdK9yKz4qicILz5czSLj1mC7HKDRy8cVADUxEICis++CsCu
84
+ rYOvyCVergHQLREcxPq4rc5Nq1uj6J6649NEeh4WazOOjL4ZfQ1jVznMbGy+fJm3
85
+ 3Hoelv6jWRG9iqeJZja7/1s6YC6bWymI/OY1e4wUKeNHAo+Vger7MlHV+RuabaX+
86
+ hSJ8bJAM59NCM7AgMTQpJCncrcdLeceYniGy5Q/qt2b5mJkQVkIdy4TPGGB+AXDJ
87
+ D0q3I/JDRkDUFNFdeW0js7fHdsvCR7O3tJy5zIgEV/o/BCkmJVtuwPYOrw/yOlKj
88
+ TY/U7ATAx9VFF6/vYEOMYSmrZlFX+98L6nJtwDqfLB5VTltqZ4H/KBxGE3IRSt9l
89
+ FXy40U+LnXzhhW+7VBAvyYX8GEXhHkKU8Gqk1xitrqfBXY74xKgyUSTolFSfFVgj
90
+ mcM/X4K45bka+qpkj7Kfv/8D4j6aZekwhN2ly6hhC1SmQ8qjMjpG/mrWOSSHZFmf
91
+ ybu9iD2AYHeIOkshIl6xYIa++Q/00/vs46IzAbQyriOi0XxlSMMVtPx0Q3isp+ji
92
+ n8Mq9eOuxYOEQ4of8twUkUDd528iwGtEdwf0Q01UyT84S62N8AySl1ZBKXJz6W4F
93
+ UhWfa/HQYOAPDdEjNgnVwLI23b8t0TozyCWw7q8h
94
+ -----END CERTIFICATE-----
95
+
96
+ -----BEGIN CERTIFICATE-----
97
+ MIIEjzCCA3egAwIBAgIQe55B/ALCKJDZtdNT8kD6hTANBgkqhkiG9w0BAQsFADBM
98
+ MSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xv
99
+ YmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjAeFw0yMjAxMjYxMjAwMDBaFw0y
100
+ NTAxMjYwMDAwMDBaMFgxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWdu
101
+ IG52LXNhMS4wLAYDVQQDEyVHbG9iYWxTaWduIEF0bGFzIFIzIE9WIFRMUyBDQSAy
102
+ MDIyIFEyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmGmg1LW9b7Lf
103
+ 8zDD83yBDTEkt+FOxKJZqF4veWc5KZsQj9HfnUS2e5nj/E+JImlGPsQuoiosLuXD
104
+ BVBNAMcUFa11buFMGMeEMwiTmCXoXRrXQmH0qjpOfKgYc5gHG3BsRGaRrf7VR4eg
105
+ ofNMG9wUBw4/g/TT7+bQJdA4NfE7Y4d5gEryZiBGB/swaX6Jp/8MF4TgUmOWmalK
106
+ dZCKyb4sPGQFRTtElk67F7vU+wdGcrcOx1tDcIB0ncjLPMnaFicagl+daWGsKqTh
107
+ counQb6QJtYHa91KvCfKWocMxQ7OIbB5UARLPmC4CJ1/f8YFm35ebfzAeULYdGXu
108
+ jE9CLor0OwIDAQABo4IBXzCCAVswDgYDVR0PAQH/BAQDAgGGMB0GA1UdJQQWMBQG
109
+ CCsGAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdDgQW
110
+ BBSH5Zq7a7B/t95GfJWkDBpA8HHqdjAfBgNVHSMEGDAWgBSP8Et/qC5FJK5NUPpj
111
+ move4t0bvDB7BggrBgEFBQcBAQRvMG0wLgYIKwYBBQUHMAGGImh0dHA6Ly9vY3Nw
112
+ Mi5nbG9iYWxzaWduLmNvbS9yb290cjMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9zZWN1
113
+ cmUuZ2xvYmFsc2lnbi5jb20vY2FjZXJ0L3Jvb3QtcjMuY3J0MDYGA1UdHwQvMC0w
114
+ K6ApoCeGJWh0dHA6Ly9jcmwuZ2xvYmFsc2lnbi5jb20vcm9vdC1yMy5jcmwwIQYD
115
+ VR0gBBowGDAIBgZngQwBAgIwDAYKKwYBBAGgMgoBAjANBgkqhkiG9w0BAQsFAAOC
116
+ AQEAKRic9/f+nmhQU/wz04APZLjgG5OgsuUOyUEZjKVhNGDwxGTvKhyXGGAMW2B/
117
+ 3bRi+aElpXwoxu3pL6fkElbX3B0BeS5LoDtxkyiVEBMZ8m+sXbocwlPyxrPbX6mY
118
+ 0rVIvnuUeBH8X0L5IwfpNVvKnBIilTbcebfHyXkPezGwz7E1yhUULjJFm2bt0SdX
119
+ y+4X/WeiiYIv+fTVgZZgl+/2MKIsu/qdBJc3f3TvJ8nz+Eax1zgZmww+RSQWeOj3
120
+ 15Iw6Z5FX+NwzY/Ab+9PosR5UosSeq+9HhtaxZttXG1nVh+avYPGYddWmiMT90J5
121
+ ZgKnO/Fx2hBgTxhOTMYaD312kg==
122
+ -----END CERTIFICATE-----
123
+
124
+ -----BEGIN CERTIFICATE-----
125
+ MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
126
+ A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
127
+ Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
128
+ MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
129
+ A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
130
+ hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
131
+ RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
132
+ gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
133
+ KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
134
+ QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
135
+ XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
136
+ DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
137
+ LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
138
+ RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
139
+ jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
140
+ 6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
141
+ mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
142
+ Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
143
+ WD9f
144
+ -----END CERTIFICATE-----`,m4={RedisCloudFixed:{ca:Cy},RedisCloudFlexible:{ca:Cy}};_y.default=m4});var F=q((j1)=>{var __dirname="C:\\Users\\offby\\Documents\\Research\\stabilize\\node_modules\\ioredis\\built\\utils";Object.defineProperty(j1,"__esModule",{value:!0});j1.noop=j1.defaults=j1.Debug=j1.getPackageMeta=j1.zipMap=j1.CONNECTION_CLOSED_ERROR_MSG=j1.shuffle=j1.sample=j1.resolveTLSProfile=j1.parseURL=j1.optimizeErrorStack=j1.toArg=j1.convertMapToArray=j1.convertObjectToArray=j1.timeout=j1.packObject=j1.isInt=j1.wrapMultiResult=j1.convertBufferToString=void 0;var o4=G("fs"),a4=G("path"),hy=G("url"),US=K1();Object.defineProperty(j1,"defaults",{enumerable:!0,get:function(){return US.defaults}});Object.defineProperty(j1,"noop",{enumerable:!0,get:function(){return US.noop}});var n4=xy();j1.Debug=n4.default;var s4=fy();function vy(S,y){if(S instanceof Buffer)return S.toString(y);if(Array.isArray(S)){let w=S.length,k=Array(w);for(let $=0;$<w;++$)k[$]=S[$]instanceof Buffer&&y==="utf8"?S[$].toString():vy(S[$],y);return k}return S}j1.convertBufferToString=vy;function r4(S){if(!S)return null;let y=[],w=S.length;for(let k=0;k<w;++k){let $=S[k];if($ instanceof Error)y.push([$]);else y.push([null,$])}return y}j1.wrapMultiResult=r4;function by(S){let y=parseFloat(S);return!isNaN(S)&&(y|0)===y}j1.isInt=by;function e4(S){let y={},w=S.length;for(let k=1;k<w;k+=2)y[S[k-1]]=S[k];return y}j1.packObject=e4;function S5(S,y){let w=null,k=function(){if(w)clearTimeout(w),w=null,S.apply(this,arguments)};return w=setTimeout(k,y,Error("timeout")),k}j1.timeout=S5;function y5(S){let y=[],w=Object.keys(S);for(let k=0,$=w.length;k<$;k++)y.push(w[k],S[w[k]]);return y}j1.convertObjectToArray=y5;function w5(S){let y=[],w=0;return S.forEach(function(k,$){y[w]=$,y[w+1]=k,w+=2}),y}j1.convertMapToArray=w5;function k5(S){if(S===null||typeof S>"u")return"";return String(S)}j1.toArg=k5;function $5(S,y,w){let k=y.split(`
145
+ `),$="",Z;for(Z=1;Z<k.length;++Z)if(k[Z].indexOf(w)===-1)break;for(let Y=Z;Y<k.length;++Y)$+=`
146
+ `+k[Y];if(S.stack){let Y=S.stack.indexOf(`
147
+ `);S.stack=S.stack.slice(0,Y)+$}return S}j1.optimizeErrorStack=$5;function Z5(S){if(by(S))return{port:S};let y=(0,hy.parse)(S,!0,!0);if(!y.slashes&&S[0]!=="/")S="//"+S,y=(0,hy.parse)(S,!0,!0);let w=y.query||{},k={};if(y.auth){let $=y.auth.indexOf(":");k.username=$===-1?y.auth:y.auth.slice(0,$),k.password=$===-1?"":y.auth.slice($+1)}if(y.pathname)if(y.protocol==="redis:"||y.protocol==="rediss:"){if(y.pathname.length>1)k.db=y.pathname.slice(1)}else k.path=y.pathname;if(y.host)k.host=y.hostname;if(y.port)k.port=y.port;if(typeof w.family==="string"){let $=Number.parseInt(w.family,10);if(!Number.isNaN($))k.family=$}return(0,US.defaults)(k,w),k}j1.parseURL=Z5;function Y5(S){let y=S===null||S===void 0?void 0:S.tls;if(typeof y==="string")y={profile:y};let w=s4.default[y===null||y===void 0?void 0:y.profile];if(w)y=Object.assign({},w,y),delete y.profile,S=Object.assign({},S,{tls:y});return S}j1.resolveTLSProfile=Y5;function J5(S,y=0){let w=S.length;if(y>=w)return null;return S[y+Math.floor(Math.random()*(w-y))]}j1.sample=J5;function U5(S){let y=S.length;while(y>0){let w=Math.floor(Math.random()*y);y--,[S[y],S[w]]=[S[w],S[y]]}return S}j1.shuffle=U5;j1.CONNECTION_CLOSED_ERROR_MSG="Connection is closed.";function W5(S,y){let w=new Map;return S.forEach((k,$)=>{w.set(k,y[$])}),w}j1.zipMap=W5;var $1=null;async function X5(){if($1)return $1;try{let S=(0,a4.resolve)(__dirname,"..","..","package.json"),y=await o4.promises.readFile(S,"utf8");return $1={version:JSON.parse(y).version},$1}catch(S){return $1={version:"error-fetching-version"},$1}}j1.getPackageMeta=X5});var C=q((dy)=>{var __dirname="C:\\Users\\offby\\Documents\\Research\\stabilize\\node_modules\\ioredis\\built";Object.defineProperty(dy,"__esModule",{value:!0});var gy=r(),D5=W1(),j5=f(),o=F();class K{constructor(S,y=[],w={},k){if(this.name=S,this.inTransaction=!1,this.isResolved=!1,this.transformed=!1,this.replyEncoding=w.replyEncoding,this.errorStack=w.errorStack,this.args=y.flat(),this.callback=k,this.initPromise(),w.keyPrefix){let $=w.keyPrefix instanceof Buffer,Z=$?w.keyPrefix:null;this._iterateKeys((Y)=>{if(Y instanceof Buffer){if(Z===null)Z=Buffer.from(w.keyPrefix);return Buffer.concat([Z,Y])}else if($)return Buffer.concat([w.keyPrefix,Buffer.from(String(Y))]);return w.keyPrefix+Y})}if(w.readOnly)this.isReadOnly=!0}static checkFlag(S,y){return!!this.getFlagMap()[S][y]}static setArgumentTransformer(S,y){this._transformer.argument[S]=y}static setReplyTransformer(S,y){this._transformer.reply[S]=y}static getFlagMap(){if(!this.flagMap)this.flagMap=Object.keys(K.FLAGS).reduce((S,y)=>{return S[y]={},K.FLAGS[y].forEach((w)=>{S[y][w]=!0}),S},{});return this.flagMap}getSlot(){if(typeof this.slot>"u"){let S=this.getKeys()[0];this.slot=S==null?null:D5(S)}return this.slot}getKeys(){return this._iterateKeys()}toWritable(S){let y,w="*"+(this.args.length+1)+`\r
148
+ $`+Buffer.byteLength(this.name)+`\r
149
+ `+this.name+`\r
150
+ `;if(this.bufferMode){let k=new uy;k.push(w);for(let $=0;$<this.args.length;++$){let Z=this.args[$];if(Z instanceof Buffer)if(Z.length===0)k.push(`$0\r
151
+ \r
152
+ `);else k.push("$"+Z.length+`\r
153
+ `),k.push(Z),k.push(`\r
154
+ `);else k.push("$"+Buffer.byteLength(Z)+`\r
155
+ `+Z+`\r
156
+ `)}y=k.toBuffer()}else{y=w;for(let k=0;k<this.args.length;++k){let $=this.args[k];y+="$"+Buffer.byteLength($)+`\r
157
+ `+$+`\r
158
+ `}}return y}stringifyArguments(){for(let S=0;S<this.args.length;++S){let y=this.args[S];if(typeof y==="string");else if(y instanceof Buffer)this.bufferMode=!0;else this.args[S]=(0,o.toArg)(y)}}transformReply(S){if(this.replyEncoding)S=(0,o.convertBufferToString)(S,this.replyEncoding);let y=K._transformer.reply[this.name];if(y)S=y(S);return S}setTimeout(S){if(!this._commandTimeoutTimer)this._commandTimeoutTimer=setTimeout(()=>{if(!this.isResolved)this.reject(Error("Command timed out"))},S)}initPromise(){let S=new Promise((y,w)=>{if(!this.transformed){this.transformed=!0;let k=K._transformer.argument[this.name];if(k)this.args=k(this.args);this.stringifyArguments()}if(this.resolve=this._convertValue(y),this.errorStack)this.reject=(k)=>{w((0,o.optimizeErrorStack)(k,this.errorStack.stack,__dirname))};else this.reject=w});this.promise=(0,j5.default)(S,this.callback)}_iterateKeys(S=(y)=>y){if(typeof this.keys>"u"){if(this.keys=[],(0,gy.exists)(this.name)){let y=(0,gy.getKeyIndexes)(this.name,this.args);for(let w of y)this.args[w]=S(this.args[w]),this.keys.push(this.args[w])}}return this.keys}_convertValue(S){return(y)=>{try{let w=this._commandTimeoutTimer;if(w)clearTimeout(w),delete this._commandTimeoutTimer;S(this.transformReply(y)),this.isResolved=!0}catch(w){this.reject(w)}return this.promise}}}dy.default=K;K.FLAGS={VALID_IN_SUBSCRIBER_MODE:["subscribe","psubscribe","unsubscribe","punsubscribe","ssubscribe","sunsubscribe","ping","quit"],VALID_IN_MONITOR_MODE:["monitor","auth"],ENTER_SUBSCRIBER_MODE:["subscribe","psubscribe","ssubscribe"],EXIT_SUBSCRIBER_MODE:["unsubscribe","punsubscribe","sunsubscribe"],WILL_DISCONNECT:["quit"]};K._transformer={argument:{},reply:{}};var py=function(S){if(S.length===1){if(S[0]instanceof Map)return(0,o.convertMapToArray)(S[0]);if(typeof S[0]==="object"&&S[0]!==null)return(0,o.convertObjectToArray)(S[0])}return S},ty=function(S){if(S.length===2){if(S[1]instanceof Map)return[S[0]].concat((0,o.convertMapToArray)(S[1]));if(typeof S[1]==="object"&&S[1]!==null)return[S[0]].concat((0,o.convertObjectToArray)(S[1]))}return S};K.setArgumentTransformer("mset",py);K.setArgumentTransformer("msetnx",py);K.setArgumentTransformer("hset",ty);K.setArgumentTransformer("hmset",ty);K.setReplyTransformer("hgetall",function(S){if(Array.isArray(S)){let y={};for(let w=0;w<S.length;w+=2){let k=S[w],$=S[w+1];if(k in y)Object.defineProperty(y,k,{value:$,configurable:!0,enumerable:!0,writable:!0});else y[k]=$}return y}return S});class uy{constructor(){this.length=0,this.items=[]}push(S){this.length+=Buffer.byteLength(S),this.items.push(S)}toBuffer(){let S=Buffer.allocUnsafe(this.length),y=0;for(let w of this.items){let k=Buffer.byteLength(w);Buffer.isBuffer(w)?w.copy(S,y):S.write(w,y,k),y+=k}return S}}});var iy=q((cy)=>{Object.defineProperty(cy,"__esModule",{value:!0});var x5=i();class WS extends x5.RedisError{constructor(S,y){super(S);this.lastNodeError=y,Error.captureStackTrace(this,this.constructor)}get name(){return this.constructor.name}}cy.default=WS;WS.defaultMessage="Failed to refresh slots cache."});var N1=q((ly)=>{Object.defineProperty(ly,"__esModule",{value:!0});var _5=G("stream");class my extends _5.Readable{constructor(S){super(S);this.opt=S,this._redisCursor="0",this._redisDrained=!1}_read(){if(this._redisDrained){this.push(null);return}let S=[this._redisCursor];if(this.opt.key)S.unshift(this.opt.key);if(this.opt.match)S.push("MATCH",this.opt.match);if(this.opt.type)S.push("TYPE",this.opt.type);if(this.opt.count)S.push("COUNT",String(this.opt.count));if(this.opt.noValues)S.push("NOVALUES");this.opt.redis[this.opt.command](S,(y,w)=>{if(y){this.emit("error",y);return}if(this._redisCursor=w[0]instanceof Buffer?w[0].toString():w[0],this._redisCursor==="0")this._redisDrained=!0;this.push(w[1])})}close(){this._redisDrained=!0}}ly.default=my});var w0=q((ey)=>{Object.defineProperty(ey,"__esModule",{value:!0});ey.executeWithAutoPipelining=ey.getFirstValueInFlattenedArray=ey.shouldUseAutoPipelining=ey.notAllowedAutoPipelineCommands=ey.kCallbacks=ey.kExec=void 0;var ay=K1(),h5=W1(),oy=f();ey.kExec=Symbol("exec");ey.kCallbacks=Symbol("callbacks");ey.notAllowedAutoPipelineCommands=["auth","info","script","quit","cluster","pipeline","multi","subscribe","psubscribe","unsubscribe","unpsubscribe","select"];function ny(S,y){if(S._runningAutoPipelines.has(y))return;if(!S._autoPipelines.has(y))return;S._runningAutoPipelines.add(y);let w=S._autoPipelines.get(y);S._autoPipelines.delete(y);let k=w[ey.kCallbacks];w[ey.kCallbacks]=null,w.exec(function($,Z){if(S._runningAutoPipelines.delete(y),$)for(let Y=0;Y<k.length;Y++)process.nextTick(k[Y],$);else for(let Y=0;Y<k.length;Y++)process.nextTick(k[Y],...Z[Y]);if(S._autoPipelines.has(y))ny(S,y)})}function v5(S,y,w){return y&&S.options.enableAutoPipelining&&!S.isPipeline&&!ey.notAllowedAutoPipelineCommands.includes(w)&&!S.options.autoPipeliningIgnoredCommands.includes(w)}ey.shouldUseAutoPipelining=v5;function sy(S){for(let y=0;y<S.length;y++){let w=S[y];if(typeof w==="string")return w;else if(Array.isArray(w)||(0,ay.isArguments)(w)){if(w.length===0)continue;return w[0]}let k=[w].flat();if(k.length>0)return k[0]}return}ey.getFirstValueInFlattenedArray=sy;function ry(S,y,w,k,$){if(S.isCluster&&!S.slots.length){if(S.status==="wait")S.connect().catch(ay.noop);return(0,oy.default)(new Promise(function(z,W){S.delayUntilReady((X)=>{if(X){W(X);return}ry(S,y,w,k,null).then(z,W)})}),$)}let Z=S.options.keyPrefix||"",Y=S.isCluster?S.slots[h5(`${Z}${sy(k)}`)].join(","):"main";if(!S._autoPipelines.has(Y)){let z=S.pipeline();z[ey.kExec]=!1,z[ey.kCallbacks]=[],S._autoPipelines.set(Y,z)}let J=S._autoPipelines.get(Y);if(!J[ey.kExec])J[ey.kExec]=!0,setImmediate(ny,S,Y);let U=new Promise(function(z,W){if(J[ey.kCallbacks].push(function(X,Q){if(X){W(X);return}z(Q)}),y==="call")k.unshift(w);J[y](...k)});return(0,oy.default)(U,$)}ey.executeWithAutoPipelining=ry});var Z0=q(($0)=>{Object.defineProperty($0,"__esModule",{value:!0});var p5=G("crypto"),t5=C(),u5=f();class k0{constructor(S,y=null,w="",k=!1){this.lua=S,this.numberOfKeys=y,this.keyPrefix=w,this.readOnly=k,this.sha=(0,p5.createHash)("sha1").update(S).digest("hex");let $=this.sha,Z=new WeakSet;this.Command=class extends t5.default{toWritable(J){let U=this.reject;if(this.reject=(z)=>{if(z.message.indexOf("NOSCRIPT")!==-1)Z.delete(J);U.call(this,z)},!Z.has(J))Z.add(J),this.name="eval",this.args[0]=S;else if(this.name==="eval")this.name="evalsha",this.args[0]=$;return super.toWritable(J)}}}execute(S,y,w,k){if(typeof this.numberOfKeys==="number")y.unshift(this.numberOfKeys);if(this.keyPrefix)w.keyPrefix=this.keyPrefix;if(this.readOnly)w.readOnly=!0;let $=new this.Command("evalsha",[this.sha,...y],w);return $.promise=$.promise.catch((Z)=>{if(Z.message.indexOf("NOSCRIPT")===-1)throw Z;let Y=new this.Command("evalsha",[this.sha,...y],w);return(S.isPipeline?S.redis:S).sendCommand(Y)}),(0,u5.default)($.promise,k),S.sendCommand($)}}$0.default=k0});var _1=q((J0)=>{Object.defineProperty(J0,"__esModule",{value:!0});var c5=r(),C1=w0(),i5=C(),m5=Z0();class b{constructor(){this.options={},this.scriptsSet={},this.addedBuiltinSet=new Set}getBuiltinCommands(){return XS.slice(0)}createBuiltinCommand(S){return{string:v(null,S,"utf8"),buffer:v(null,S,null)}}addBuiltinCommand(S){this.addedBuiltinSet.add(S),this[S]=v(S,S,"utf8"),this[S+"Buffer"]=v(S+"Buffer",S,null)}defineCommand(S,y){let w=new m5.default(y.lua,y.numberOfKeys,this.options.keyPrefix,y.readOnly);this.scriptsSet[S]=w,this[S]=Y0(S,S,w,"utf8"),this[S+"Buffer"]=Y0(S+"Buffer",S,w,null)}sendCommand(S,y,w){throw Error('"sendCommand" is not implemented')}}var XS=c5.list.filter((S)=>S!=="monitor");XS.push("sentinel");XS.forEach(function(S){b.prototype[S]=v(S,S,"utf8"),b.prototype[S+"Buffer"]=v(S+"Buffer",S,null)});b.prototype.call=v("call","utf8");b.prototype.callBuffer=v("callBuffer",null);b.prototype.send_command=b.prototype.call;function v(S,y,w){if(typeof w>"u")w=y,y=null;return function(...k){let $=y||k.shift(),Z=k[k.length-1];if(typeof Z==="function")k.pop();else Z=void 0;let Y={errorStack:this.options.showFriendlyErrorStack?Error():void 0,keyPrefix:this.options.keyPrefix,replyEncoding:w};if(!(0,C1.shouldUseAutoPipelining)(this,S,$))return this.sendCommand(new i5.default($,k,Y,Z));return(0,C1.executeWithAutoPipelining)(this,S,$,k,Z)}}function Y0(S,y,w,k){return function(...$){let Z=typeof $[$.length-1]==="function"?$.pop():void 0,Y={replyEncoding:k};if(this.options.showFriendlyErrorStack)Y.errorStack=Error();if(!(0,C1.shouldUseAutoPipelining)(this,S,y))return w.execute(this,$,Y,Z);return(0,C1.executeWithAutoPipelining)(this,S,y,$,Z)}}J0.default=b});var QS=q((z0)=>{Object.defineProperty(z0,"__esModule",{value:!0});var zS=W1(),U0=r(),W0=f(),o5=G("util"),a5=C(),n5=F(),s5=_1();function r5(S,y){let w=zS(y[0]),k=S._groupsBySlot[w];for(let $=1;$<y.length;$++)if(S._groupsBySlot[zS(y[$])]!==k)return-1;return w}class a extends s5.default{constructor(S){super();this.redis=S,this.isPipeline=!0,this.replyPending=0,this._queue=[],this._result=[],this._transactions=0,this._shaToScript={},this.isCluster=this.redis.constructor.name==="Cluster"||this.redis.isCluster,this.options=S.options,Object.keys(S.scriptsSet).forEach((w)=>{let k=S.scriptsSet[w];this._shaToScript[k.sha]=k,this[w]=S[w],this[w+"Buffer"]=S[w+"Buffer"]}),S.addedBuiltinSet.forEach((w)=>{this[w]=S[w],this[w+"Buffer"]=S[w+"Buffer"]}),this.promise=new Promise((w,k)=>{this.resolve=w,this.reject=k});let y=this;Object.defineProperty(this,"length",{get:function(){return y._queue.length}})}fillResult(S,y){if(this._queue[y].name==="exec"&&Array.isArray(S[1])){let k=S[1].length;for(let $=0;$<k;$++){if(S[1][$]instanceof Error)continue;let Z=this._queue[y-(k-$)];try{S[1][$]=Z.transformReply(S[1][$])}catch(Y){S[1][$]=Y}}}if(this._result[y]=S,--this.replyPending)return;if(this.isCluster){let k=!0,$;for(let Z=0;Z<this._result.length;++Z){let Y=this._result[Z][0],J=this._queue[Z];if(Y){if(J.name==="exec"&&Y.message==="EXECABORT Transaction discarded because of previous errors.")continue;if(!$)$={name:Y.name,message:Y.message};else if($.name!==Y.name||$.message!==Y.message){k=!1;break}}else if(!J.inTransaction){if(!((0,U0.exists)(J.name)&&(0,U0.hasFlag)(J.name,"readonly"))){k=!1;break}}}if($&&k){let Z=this,Y=$.message.split(" "),J=this._queue,U=!1;this._queue=[];for(let Q=0;Q<J.length;++Q){if(Y[0]==="ASK"&&!U&&J[Q].name!=="asking"&&(!J[Q-1]||J[Q-1].name!=="asking")){let V=new a5.default("asking");V.ignore=!0,this.sendCommand(V)}J[Q].initPromise(),this.sendCommand(J[Q]),U=J[Q].inTransaction}let z=!0;if(typeof this.leftRedirections>"u")this.leftRedirections={};let W=function(){Z.exec()},X=this.redis;if(X.handleError($,this.leftRedirections,{moved:function(Q,V){Z.preferKey=V,X.slots[Y[1]]=[V],X._groupsBySlot[Y[1]]=X._groupsIds[X.slots[Y[1]].join(";")],X.refreshSlotsCache(),Z.exec()},ask:function(Q,V){Z.preferKey=V,Z.exec()},tryagain:W,clusterDown:W,connectionClosed:W,maxRedirections:()=>{z=!1},defaults:()=>{z=!1}}),z)return}}let w=0;for(let k=0;k<this._queue.length-w;++k){if(this._queue[k+w].ignore)w+=1;this._result[k]=this._result[k+w]}this.resolve(this._result.slice(0,this._result.length-w))}sendCommand(S){if(this._transactions>0)S.inTransaction=!0;let y=this._queue.length;return S.pipelineIndex=y,S.promise.then((w)=>{this.fillResult([null,w],y)}).catch((w)=>{this.fillResult([w],y)}),this._queue.push(S),this}addBatch(S){let y,w,k;for(let $=0;$<S.length;++$)y=S[$],w=y[0],k=y.slice(1),this[w].apply(this,k);return this}}z0.default=a;var e5=a.prototype.multi;a.prototype.multi=function(){return this._transactions+=1,e5.apply(this,arguments)};var X0=a.prototype.execBuffer;a.prototype.execBuffer=(0,o5.deprecate)(function(){if(this._transactions>0)this._transactions-=1;return X0.apply(this,arguments)},"Pipeline#execBuffer: Use Pipeline#exec instead");a.prototype.exec=function(S){if(this.isCluster&&!this.redis.slots.length){if(this.redis.status==="wait")this.redis.connect().catch(n5.noop);if(S&&!this.nodeifiedPromise)this.nodeifiedPromise=!0,(0,W0.default)(this.promise,S);return this.redis.delayUntilReady(($)=>{if($){this.reject($);return}this.exec(S)}),this.promise}if(this._transactions>0)return this._transactions-=1,X0.apply(this,arguments);if(!this.nodeifiedPromise)this.nodeifiedPromise=!0,(0,W0.default)(this.promise,S);if(!this._queue.length)this.resolve([]);let y;if(this.isCluster){let $=[];for(let Z=0;Z<this._queue.length;Z++){let Y=this._queue[Z].getKeys();if(Y.length)$.push(Y[0]);if(Y.length&&zS.generateMulti(Y)<0)return this.reject(Error("All the keys in a pipeline command should belong to the same slot")),this.promise}if($.length){if(y=r5(this.redis,$),y<0)return this.reject(Error("All keys in the pipeline should belong to the same slots allocation group")),this.promise}else y=Math.random()*16384|0}let w=this;return k(),this.promise;function k(){let $=w.replyPending=w._queue.length,Z;if(w.isCluster)Z={slot:y,redis:w.redis.connectionPool.nodes.all[w.preferKey]};let Y="",J,U={isPipeline:!0,destination:w.isCluster?Z:{redis:w.redis},write(z){if(typeof z!=="string"){if(!J)J=[];if(Y)J.push(Buffer.from(Y,"utf8")),Y="";J.push(z)}else Y+=z;if(!--$){if(J){if(Y)J.push(Buffer.from(Y,"utf8"));U.destination.redis.stream.write(Buffer.concat(J))}else U.destination.redis.stream.write(Y);$=w._queue.length,Y="",J=void 0}}};for(let z=0;z<w._queue.length;++z)w.redis.sendCommand(w._queue[z],U,Z);return w.promise}}});var GS=q((V0)=>{Object.defineProperty(V0,"__esModule",{value:!0});V0.addTransactionSupport=void 0;var VS=F(),qS=f(),Q0=QS();function yk(S){S.pipeline=function(k){let $=new Q0.default(this);if(Array.isArray(k))$.addBatch(k);return $};let{multi:y}=S;S.multi=function(k,$){if(typeof $>"u"&&!Array.isArray(k))$=k,k=null;if($&&$.pipeline===!1)return y.call(this);let Z=new Q0.default(this);if(Z.multi(),Array.isArray(k))Z.addBatch(k);let Y=Z.exec;Z.exec=function(U){if(this.isCluster&&!this.redis.slots.length){if(this.redis.status==="wait")this.redis.connect().catch(VS.noop);return(0,qS.default)(new Promise((W,X)=>{this.redis.delayUntilReady((Q)=>{if(Q){X(Q);return}this.exec(Z).then(W,X)})}),U)}if(this._transactions>0)Y.call(Z);if(this.nodeifiedPromise)return Y.call(Z);let z=Y.call(Z);return(0,qS.default)(z.then(function(W){let X=W[W.length-1];if(typeof X>"u")throw Error("Pipeline cannot be used to send any commands when the `exec()` has been called on it.");if(X[0]){X[0].previousErrors=[];for(let Q=0;Q<W.length-1;++Q)if(W[Q][0])X[0].previousErrors.push(W[Q][0]);throw X[0]}return(0,VS.wrapMultiResult)(X[1])}),U)};let{execBuffer:J}=Z;return Z.execBuffer=function(U){if(this._transactions>0)J.call(Z);return Z.exec(U)},Z};let{exec:w}=S;S.exec=function(k){return(0,qS.default)(w.call(this).then(function($){if(Array.isArray($))$=(0,VS.wrapMultiResult)($);return $}),k)}}V0.addTransactionSupport=yk});var HS=q((G0)=>{Object.defineProperty(G0,"__esModule",{value:!0});function wk(S,y){Object.getOwnPropertyNames(y.prototype).forEach((w)=>{Object.defineProperty(S.prototype,w,Object.getOwnPropertyDescriptor(y.prototype,w))})}G0.default=wk});var F0=q((B0)=>{Object.defineProperty(B0,"__esModule",{value:!0});B0.DEFAULT_CLUSTER_OPTIONS=void 0;var H0=G("dns");B0.DEFAULT_CLUSTER_OPTIONS={clusterRetryStrategy:(S)=>Math.min(100+S*2,2000),enableOfflineQueue:!0,enableReadyCheck:!0,scaleReads:"master",maxRedirections:16,retryDelayOnMoved:0,retryDelayOnFailover:100,retryDelayOnClusterDown:100,retryDelayOnTryAgain:100,slotsRefreshTimeout:1000,useSRVRecords:!1,resolveSrv:H0.resolveSrv,dnsLookup:H0.lookup,enableAutoPipelining:!1,autoPipeliningIgnoredCommands:[],shardedSubscribers:!1}});var q1=q((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});O0.getConnectionName=O0.weightSrvRecords=O0.groupSrvRecords=O0.getUniqueHostnamesFromOptions=O0.normalizeNodeOptions=O0.nodeKeyToRedisOptions=O0.getNodeKey=void 0;var E0=F(),$k=G("net");function Zk(S){return S.port=S.port||6379,S.host=S.host||"127.0.0.1",S.host+":"+S.port}O0.getNodeKey=Zk;function Yk(S){let y=S.lastIndexOf(":");if(y===-1)throw Error(`Invalid node key ${S}`);return{host:S.slice(0,y),port:Number(S.slice(y+1))}}O0.nodeKeyToRedisOptions=Yk;function Jk(S){return S.map((y)=>{let w={};if(typeof y==="object")Object.assign(w,y);else if(typeof y==="string")Object.assign(w,(0,E0.parseURL)(y));else if(typeof y==="number")w.port=y;else throw Error("Invalid argument "+y);if(typeof w.port==="string")w.port=parseInt(w.port,10);if(delete w.db,!w.port)w.port=6379;if(!w.host)w.host="127.0.0.1";return(0,E0.resolveTLSProfile)(w)})}O0.normalizeNodeOptions=Jk;function Uk(S){let y={};return S.forEach((w)=>{y[w.host]=!0}),Object.keys(y).filter((w)=>!(0,$k.isIP)(w))}O0.getUniqueHostnamesFromOptions=Uk;function Wk(S){let y={};for(let w of S)if(!y.hasOwnProperty(w.priority))y[w.priority]={totalWeight:w.weight,records:[w]};else y[w.priority].totalWeight+=w.weight,y[w.priority].records.push(w);return y}O0.groupSrvRecords=Wk;function Xk(S){if(S.records.length===1)return S.totalWeight=0,S.records.shift();let y=Math.floor(Math.random()*(S.totalWeight+S.records.length)),w=0;for(let[k,$]of S.records.entries())if(w+=1+$.weight,w>y)return S.totalWeight-=$.weight,S.records.splice(k,1),$}O0.weightSrvRecords=Xk;function zk(S,y){let w=`ioredis-cluster(${S})`;return y?`${w}:${y}`:w}O0.getConnectionName=zk});var MS=q((K0)=>{Object.defineProperty(K0,"__esModule",{value:!0});var I0=q1(),BS=F(),Mk=g(),N=(0,BS.Debug)("cluster:subscriber");class L0{constructor(S,y,w=!1){this.connectionPool=S,this.emitter=y,this.isSharded=w,this.started=!1,this.subscriber=null,this.slotRange=[],this.onSubscriberEnd=()=>{if(!this.started){N("subscriber has disconnected, but ClusterSubscriber is not started, so not reconnecting.");return}N("subscriber has disconnected, selecting a new one..."),this.selectSubscriber()},this.connectionPool.on("-node",(k,$)=>{if(!this.started||!this.subscriber)return;if((0,I0.getNodeKey)(this.subscriber.options)===$)N("subscriber has left, selecting a new one..."),this.selectSubscriber()}),this.connectionPool.on("+node",()=>{if(!this.started||this.subscriber)return;N("a new node is discovered and there is no subscriber, selecting a new one..."),this.selectSubscriber()})}getInstance(){return this.subscriber}associateSlotRange(S){if(this.isSharded)this.slotRange=S;return this.slotRange}start(){this.started=!0,this.selectSubscriber(),N("started")}stop(){if(this.started=!1,this.subscriber)this.subscriber.disconnect(),this.subscriber=null}isStarted(){return this.started}selectSubscriber(){let S=this.lastActiveSubscriber;if(S)S.off("end",this.onSubscriberEnd),S.disconnect();if(this.subscriber)this.subscriber.off("end",this.onSubscriberEnd),this.subscriber.disconnect();let y=(0,BS.sample)(this.connectionPool.getNodes());if(!y){N("selecting subscriber failed since there is no node discovered in the cluster yet"),this.subscriber=null;return}let{options:w}=y;N("selected a subscriber %s:%s",w.host,w.port);let k="subscriber";if(this.isSharded)k="ssubscriber";this.subscriber=new Mk.default({port:w.port,host:w.host,username:w.username,password:w.password,enableReadyCheck:!0,connectionName:(0,I0.getConnectionName)(k,w.connectionName),lazyConnect:!0,tls:w.tls,retryStrategy:null}),this.subscriber.on("error",BS.noop),this.subscriber.on("moved",()=>{this.emitter.emit("forceRefresh")}),this.subscriber.once("end",this.onSubscriberEnd);let $={subscribe:[],psubscribe:[],ssubscribe:[]};if(S){let Z=S.condition||S.prevCondition;if(Z&&Z.subscriber)$.subscribe=Z.subscriber.channels("subscribe"),$.psubscribe=Z.subscriber.channels("psubscribe"),$.ssubscribe=Z.subscriber.channels("ssubscribe")}if($.subscribe.length||$.psubscribe.length||$.ssubscribe.length){let Z=0;for(let Y of["subscribe","psubscribe","ssubscribe"]){let J=$[Y];if(J.length==0)continue;if(N("%s %d channels",Y,J.length),Y==="ssubscribe")for(let U of J)Z+=1,this.subscriber[Y](U).then(()=>{if(!--Z)this.lastActiveSubscriber=this.subscriber}).catch(()=>{N("failed to ssubscribe to channel: %s",U)});else Z+=1,this.subscriber[Y](J).then(()=>{if(!--Z)this.lastActiveSubscriber=this.subscriber}).catch(()=>{N("failed to %s %d channels",Y,J.length)})}}else this.lastActiveSubscriber=this.subscriber;for(let Z of["message","messageBuffer"])this.subscriber.on(Z,(Y,J)=>{this.emitter.emit(Z,Y,J)});for(let Z of["pmessage","pmessageBuffer"])this.subscriber.on(Z,(Y,J,U)=>{this.emitter.emit(Z,Y,J,U)});if(this.isSharded==!0)for(let Z of["smessage","smessageBuffer"])this.subscriber.on(Z,(Y,J)=>{this.emitter.emit(Z,Y,J)})}}K0.default=L0});var ES=q((A0)=>{Object.defineProperty(A0,"__esModule",{value:!0});var Ek=G("events"),f1=F(),FS=q1(),Ok=g(),G1=(0,f1.Debug)("cluster:connectionPool");class R0 extends Ek.EventEmitter{constructor(S){super();this.redisOptions=S,this.nodes={all:{},master:{},slave:{}},this.specifiedOptions={}}getNodes(S="all"){let y=this.nodes[S];return Object.keys(y).map((w)=>y[w])}getInstanceByKey(S){return this.nodes.all[S]}getSampleInstance(S){let y=Object.keys(this.nodes[S]),w=(0,f1.sample)(y);return this.nodes[S][w]}addMasterNode(S){let y=(0,FS.getNodeKey)(S.options),w=this.createRedisFromOptions(S,S.options.readOnly);if(!S.options.readOnly)return this.nodes.all[y]=w,this.nodes.master[y]=w,!0;return!1}createRedisFromOptions(S,y){return new Ok.default((0,f1.defaults)({retryStrategy:null,enableOfflineQueue:!0,readOnly:y},S,this.redisOptions,{lazyConnect:!0}))}findOrCreate(S,y=!1){let w=(0,FS.getNodeKey)(S);if(y=Boolean(y),this.specifiedOptions[w])Object.assign(S,this.specifiedOptions[w]);else this.specifiedOptions[w]=S;let k;if(this.nodes.all[w]){if(k=this.nodes.all[w],k.options.readOnly!==y)if(k.options.readOnly=y,G1("Change role of %s to %s",w,y?"slave":"master"),k[y?"readonly":"readwrite"]().catch(f1.noop),y)delete this.nodes.master[w],this.nodes.slave[w]=k;else delete this.nodes.slave[w],this.nodes.master[w]=k}else G1("Connecting to %s as %s",w,y?"slave":"master"),k=this.createRedisFromOptions(S,y),this.nodes.all[w]=k,this.nodes[y?"slave":"master"][w]=k,k.once("end",()=>{if(this.removeNode(w),this.emit("-node",k,w),!Object.keys(this.nodes.all).length)this.emit("drain")}),this.emit("+node",k,w),k.on("error",function($){this.emit("nodeError",$,w)});return k}reset(S){G1("Reset with %O",S);let y={};S.forEach((w)=>{let k=(0,FS.getNodeKey)(w);if(!(w.readOnly&&y[k]))y[k]=w}),Object.keys(this.nodes.all).forEach((w)=>{if(!y[w])G1("Disconnect %s because the node does not hold any slot",w),this.nodes.all[w].disconnect(),this.removeNode(w)}),Object.keys(y).forEach((w)=>{let k=y[w];this.findOrCreate(k,k.readOnly)})}removeNode(S){let{nodes:y}=this;if(y.all[S])G1("Remove %s from the pool",S),delete y.all[S];delete y.master[S],delete y.slave[S]}}A0.default=R0});var h1=q((e7,T0)=>{function H(S,w){var w=w||{};if(this._capacity=w.capacity,this._head=0,this._tail=0,Array.isArray(S))this._fromArray(S);else this._capacityMask=3,this._list=[,,,,]}H.prototype.peekAt=function(y){var w=y;if(w!==(w|0))return;var k=this.size();if(w>=k||w<-k)return;if(w<0)w+=k;return w=this._head+w&this._capacityMask,this._list[w]};H.prototype.get=function(y){return this.peekAt(y)};H.prototype.peek=function(){if(this._head===this._tail)return;return this._list[this._head]};H.prototype.peekFront=function(){return this.peek()};H.prototype.peekBack=function(){return this.peekAt(-1)};Object.defineProperty(H.prototype,"length",{get:function(){return this.size()}});H.prototype.size=function(){if(this._head===this._tail)return 0;if(this._head<this._tail)return this._tail-this._head;else return this._capacityMask+1-(this._head-this._tail)};H.prototype.unshift=function(y){if(arguments.length===0)return this.size();var w=this._list.length;if(this._head=this._head-1+w&this._capacityMask,this._list[this._head]=y,this._tail===this._head)this._growArray();if(this._capacity&&this.size()>this._capacity)this.pop();if(this._head<this._tail)return this._tail-this._head;else return this._capacityMask+1-(this._head-this._tail)};H.prototype.shift=function(){var y=this._head;if(y===this._tail)return;var w=this._list[y];if(this._list[y]=void 0,this._head=y+1&this._capacityMask,y<2&&this._tail>1e4&&this._tail<=this._list.length>>>2)this._shrinkArray();return w};H.prototype.push=function(y){if(arguments.length===0)return this.size();var w=this._tail;if(this._list[w]=y,this._tail=w+1&this._capacityMask,this._tail===this._head)this._growArray();if(this._capacity&&this.size()>this._capacity)this.shift();if(this._head<this._tail)return this._tail-this._head;else return this._capacityMask+1-(this._head-this._tail)};H.prototype.pop=function(){var y=this._tail;if(y===this._head)return;var w=this._list.length;this._tail=y-1+w&this._capacityMask;var k=this._list[this._tail];if(this._list[this._tail]=void 0,this._head<2&&y>1e4&&y<=w>>>2)this._shrinkArray();return k};H.prototype.removeOne=function(y){var w=y;if(w!==(w|0))return;if(this._head===this._tail)return;var k=this.size(),$=this._list.length;if(w>=k||w<-k)return;if(w<0)w+=k;w=this._head+w&this._capacityMask;var Z=this._list[w],Y;if(y<k/2){for(Y=y;Y>0;Y--)this._list[w]=this._list[w=w-1+$&this._capacityMask];this._list[w]=void 0,this._head=this._head+1+$&this._capacityMask}else{for(Y=k-1-y;Y>0;Y--)this._list[w]=this._list[w=w+1+$&this._capacityMask];this._list[w]=void 0,this._tail=this._tail-1+$&this._capacityMask}return Z};H.prototype.remove=function(y,w){var k=y,$,Z=w;if(k!==(k|0))return;if(this._head===this._tail)return;var Y=this.size(),J=this._list.length;if(k>=Y||k<-Y||w<1)return;if(k<0)k+=Y;if(w===1||!w)return $=[,],$[0]=this.removeOne(k),$;if(k===0&&k+w>=Y)return $=this.toArray(),this.clear(),$;if(k+w>Y)w=Y-k;var U;$=Array(w);for(U=0;U<w;U++)$[U]=this._list[this._head+k+U&this._capacityMask];if(k=this._head+k&this._capacityMask,y+w===Y){this._tail=this._tail-w+J&this._capacityMask;for(U=w;U>0;U--)this._list[k=k+1+J&this._capacityMask]=void 0;return $}if(y===0){this._head=this._head+w+J&this._capacityMask;for(U=w-1;U>0;U--)this._list[k=k+1+J&this._capacityMask]=void 0;return $}if(k<Y/2){this._head=this._head+y+w+J&this._capacityMask;for(U=y;U>0;U--)this.unshift(this._list[k=k-1+J&this._capacityMask]);k=this._head-1+J&this._capacityMask;while(Z>0)this._list[k=k-1+J&this._capacityMask]=void 0,Z--;if(y<0)this._tail=k}else{this._tail=k,k=k+w+J&this._capacityMask;for(U=Y-(w+y);U>0;U--)this.push(this._list[k++]);k=this._tail;while(Z>0)this._list[k=k+1+J&this._capacityMask]=void 0,Z--}if(this._head<2&&this._tail>1e4&&this._tail<=J>>>2)this._shrinkArray();return $};H.prototype.splice=function(y,w){var k=y;if(k!==(k|0))return;var $=this.size();if(k<0)k+=$;if(k>$)return;if(arguments.length>2){var Z,Y,J,U=arguments.length,z=this._list.length,W=2;if(!$||k<$/2){Y=Array(k);for(Z=0;Z<k;Z++)Y[Z]=this._list[this._head+Z&this._capacityMask];if(w===0){if(J=[],k>0)this._head=this._head+k+z&this._capacityMask}else J=this.remove(k,w),this._head=this._head+k+z&this._capacityMask;while(U>W)this.unshift(arguments[--U]);for(Z=k;Z>0;Z--)this.unshift(Y[Z-1])}else{Y=Array($-(k+w));var X=Y.length;for(Z=0;Z<X;Z++)Y[Z]=this._list[this._head+k+w+Z&this._capacityMask];if(w===0){if(J=[],k!=$)this._tail=this._head+k+z&this._capacityMask}else J=this.remove(k,w),this._tail=this._tail-X+z&this._capacityMask;while(W<U)this.push(arguments[W++]);for(Z=0;Z<X;Z++)this.push(Y[Z])}return J}else return this.remove(k,w)};H.prototype.clear=function(){this._list=Array(this._list.length),this._head=0,this._tail=0};H.prototype.isEmpty=function(){return this._head===this._tail};H.prototype.toArray=function(){return this._copyArray(!1)};H.prototype._fromArray=function(y){var w=y.length,k=this._nextPowerOf2(w);this._list=Array(k),this._capacityMask=k-1,this._tail=w;for(var $=0;$<w;$++)this._list[$]=y[$]};H.prototype._copyArray=function(y,w){var k=this._list,$=k.length,Z=this.length;if(w=w|Z,w==Z&&this._head<this._tail)return this._list.slice(this._head,this._tail);var Y=Array(w),J=0,U;if(y||this._head>this._tail){for(U=this._head;U<$;U++)Y[J++]=k[U];for(U=0;U<this._tail;U++)Y[J++]=k[U]}else for(U=this._head;U<this._tail;U++)Y[J++]=k[U];return Y};H.prototype._growArray=function(){if(this._head!=0){var y=this._copyArray(!0,this._list.length<<1);this._tail=this._list.length,this._head=0,this._list=y}else this._tail=this._list.length,this._list.length<<=1;this._capacityMask=this._capacityMask<<1|1};H.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1};H.prototype._nextPowerOf2=function(y){var w=Math.log(y)/Math.log(2),k=1<<w+1;return Math.max(k,4)};T0.exports=H});var N0=q((j0)=>{Object.defineProperty(j0,"__esModule",{value:!0});var Ik=F(),Lk=h1(),Kk=(0,Ik.Debug)("delayqueue");class D0{constructor(){this.queues={},this.timeouts={}}push(S,y,w){let k=w.callback||process.nextTick;if(!this.queues[S])this.queues[S]=new Lk;if(this.queues[S].push(y),!this.timeouts[S])this.timeouts[S]=setTimeout(()=>{k(()=>{this.timeouts[S]=null,this.execute(S)})},w.timeout)}execute(S){let y=this.queues[S];if(!y)return;let{length:w}=y;if(!w)return;Kk("send %d commands in %s queue",w,S),this.queues[S]=null;while(y.length>0)y.shift()()}}j0.default=D0});var h0=q((f0)=>{Object.defineProperty(f0,"__esModule",{value:!0});var Ak=F(),Tk=MS(),Dk=ES(),x0=q1(),v1=W1(),C0=(0,Ak.Debug)("cluster:subscriberGroup");class _0{constructor(S,y){this.cluster=S,this.shardedSubscribers=new Map,this.clusterSlots=[],this.subscriberToSlotsIndex=new Map,this.channels=new Map,S.on("+node",(w)=>{this._addSubscriber(w)}),S.on("-node",(w)=>{this._removeSubscriber(w)}),S.on("refresh",()=>{this._refreshSlots(S)}),S.on("forceRefresh",()=>{y()})}getResponsibleSubscriber(S){let y=this.clusterSlots[S][0];return this.shardedSubscribers.get(y)}addChannels(S){let y=v1(S[0]);S.forEach((k)=>{if(v1(k)!=y)return-1});let w=this.channels.get(y);if(!w)this.channels.set(y,S);else this.channels.set(y,w.concat(S));return[...this.channels.values()].flatMap((k)=>k).length}removeChannels(S){let y=v1(S[0]);S.forEach((k)=>{if(v1(k)!=y)return-1});let w=this.channels.get(y);if(w){let k=w.filter(($)=>!S.includes($));this.channels.set(y,k)}return[...this.channels.values()].flatMap((k)=>k).length}stop(){for(let S of this.shardedSubscribers.values())S.stop()}start(){for(let S of this.shardedSubscribers.values())if(!S.isStarted())S.start()}_addSubscriber(S){let y=new Dk.default(S.options);if(y.addMasterNode(S)){let w=new Tk.default(y,this.cluster,!0),k=(0,x0.getNodeKey)(S.options);return this.shardedSubscribers.set(k,w),w.start(),this._resubscribe(),this.cluster.emit("+subscriber"),w}return null}_removeSubscriber(S){let y=(0,x0.getNodeKey)(S.options),w=this.shardedSubscribers.get(y);if(w)w.stop(),this.shardedSubscribers.delete(y),this._resubscribe(),this.cluster.emit("-subscriber");return this.shardedSubscribers}_refreshSlots(S){if(this._slotsAreEqual(S.slots))C0("Nothing to refresh because the new cluster map is equal to the previous one.");else{C0("Refreshing the slots of the subscriber group."),this.subscriberToSlotsIndex=new Map;for(let y=0;y<S.slots.length;y++){let w=S.slots[y][0];if(!this.subscriberToSlotsIndex.has(w))this.subscriberToSlotsIndex.set(w,[]);this.subscriberToSlotsIndex.get(w).push(Number(y))}return this._resubscribe(),this.clusterSlots=JSON.parse(JSON.stringify(S.slots)),this.cluster.emit("subscribersReady"),!0}return!1}_resubscribe(){if(this.shardedSubscribers)this.shardedSubscribers.forEach((S,y)=>{let w=this.subscriberToSlotsIndex.get(y);if(w)S.associateSlotRange(w),w.forEach((k)=>{let $=S.getInstance(),Z=this.channels.get(k);if(Z&&Z.length>0){if($)$.ssubscribe(Z),$.on("ready",()=>{$.ssubscribe(Z)})}})})}_slotsAreEqual(S){if(this.clusterSlots===void 0)return!1;else return JSON.stringify(this.clusterSlots)===JSON.stringify(S)}}f0.default=_0});var PS=q((d0)=>{Object.defineProperty(d0,"__esModule",{value:!0});var v0=r(),u0=G("events"),H1=i(),b0=f(),g0=C(),OS=iy(),Nk=g(),xk=N1(),Ck=GS(),R=F(),_k=HS(),fk=_1(),hk=F0(),vk=MS(),bk=ES(),gk=N0(),Z1=q1(),p0=h1(),pk=h0(),B=(0,R.Debug)("cluster"),t0=new WeakSet;class B1 extends fk.default{constructor(S,y={}){super();if(this.slots=[],this._groupsIds={},this._groupsBySlot=Array(16384),this.isCluster=!0,this.retryAttempts=0,this.delayQueue=new gk.default,this.offlineQueue=new p0,this.isRefreshing=!1,this._refreshSlotsCacheCallbacks=[],this._autoPipelines=new Map,this._runningAutoPipelines=new Set,this._readyDelayedCallbacks=[],this.connectionEpoch=0,u0.EventEmitter.call(this),this.startupNodes=S,this.options=(0,R.defaults)({},y,hk.DEFAULT_CLUSTER_OPTIONS,this.options),this.options.shardedSubscribers==!0)this.shardedSubscribers=new pk.default(this,this.refreshSlotsCache.bind(this));if(this.options.redisOptions&&this.options.redisOptions.keyPrefix&&!this.options.keyPrefix)this.options.keyPrefix=this.options.redisOptions.keyPrefix;if(typeof this.options.scaleReads!=="function"&&["all","master","slave"].indexOf(this.options.scaleReads)===-1)throw Error('Invalid option scaleReads "'+this.options.scaleReads+'". Expected "all", "master", "slave" or a custom function');if(this.connectionPool=new bk.default(this.options.redisOptions),this.connectionPool.on("-node",(w,k)=>{this.emit("-node",w)}),this.connectionPool.on("+node",(w)=>{this.emit("+node",w)}),this.connectionPool.on("drain",()=>{this.setStatus("close")}),this.connectionPool.on("nodeError",(w,k)=>{this.emit("node error",w,k)}),this.subscriber=new vk.default(this.connectionPool,this),this.options.scripts)Object.entries(this.options.scripts).forEach(([w,k])=>{this.defineCommand(w,k)});if(this.options.lazyConnect)this.setStatus("wait");else this.connect().catch((w)=>{B("connecting failed: %s",w)})}connect(){return new Promise((S,y)=>{if(this.status==="connecting"||this.status==="connect"||this.status==="ready"){y(Error("Redis is already connecting/connected"));return}let w=++this.connectionEpoch;this.setStatus("connecting"),this.resolveStartupNodeHostnames().then((k)=>{if(this.connectionEpoch!==w){B("discard connecting after resolving startup nodes because epoch not match: %d != %d",w,this.connectionEpoch),y(new H1.RedisError("Connection is discarded because a new connection is made"));return}if(this.status!=="connecting"){B("discard connecting after resolving startup nodes because the status changed to %s",this.status),y(new H1.RedisError("Connection is aborted"));return}this.connectionPool.reset(k);let $=()=>{this.setStatus("ready"),this.retryAttempts=0,this.executeOfflineCommands(),this.resetNodesRefreshInterval(),S()},Z=void 0,Y=()=>{if(this.invokeReadyDelayedCallbacks(void 0),this.removeListener("close",Z),this.manuallyClosing=!1,this.setStatus("connect"),this.options.enableReadyCheck)this.readyCheck((J,U)=>{if(J||U){if(B("Ready check failed (%s). Reconnecting...",J||U),this.status==="connect")this.disconnect(!0)}else $()});else $()};if(Z=()=>{let J=Error("None of startup nodes is available");this.removeListener("refresh",Y),this.invokeReadyDelayedCallbacks(J),y(J)},this.once("refresh",Y),this.once("close",Z),this.once("close",this.handleCloseEvent.bind(this)),this.refreshSlotsCache((J)=>{if(J&&J.message===OS.default.defaultMessage)Nk.default.prototype.silentEmit.call(this,"error",J),this.connectionPool.reset([])}),this.subscriber.start(),this.options.shardedSubscribers)this.shardedSubscribers.start()}).catch((k)=>{this.setStatus("close"),this.handleCloseEvent(k),this.invokeReadyDelayedCallbacks(k),y(k)})})}disconnect(S=!1){let y=this.status;if(this.setStatus("disconnecting"),!S)this.manuallyClosing=!0;if(this.reconnectTimeout&&!S)clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null,B("Canceled reconnecting attempts");if(this.clearNodesRefreshInterval(),this.subscriber.stop(),this.options.shardedSubscribers)this.shardedSubscribers.stop();if(y==="wait")this.setStatus("close"),this.handleCloseEvent();else this.connectionPool.reset([])}quit(S){let y=this.status;if(this.setStatus("disconnecting"),this.manuallyClosing=!0,this.reconnectTimeout)clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null;if(this.clearNodesRefreshInterval(),this.subscriber.stop(),this.options.shardedSubscribers)this.shardedSubscribers.stop();if(y==="wait"){let w=(0,b0.default)(Promise.resolve("OK"),S);return setImmediate(function(){this.setStatus("close"),this.handleCloseEvent()}.bind(this)),w}return(0,b0.default)(Promise.all(this.nodes().map((w)=>w.quit().catch((k)=>{if(k.message===R.CONNECTION_CLOSED_ERROR_MSG)return"OK";throw k}))).then(()=>"OK"),S)}duplicate(S=[],y={}){let w=S.length>0?S:this.startupNodes.slice(0),k=Object.assign({},this.options,y);return new B1(w,k)}nodes(S="all"){if(S!=="all"&&S!=="master"&&S!=="slave")throw Error('Invalid role "'+S+'". Expected "all", "master" or "slave"');return this.connectionPool.getNodes(S)}delayUntilReady(S){this._readyDelayedCallbacks.push(S)}get autoPipelineQueueSize(){let S=0;for(let y of this._autoPipelines.values())S+=y.length;return S}refreshSlotsCache(S){if(S)this._refreshSlotsCacheCallbacks.push(S);if(this.isRefreshing)return;this.isRefreshing=!0;let y=this,w=(Y)=>{this.isRefreshing=!1;for(let J of this._refreshSlotsCacheCallbacks)J(Y);this._refreshSlotsCacheCallbacks=[]},k=(0,R.shuffle)(this.connectionPool.getNodes()),$=null;function Z(Y){if(Y===k.length){let z=new OS.default(OS.default.defaultMessage,$);return w(z)}let J=k[Y],U=`${J.options.host}:${J.options.port}`;B("getting slot cache from %s",U),y.getInfoFromNode(J,function(z){switch(y.status){case"close":case"end":return w(Error("Cluster is disconnected."));case"disconnecting":return w(Error("Cluster is disconnecting."))}if(z)y.emit("node error",z,U),$=z,Z(Y+1);else y.emit("refresh"),w()})}Z(0)}sendCommand(S,y,w){if(this.status==="wait")this.connect().catch(R.noop);if(this.status==="end")return S.reject(Error(R.CONNECTION_CLOSED_ERROR_MSG)),S.promise;let k=this.options.scaleReads;if(k!=="master"){if(!(S.isReadOnly||(0,v0.exists)(S.name)&&(0,v0.hasFlag)(S.name,"readonly")))k="master"}let $=w?w.slot:S.getSlot(),Z={},Y=this;if(!w&&!t0.has(S)){t0.add(S);let U=S.reject;S.reject=function(z){let W=J.bind(null,!0);Y.handleError(z,Z,{moved:function(X,Q){if(B("command %s is moved to %s",S.name,Q),$=Number(X),Y.slots[X])Y.slots[X][0]=Q;else Y.slots[X]=[Q];Y._groupsBySlot[X]=Y._groupsIds[Y.slots[X].join(";")],Y.connectionPool.findOrCreate(Y.natMapper(Q)),J(),B("refreshing slot caches... (triggered by MOVED error)"),Y.refreshSlotsCache()},ask:function(X,Q){B("command %s is required to ask %s:%s",S.name,Q);let V=Y.natMapper(Q);Y.connectionPool.findOrCreate(V),J(!1,`${V.host}:${V.port}`)},tryagain:W,clusterDown:W,connectionClosed:W,maxRedirections:function(X){U.call(S,X)},defaults:function(){U.call(S,z)}})}}J();function J(U,z){if(Y.status==="end"){S.reject(new H1.AbortError("Cluster is ended."));return}let W;if(Y.status==="ready"||S.name==="cluster"){if(w&&w.redis)W=w.redis;else if(g0.default.checkFlag("ENTER_SUBSCRIBER_MODE",S.name)||g0.default.checkFlag("EXIT_SUBSCRIBER_MODE",S.name)){if(Y.options.shardedSubscribers==!0&&(S.name=="ssubscribe"||S.name=="sunsubscribe")){let X=Y.shardedSubscribers.getResponsibleSubscriber($),Q=-1;if(S.name=="ssubscribe")Q=Y.shardedSubscribers.addChannels(S.getKeys());if(S.name=="sunsubscribe")Q=Y.shardedSubscribers.removeChannels(S.getKeys());if(Q!==-1)W=X.getInstance();else S.reject(new H1.AbortError("Can't add or remove the given channels. Are they in the same slot?"))}else W=Y.subscriber.getInstance();if(!W){S.reject(new H1.AbortError("No subscriber for the cluster"));return}}else{if(!U){if(typeof $==="number"&&Y.slots[$]){let X=Y.slots[$];if(typeof k==="function"){let Q=X.map(function(V){return Y.connectionPool.getInstanceByKey(V)});if(W=k(Q,S),Array.isArray(W))W=(0,R.sample)(W);if(!W)W=Q[0]}else{let Q;if(k==="all")Q=(0,R.sample)(X);else if(k==="slave"&&X.length>1)Q=(0,R.sample)(X,1);else Q=X[0];W=Y.connectionPool.getInstanceByKey(Q)}}if(z)W=Y.connectionPool.getInstanceByKey(z),W.asking()}if(!W)W=(typeof k==="function"?null:Y.connectionPool.getSampleInstance(k))||Y.connectionPool.getSampleInstance("all")}if(w&&!w.redis)w.redis=W}if(W)W.sendCommand(S,y);else if(Y.options.enableOfflineQueue)Y.offlineQueue.push({command:S,stream:y,node:w});else S.reject(Error("Cluster isn't ready and enableOfflineQueue options is false"))}return S.promise}sscanStream(S,y){return this.createScanStream("sscan",{key:S,options:y})}sscanBufferStream(S,y){return this.createScanStream("sscanBuffer",{key:S,options:y})}hscanStream(S,y){return this.createScanStream("hscan",{key:S,options:y})}hscanBufferStream(S,y){return this.createScanStream("hscanBuffer",{key:S,options:y})}zscanStream(S,y){return this.createScanStream("zscan",{key:S,options:y})}zscanBufferStream(S,y){return this.createScanStream("zscanBuffer",{key:S,options:y})}handleError(S,y,w){if(typeof y.value>"u")y.value=this.options.maxRedirections;else y.value-=1;if(y.value<=0){w.maxRedirections(Error("Too many Cluster redirections. Last error: "+S));return}let k=S.message.split(" ");if(k[0]==="MOVED"){let $=this.options.retryDelayOnMoved;if($&&typeof $==="number")this.delayQueue.push("moved",w.moved.bind(null,k[1],k[2]),{timeout:$});else w.moved(k[1],k[2])}else if(k[0]==="ASK")w.ask(k[1],k[2]);else if(k[0]==="TRYAGAIN")this.delayQueue.push("tryagain",w.tryagain,{timeout:this.options.retryDelayOnTryAgain});else if(k[0]==="CLUSTERDOWN"&&this.options.retryDelayOnClusterDown>0)this.delayQueue.push("clusterdown",w.connectionClosed,{timeout:this.options.retryDelayOnClusterDown,callback:this.refreshSlotsCache.bind(this)});else if(S.message===R.CONNECTION_CLOSED_ERROR_MSG&&this.options.retryDelayOnFailover>0&&this.status==="ready")this.delayQueue.push("failover",w.connectionClosed,{timeout:this.options.retryDelayOnFailover,callback:this.refreshSlotsCache.bind(this)});else w.defaults()}resetOfflineQueue(){this.offlineQueue=new p0}clearNodesRefreshInterval(){if(this.slotsTimer)clearTimeout(this.slotsTimer),this.slotsTimer=null}resetNodesRefreshInterval(){if(this.slotsTimer||!this.options.slotsRefreshInterval)return;let S=()=>{this.slotsTimer=setTimeout(()=>{B('refreshing slot caches... (triggered by "slotsRefreshInterval" option)'),this.refreshSlotsCache(()=>{S()})},this.options.slotsRefreshInterval)};S()}setStatus(S){B("status: %s -> %s",this.status||"[empty]",S),this.status=S,process.nextTick(()=>{this.emit(S)})}handleCloseEvent(S){if(S)B("closed because %s",S);let y;if(!this.manuallyClosing&&typeof this.options.clusterRetryStrategy==="function")y=this.options.clusterRetryStrategy.call(this,++this.retryAttempts,S);if(typeof y==="number")this.setStatus("reconnecting"),this.reconnectTimeout=setTimeout(()=>{this.reconnectTimeout=null,B("Cluster is disconnected. Retrying after %dms",y),this.connect().catch(function(w){B("Got error %s when reconnecting. Ignoring...",w)})},y);else this.setStatus("end"),this.flushQueue(Error("None of startup nodes is available"))}flushQueue(S){let y;while(y=this.offlineQueue.shift())y.command.reject(S)}executeOfflineCommands(){if(this.offlineQueue.length){B("send %d commands in offline queue",this.offlineQueue.length);let S=this.offlineQueue;this.resetOfflineQueue();let y;while(y=S.shift())this.sendCommand(y.command,y.stream,y.node)}}natMapper(S){let y=typeof S==="string"?S:`${S.host}:${S.port}`,w=null;if(this.options.natMap&&typeof this.options.natMap==="function")w=this.options.natMap(y);else if(this.options.natMap&&typeof this.options.natMap==="object")w=this.options.natMap[y];if(w)return B("NAT mapping %s -> %O",y,w),Object.assign({},w);return typeof S==="string"?(0,Z1.nodeKeyToRedisOptions)(S):S}getInfoFromNode(S,y){if(!S)return y(Error("Node is disconnected"));let w=S.duplicate({enableOfflineQueue:!0,enableReadyCheck:!1,retryStrategy:null,connectionName:(0,Z1.getConnectionName)("refresher",this.options.redisOptions&&this.options.redisOptions.connectionName)});w.on("error",R.noop),w.cluster("SLOTS",(0,R.timeout)((k,$)=>{if(w.disconnect(),k)return B("error encountered running CLUSTER.SLOTS: %s",k),y(k);if(this.status==="disconnecting"||this.status==="close"||this.status==="end"){B("ignore CLUSTER.SLOTS results (count: %d) since cluster status is %s",$.length,this.status),y();return}let Z=[];B("cluster slots result count: %d",$.length);for(let J=0;J<$.length;++J){let U=$[J],z=U[0],W=U[1],X=[];for(let Q=2;Q<U.length;Q++){if(!U[Q][0])continue;let V=this.natMapper({host:U[Q][0],port:U[Q][1]});V.readOnly=Q!==2,Z.push(V),X.push(V.host+":"+V.port)}B("cluster slots result [%d]: slots %d~%d served by %s",J,z,W,X);for(let Q=z;Q<=W;Q++)this.slots[Q]=X}this._groupsIds=Object.create(null);let Y=0;for(let J=0;J<16384;J++){let U=(this.slots[J]||[]).join(";");if(!U.length){this._groupsBySlot[J]=void 0;continue}if(!this._groupsIds[U])this._groupsIds[U]=++Y;this._groupsBySlot[J]=this._groupsIds[U]}this.connectionPool.reset(Z),y()},this.options.slotsRefreshTimeout))}invokeReadyDelayedCallbacks(S){for(let y of this._readyDelayedCallbacks)process.nextTick(y,S);this._readyDelayedCallbacks=[]}readyCheck(S){this.cluster("INFO",(y,w)=>{if(y)return S(y);if(typeof w!=="string")return S();let k,$=w.split(`\r
159
+ `);for(let Z=0;Z<$.length;++Z){let Y=$[Z].split(":");if(Y[0]==="cluster_state"){k=Y[1];break}}if(k==="fail")B("cluster state not ok (%s)",k),S(null,k);else S()})}resolveSrv(S){return new Promise((y,w)=>{this.options.resolveSrv(S,(k,$)=>{if(k)return w(k);let Z=this,Y=(0,Z1.groupSrvRecords)($),J=Object.keys(Y).sort((z,W)=>parseInt(z)-parseInt(W));function U(z){if(!J.length)return w(z);let W=J[0],X=Y[W],Q=(0,Z1.weightSrvRecords)(X);if(!X.records.length)J.shift();Z.dnsLookup(Q.name).then((V)=>y({host:V,port:Q.port}),U)}U()})})}dnsLookup(S){return new Promise((y,w)=>{this.options.dnsLookup(S,(k,$)=>{if(k)B("failed to resolve hostname %s to IP: %s",S,k.message),w(k);else B("resolved hostname %s to IP %s",S,$),y($)})})}async resolveStartupNodeHostnames(){if(!Array.isArray(this.startupNodes)||this.startupNodes.length===0)throw Error("`startupNodes` should contain at least one node.");let S=(0,Z1.normalizeNodeOptions)(this.startupNodes),y=(0,Z1.getUniqueHostnamesFromOptions)(S);if(y.length===0)return S;let w=await Promise.all(y.map((this.options.useSRVRecords?this.resolveSrv:this.dnsLookup).bind(this))),k=(0,R.zipMap)(y,w);return S.map(($)=>{let Z=k.get($.host);if(!Z)return $;if(this.options.useSRVRecords)return Object.assign({},$,Z);return Object.assign({},$,{host:Z})})}createScanStream(S,{key:y,options:w={}}){return new xk.default({objectMode:!0,key:y,redis:this,command:S,...w})}}(0,_k.default)(B1,u0.EventEmitter);(0,Ck.addTransactionSupport)(B1.prototype);d0.default=B1});var b1=q((i0)=>{Object.defineProperty(i0,"__esModule",{value:!0});var uk=F(),dk=(0,uk.Debug)("AbstractConnector");class c0{constructor(S){this.connecting=!1,this.disconnectTimeout=S}check(S){return!0}disconnect(){if(this.connecting=!1,this.stream){let S=this.stream,y=setTimeout(()=>{dk("stream %s:%s still open, destroying it",S.remoteAddress,S.remotePort),S.destroy()},this.disconnectTimeout);S.on("close",()=>clearTimeout(y)),S.end()}}}i0.default=c0});var o0=q((l0)=>{Object.defineProperty(l0,"__esModule",{value:!0});var ik=G("net"),mk=G("tls"),lk=F(),ok=b1();class m0 extends ok.default{constructor(S){super(S.disconnectTimeout);this.options=S}connect(S){let{options:y}=this;this.connecting=!0;let w;if("path"in y&&y.path)w={path:y.path};else{if(w={},"port"in y&&y.port!=null)w.port=y.port;if("host"in y&&y.host!=null)w.host=y.host;if("family"in y&&y.family!=null)w.family=y.family}if(y.tls)Object.assign(w,y.tls);return new Promise((k,$)=>{process.nextTick(()=>{if(!this.connecting){$(Error(lk.CONNECTION_CLOSED_ERROR_MSG));return}try{if(y.tls)this.stream=(0,mk.connect)(w);else this.stream=(0,ik.createConnection)(w)}catch(Z){$(Z);return}this.stream.once("error",(Z)=>{this.firstError=Z}),k(this.stream)})})}}l0.default=m0});var s0=q((n0)=>{Object.defineProperty(n0,"__esModule",{value:!0});function nk(S,y){return(S.host||"127.0.0.1")===(y.host||"127.0.0.1")&&(S.port||26379)===(y.port||26379)}class a0{constructor(S){this.cursor=0,this.sentinels=S.slice(0)}next(){let S=this.cursor>=this.sentinels.length;return{done:S,value:S?void 0:this.sentinels[this.cursor++]}}reset(S){if(S&&this.sentinels.length>1&&this.cursor!==1)this.sentinels.unshift(...this.sentinels.splice(this.cursor-1));this.cursor=0}add(S){for(let y=0;y<this.sentinels.length;y++)if(nk(S,this.sentinels[y]))return!1;return this.sentinels.push(S),!0}toString(){return`${JSON.stringify(this.sentinels)} @${this.cursor}`}}n0.default=a0});var ww=q((Sw)=>{Object.defineProperty(Sw,"__esModule",{value:!0});Sw.FailoverDetector=void 0;var rk=F(),IS=(0,rk.Debug)("FailoverDetector"),r0="+switch-master";class e0{constructor(S,y){this.isDisconnected=!1,this.connector=S,this.sentinels=y}cleanup(){this.isDisconnected=!0;for(let S of this.sentinels)S.client.disconnect()}async subscribe(){IS("Starting FailoverDetector");let S=[];for(let y of this.sentinels){let w=y.client.subscribe(r0).catch((k)=>{IS("Failed to subscribe to failover messages on sentinel %s:%s (%s)",y.address.host||"127.0.0.1",y.address.port||26739,k.message)});S.push(w),y.client.on("message",(k)=>{if(!this.isDisconnected&&k===r0)this.disconnect()})}await Promise.all(S)}disconnect(){this.isDisconnected=!0,IS("Failover detected, disconnecting"),this.connector.disconnect()}}Sw.FailoverDetector=e0});var g1=q((Yw)=>{Object.defineProperty(Yw,"__esModule",{value:!0});Yw.SentinelIterator=void 0;var ek=G("net"),M1=F(),S6=G("tls"),kw=s0();Yw.SentinelIterator=kw.default;var y6=b1(),w6=g(),k6=ww(),Y1=(0,M1.Debug)("SentinelConnector");class $w extends y6.default{constructor(S){super(S.disconnectTimeout);if(this.options=S,this.emitter=null,this.failoverDetector=null,!this.options.sentinels.length)throw Error("Requires at least one sentinel to connect to.");if(!this.options.name)throw Error("Requires the name of master.");this.sentinelIterator=new kw.default(this.options.sentinels)}check(S){let y=!S.role||this.options.role===S.role;if(!y)Y1("role invalid, expected %s, but got %s",this.options.role,S.role),this.sentinelIterator.next(),this.sentinelIterator.next(),this.sentinelIterator.reset(!0);return y}disconnect(){if(super.disconnect(),this.failoverDetector)this.failoverDetector.cleanup()}connect(S){this.connecting=!0,this.retryAttempts=0;let y,w=async()=>{let k=this.sentinelIterator.next();if(k.done){this.sentinelIterator.reset(!1);let J=typeof this.options.sentinelRetryStrategy==="function"?this.options.sentinelRetryStrategy(++this.retryAttempts):null,U=typeof J!=="number"?"All sentinels are unreachable and retry is disabled.":`All sentinels are unreachable. Retrying from scratch after ${J}ms.`;if(y)U+=` Last error: ${y.message}`;Y1(U);let z=Error(U);if(typeof J==="number")return S("error",z),await new Promise((W)=>setTimeout(W,J)),w();else throw z}let $=null,Z=null;try{$=await this.resolve(k.value)}catch(J){Z=J}if(!this.connecting)throw Error(M1.CONNECTION_CLOSED_ERROR_MSG);let Y=k.value.host+":"+k.value.port;if($){if(Y1("resolved: %s:%s from sentinel %s",$.host,$.port,Y),this.options.enableTLSForSentinelMode&&this.options.tls)Object.assign($,this.options.tls),this.stream=(0,S6.connect)($),this.stream.once("secureConnect",this.initFailoverDetector.bind(this));else this.stream=(0,ek.createConnection)($),this.stream.once("connect",this.initFailoverDetector.bind(this));return this.stream.once("error",(J)=>{this.firstError=J}),this.stream}else{let J=Z?"failed to connect to sentinel "+Y+" because "+Z.message:"connected to sentinel "+Y+" successfully, but got an invalid reply: "+$;if(Y1(J),S("sentinelError",Error(J)),Z)y=Z;return w()}};return w()}async updateSentinels(S){if(!this.options.updateSentinels)return;let y=await S.sentinel("sentinels",this.options.name);if(!Array.isArray(y))return;y.map(M1.packObject).forEach((w)=>{if((w.flags?w.flags.split(","):[]).indexOf("disconnected")===-1&&w.ip&&w.port){let $=this.sentinelNatResolve(Zw(w));if(this.sentinelIterator.add($))Y1("adding sentinel %s:%s",$.host,$.port)}}),Y1("Updated internal sentinels: %s",this.sentinelIterator)}async resolveMaster(S){let y=await S.sentinel("get-master-addr-by-name",this.options.name);return await this.updateSentinels(S),this.sentinelNatResolve(Array.isArray(y)?{host:y[0],port:Number(y[1])}:null)}async resolveSlave(S){let y=await S.sentinel("slaves",this.options.name);if(!Array.isArray(y))return null;let w=y.map(M1.packObject).filter((k)=>k.flags&&!k.flags.match(/(disconnected|s_down|o_down)/));return this.sentinelNatResolve($6(w,this.options.preferredSlaves))}sentinelNatResolve(S){if(!S||!this.options.natMap)return S;let y=`${S.host}:${S.port}`,w=S;if(typeof this.options.natMap==="function")w=this.options.natMap(y)||S;else if(typeof this.options.natMap==="object")w=this.options.natMap[y]||S;return w}connectToSentinel(S,y){return new w6.default({port:S.port||26379,host:S.host,username:this.options.sentinelUsername||null,password:this.options.sentinelPassword||null,family:S.family||("path"in this.options&&this.options.path?void 0:this.options.family),tls:this.options.sentinelTLS,retryStrategy:null,enableReadyCheck:!1,connectTimeout:this.options.connectTimeout,commandTimeout:this.options.sentinelCommandTimeout,...y})}async resolve(S){let y=this.connectToSentinel(S);y.on("error",Z6);try{if(this.options.role==="slave")return await this.resolveSlave(y);else return await this.resolveMaster(y)}finally{y.disconnect()}}async initFailoverDetector(){var S;if(!this.options.failoverDetector)return;this.sentinelIterator.reset(!0);let y=[];while(y.length<this.options.sentinelMaxConnections){let{done:w,value:k}=this.sentinelIterator.next();if(w)break;let $=this.connectToSentinel(k,{lazyConnect:!0,retryStrategy:this.options.sentinelReconnectStrategy});$.on("reconnecting",()=>{var Z;(Z=this.emitter)===null||Z===void 0||Z.emit("sentinelReconnecting")}),y.push({address:k,client:$})}if(this.sentinelIterator.reset(!1),this.failoverDetector)this.failoverDetector.cleanup();this.failoverDetector=new k6.FailoverDetector(this,y),await this.failoverDetector.subscribe(),(S=this.emitter)===null||S===void 0||S.emit("failoverSubscribed")}}Yw.default=$w;function $6(S,y){if(S.length===0)return null;let w;if(typeof y==="function")w=y(S);else if(y!==null&&typeof y==="object"){let k=Array.isArray(y)?y:[y];k.sort(($,Z)=>{if(!$.prio)$.prio=1;if(!Z.prio)Z.prio=1;if($.prio<Z.prio)return-1;if($.prio>Z.prio)return 1;return 0});for(let $=0;$<k.length;$++){for(let Z=0;Z<S.length;Z++){let Y=S[Z];if(Y.ip===k[$].ip){if(Y.port===k[$].port){w=Y;break}}}if(w)break}}if(!w)w=(0,M1.sample)(S);return Zw(w)}function Zw(S){return{host:S.ip,port:Number(S.port)}}function Z6(){}});var Xw=q((Uw)=>{Object.defineProperty(Uw,"__esModule",{value:!0});Uw.SentinelConnector=Uw.StandaloneConnector=void 0;var J6=o0();Uw.StandaloneConnector=J6.default;var U6=g1();Uw.SentinelConnector=U6.default});var Vw=q((Qw)=>{Object.defineProperty(Qw,"__esModule",{value:!0});var X6=i();class zw extends X6.AbortError{constructor(S){let y=`Reached the max retries per request limit (which is ${S}). Refer to "maxRetriesPerRequest" option for details.`;super(y);Error.captureStackTrace(this,this.constructor)}get name(){return this.constructor.name}}Qw.default=zw});var Hw=q((qw)=>{Object.defineProperty(qw,"__esModule",{value:!0});qw.MaxRetriesPerRequestError=void 0;var Q6=Vw();qw.MaxRetriesPerRequestError=Q6.default});var Lw=q((z$,Iw)=>{var TS=G("buffer").Buffer,V6=G("string_decoder").StringDecoder,LS=new V6,Bw=i(),q6=Bw.ReplyError,G6=Bw.ParserError,D=TS.allocUnsafe(32768),O=0,p1=null,F1=0,KS=0;function H6(S){let y=S.buffer.length-1;var w=S.offset,k=0,$=1;if(S.buffer[w]===45)$=-1,w++;while(w<y){let Z=S.buffer[w++];if(Z===13)return S.offset=w+1,$*k;k=k*10+(Z-48)}}function B6(S){let y=S.buffer.length-1;var w=S.offset,k=0,$="";if(S.buffer[w]===45)$+="-",w++;while(w<y){var Z=S.buffer[w++];if(Z===13){if(S.offset=w+1,k!==0)$+=k;return $}else if(k>429496728)$+=k*10+(Z-48),k=0;else if(Z===48&&k===0)$+=0;else k=k*10+(Z-48)}}function Mw(S){let{offset:y,buffer:w}=S,k=w.length-1;var $=y;while($<k)if(w[$++]===13){if(S.offset=$+1,S.optionReturnBuffers===!0)return S.buffer.slice(y,$-1);return S.buffer.toString("utf8",y,$-1)}}function Fw(S){let y=S.buffer.length-1;var w=S.offset,k=0;while(w<y){let $=S.buffer[w++];if($===13)return S.offset=w+1,k;k=k*10+($-48)}}function M6(S){if(S.optionStringNumbers===!0)return B6(S);return H6(S)}function F6(S){let y=Fw(S);if(y===void 0)return;if(y<0)return null;let w=S.offset+y;if(w+2>S.buffer.length){S.bigStrSize=w+2,S.totalChunkSize=S.buffer.length,S.bufferCache.push(S.buffer);return}let k=S.offset;if(S.offset=w+2,S.optionReturnBuffers===!0)return S.buffer.slice(k,w);return S.buffer.toString("utf8",k,w)}function E6(S){var y=Mw(S);if(y!==void 0){if(S.optionReturnBuffers===!0)y=y.toString();return new q6(y)}}function O6(S,y){let w=new G6("Protocol error, got "+JSON.stringify(String.fromCharCode(y))+" as reply type byte",JSON.stringify(S.buffer),S.offset);S.buffer=null,S.returnFatalError(w)}function P6(S){let y=Fw(S);if(y===void 0)return;if(y<0)return null;let w=Array(y);return Ew(S,w,0)}function RS(S,y,w){S.arrayCache.push(y),S.arrayPos.push(w)}function AS(S){let y=S.arrayCache.pop();var w=S.arrayPos.pop();if(S.arrayCache.length){let k=AS(S);if(k===void 0){RS(S,y,w);return}y[w++]=k}return Ew(S,y,w)}function Ew(S,y,w){let k=S.buffer.length;while(w<y.length){let $=S.offset;if(S.offset>=k){RS(S,y,w);return}let Z=Ow(S,S.buffer[S.offset++]);if(Z===void 0){if(!(S.arrayCache.length||S.bufferCache.length))S.offset=$;RS(S,y,w);return}y[w]=Z,w++}return y}function Ow(S,y){switch(y){case 36:return F6(S);case 43:return Mw(S);case 42:return P6(S);case 58:return M6(S);case 45:return E6(S);default:return O6(S,y)}}function I6(){if(D.length>51200)if(F1===1||KS>F1*2){let S=Math.floor(D.length/10),y=S<O?O:S;O=0,D=D.slice(y,D.length)}else KS++,F1--;else clearInterval(p1),F1=0,KS=0,p1=null}function L6(S){if(D.length<S+O){let y=S>78643200?2:3;if(O>116391936)O=52428800;if(D=TS.allocUnsafe(S*y+O),O=0,F1++,p1===null)p1=setInterval(I6,50)}}function K6(S){let{bufferCache:y,offset:w}=S;var k=y.length,$=S.bigStrSize-S.totalChunkSize;if(S.offset=$,$<=2){if(k===2)return y[0].toString("utf8",w,y[0].length+$-2);k--,$=y[y.length-2].length+$}var Z=LS.write(y[0].slice(w));for(var Y=1;Y<k-1;Y++)Z+=LS.write(y[Y]);return Z+=LS.end(y[Y].slice(0,$-2)),Z}function R6(S){let{bufferCache:y,offset:w}=S,k=S.bigStrSize-w-2;var $=y.length,Z=S.bigStrSize-S.totalChunkSize;if(S.offset=Z,Z<=2){if($===2)return y[0].slice(w,y[0].length+Z-2);$--,Z=y[y.length-2].length+Z}L6(k);let Y=O;y[0].copy(D,Y,w,y[0].length),O+=y[0].length-w;for(var J=1;J<$-1;J++)y[J].copy(D,O),O+=y[J].length;return y[J].copy(D,O,0,Z-2),O+=Z-2,D.slice(Y,O)}class Pw{constructor(S){if(!S)throw TypeError("Options are mandatory.");if(typeof S.returnError!=="function"||typeof S.returnReply!=="function")throw TypeError("The returnReply and returnError options have to be functions.");this.setReturnBuffers(!!S.returnBuffers),this.setStringNumbers(!!S.stringNumbers),this.returnError=S.returnError,this.returnFatalError=S.returnFatalError||S.returnError,this.returnReply=S.returnReply,this.reset()}reset(){this.offset=0,this.buffer=null,this.bigStrSize=0,this.totalChunkSize=0,this.bufferCache=[],this.arrayCache=[],this.arrayPos=[]}setReturnBuffers(S){if(typeof S!=="boolean")throw TypeError("The returnBuffers argument has to be a boolean");this.optionReturnBuffers=S}setStringNumbers(S){if(typeof S!=="boolean")throw TypeError("The stringNumbers argument has to be a boolean");this.optionStringNumbers=S}execute(S){if(this.buffer===null)this.buffer=S,this.offset=0;else if(this.bigStrSize===0){let w=this.buffer.length,k=w-this.offset,$=TS.allocUnsafe(k+S.length);if(this.buffer.copy($,0,this.offset,w),S.copy($,k,0,S.length),this.buffer=$,this.offset=0,this.arrayCache.length){let Z=AS(this);if(Z===void 0)return;this.returnReply(Z)}}else if(this.totalChunkSize+S.length>=this.bigStrSize){this.bufferCache.push(S);var y=this.optionReturnBuffers?R6(this):K6(this);if(this.bigStrSize=0,this.bufferCache=[],this.buffer=S,this.arrayCache.length){if(this.arrayCache[0][this.arrayPos[0]++]=y,y=AS(this),y===void 0)return}this.returnReply(y)}else{this.bufferCache.push(S),this.totalChunkSize+=S.length;return}while(this.offset<this.buffer.length){let w=this.offset,k=this.buffer[this.offset++],$=Ow(this,k);if($===void 0){if(!(this.arrayCache.length||this.bufferCache.length))this.offset=w;return}if(k===45)this.returnError($);else this.returnReply($)}this.buffer=null}}Iw.exports=Pw});var Aw=q((Rw)=>{Object.defineProperty(Rw,"__esModule",{value:!0});class Kw{constructor(){this.set={subscribe:{},psubscribe:{},ssubscribe:{}}}add(S,y){this.set[DS(S)][y]=!0}del(S,y){delete this.set[DS(S)][y]}channels(S){return Object.keys(this.set[DS(S)])}isEmpty(){return this.channels("subscribe").length===0&&this.channels("psubscribe").length===0&&this.channels("ssubscribe").length===0}}Rw.default=Kw;function DS(S){if(S==="unsubscribe")return"subscribe";if(S==="punsubscribe")return"psubscribe";if(S==="sunsubscribe")return"ssubscribe";return S}});var Cw=q((xw)=>{Object.defineProperty(xw,"__esModule",{value:!0});var Tw=C(),T6=F(),D6=Lw(),j6=Aw(),N6=(0,T6.Debug)("dataHandler");class Nw{constructor(S,y){this.redis=S;let w=new D6({stringNumbers:y.stringNumbers,returnBuffers:!0,returnError:(k)=>{this.returnError(k)},returnFatalError:(k)=>{this.returnFatalError(k)},returnReply:(k)=>{this.returnReply(k)}});S.stream.prependListener("data",(k)=>{w.execute(k)}),S.stream.resume()}returnFatalError(S){S.message+=". Please report this.",this.redis.recoverFromFatalError(S,S,{offlineQueue:!1})}returnError(S){let y=this.shiftCommand(S);if(!y)return;if(S.command={name:y.command.name,args:y.command.args},y.command.name=="ssubscribe"&&S.message.includes("MOVED")){this.redis.emit("moved");return}this.redis.handleReconnection(S,y)}returnReply(S){if(this.handleMonitorReply(S))return;if(this.handleSubscriberReply(S))return;let y=this.shiftCommand(S);if(!y)return;if(Tw.default.checkFlag("ENTER_SUBSCRIBER_MODE",y.command.name)){if(this.redis.condition.subscriber=new j6.default,this.redis.condition.subscriber.add(y.command.name,S[1].toString()),!Dw(y.command,S[2]))this.redis.commandQueue.unshift(y)}else if(Tw.default.checkFlag("EXIT_SUBSCRIBER_MODE",y.command.name)){if(!jw(y.command,S[2]))this.redis.commandQueue.unshift(y)}else y.command.resolve(S)}handleSubscriberReply(S){if(!this.redis.condition.subscriber)return!1;let y=Array.isArray(S)?S[0].toString():null;switch(N6('receive reply "%s" in subscriber mode',y),y){case"message":if(this.redis.listeners("message").length>0)this.redis.emit("message",S[1].toString(),S[2]?S[2].toString():"");this.redis.emit("messageBuffer",S[1],S[2]);break;case"pmessage":{let w=S[1].toString();if(this.redis.listeners("pmessage").length>0)this.redis.emit("pmessage",w,S[2].toString(),S[3].toString());this.redis.emit("pmessageBuffer",w,S[2],S[3]);break}case"smessage":{if(this.redis.listeners("smessage").length>0)this.redis.emit("smessage",S[1].toString(),S[2]?S[2].toString():"");this.redis.emit("smessageBuffer",S[1],S[2]);break}case"ssubscribe":case"subscribe":case"psubscribe":{let w=S[1].toString();this.redis.condition.subscriber.add(y,w);let k=this.shiftCommand(S);if(!k)return;if(!Dw(k.command,S[2]))this.redis.commandQueue.unshift(k);break}case"sunsubscribe":case"unsubscribe":case"punsubscribe":{let w=S[1]?S[1].toString():null;if(w)this.redis.condition.subscriber.del(y,w);let k=S[2];if(Number(k)===0)this.redis.condition.subscriber=!1;let $=this.shiftCommand(S);if(!$)return;if(!jw($.command,k))this.redis.commandQueue.unshift($);break}default:{let w=this.shiftCommand(S);if(!w)return;w.command.resolve(S)}}return!0}handleMonitorReply(S){if(this.redis.status!=="monitoring")return!1;let y=S.toString();if(y==="OK")return!1;let w=y.indexOf(" "),k=y.slice(0,w),$=y.indexOf('"'),Z=y.slice($+1,-1).split('" "').map((J)=>J.replace(/\\"/g,'"')),Y=y.slice(w+2,$-2).split(" ");return this.redis.emit("monitor",k,Z,Y[1],Y[0]),!0}shiftCommand(S){let y=this.redis.commandQueue.shift();if(!y){let k=Error("Command queue state error. If you can reproduce this, please report it."+(S instanceof Error?` Last error: ${S.message}`:` Last reply: ${S.toString()}`));return this.redis.emit("error",k),null}return y}}xw.default=Nw;var p=new WeakMap;function Dw(S,y){let w=p.has(S)?p.get(S):S.args.length;if(w-=1,w<=0)return S.resolve(y),p.delete(S),!0;return p.set(S,w),!1}function jw(S,y){let w=p.has(S)?p.get(S):S.args.length;if(w===0){if(Number(y)===0)return p.delete(S),S.resolve(y),!0;return!1}if(w-=1,w<=0)return S.resolve(y),!0;return p.set(S,w),!1}});var fw=q((_w)=>{Object.defineProperty(_w,"__esModule",{value:!0});_w.readyHandler=_w.errorHandler=_w.closeHandler=_w.connectHandler=void 0;var C6=i(),_6=C(),f6=Hw(),_=F(),h6=Cw(),E=(0,_.Debug)("connection");function v6(S){return function(){S.setStatus("connect"),S.resetCommandQueue();let y=!1,{connectionEpoch:w}=S;if(S.condition.auth)S.auth(S.condition.auth,function(k){if(w!==S.connectionEpoch)return;if(k)if(k.message.indexOf("no password is set")!==-1)console.warn("[WARN] Redis server does not require a password, but a password was supplied.");else if(k.message.indexOf("without any password configured for the default user")!==-1)console.warn("[WARN] This Redis server's `default` user does not require a password, but a password was supplied");else if(k.message.indexOf("wrong number of arguments for 'auth' command")!==-1)console.warn(`[ERROR] The server returned "wrong number of arguments for 'auth' command". You are probably passing both username and password to Redis version 5 or below. You should only pass the 'password' option for Redis version 5 and under.`);else y=!0,S.recoverFromFatalError(k,k)});if(S.condition.select)S.select(S.condition.select).catch((k)=>{S.silentEmit("error",k)});if(!S.options.enableReadyCheck)_w.readyHandler(S)();if(new h6.default(S,{stringNumbers:S.options.stringNumbers}),S.options.enableReadyCheck)S._readyCheck(function(k,$){if(w!==S.connectionEpoch)return;if(k){if(!y)S.recoverFromFatalError(Error("Ready check failed: "+k.message),k)}else if(S.connector.check($))_w.readyHandler(S)();else S.disconnect(!0)})}}_w.connectHandler=v6;function jS(S){let y=new C6.AbortError("Command aborted due to connection close");return y.command={name:S.name,args:S.args},y}function b6(S){var y;let w=0;for(let k=0;k<S.length;){let $=(y=S.peekAt(k))===null||y===void 0?void 0:y.command,Z=$.pipelineIndex;if(Z===void 0||Z===0)w=0;if(Z!==void 0&&Z!==w++){S.remove(k,1),$.reject(jS($));continue}k++}}function g6(S){var y;for(let w=0;w<S.length;){let k=(y=S.peekAt(w))===null||y===void 0?void 0:y.command;if(k.name==="multi")break;if(k.name==="exec"){S.remove(w,1),k.reject(jS(k));break}if(k.inTransaction)S.remove(w,1),k.reject(jS(k));else w++}}function p6(S){return function(){let w=S.status;if(S.setStatus("close"),S.commandQueue.length)b6(S.commandQueue);if(S.offlineQueue.length)g6(S.offlineQueue);if(w==="ready"){if(!S.prevCondition)S.prevCondition=S.condition;if(S.commandQueue.length)S.prevCommandQueue=S.commandQueue}if(S.manuallyClosing)return S.manuallyClosing=!1,E("skip reconnecting since the connection is manually closed."),y();if(typeof S.options.retryStrategy!=="function")return E("skip reconnecting because `retryStrategy` is not a function"),y();let k=S.options.retryStrategy(++S.retryAttempts);if(typeof k!=="number")return E("skip reconnecting because `retryStrategy` doesn't return a number"),y();E("reconnect in %sms",k),S.setStatus("reconnecting",k),S.reconnectTimeout=setTimeout(function(){S.reconnectTimeout=null,S.connect().catch(_.noop)},k);let{maxRetriesPerRequest:$}=S.options;if(typeof $==="number"){if($<0)E("maxRetriesPerRequest is negative, ignoring...");else if(S.retryAttempts%($+1)===0)E("reach maxRetriesPerRequest limitation, flushing command queue..."),S.flushQueue(new f6.MaxRetriesPerRequestError($))}};function y(){S.setStatus("end"),S.flushQueue(Error(_.CONNECTION_CLOSED_ERROR_MSG))}}_w.closeHandler=p6;function t6(S){return function(y){E("error: %s",y),S.silentEmit("error",y)}}_w.errorHandler=t6;function u6(S){return function(){var y,w;if(S.setStatus("ready"),S.retryAttempts=0,S.options.monitor){S.call("monitor").then(()=>S.setStatus("monitoring"),(Z)=>S.emit("error",Z));let{sendCommand:$}=S;S.sendCommand=function(Z){if(_6.default.checkFlag("VALID_IN_MONITOR_MODE",Z.name))return $.call(S,Z);return Z.reject(Error("Connection is in monitoring mode, can't process commands.")),Z.promise},S.once("close",function(){delete S.sendCommand});return}let k=S.prevCondition?S.prevCondition.select:S.condition.select;if(S.options.connectionName)E("set the connection name [%s]",S.options.connectionName),S.client("setname",S.options.connectionName).catch(_.noop);if(!((y=S.options)===null||y===void 0?void 0:y.disableClientInfo)){E("set the client info");let $=null;(0,_.getPackageMeta)().then((Z)=>{$=Z===null||Z===void 0?void 0:Z.version}).catch(_.noop).finally(()=>{S.client("SETINFO","LIB-VER",$).catch(_.noop)}),S.client("SETINFO","LIB-NAME",((w=S.options)===null||w===void 0?void 0:w.clientInfoTag)?`ioredis(${S.options.clientInfoTag})`:"ioredis").catch(_.noop)}if(S.options.readOnly)E("set the connection to readonly mode"),S.readonly().catch(_.noop);if(S.prevCondition){let $=S.prevCondition;if(S.prevCondition=null,$.subscriber&&S.options.autoResubscribe){if(S.condition.select!==k)E("connect to db [%d]",k),S.select(k);let Z=$.subscriber.channels("subscribe");if(Z.length)E("subscribe %d channels",Z.length),S.subscribe(Z);let Y=$.subscriber.channels("psubscribe");if(Y.length)E("psubscribe %d channels",Y.length),S.psubscribe(Y);let J=$.subscriber.channels("ssubscribe");if(J.length){E("ssubscribe %s",J.length);for(let U of J)S.ssubscribe(U)}}}if(S.prevCommandQueue)if(S.options.autoResendUnfulfilledCommands){E("resend %d unfulfilled commands",S.prevCommandQueue.length);while(S.prevCommandQueue.length>0){let $=S.prevCommandQueue.shift();if($.select!==S.condition.select&&$.command.name!=="select")S.select($.select);S.sendCommand($.command,$.stream)}}else S.prevCommandQueue=null;if(S.offlineQueue.length){E("send %d commands in offline queue",S.offlineQueue.length);let $=S.offlineQueue;S.resetOfflineQueue();while($.length>0){let Z=$.shift();if(Z.select!==S.condition.select&&Z.command.name!=="select")S.select(Z.select);S.sendCommand(Z.command,Z.stream)}}if(S.condition.select!==k)E("connect to db [%d]",k),S.select(k)}}_w.readyHandler=u6});var bw=q((hw)=>{Object.defineProperty(hw,"__esModule",{value:!0});hw.DEFAULT_REDIS_OPTIONS=void 0;hw.DEFAULT_REDIS_OPTIONS={port:6379,host:"localhost",family:4,connectTimeout:1e4,disconnectTimeout:2000,retryStrategy:function(S){return Math.min(S*50,2000)},keepAlive:0,noDelay:!0,connectionName:null,disableClientInfo:!1,clientInfoTag:void 0,sentinels:null,name:null,role:"master",sentinelRetryStrategy:function(S){return Math.min(S*10,1000)},sentinelReconnectStrategy:function(){return 60000},natMap:null,enableTLSForSentinelMode:!1,updateSentinels:!0,failoverDetector:!1,username:null,password:null,db:0,enableOfflineQueue:!0,enableReadyCheck:!0,autoResubscribe:!0,autoResendUnfulfilledCommands:!0,lazyConnect:!1,keyPrefix:"",reconnectOnError:null,readOnly:!1,stringNumbers:!1,maxRetriesPerRequest:20,maxLoadingRetryTime:1e4,enableAutoPipelining:!1,autoPipeliningIgnoredCommands:[],sentinelMaxConnections:10}});var g=q((uw)=>{Object.defineProperty(uw,"__esModule",{value:!0});var gw=r(),tw=G("events"),NS=f(),m6=PS(),xS=C(),l6=Xw(),o6=g1(),t=fw(),a6=bw(),n6=N1(),s6=GS(),n=F(),r6=HS(),e6=_1(),u=K1(),pw=h1(),d=(0,n.Debug)("redis");class x extends e6.default{constructor(S,y,w){super();if(this.status="wait",this.isCluster=!1,this.reconnectTimeout=null,this.connectionEpoch=0,this.retryAttempts=0,this.manuallyClosing=!1,this._autoPipelines=new Map,this._runningAutoPipelines=new Set,this.parseOptions(S,y,w),tw.EventEmitter.call(this),this.resetCommandQueue(),this.resetOfflineQueue(),this.options.Connector)this.connector=new this.options.Connector(this.options);else if(this.options.sentinels){let k=new o6.default(this.options);k.emitter=this,this.connector=k}else this.connector=new l6.StandaloneConnector(this.options);if(this.options.scripts)Object.entries(this.options.scripts).forEach(([k,$])=>{this.defineCommand(k,$)});if(this.options.lazyConnect)this.setStatus("wait");else this.connect().catch(u.noop)}static createClient(...S){return new x(...S)}get autoPipelineQueueSize(){let S=0;for(let y of this._autoPipelines.values())S+=y.length;return S}connect(S){let y=new Promise((w,k)=>{if(this.status==="connecting"||this.status==="connect"||this.status==="ready"){k(Error("Redis is already connecting/connected"));return}this.connectionEpoch+=1,this.setStatus("connecting");let{options:$}=this;this.condition={select:$.db,auth:$.username?[$.username,$.password]:$.password,subscriber:!1};let Z=this;(0,NS.default)(this.connector.connect(function(Y,J){Z.silentEmit(Y,J)}),function(Y,J){if(Y){Z.flushQueue(Y),Z.silentEmit("error",Y),k(Y),Z.setStatus("end");return}let U=$.tls?"secureConnect":"connect";if("sentinels"in $&&$.sentinels&&!$.enableTLSForSentinelMode)U="connect";if(Z.stream=J,$.noDelay)J.setNoDelay(!0);if(typeof $.keepAlive==="number")if(J.connecting)J.once(U,()=>{J.setKeepAlive(!0,$.keepAlive)});else J.setKeepAlive(!0,$.keepAlive);if(J.connecting){if(J.once(U,t.connectHandler(Z)),$.connectTimeout){let X=!1;J.setTimeout($.connectTimeout,function(){if(X)return;J.setTimeout(0),J.destroy();let Q=Error("connect ETIMEDOUT");Q.errorno="ETIMEDOUT",Q.code="ETIMEDOUT",Q.syscall="connect",t.errorHandler(Z)(Q)}),J.once(U,function(){X=!0,J.setTimeout(0)})}}else if(J.destroyed){let X=Z.connector.firstError;if(X)process.nextTick(()=>{t.errorHandler(Z)(X)});process.nextTick(t.closeHandler(Z))}else process.nextTick(t.connectHandler(Z));if(!J.destroyed)J.once("error",t.errorHandler(Z)),J.once("close",t.closeHandler(Z));let z=function(){Z.removeListener("close",W),w()};var W=function(){Z.removeListener("ready",z),k(Error(n.CONNECTION_CLOSED_ERROR_MSG))};Z.once("ready",z),Z.once("close",W)})});return(0,NS.default)(y,S)}disconnect(S=!1){if(!S)this.manuallyClosing=!0;if(this.reconnectTimeout&&!S)clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null;if(this.status==="wait")t.closeHandler(this)();else this.connector.disconnect()}end(){this.disconnect()}duplicate(S){return new x({...this.options,...S})}get mode(){var S;return this.options.monitor?"monitor":((S=this.condition)===null||S===void 0?void 0:S.subscriber)?"subscriber":"normal"}monitor(S){let y=this.duplicate({monitor:!0,lazyConnect:!1});return(0,NS.default)(new Promise(function(w,k){y.once("error",k),y.once("monitoring",function(){w(y)})}),S)}sendCommand(S,y){var w,k;if(this.status==="wait")this.connect().catch(u.noop);if(this.status==="end")return S.reject(Error(n.CONNECTION_CLOSED_ERROR_MSG)),S.promise;if(((w=this.condition)===null||w===void 0?void 0:w.subscriber)&&!xS.default.checkFlag("VALID_IN_SUBSCRIBER_MODE",S.name))return S.reject(Error("Connection in subscriber mode, only subscriber commands may be used")),S.promise;if(typeof this.options.commandTimeout==="number")S.setTimeout(this.options.commandTimeout);let $=this.status==="ready"||!y&&this.status==="connect"&&(0,gw.exists)(S.name)&&(0,gw.hasFlag)(S.name,"loading");if(!this.stream)$=!1;else if(!this.stream.writable)$=!1;else if(this.stream._writableState&&this.stream._writableState.ended)$=!1;if(!$){if(!this.options.enableOfflineQueue)return S.reject(Error("Stream isn't writeable and enableOfflineQueue options is false")),S.promise;if(S.name==="quit"&&this.offlineQueue.length===0)return this.disconnect(),S.resolve(Buffer.from("OK")),S.promise;if(d.enabled)d("queue command[%s]: %d -> %s(%o)",this._getDescription(),this.condition.select,S.name,S.args);this.offlineQueue.push({command:S,stream:y,select:this.condition.select})}else{if(d.enabled)d("write command[%s]: %d -> %s(%o)",this._getDescription(),(k=this.condition)===null||k===void 0?void 0:k.select,S.name,S.args);if(y)if("isPipeline"in y&&y.isPipeline)y.write(S.toWritable(y.destination.redis.stream));else y.write(S.toWritable(y));else this.stream.write(S.toWritable(this.stream));if(this.commandQueue.push({command:S,stream:y,select:this.condition.select}),xS.default.checkFlag("WILL_DISCONNECT",S.name))this.manuallyClosing=!0;if(this.options.socketTimeout!==void 0&&this.socketTimeoutTimer===void 0)this.setSocketTimeout()}if(S.name==="select"&&(0,n.isInt)(S.args[0])){let Z=parseInt(S.args[0],10);if(this.condition.select!==Z)this.condition.select=Z,this.emit("select",Z),d("switch to db [%d]",this.condition.select)}return S.promise}setSocketTimeout(){this.socketTimeoutTimer=setTimeout(()=>{this.stream.destroy(Error(`Socket timeout. Expecting data, but didn't receive any in ${this.options.socketTimeout}ms.`)),this.socketTimeoutTimer=void 0},this.options.socketTimeout),this.stream.once("data",()=>{if(clearTimeout(this.socketTimeoutTimer),this.socketTimeoutTimer=void 0,this.commandQueue.length===0)return;this.setSocketTimeout()})}scanStream(S){return this.createScanStream("scan",{options:S})}scanBufferStream(S){return this.createScanStream("scanBuffer",{options:S})}sscanStream(S,y){return this.createScanStream("sscan",{key:S,options:y})}sscanBufferStream(S,y){return this.createScanStream("sscanBuffer",{key:S,options:y})}hscanStream(S,y){return this.createScanStream("hscan",{key:S,options:y})}hscanBufferStream(S,y){return this.createScanStream("hscanBuffer",{key:S,options:y})}zscanStream(S,y){return this.createScanStream("zscan",{key:S,options:y})}zscanBufferStream(S,y){return this.createScanStream("zscanBuffer",{key:S,options:y})}silentEmit(S,y){let w;if(S==="error"){if(w=y,this.status==="end")return;if(this.manuallyClosing){if(w instanceof Error&&(w.message===n.CONNECTION_CLOSED_ERROR_MSG||w.syscall==="connect"||w.syscall==="read"))return}}if(this.listeners(S).length>0)return this.emit.apply(this,arguments);if(w&&w instanceof Error)console.error("[ioredis] Unhandled error event:",w.stack);return!1}recoverFromFatalError(S,y,w){this.flushQueue(y,w),this.silentEmit("error",y),this.disconnect(!0)}handleReconnection(S,y){var w;let k=!1;if(this.options.reconnectOnError)k=this.options.reconnectOnError(S);switch(k){case 1:case!0:if(this.status!=="reconnecting")this.disconnect(!0);y.command.reject(S);break;case 2:if(this.status!=="reconnecting")this.disconnect(!0);if(((w=this.condition)===null||w===void 0?void 0:w.select)!==y.select&&y.command.name!=="select")this.select(y.select);this.sendCommand(y.command);break;default:y.command.reject(S)}}_getDescription(){let S;if("path"in this.options&&this.options.path)S=this.options.path;else if(this.stream&&this.stream.remoteAddress&&this.stream.remotePort)S=this.stream.remoteAddress+":"+this.stream.remotePort;else if("host"in this.options&&this.options.host)S=this.options.host+":"+this.options.port;else S="";if(this.options.connectionName)S+=` (${this.options.connectionName})`;return S}resetCommandQueue(){this.commandQueue=new pw}resetOfflineQueue(){this.offlineQueue=new pw}parseOptions(...S){let y={},w=!1;for(let k=0;k<S.length;++k){let $=S[k];if($===null||typeof $>"u")continue;if(typeof $==="object")(0,u.defaults)(y,$);else if(typeof $==="string"){if((0,u.defaults)(y,(0,n.parseURL)($)),$.startsWith("rediss://"))w=!0}else if(typeof $==="number")y.port=$;else throw Error("Invalid argument "+$)}if(w)(0,u.defaults)(y,{tls:!0});if((0,u.defaults)(y,x.defaultOptions),typeof y.port==="string")y.port=parseInt(y.port,10);if(typeof y.db==="string")y.db=parseInt(y.db,10);this.options=(0,n.resolveTLSProfile)(y)}setStatus(S,y){if(d.enabled)d("status[%s]: %s -> %s",this._getDescription(),this.status||"[empty]",S);this.status=S,process.nextTick(this.emit.bind(this,S,y))}createScanStream(S,{key:y,options:w={}}){return new n6.default({objectMode:!0,key:y,redis:this,command:S,...w})}flushQueue(S,y){y=(0,u.defaults)({},y,{offlineQueue:!0,commandQueue:!0});let w;if(y.offlineQueue)while(w=this.offlineQueue.shift())w.command.reject(S);if(y.commandQueue){if(this.commandQueue.length>0){if(this.stream)this.stream.removeAllListeners("data");while(w=this.commandQueue.shift())w.command.reject(S)}}}_readyCheck(S){let y=this;this.info(function(w,k){if(w){if(w.message&&w.message.includes("NOPERM"))return console.warn(`Skipping the ready check because INFO command fails: "${w.message}". You can disable ready check with "enableReadyCheck". More: https://github.com/luin/ioredis/wiki/Disable-ready-check.`),S(null,{});return S(w)}if(typeof k!=="string")return S(null,k);let $={},Z=k.split(`\r
160
+ `);for(let Y=0;Y<Z.length;++Y){let[J,...U]=Z[Y].split(":"),z=U.join(":");if(z)$[J]=z}if(!$.loading||$.loading==="0")S(null,$);else{let Y=($.loading_eta_seconds||1)*1000,J=y.options.maxLoadingRetryTime&&y.options.maxLoadingRetryTime<Y?y.options.maxLoadingRetryTime:Y;d("Redis server still loading, trying again in "+J+"ms"),setTimeout(function(){y._readyCheck(S)},J)}}).catch(u.noop)}}x.Cluster=m6.default;x.Command=xS.default;x.defaultOptions=a6.DEFAULT_REDIS_OPTIONS;(0,r6.default)(x,tw.EventEmitter);(0,s6.addTransactionSupport)(x.prototype);uw.default=x});var iw=q((P,cw)=>{Object.defineProperty(P,"__esModule",{value:!0});P.print=P.ReplyError=P.SentinelIterator=P.SentinelConnector=P.AbstractConnector=P.Pipeline=P.ScanStream=P.Command=P.Cluster=P.Redis=P.default=void 0;P=cw.exports=g().default;var y7=g();Object.defineProperty(P,"default",{enumerable:!0,get:function(){return y7.default}});var w7=g();Object.defineProperty(P,"Redis",{enumerable:!0,get:function(){return w7.default}});var k7=PS();Object.defineProperty(P,"Cluster",{enumerable:!0,get:function(){return k7.default}});var $7=C();Object.defineProperty(P,"Command",{enumerable:!0,get:function(){return $7.default}});var Z7=N1();Object.defineProperty(P,"ScanStream",{enumerable:!0,get:function(){return Z7.default}});var Y7=QS();Object.defineProperty(P,"Pipeline",{enumerable:!0,get:function(){return Y7.default}});var J7=b1();Object.defineProperty(P,"AbstractConnector",{enumerable:!0,get:function(){return J7.default}});var dw=g1();Object.defineProperty(P,"SentinelConnector",{enumerable:!0,get:function(){return dw.default}});Object.defineProperty(P,"SentinelIterator",{enumerable:!0,get:function(){return dw.SentinelIterator}});P.ReplyError=i().ReplyError;Object.defineProperty(P,"Promise",{get(){return console.warn("ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used."),Promise},set(S){console.warn("ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used.")}});function U7(S,y){if(S)console.log("Error: "+S);else console.log("Reply: "+y)}P.print=U7});var y3;((k)=>{k.Postgres="postgres";k.MySQL="mysql";k.SQLite="sqlite"})(y3||={});var d1;(($)=>{$[$.Debug=0]="Debug";$[$.Info=1]="Info";$[$.Warn=2]="Warn";$[$.Error=3]="Error"})(d1||={});var w3;(($)=>{$[$.OneToOne=0]="OneToOne";$[$.OneToMany=1]="OneToMany";$[$.ManyToOne=2]="ManyToOne";$[$.ManyToMany=3]="ManyToMany"})(w3||={});var k3;((V)=>{V[V.STRING=0]="STRING";V[V.TEXT=1]="TEXT";V[V.INTEGER=2]="INTEGER";V[V.BIGINT=3]="BIGINT";V[V.FLOAT=4]="FLOAT";V[V.DOUBLE=5]="DOUBLE";V[V.DECIMAL=6]="DECIMAL";V[V.BOOLEAN=7]="BOOLEAN";V[V.DATE=8]="DATE";V[V.DATETIME=9]="DATETIME";V[V.JSON=10]="JSON";V[V.UUID=11]="UUID";V[V.BLOB=12]="BLOB"})(k3||={});class P1 extends Error{code;originalError;constructor(S,y,w){super(S);this.code=y;this.originalError=w;this.name="StabilizeError"}}function V7(S){return{sql:S}}class $3{listeners=new Map;on(S,y){if(!this.listeners.has(S))this.listeners.set(S,[]);this.listeners.get(S).push(y)}off(S,y){let w=this.listeners.get(S);if(w){let k=w.indexOf(y);if(k!==-1)w.splice(k,1)}}emit(S,...y){let w=this.listeners.get(S);if(w)for(let k of w)try{k(...y)}catch{}}}function q7(){return crypto.randomUUID()}import*as j from"fs/promises";class c1{level;filePath;maxFileSize;maxFiles;constructor(S={}){this.level=S.level??1,this.filePath=S.filePath||null,this.maxFileSize=S.maxFileSize||1048576,this.maxFiles=S.maxFiles||3}shouldLog(S){return S<=this.level}async rotateLogFile(){if(!this.filePath)return;try{let S=await j.stat(this.filePath).catch(()=>null);if(!S||S.size<this.maxFileSize)return;let y=`${this.filePath}.${this.maxFiles}`;await j.unlink(y).catch(()=>{});for(let w=this.maxFiles-1;w>=1;w--){let k=`${this.filePath}.${w}`,$=`${this.filePath}.${w+1}`;if(await j.stat(k).catch(()=>null))await j.rename(k,$)}await j.rename(this.filePath,`${this.filePath}.1`)}catch(S){let y=new P1("Log rotation failed","LOG_ROTATION_ERROR",S);console.error(`[LOGGER_ERROR] ${y.message}
161
+ ${y.stack}`)}}async log(S,y){if(!this.shouldLog(S))return;let k=`[${d1[S].toUpperCase()}] ${new Date().toISOString()} - ${y}`;switch(S){case 3:console.error(k);break;case 2:console.warn(k);break;default:console.log(k);break}if(this.filePath)try{await this.rotateLogFile(),await j.appendFile(this.filePath,k+`
162
+ `)}catch($){let Z=new P1("Failed to write to log file","LOG_WRITE_ERROR",$);console.error(`[LOGGER_ERROR] ${Z.message}
163
+ ${Z.stack}`)}}logQuery(S,y,w){let k=w?`${w.toFixed(2)}ms`:"N/A";this.log(0,`Query: ${S} | Params: ${JSON.stringify(y)} | Time: ${k}`)}logError(S){let y=`${S.message}${S.stack?`
164
+ ${S.stack}`:""}`;this.log(3,y)}logMetrics(S){let y=`Pool Metrics: Active=${S.activeConnections}, Idle=${S.idleConnections}, Total=${S.totalConnections}`;this.log(1,y)}logInfo(S){this.log(1,S)}logWarn(S){this.log(2,S)}logDebug(S){this.log(0,S)}}var mw=S3(iw(),1);class X7{redis=null;logger;hits=0;misses=0;config;constructor(S,y=new c1){if(this.config={...S,cachePrefix:S.cachePrefix||""},this.logger=y,this.config.enabled&&this.config.redisUrl)this.redis=new mw.default(this.config.redisUrl,{lazyConnect:!0}),this.redis.on("error",(w)=>this.logger.logError(w))}getStrategy(){return this.config.strategy||"cache-aside"}async get(S){if(!this.redis)return null;try{let y=await this.redis.get(this.config.cachePrefix+S);if(y)return this.hits++,this.logger.logDebug(`Cache hit for key: ${S}`),JSON.parse(y);return this.misses++,this.logger.logDebug(`Cache miss for key: ${S}`),null}catch(y){return this.logger.logError(y),null}}async set(S,y,w){if(!this.redis)return;try{let k=w??this.config.ttl;await this.redis.set(this.config.cachePrefix+S,JSON.stringify(y),"EX",k),this.logger.logDebug(`Cache set for key: ${S}`)}catch(k){this.logger.logError(k)}}async invalidate(S){if(!this.redis)return;try{let y=this.redis.pipeline();for(let w of S)y.del(this.config.cachePrefix+w),this.logger.logDebug(`Cache invalidated for key: ${w}`);await y.exec()}catch(y){this.logger.logError(y)}}async invalidatePattern(S){if(!this.redis)return;try{let y=await this.redis.keys(this.config.cachePrefix+S);if(y.length>0){let w=this.redis.pipeline();for(let k of y)w.del(k);await w.exec(),this.logger.logDebug(`Cache invalidated for pattern: ${S} (${y.length} keys)`)}}catch(y){this.logger.logError(y)}}async getStats(){if(!this.redis)return{hits:0,misses:0,keys:0};try{let S=await this.redis.keys(this.config.cachePrefix+"*");return{hits:this.hits,misses:this.misses,keys:S.length}}catch(S){return this.logger.logError(S),{hits:this.hits,misses:this.misses,keys:0}}}async disconnect(){if(this.redis)await this.redis.quit(),this.logger.logInfo("Redis connection closed")}}export{X7 as Cache};
165
+
166
+ //# debugId=F08C0B808EA04C4C64756E2164756E21