@prosopo/cli 3.5.19 → 3.6.31

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 (85) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +27 -21
  2. package/.turbo/turbo-build$colon$tsc.log +31 -25
  3. package/.turbo/turbo-build.log +28 -22
  4. package/CHANGELOG.md +565 -0
  5. package/README.md +52 -95
  6. package/dist/RateLimiter.d.ts +56 -0
  7. package/dist/RateLimiter.d.ts.map +1 -1
  8. package/dist/RateLimiter.js +57 -1
  9. package/dist/RateLimiter.js.map +1 -1
  10. package/dist/argv.d.ts.map +1 -1
  11. package/dist/argv.js +5 -1
  12. package/dist/argv.js.map +1 -1
  13. package/dist/bundle/decodeBehavior-DA4X_swr.js +210 -0
  14. package/dist/bundle/decodeSimd-CKp22xIS.js +205 -0
  15. package/dist/bundle/{i18nBackend-D6GWR1ra.js → i18nBackend-o8t6Kg5r.js} +17 -17
  16. package/dist/bundle/index-DUVLsNmB.js +2371 -0
  17. package/dist/bundle/provider.cli.bundle.js +51809 -45354
  18. package/dist/cjs/RateLimiter.cjs +56 -0
  19. package/dist/cjs/argv.cjs +15 -11
  20. package/dist/cjs/cli.cjs +2 -2
  21. package/dist/cjs/commands/ensureExternalIndexes.cjs +3 -3
  22. package/dist/cjs/commands/ensureIndexes.cjs +3 -3
  23. package/dist/cjs/commands/index.cjs +4 -0
  24. package/dist/cjs/commands/migrateAbuserScoreThreshold.cjs +66 -0
  25. package/dist/cjs/commands/providerSetDataset.cjs +5 -5
  26. package/dist/cjs/commands/siteKeyRegister.cjs +14 -6
  27. package/dist/cjs/commands/siteKeyRegisterApi.cjs +12 -5
  28. package/dist/cjs/commands/storeCaptchasExternally.cjs +3 -3
  29. package/dist/cjs/commands/updateSpamEmailDomains.cjs +50 -0
  30. package/dist/cjs/commands/version.cjs +3 -3
  31. package/dist/cjs/prosopo.config.cjs +38 -3
  32. package/dist/cjs/reloader.cjs +2 -2
  33. package/dist/cjs/start.cjs +17 -139
  34. package/dist/cli.js +1 -1
  35. package/dist/cli.js.map +1 -1
  36. package/dist/commands/ensureExternalIndexes.d.ts +1 -1
  37. package/dist/commands/ensureExternalIndexes.d.ts.map +1 -1
  38. package/dist/commands/ensureExternalIndexes.js +1 -1
  39. package/dist/commands/ensureExternalIndexes.js.map +1 -1
  40. package/dist/commands/ensureIndexes.d.ts +1 -1
  41. package/dist/commands/ensureIndexes.d.ts.map +1 -1
  42. package/dist/commands/ensureIndexes.js +1 -1
  43. package/dist/commands/ensureIndexes.js.map +1 -1
  44. package/dist/commands/index.d.ts +2 -0
  45. package/dist/commands/index.d.ts.map +1 -1
  46. package/dist/commands/index.js +14 -10
  47. package/dist/commands/index.js.map +1 -1
  48. package/dist/commands/migrateAbuserScoreThreshold.d.ts +16 -0
  49. package/dist/commands/migrateAbuserScoreThreshold.d.ts.map +1 -0
  50. package/dist/commands/migrateAbuserScoreThreshold.js +67 -0
  51. package/dist/commands/migrateAbuserScoreThreshold.js.map +1 -0
  52. package/dist/commands/providerSetDataset.d.ts +1 -1
  53. package/dist/commands/providerSetDataset.d.ts.map +1 -1
  54. package/dist/commands/providerSetDataset.js +1 -1
  55. package/dist/commands/providerSetDataset.js.map +1 -1
  56. package/dist/commands/siteKeyRegister.d.ts +6 -1
  57. package/dist/commands/siteKeyRegister.d.ts.map +1 -1
  58. package/dist/commands/siteKeyRegister.js +12 -4
  59. package/dist/commands/siteKeyRegister.js.map +1 -1
  60. package/dist/commands/siteKeyRegisterApi.d.ts +3 -1
  61. package/dist/commands/siteKeyRegisterApi.d.ts.map +1 -1
  62. package/dist/commands/siteKeyRegisterApi.js +10 -3
  63. package/dist/commands/siteKeyRegisterApi.js.map +1 -1
  64. package/dist/commands/storeCaptchasExternally.d.ts +1 -1
  65. package/dist/commands/storeCaptchasExternally.d.ts.map +1 -1
  66. package/dist/commands/storeCaptchasExternally.js +1 -1
  67. package/dist/commands/storeCaptchasExternally.js.map +1 -1
  68. package/dist/commands/updateSpamEmailDomains.d.ts +13 -0
  69. package/dist/commands/updateSpamEmailDomains.d.ts.map +1 -0
  70. package/dist/commands/updateSpamEmailDomains.js +51 -0
  71. package/dist/commands/updateSpamEmailDomains.js.map +1 -0
  72. package/dist/commands/version.d.ts +1 -1
  73. package/dist/commands/version.js +1 -1
  74. package/dist/prosopo.config.d.ts.map +1 -1
  75. package/dist/prosopo.config.js +37 -2
  76. package/dist/prosopo.config.js.map +1 -1
  77. package/dist/reloader.d.ts.map +1 -1
  78. package/dist/reloader.js +1 -1
  79. package/dist/reloader.js.map +1 -1
  80. package/dist/start.d.ts +1 -2
  81. package/dist/start.d.ts.map +1 -1
  82. package/dist/start.js +18 -140
  83. package/dist/start.js.map +1 -1
  84. package/package.json +18 -17
  85. package/dist/bundle/decodeBehavior-BFkC8mpH.js +0 -212
@@ -0,0 +1,2371 @@
1
+ import Re from "assert";
2
+ import Ct from "net";
3
+ import Xt from "fs";
4
+ import de from "util";
5
+ import Yt from "stream";
6
+ import Qt from "https";
7
+ function er(o, g) {
8
+ for (var m = 0; m < g.length; m++) {
9
+ const u = g[m];
10
+ if (typeof u != "string" && !Array.isArray(u)) {
11
+ for (const l in u)
12
+ if (l !== "default" && !(l in o)) {
13
+ const p = Object.getOwnPropertyDescriptor(u, l);
14
+ p && Object.defineProperty(o, l, p.get ? p : {
15
+ enumerable: !0,
16
+ get: () => u[l]
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return Object.freeze(Object.defineProperty(o, Symbol.toStringTag, { value: "Module" }));
22
+ }
23
+ var G = {}, Q = {}, J = {}, K = {}, ee = {}, _e = {}, ze;
24
+ function Pt() {
25
+ if (ze) return _e;
26
+ ze = 1, Object.defineProperty(_e, "__esModule", { value: !0 });
27
+ const o = `Maxmind v2 module has changed API.
28
+ Upgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide
29
+ If you want to use legacy library then explicitly install maxmind@1`, g = (m, u) => {
30
+ if (!m)
31
+ throw new Error(u);
32
+ };
33
+ return _e.default = {
34
+ assert: g,
35
+ legacyErrorMessage: o
36
+ }, _e;
37
+ }
38
+ var Ve;
39
+ function St() {
40
+ if (Ve) return ee;
41
+ Ve = 1;
42
+ var o = ee && ee.__importDefault || function(s) {
43
+ return s && s.__esModule ? s : { default: s };
44
+ };
45
+ Object.defineProperty(ee, "__esModule", { value: !0 });
46
+ const g = o(/* @__PURE__ */ Pt());
47
+ g.default.assert(typeof BigInt < "u", "Apparently you are using old version of node. Please upgrade to node 10.4.x or above.");
48
+ var m;
49
+ (function(s) {
50
+ s[s.Extended = 0] = "Extended", s[s.Pointer = 1] = "Pointer", s[s.Utf8String = 2] = "Utf8String", s[s.Double = 3] = "Double", s[s.Bytes = 4] = "Bytes", s[s.Uint16 = 5] = "Uint16", s[s.Uint32 = 6] = "Uint32", s[s.Map = 7] = "Map", s[s.Int32 = 8] = "Int32", s[s.Uint64 = 9] = "Uint64", s[s.Uint128 = 10] = "Uint128", s[s.Array = 11] = "Array", s[s.Container = 12] = "Container", s[s.EndMarker = 13] = "EndMarker", s[s.Boolean = 14] = "Boolean", s[s.Float = 15] = "Float";
51
+ })(m || (m = {}));
52
+ const u = [0, 2048, 526336, 0], l = {
53
+ get: () => {
54
+ },
55
+ set: () => {
56
+ }
57
+ }, p = (s, n) => ({ value: s, offset: n });
58
+ class h {
59
+ constructor(n, t = 0, e = l) {
60
+ this.telemetry = {}, g.default.assert(!!n, "Database buffer is required"), this.db = n, this.baseOffset = t, this.cache = e;
61
+ }
62
+ decode(n) {
63
+ let t;
64
+ const e = this.db[n++];
65
+ let r = e >> 5;
66
+ if (r === m.Pointer)
67
+ return t = this.decodePointer(e, n), p(this.decodeFast(t.value).value, t.offset);
68
+ if (r === m.Extended) {
69
+ if (t = this.db[n] + 7, t < 8)
70
+ throw new Error("Invalid Extended Type at offset " + n + " val " + t);
71
+ r = t, n++;
72
+ }
73
+ const i = this.sizeFromCtrlByte(e, n);
74
+ return this.decodeByType(r, i.offset, i.value);
75
+ }
76
+ decodeFast(n) {
77
+ const t = this.cache.get(n);
78
+ if (t)
79
+ return t;
80
+ const e = this.decode(n);
81
+ return this.cache.set(n, e), e;
82
+ }
83
+ decodeByType(n, t, e) {
84
+ const r = t + e;
85
+ switch (n) {
86
+ case m.Utf8String:
87
+ return p(this.decodeString(t, e), r);
88
+ case m.Map:
89
+ return this.decodeMap(e, t);
90
+ case m.Uint32:
91
+ return p(this.decodeUint(t, e), r);
92
+ case m.Double:
93
+ return p(this.decodeDouble(t), r);
94
+ case m.Array:
95
+ return this.decodeArray(e, t);
96
+ case m.Boolean:
97
+ return p(this.decodeBoolean(e), t);
98
+ case m.Float:
99
+ return p(this.decodeFloat(t), r);
100
+ case m.Bytes:
101
+ return p(this.decodeBytes(t, e), r);
102
+ case m.Uint16:
103
+ return p(this.decodeUint(t, e), r);
104
+ case m.Int32:
105
+ return p(this.decodeInt32(t, e), r);
106
+ case m.Uint64:
107
+ return p(this.decodeUint(t, e), r);
108
+ case m.Uint128:
109
+ return p(this.decodeUint(t, e), r);
110
+ }
111
+ throw new Error("Unknown type " + n + " at offset " + t);
112
+ }
113
+ sizeFromCtrlByte(n, t) {
114
+ const e = n & 31;
115
+ return e < 29 ? p(e, t) : e === 29 ? p(29 + this.db[t], t + 1) : e === 30 ? p(285 + this.db.readUInt16BE(t), t + 2) : p(65821 + this.db.readUIntBE(t, 3), t + 3);
116
+ }
117
+ decodeBytes(n, t) {
118
+ return this.db.subarray(n, n + t);
119
+ }
120
+ decodePointer(n, t) {
121
+ const e = n >> 3 & 3, r = this.baseOffset + u[e];
122
+ let i = 0;
123
+ return e === 0 ? i = (n & 7) << 8 | this.db[t] : e === 1 ? i = (n & 7) << 16 | this.db.readUInt16BE(t) : e === 2 ? i = (n & 7) << 24 | this.db.readUIntBE(t, 3) : i = this.db.readUInt32BE(t), t += e + 1, p(r + i, t);
124
+ }
125
+ decodeArray(n, t) {
126
+ let e;
127
+ const r = new Array(n);
128
+ for (let i = 0; i < n; i++)
129
+ e = this.decode(t), t = e.offset, r[i] = e.value;
130
+ return p(r, t);
131
+ }
132
+ decodeBoolean(n) {
133
+ return n !== 0;
134
+ }
135
+ decodeDouble(n) {
136
+ return this.db.readDoubleBE(n);
137
+ }
138
+ decodeFloat(n) {
139
+ return this.db.readFloatBE(n);
140
+ }
141
+ decodeMap(n, t) {
142
+ let e, r;
143
+ const i = {};
144
+ for (let f = 0; f < n; f++)
145
+ e = this.decode(t), r = e.value, e = this.decode(e.offset), t = e.offset, i[r] = e.value;
146
+ return p(i, t);
147
+ }
148
+ decodeInt32(n, t) {
149
+ return t === 0 ? 0 : t < 4 ? this.db.readUIntBE(n, t) : this.db.readInt32BE(n);
150
+ }
151
+ decodeUint(n, t) {
152
+ return t === 0 ? 0 : t <= 6 ? this.db.readUIntBE(n, t) : t == 8 ? this.db.readBigUInt64BE(n).toString() : t > 16 ? 0 : this.decodeBigUint(n, t);
153
+ }
154
+ decodeString(n, t) {
155
+ return this.db.toString("utf8", n, n + t);
156
+ }
157
+ decodeBigUint(n, t) {
158
+ let e = 0n;
159
+ for (let r = 0; r < t; r++)
160
+ e <<= 8n, e |= BigInt(this.db.readUInt8(n + r));
161
+ return e.toString();
162
+ }
163
+ }
164
+ return ee.default = h, ee;
165
+ }
166
+ var te = {}, We;
167
+ function tr() {
168
+ if (We) return te;
169
+ We = 1;
170
+ var o = te && te.__importDefault || function(n) {
171
+ return n && n.__esModule ? n : { default: n };
172
+ };
173
+ Object.defineProperty(te, "__esModule", { value: !0 });
174
+ const g = o(Ct), m = (n) => {
175
+ const t = n.split(".", 4), e = parseInt(t[0]), r = parseInt(t[1]), i = parseInt(t[2]), f = parseInt(t[3]);
176
+ return [e, r, i, f];
177
+ }, u = (n) => {
178
+ const t = parseInt(n, 10).toString(16);
179
+ return t.length === 2 ? t : "0" + t;
180
+ }, l = (n) => {
181
+ const t = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
182
+ let e, r, i;
183
+ const f = n.indexOf(".") > -1 ? n.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (b, x, E, I, S) => u(x) + u(E) + ":" + u(I) + u(S)) : n, [y, _] = f.split("::", 2);
184
+ if (y)
185
+ for (r = y.split(":"), e = 0; e < r.length; e++)
186
+ i = parseInt(r[e], 16), t[e * 2] = i >> 8, t[e * 2 + 1] = i & 255;
187
+ if (_) {
188
+ r = _.split(":");
189
+ const b = 16 - r.length * 2;
190
+ for (e = 0; e < r.length; e++)
191
+ i = parseInt(r[e], 16), t[b + e * 2] = i >> 8, t[b + (e * 2 + 1)] = i & 255;
192
+ }
193
+ return t;
194
+ }, p = (n) => n.indexOf(":") === -1 ? m(n) : l(n), h = (n, t) => {
195
+ const e = t >> 3, r = 7 ^ t & 7;
196
+ return n[e] >>> r & 1;
197
+ }, s = (n) => {
198
+ const t = g.default.isIP(n);
199
+ return t === 4 || t === 6;
200
+ };
201
+ return te.default = {
202
+ bitAt: h,
203
+ parse: p,
204
+ validate: s
205
+ }, te;
206
+ }
207
+ var ce = {}, He;
208
+ function rr() {
209
+ return He || (He = 1, (function(o) {
210
+ var g = ce && ce.__importDefault || function(n) {
211
+ return n && n.__esModule ? n : { default: n };
212
+ };
213
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.isLegacyFormat = o.parseMetadata = void 0;
214
+ const m = g(/* @__PURE__ */ St()), u = g(/* @__PURE__ */ Pt()), l = Buffer.from("ABCDEF4D61784D696E642E636F6D", "hex"), p = (n) => {
215
+ const t = h(n), r = new m.default(n, t).decode(t).value;
216
+ if (!r)
217
+ throw new Error((0, o.isLegacyFormat)(n) ? u.default.legacyErrorMessage : "Cannot parse binary database");
218
+ return u.default.assert([24, 28, 32].indexOf(r.record_size) > -1, "Unsupported record size"), {
219
+ binaryFormatMajorVersion: r.binary_format_major_version,
220
+ binaryFormatMinorVersion: r.binary_format_minor_version,
221
+ buildEpoch: new Date(r.build_epoch * 1e3),
222
+ databaseType: r.database_type,
223
+ description: r.description,
224
+ ipVersion: r.ip_version,
225
+ languages: r.languages,
226
+ nodeByteSize: r.record_size / 4,
227
+ nodeCount: r.node_count,
228
+ recordSize: r.record_size,
229
+ searchTreeSize: r.node_count * r.record_size / 4,
230
+ // Depth depends on the IP version, it's 32 for IPv4 and 128 for IPv6.
231
+ treeDepth: Math.pow(2, r.ip_version + 1)
232
+ };
233
+ };
234
+ o.parseMetadata = p;
235
+ const h = (n) => {
236
+ let t = 0, e = n.length - 1;
237
+ const r = l.length - 1;
238
+ for (; t <= r && e-- > 0; )
239
+ t += n[e] === l[r - t] ? 1 : -t;
240
+ return e + t;
241
+ }, s = (n) => {
242
+ for (let e = 0; e < 20; e++) {
243
+ const r = n.slice(n.length - 3 - e, n.length - e);
244
+ if (r[0] === 255 && r[1] === 255 && r[2] === 255)
245
+ return !0;
246
+ }
247
+ return !1;
248
+ };
249
+ o.isLegacyFormat = s;
250
+ })(ce)), ce;
251
+ }
252
+ var ve = {}, Ge;
253
+ function nr() {
254
+ if (Ge) return ve;
255
+ Ge = 1, Object.defineProperty(ve, "__esModule", { value: !0 });
256
+ const o = (h) => (s) => h.readUIntBE(s + 3, 3), g = (h) => (s) => h.readUIntBE(s, 3), m = (h) => (s) => (h[s + 3] & 240) << 20 | h.readUIntBE(s, 3), u = (h) => (s) => (h[s + 3] & 15) << 24 | h.readUIntBE(s + 4, 3), l = (h) => (s) => h.readUInt32BE(s), p = (h) => (s) => h.readUInt32BE(s + 4);
257
+ return ve.default = (h, s) => {
258
+ switch (s) {
259
+ case 24:
260
+ return { left: g(h), right: o(h) };
261
+ case 28:
262
+ return { left: m(h), right: u(h) };
263
+ case 32:
264
+ return { left: l(h), right: p(h) };
265
+ }
266
+ throw new Error("Unsupported record size");
267
+ }, ve;
268
+ }
269
+ var Ae = {}, Je;
270
+ function ir() {
271
+ return Je || (Je = 1, Object.defineProperty(Ae, "__esModule", { value: !0 })), Ae;
272
+ }
273
+ var Ke;
274
+ function Ze() {
275
+ return Ke || (Ke = 1, (function(o) {
276
+ var g = K && K.__createBinding || (Object.create ? (function(e, r, i, f) {
277
+ f === void 0 && (f = i);
278
+ var y = Object.getOwnPropertyDescriptor(r, i);
279
+ (!y || ("get" in y ? !r.__esModule : y.writable || y.configurable)) && (y = { enumerable: !0, get: function() {
280
+ return r[i];
281
+ } }), Object.defineProperty(e, f, y);
282
+ }) : (function(e, r, i, f) {
283
+ f === void 0 && (f = i), e[f] = r[i];
284
+ })), m = K && K.__exportStar || function(e, r) {
285
+ for (var i in e) i !== "default" && !Object.prototype.hasOwnProperty.call(r, i) && g(r, e, i);
286
+ }, u = K && K.__importDefault || function(e) {
287
+ return e && e.__esModule ? e : { default: e };
288
+ };
289
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.Reader = void 0;
290
+ const l = u(/* @__PURE__ */ St()), p = u(/* @__PURE__ */ tr()), h = /* @__PURE__ */ rr(), s = u(/* @__PURE__ */ nr()), n = 16;
291
+ class t {
292
+ constructor(r, i = {}) {
293
+ this.opts = i, this.load(r);
294
+ }
295
+ load(r) {
296
+ if (!Buffer.isBuffer(r))
297
+ throw new Error(`mmdb-lib expects an instance of Buffer, got: ${typeof r}`);
298
+ this.db = r, this.metadata = (0, h.parseMetadata)(this.db), this.decoder = new l.default(this.db, this.metadata.searchTreeSize + n, this.opts.cache), this.walker = (0, s.default)(this.db, this.metadata.recordSize), this.ipv4StartNodeNumber = this.ipv4Start();
299
+ }
300
+ get(r) {
301
+ const [i] = this.getWithPrefixLength(r);
302
+ return i;
303
+ }
304
+ getWithPrefixLength(r) {
305
+ const [i, f] = this.findAddressInTree(r);
306
+ return [i ? this.resolveDataPointer(i) : null, f];
307
+ }
308
+ findAddressInTree(r) {
309
+ const i = p.default.parse(r), f = this.metadata.nodeCount, y = i.length * 8;
310
+ let _, b = 0, x, E = 0;
311
+ for (i.length === 4 && (b = this.ipv4StartNodeNumber); E < y && b < f; E++)
312
+ _ = p.default.bitAt(i, E), x = b * this.metadata.nodeByteSize, b = _ ? this.walker.right(x) : this.walker.left(x);
313
+ return b > f ? [b, E] : [null, E];
314
+ }
315
+ resolveDataPointer(r) {
316
+ const i = r - this.metadata.nodeCount + this.metadata.searchTreeSize;
317
+ return this.decoder.decodeFast(i).value;
318
+ }
319
+ ipv4Start() {
320
+ if (this.metadata.ipVersion === 4)
321
+ return 0;
322
+ const r = this.metadata.nodeCount;
323
+ let i = 0, f = 0;
324
+ for (; f < 96 && i < r; f++) {
325
+ const y = i * this.metadata.nodeByteSize;
326
+ i = this.walker.left(y);
327
+ }
328
+ return i;
329
+ }
330
+ }
331
+ o.Reader = t, m(/* @__PURE__ */ ir(), o);
332
+ })(K)), K;
333
+ }
334
+ var me = {};
335
+ var Xe;
336
+ function or() {
337
+ if (Xe) return me;
338
+ Xe = 1;
339
+ class o {
340
+ /**
341
+ * Creates a new LRU cache instance.
342
+ *
343
+ * @constructor
344
+ * @param {number} [max=0] - Maximum number of items to store. 0 means unlimited.
345
+ * @param {number} [ttl=0] - Time to live in milliseconds. 0 means no expiration.
346
+ * @param {boolean} [resetTtl=false] - Whether to reset TTL when accessing existing items.
347
+ * @throws {TypeError} When parameters are of invalid type.
348
+ * @example
349
+ * const cache = new LRU(1000, 60000, true); // 1000 items, 1 minute TTL, reset on access
350
+ * @since 1.0.0
351
+ */
352
+ constructor(u = 0, l = 0, p = !1) {
353
+ this.first = null, this.items = /* @__PURE__ */ Object.create(null), this.last = null, this.max = u, this.resetTtl = p, this.size = 0, this.ttl = l;
354
+ }
355
+ /**
356
+ * Removes all items from the cache.
357
+ *
358
+ * @method clear
359
+ * @memberof LRU
360
+ * @returns {LRU} The LRU instance for method chaining.
361
+ * @example
362
+ * cache.clear();
363
+ * console.log(cache.size); // 0
364
+ * @since 1.0.0
365
+ */
366
+ clear() {
367
+ return this.first = null, this.items = /* @__PURE__ */ Object.create(null), this.last = null, this.size = 0, this;
368
+ }
369
+ /**
370
+ * Removes an item from the cache by key.
371
+ *
372
+ * @method delete
373
+ * @memberof LRU
374
+ * @param {string} key - The key of the item to delete.
375
+ * @returns {LRU} The LRU instance for method chaining.
376
+ * @example
377
+ * cache.set('key1', 'value1');
378
+ * cache.delete('key1');
379
+ * console.log(cache.has('key1')); // false
380
+ * @see {@link LRU#has}
381
+ * @see {@link LRU#clear}
382
+ * @since 1.0.0
383
+ */
384
+ delete(u) {
385
+ if (this.has(u)) {
386
+ const l = this.items[u];
387
+ delete this.items[u], this.size--, l.prev !== null && (l.prev.next = l.next), l.next !== null && (l.next.prev = l.prev), this.first === l && (this.first = l.next), this.last === l && (this.last = l.prev);
388
+ }
389
+ return this;
390
+ }
391
+ /**
392
+ * Returns an array of [key, value] pairs for the specified keys.
393
+ *
394
+ * @method entries
395
+ * @memberof LRU
396
+ * @param {string[]} [keys=this.keys()] - Array of keys to get entries for. Defaults to all keys.
397
+ * @returns {Array<Array<*>>} Array of [key, value] pairs.
398
+ * @example
399
+ * cache.set('a', 1).set('b', 2);
400
+ * console.log(cache.entries()); // [['a', 1], ['b', 2]]
401
+ * console.log(cache.entries(['a'])); // [['a', 1]]
402
+ * @see {@link LRU#keys}
403
+ * @see {@link LRU#values}
404
+ * @since 11.1.0
405
+ */
406
+ entries(u = this.keys()) {
407
+ return u.map((l) => [l, this.get(l)]);
408
+ }
409
+ /**
410
+ * Removes the least recently used item from the cache.
411
+ *
412
+ * @method evict
413
+ * @memberof LRU
414
+ * @param {boolean} [bypass=false] - Whether to bypass the size check and force eviction.
415
+ * @returns {LRU} The LRU instance for method chaining.
416
+ * @example
417
+ * cache.set('old', 'value').set('new', 'value');
418
+ * cache.evict(); // Removes 'old' item
419
+ * @see {@link LRU#setWithEvicted}
420
+ * @since 1.0.0
421
+ */
422
+ evict(u = !1) {
423
+ if (u || this.size > 0) {
424
+ const l = this.first;
425
+ delete this.items[l.key], --this.size === 0 ? (this.first = null, this.last = null) : (this.first = l.next, this.first.prev = null);
426
+ }
427
+ return this;
428
+ }
429
+ /**
430
+ * Returns the expiration timestamp for a given key.
431
+ *
432
+ * @method expiresAt
433
+ * @memberof LRU
434
+ * @param {string} key - The key to check expiration for.
435
+ * @returns {number|undefined} The expiration timestamp in milliseconds, or undefined if key doesn't exist.
436
+ * @example
437
+ * const cache = new LRU(100, 5000); // 5 second TTL
438
+ * cache.set('key1', 'value1');
439
+ * console.log(cache.expiresAt('key1')); // timestamp 5 seconds from now
440
+ * @see {@link LRU#get}
441
+ * @see {@link LRU#has}
442
+ * @since 1.0.0
443
+ */
444
+ expiresAt(u) {
445
+ let l;
446
+ return this.has(u) && (l = this.items[u].expiry), l;
447
+ }
448
+ /**
449
+ * Retrieves a value from the cache by key. Updates the item's position to most recently used.
450
+ *
451
+ * @method get
452
+ * @memberof LRU
453
+ * @param {string} key - The key to retrieve.
454
+ * @returns {*} The value associated with the key, or undefined if not found or expired.
455
+ * @example
456
+ * cache.set('key1', 'value1');
457
+ * console.log(cache.get('key1')); // 'value1'
458
+ * console.log(cache.get('nonexistent')); // undefined
459
+ * @see {@link LRU#set}
460
+ * @see {@link LRU#has}
461
+ * @since 1.0.0
462
+ */
463
+ get(u) {
464
+ let l;
465
+ if (this.has(u)) {
466
+ const p = this.items[u];
467
+ this.ttl > 0 && p.expiry <= Date.now() ? this.delete(u) : (l = p.value, this.set(u, l, !0));
468
+ }
469
+ return l;
470
+ }
471
+ /**
472
+ * Checks if a key exists in the cache.
473
+ *
474
+ * @method has
475
+ * @memberof LRU
476
+ * @param {string} key - The key to check for.
477
+ * @returns {boolean} True if the key exists, false otherwise.
478
+ * @example
479
+ * cache.set('key1', 'value1');
480
+ * console.log(cache.has('key1')); // true
481
+ * console.log(cache.has('nonexistent')); // false
482
+ * @see {@link LRU#get}
483
+ * @see {@link LRU#delete}
484
+ * @since 9.0.0
485
+ */
486
+ has(u) {
487
+ return u in this.items;
488
+ }
489
+ /**
490
+ * Returns an array of all keys in the cache, ordered from least to most recently used.
491
+ *
492
+ * @method keys
493
+ * @memberof LRU
494
+ * @returns {string[]} Array of keys in LRU order.
495
+ * @example
496
+ * cache.set('a', 1).set('b', 2);
497
+ * cache.get('a'); // Move 'a' to most recent
498
+ * console.log(cache.keys()); // ['b', 'a']
499
+ * @see {@link LRU#values}
500
+ * @see {@link LRU#entries}
501
+ * @since 9.0.0
502
+ */
503
+ keys() {
504
+ const u = [];
505
+ let l = this.first;
506
+ for (; l !== null; )
507
+ u.push(l.key), l = l.next;
508
+ return u;
509
+ }
510
+ /**
511
+ * Sets a value in the cache and returns any evicted item.
512
+ *
513
+ * @method setWithEvicted
514
+ * @memberof LRU
515
+ * @param {string} key - The key to set.
516
+ * @param {*} value - The value to store.
517
+ * @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
518
+ * @returns {Object|null} The evicted item (if any) with shape {key, value, expiry, prev, next}, or null.
519
+ * @example
520
+ * const cache = new LRU(2);
521
+ * cache.set('a', 1).set('b', 2);
522
+ * const evicted = cache.setWithEvicted('c', 3); // evicted = {key: 'a', value: 1, ...}
523
+ * @see {@link LRU#set}
524
+ * @see {@link LRU#evict}
525
+ * @since 11.3.0
526
+ */
527
+ setWithEvicted(u, l, p = this.resetTtl) {
528
+ let h = null;
529
+ if (this.has(u))
530
+ this.set(u, l, !0, p);
531
+ else {
532
+ this.max > 0 && this.size === this.max && (h = { ...this.first }, this.evict(!0));
533
+ let s = this.items[u] = {
534
+ expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl,
535
+ key: u,
536
+ prev: this.last,
537
+ next: null,
538
+ value: l
539
+ };
540
+ ++this.size === 1 ? this.first = s : this.last.next = s, this.last = s;
541
+ }
542
+ return h;
543
+ }
544
+ /**
545
+ * Sets a value in the cache. Updates the item's position to most recently used.
546
+ *
547
+ * @method set
548
+ * @memberof LRU
549
+ * @param {string} key - The key to set.
550
+ * @param {*} value - The value to store.
551
+ * @param {boolean} [bypass=false] - Whether to bypass normal LRU positioning (internal use).
552
+ * @param {boolean} [resetTtl=this.resetTtl] - Whether to reset the TTL for this operation.
553
+ * @returns {LRU} The LRU instance for method chaining.
554
+ * @example
555
+ * cache.set('key1', 'value1')
556
+ * .set('key2', 'value2')
557
+ * .set('key3', 'value3');
558
+ * @see {@link LRU#get}
559
+ * @see {@link LRU#setWithEvicted}
560
+ * @since 1.0.0
561
+ */
562
+ set(u, l, p = !1, h = this.resetTtl) {
563
+ let s;
564
+ if (p || this.has(u)) {
565
+ if (s = this.items[u], s.value = l, p === !1 && h && (s.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl), this.last !== s) {
566
+ const n = this.last, t = s.next, e = s.prev;
567
+ this.first === s && (this.first = s.next), s.next = null, s.prev = this.last, n.next = s, e !== null && (e.next = t), t !== null && (t.prev = e);
568
+ }
569
+ } else
570
+ this.max > 0 && this.size === this.max && this.evict(!0), s = this.items[u] = {
571
+ expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl,
572
+ key: u,
573
+ prev: this.last,
574
+ next: null,
575
+ value: l
576
+ }, ++this.size === 1 ? this.first = s : this.last.next = s;
577
+ return this.last = s, this;
578
+ }
579
+ /**
580
+ * Returns an array of all values in the cache for the specified keys.
581
+ *
582
+ * @method values
583
+ * @memberof LRU
584
+ * @param {string[]} [keys=this.keys()] - Array of keys to get values for. Defaults to all keys.
585
+ * @returns {Array<*>} Array of values corresponding to the keys.
586
+ * @example
587
+ * cache.set('a', 1).set('b', 2);
588
+ * console.log(cache.values()); // [1, 2]
589
+ * console.log(cache.values(['a'])); // [1]
590
+ * @see {@link LRU#keys}
591
+ * @see {@link LRU#entries}
592
+ * @since 11.1.0
593
+ */
594
+ values(u = this.keys()) {
595
+ return u.map((l) => this.get(l));
596
+ }
597
+ }
598
+ function g(m = 1e3, u = 0, l = !1) {
599
+ if (isNaN(m) || m < 0)
600
+ throw new TypeError("Invalid max value");
601
+ if (isNaN(u) || u < 0)
602
+ throw new TypeError("Invalid ttl value");
603
+ if (typeof l != "boolean")
604
+ throw new TypeError("Invalid resetTtl value");
605
+ return new o(m, u, l);
606
+ }
607
+ return me.LRU = o, me.lru = g, me;
608
+ }
609
+ var re = {}, Ye;
610
+ function sr() {
611
+ if (Ye) return re;
612
+ Ye = 1;
613
+ var o = re && re.__importDefault || function(u) {
614
+ return u && u.__esModule ? u : { default: u };
615
+ };
616
+ Object.defineProperty(re, "__esModule", { value: !0 });
617
+ const g = o(Xt), m = o(de);
618
+ return re.default = {
619
+ existsSync: g.default.existsSync,
620
+ readFile: m.default.promisify(g.default.readFile),
621
+ watchFile: g.default.watchFile,
622
+ createReadStream: g.default.createReadStream,
623
+ stat: m.default.promisify(g.default.stat)
624
+ }, re;
625
+ }
626
+ var ne = {}, Qe;
627
+ function ar() {
628
+ if (Qe) return ne;
629
+ Qe = 1;
630
+ var o = ne && ne.__importDefault || function(n) {
631
+ return n && n.__esModule ? n : { default: n };
632
+ };
633
+ Object.defineProperty(ne, "__esModule", { value: !0 });
634
+ const g = o(Ct), m = (n) => {
635
+ const t = n.split(".", 4), e = parseInt(t[0]), r = parseInt(t[1]), i = parseInt(t[2]), f = parseInt(t[3]);
636
+ return [e, r, i, f];
637
+ }, u = (n) => (n = parseInt(n, 10).toString(16), n.length === 2 ? n : "0" + n), l = (n) => {
638
+ const t = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
639
+ let e, r, i;
640
+ n.indexOf(".") > -1 && (n = n.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (_, b, x, E, I) => u(b) + u(x) + ":" + u(E) + u(I)));
641
+ const [f, y] = n.split("::", 2);
642
+ if (f)
643
+ for (r = f.split(":"), e = 0; e < r.length; e++)
644
+ i = parseInt(r[e], 16), t[e * 2] = i >> 8, t[e * 2 + 1] = i & 255;
645
+ if (y) {
646
+ r = y.split(":");
647
+ const _ = 16 - r.length * 2;
648
+ for (e = 0; e < r.length; e++)
649
+ i = parseInt(r[e], 16), t[_ + e * 2] = i >> 8, t[_ + (e * 2 + 1)] = i & 255;
650
+ }
651
+ return t;
652
+ }, p = (n) => n.indexOf(":") === -1 ? m(n) : l(n), h = (n, t) => {
653
+ const e = t >> 3, r = 7 ^ t & 7;
654
+ return n[e] >>> r & 1;
655
+ }, s = (n) => {
656
+ const t = g.default.isIP(n);
657
+ return t === 4 || t === 6;
658
+ };
659
+ return ne.default = {
660
+ bitAt: h,
661
+ parse: p,
662
+ validate: s
663
+ }, ne;
664
+ }
665
+ var ye = {}, et;
666
+ function ur() {
667
+ return et || (et = 1, Object.defineProperty(ye, "__esModule", { value: !0 }), ye.default = (o) => !o || o.length < 3 ? !1 : o[0] === 31 && o[1] === 139 && o[2] === 8), ye;
668
+ }
669
+ var ge = {}, tt;
670
+ function fr() {
671
+ if (tt) return ge;
672
+ tt = 1, Object.defineProperty(ge, "__esModule", { value: !0 });
673
+ const o = (l, p) => l << 8 | p, g = (l, p, h) => l << 16 | p << 8 | h, m = (l, p, h, s) => l << 24 | p << 16 | h << 8 | s, u = `Maxmind v2 module has changed API.
674
+ Upgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide
675
+ If you want to use legacy libary then explicitly install maxmind@1`;
676
+ return ge.default = {
677
+ concat2: o,
678
+ concat3: g,
679
+ concat4: m,
680
+ legacyErrorMessage: u
681
+ }, ge;
682
+ }
683
+ var rt;
684
+ function je() {
685
+ return rt || (rt = 1, (function(o) {
686
+ var g = J && J.__createBinding || (Object.create ? (function(E, I, S, q) {
687
+ q === void 0 && (q = S);
688
+ var F = Object.getOwnPropertyDescriptor(I, S);
689
+ (!F || ("get" in F ? !I.__esModule : F.writable || F.configurable)) && (F = { enumerable: !0, get: function() {
690
+ return I[S];
691
+ } }), Object.defineProperty(E, q, F);
692
+ }) : (function(E, I, S, q) {
693
+ q === void 0 && (q = S), E[q] = I[S];
694
+ })), m = J && J.__exportStar || function(E, I) {
695
+ for (var S in E) S !== "default" && !Object.prototype.hasOwnProperty.call(I, S) && g(I, E, S);
696
+ }, u = J && J.__importDefault || function(E) {
697
+ return E && E.__esModule ? E : { default: E };
698
+ };
699
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.Reader = o.validate = o.init = o.openSync = o.open = void 0;
700
+ const l = u(Re), p = /* @__PURE__ */ Ze();
701
+ Object.defineProperty(o, "Reader", { enumerable: !0, get: function() {
702
+ return p.Reader;
703
+ } });
704
+ const h = /* @__PURE__ */ or(), s = u(/* @__PURE__ */ sr()), n = u(/* @__PURE__ */ ar()), t = u(/* @__PURE__ */ ur()), e = u(/* @__PURE__ */ fr()), r = 512 * 1024 * 1024, i = 8 * 1024 * 1024, f = async (E, I) => new Promise((S, q) => {
705
+ let F = Buffer.allocUnsafe(I), d = 0;
706
+ const c = s.default.createReadStream(E, {
707
+ highWaterMark: i
708
+ });
709
+ c.on("data", (v) => {
710
+ if (Buffer.isBuffer(v))
711
+ v.copy(F, d), d += v.length;
712
+ else {
713
+ const O = Buffer.from(v);
714
+ O.copy(F, d), d += O.length;
715
+ }
716
+ }), c.on("end", () => {
717
+ c.close(), S(F);
718
+ }), c.on("error", (v) => {
719
+ q(v);
720
+ });
721
+ }), y = async (E) => {
722
+ const I = await s.default.stat(E);
723
+ return I.size < r ? s.default.readFile(E) : f(E, I.size);
724
+ }, _ = async (E, I, S) => {
725
+ var q;
726
+ (0, l.default)(!S, e.default.legacyErrorMessage);
727
+ const F = await y(E);
728
+ if ((0, t.default)(F))
729
+ throw new Error("Looks like you are passing in a file in gzip format, please use mmdb database instead.");
730
+ const d = (0, h.lru)(((q = I?.cache) === null || q === void 0 ? void 0 : q.max) || 1e4), c = new p.Reader(F, { cache: d });
731
+ if (I && I.watchForUpdates) {
732
+ if (I.watchForUpdatesHook && typeof I.watchForUpdatesHook != "function")
733
+ throw new Error("opts.watchForUpdatesHook should be a function");
734
+ const v = {
735
+ persistent: I.watchForUpdatesNonPersistent !== !0
736
+ };
737
+ s.default.watchFile(E, v, async () => {
738
+ if (!await (async () => {
739
+ for (let R = 0; R < 3; R++) {
740
+ if (s.default.existsSync(E))
741
+ return !0;
742
+ await new Promise((M) => setTimeout(M, 500));
743
+ }
744
+ return !1;
745
+ })())
746
+ return;
747
+ const P = await y(E);
748
+ d.clear(), c.load(P), I.watchForUpdatesHook && I.watchForUpdatesHook();
749
+ });
750
+ }
751
+ return c;
752
+ };
753
+ o.open = _;
754
+ const b = () => {
755
+ throw new Error(e.default.legacyErrorMessage);
756
+ };
757
+ o.openSync = b;
758
+ const x = () => {
759
+ throw new Error(e.default.legacyErrorMessage);
760
+ };
761
+ o.init = x, o.validate = n.default.validate, m(/* @__PURE__ */ Ze(), o), o.default = {
762
+ init: o.init,
763
+ open: o.open,
764
+ openSync: o.openSync,
765
+ validate: n.default.validate
766
+ };
767
+ })(J)), J;
768
+ }
769
+ var V = {}, nt;
770
+ function Be() {
771
+ if (nt) return V;
772
+ nt = 1, Object.defineProperty(V, "__esModule", { value: !0 }), V.ValueError = V.InvalidDbBufferError = V.BadMethodCallError = V.AddressNotFoundError = void 0;
773
+ class o extends Error {
774
+ constructor(p) {
775
+ super(p), this.name = this.constructor.name;
776
+ }
777
+ }
778
+ V.AddressNotFoundError = o;
779
+ class g extends Error {
780
+ constructor(p) {
781
+ super(p), this.name = this.constructor.name;
782
+ }
783
+ }
784
+ V.BadMethodCallError = g;
785
+ class m extends Error {
786
+ constructor(p) {
787
+ super(p), this.name = this.constructor.name;
788
+ }
789
+ }
790
+ V.InvalidDbBufferError = m;
791
+ class u extends Error {
792
+ constructor(p) {
793
+ super(p), this.name = this.constructor.name;
794
+ }
795
+ }
796
+ return V.ValueError = u, V;
797
+ }
798
+ var W = {}, Ce, it;
799
+ function qe() {
800
+ if (it) return Ce;
801
+ it = 1;
802
+ var o = Re, g = Yt.Stream, m = de, u = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
803
+ function l(e) {
804
+ return e.charAt(0).toUpperCase() + e.slice(1);
805
+ }
806
+ function p(e, r, i, f, y) {
807
+ throw new o.AssertionError({
808
+ message: m.format("%s (%s) is required", e, r),
809
+ actual: y === void 0 ? typeof f : y(f),
810
+ expected: r,
811
+ operator: i || "===",
812
+ stackStartFunction: p.caller
813
+ });
814
+ }
815
+ function h(e) {
816
+ return Object.prototype.toString.call(e).slice(8, -1);
817
+ }
818
+ function s() {
819
+ }
820
+ var n = {
821
+ bool: {
822
+ check: function(e) {
823
+ return typeof e == "boolean";
824
+ }
825
+ },
826
+ func: {
827
+ check: function(e) {
828
+ return typeof e == "function";
829
+ }
830
+ },
831
+ string: {
832
+ check: function(e) {
833
+ return typeof e == "string";
834
+ }
835
+ },
836
+ object: {
837
+ check: function(e) {
838
+ return typeof e == "object" && e !== null;
839
+ }
840
+ },
841
+ number: {
842
+ check: function(e) {
843
+ return typeof e == "number" && !isNaN(e);
844
+ }
845
+ },
846
+ finite: {
847
+ check: function(e) {
848
+ return typeof e == "number" && !isNaN(e) && isFinite(e);
849
+ }
850
+ },
851
+ buffer: {
852
+ check: function(e) {
853
+ return Buffer.isBuffer(e);
854
+ },
855
+ operator: "Buffer.isBuffer"
856
+ },
857
+ array: {
858
+ check: function(e) {
859
+ return Array.isArray(e);
860
+ },
861
+ operator: "Array.isArray"
862
+ },
863
+ stream: {
864
+ check: function(e) {
865
+ return e instanceof g;
866
+ },
867
+ operator: "instanceof",
868
+ actual: h
869
+ },
870
+ date: {
871
+ check: function(e) {
872
+ return e instanceof Date;
873
+ },
874
+ operator: "instanceof",
875
+ actual: h
876
+ },
877
+ regexp: {
878
+ check: function(e) {
879
+ return e instanceof RegExp;
880
+ },
881
+ operator: "instanceof",
882
+ actual: h
883
+ },
884
+ uuid: {
885
+ check: function(e) {
886
+ return typeof e == "string" && u.test(e);
887
+ },
888
+ operator: "isUUID"
889
+ }
890
+ };
891
+ function t(e) {
892
+ var r = Object.keys(n), i;
893
+ return process.env.NODE_NDEBUG ? i = s : i = function(f, y) {
894
+ f || p(y, "true", f);
895
+ }, r.forEach(function(f) {
896
+ if (e) {
897
+ i[f] = s;
898
+ return;
899
+ }
900
+ var y = n[f];
901
+ i[f] = function(_, b) {
902
+ y.check(_) || p(b, f, y.operator, _, y.actual);
903
+ };
904
+ }), r.forEach(function(f) {
905
+ var y = "optional" + l(f);
906
+ if (e) {
907
+ i[y] = s;
908
+ return;
909
+ }
910
+ var _ = n[f];
911
+ i[y] = function(b, x) {
912
+ b != null && (_.check(b) || p(x, f, _.operator, b, _.actual));
913
+ };
914
+ }), r.forEach(function(f) {
915
+ var y = "arrayOf" + l(f);
916
+ if (e) {
917
+ i[y] = s;
918
+ return;
919
+ }
920
+ var _ = n[f], b = "[" + f + "]";
921
+ i[y] = function(x, E) {
922
+ Array.isArray(x) || p(E, b, _.operator, x, _.actual);
923
+ var I;
924
+ for (I = 0; I < x.length; I++)
925
+ _.check(x[I]) || p(E, b, _.operator, x, _.actual);
926
+ };
927
+ }), r.forEach(function(f) {
928
+ var y = "optionalArrayOf" + l(f);
929
+ if (e) {
930
+ i[y] = s;
931
+ return;
932
+ }
933
+ var _ = n[f], b = "[" + f + "]";
934
+ i[y] = function(x, E) {
935
+ if (x != null) {
936
+ Array.isArray(x) || p(E, b, _.operator, x, _.actual);
937
+ var I;
938
+ for (I = 0; I < x.length; I++)
939
+ _.check(x[I]) || p(E, b, _.operator, x, _.actual);
940
+ }
941
+ };
942
+ }), Object.keys(o).forEach(function(f) {
943
+ if (f === "AssertionError") {
944
+ i[f] = o[f];
945
+ return;
946
+ }
947
+ if (e) {
948
+ i[f] = s;
949
+ return;
950
+ }
951
+ i[f] = o[f];
952
+ }), i._setExports = t, i;
953
+ }
954
+ return Ce = t(process.env.NODE_NDEBUG), Ce;
955
+ }
956
+ var B = {}, le = {}, ot;
957
+ function Mt() {
958
+ if (ot) return le;
959
+ ot = 1;
960
+ var o = Re, g = de;
961
+ le.sprintf = m, le.printf = u, le.fprintf = l;
962
+ function m(s) {
963
+ var n = [
964
+ "([^%]*)",
965
+ /* normal text */
966
+ "%",
967
+ /* start of format */
968
+ "(['\\-+ #0]*?)",
969
+ /* flags (optional) */
970
+ "([1-9]\\d*)?",
971
+ /* width (optional) */
972
+ "(\\.([1-9]\\d*))?",
973
+ /* precision (optional) */
974
+ "[lhjztL]*?",
975
+ /* length mods (ignored) */
976
+ "([diouxXfFeEgGaAcCsSp%jr])"
977
+ /* conversion */
978
+ ].join(""), t = new RegExp(n), e = Array.prototype.slice.call(arguments, 1), r, i, f, y, _, b, x, E, I, S = "", q = 1;
979
+ for (o.equal("string", typeof s); (I = t.exec(s)) !== null; ) {
980
+ if (S += I[1], s = s.substring(I[0].length), r = I[2] || "", i = I[3] || 0, f = I[4] || "", y = I[6], _ = !1, x = !1, b = " ", y == "%") {
981
+ S += "%";
982
+ continue;
983
+ }
984
+ if (e.length === 0)
985
+ throw new Error("too few args to sprintf");
986
+ if (E = e.shift(), q++, r.match(/[\' #]/))
987
+ throw new Error(
988
+ "unsupported flags: " + r
989
+ );
990
+ if (f.length > 0)
991
+ throw new Error(
992
+ "non-zero precision not supported"
993
+ );
994
+ switch (r.match(/-/) && (_ = !0), r.match(/0/) && (b = "0"), r.match(/\+/) && (x = !0), y) {
995
+ case "s":
996
+ if (E == null)
997
+ throw new Error("argument " + q + ": attempted to print undefined or null as a string");
998
+ S += p(b, i, _, E.toString());
999
+ break;
1000
+ case "d":
1001
+ E = Math.floor(E);
1002
+ /*jsl:fallthru*/
1003
+ case "f":
1004
+ x = x && E > 0 ? "+" : "", S += x + p(
1005
+ b,
1006
+ i,
1007
+ _,
1008
+ E.toString()
1009
+ );
1010
+ break;
1011
+ case "x":
1012
+ S += p(b, i, _, E.toString(16));
1013
+ break;
1014
+ case "j":
1015
+ i === 0 && (i = 10), S += g.inspect(E, !1, i);
1016
+ break;
1017
+ case "r":
1018
+ S += h(E);
1019
+ break;
1020
+ default:
1021
+ throw new Error("unsupported conversion: " + y);
1022
+ }
1023
+ }
1024
+ return S += s, S;
1025
+ }
1026
+ function u() {
1027
+ var s = Array.prototype.slice.call(arguments);
1028
+ s.unshift(process.stdout), l.apply(null, s);
1029
+ }
1030
+ function l(s) {
1031
+ var n = Array.prototype.slice.call(arguments, 1);
1032
+ return s.write(m.apply(this, n));
1033
+ }
1034
+ function p(s, n, t, e) {
1035
+ for (var r = e; r.length < n; )
1036
+ t ? r += s : r = s + r;
1037
+ return r;
1038
+ }
1039
+ function h(s) {
1040
+ var n;
1041
+ if (!(s instanceof Error))
1042
+ throw new Error(m("invalid type for %%r: %j", s));
1043
+ if (n = "EXCEPTION: " + s.constructor.name + ": " + s.stack, s.cause && typeof s.cause == "function") {
1044
+ var t = s.cause();
1045
+ t && (n += `
1046
+ Caused by: ` + h(t));
1047
+ }
1048
+ return n;
1049
+ }
1050
+ return le;
1051
+ }
1052
+ var N = {}, st;
1053
+ function cr() {
1054
+ if (st) return N;
1055
+ st = 1;
1056
+ function o(_) {
1057
+ return Array.isArray ? Array.isArray(_) : y(_) === "[object Array]";
1058
+ }
1059
+ N.isArray = o;
1060
+ function g(_) {
1061
+ return typeof _ == "boolean";
1062
+ }
1063
+ N.isBoolean = g;
1064
+ function m(_) {
1065
+ return _ === null;
1066
+ }
1067
+ N.isNull = m;
1068
+ function u(_) {
1069
+ return _ == null;
1070
+ }
1071
+ N.isNullOrUndefined = u;
1072
+ function l(_) {
1073
+ return typeof _ == "number";
1074
+ }
1075
+ N.isNumber = l;
1076
+ function p(_) {
1077
+ return typeof _ == "string";
1078
+ }
1079
+ N.isString = p;
1080
+ function h(_) {
1081
+ return typeof _ == "symbol";
1082
+ }
1083
+ N.isSymbol = h;
1084
+ function s(_) {
1085
+ return _ === void 0;
1086
+ }
1087
+ N.isUndefined = s;
1088
+ function n(_) {
1089
+ return y(_) === "[object RegExp]";
1090
+ }
1091
+ N.isRegExp = n;
1092
+ function t(_) {
1093
+ return typeof _ == "object" && _ !== null;
1094
+ }
1095
+ N.isObject = t;
1096
+ function e(_) {
1097
+ return y(_) === "[object Date]";
1098
+ }
1099
+ N.isDate = e;
1100
+ function r(_) {
1101
+ return y(_) === "[object Error]" || _ instanceof Error;
1102
+ }
1103
+ N.isError = r;
1104
+ function i(_) {
1105
+ return typeof _ == "function";
1106
+ }
1107
+ N.isFunction = i;
1108
+ function f(_) {
1109
+ return _ === null || typeof _ == "boolean" || typeof _ == "number" || typeof _ == "string" || typeof _ == "symbol" || // ES6 symbol
1110
+ typeof _ > "u";
1111
+ }
1112
+ N.isPrimitive = f, N.isBuffer = Buffer.isBuffer;
1113
+ function y(_) {
1114
+ return Object.prototype.toString.call(_);
1115
+ }
1116
+ return N;
1117
+ }
1118
+ var Pe, at;
1119
+ function lr() {
1120
+ if (at) return Pe;
1121
+ at = 1;
1122
+ var o = /* @__PURE__ */ qe(), g = de, m = /* @__PURE__ */ Mt(), u = cr().isError, l = m.sprintf;
1123
+ Pe = h, h.VError = h, h.SError = s, h.WError = t, h.MultiError = n;
1124
+ function p(e) {
1125
+ var r, i, f, y, _;
1126
+ if (o.object(e, "args"), o.bool(e.strict, "args.strict"), o.array(e.argv, "args.argv"), r = e.argv, r.length === 0)
1127
+ i = {}, f = [];
1128
+ else if (u(r[0]))
1129
+ i = { cause: r[0] }, f = r.slice(1);
1130
+ else if (typeof r[0] == "object") {
1131
+ i = {};
1132
+ for (_ in r[0])
1133
+ i[_] = r[0][_];
1134
+ f = r.slice(1);
1135
+ } else
1136
+ o.string(
1137
+ r[0],
1138
+ "first argument to VError, SError, or WError constructor must be a string, object, or Error"
1139
+ ), i = {}, f = r;
1140
+ return o.object(i), !i.strict && !e.strict && (f = f.map(function(b) {
1141
+ return b === null ? "null" : b === void 0 ? "undefined" : b;
1142
+ })), f.length === 0 ? y = "" : y = l.apply(null, f), {
1143
+ options: i,
1144
+ shortmessage: y
1145
+ };
1146
+ }
1147
+ function h() {
1148
+ var e, r, i, f, y, _, b;
1149
+ if (e = Array.prototype.slice.call(arguments, 0), !(this instanceof h))
1150
+ return r = Object.create(h.prototype), h.apply(r, arguments), r;
1151
+ if (i = p({
1152
+ argv: e,
1153
+ strict: !1
1154
+ }), i.options.name && (o.string(
1155
+ i.options.name,
1156
+ `error's "name" must be a string`
1157
+ ), this.name = i.options.name), this.jse_shortmsg = i.shortmessage, _ = i.shortmessage, f = i.options.cause, f && (o.ok(u(f), "cause is not an Error"), this.jse_cause = f, i.options.skipCauseMessage || (_ += ": " + f.message)), this.jse_info = {}, i.options.info)
1158
+ for (b in i.options.info)
1159
+ this.jse_info[b] = i.options.info[b];
1160
+ return this.message = _, Error.call(this, _), Error.captureStackTrace && (y = i.options.constructorOpt || this.constructor, Error.captureStackTrace(this, y)), this;
1161
+ }
1162
+ g.inherits(h, Error), h.prototype.name = "VError", h.prototype.toString = function() {
1163
+ var r = this.hasOwnProperty("name") && this.name || this.constructor.name || this.constructor.prototype.name;
1164
+ return this.message && (r += ": " + this.message), r;
1165
+ }, h.prototype.cause = function() {
1166
+ var r = h.cause(this);
1167
+ return r === null ? void 0 : r;
1168
+ }, h.cause = function(e) {
1169
+ return o.ok(u(e), "err must be an Error"), u(e.jse_cause) ? e.jse_cause : null;
1170
+ }, h.info = function(e) {
1171
+ var r, i, f;
1172
+ if (o.ok(u(e), "err must be an Error"), i = h.cause(e), i !== null ? r = h.info(i) : r = {}, typeof e.jse_info == "object" && e.jse_info !== null)
1173
+ for (f in e.jse_info)
1174
+ r[f] = e.jse_info[f];
1175
+ return r;
1176
+ }, h.findCauseByName = function(e, r) {
1177
+ var i;
1178
+ for (o.ok(u(e), "err must be an Error"), o.string(r, "name"), o.ok(r.length > 0, "name cannot be empty"), i = e; i !== null; i = h.cause(i))
1179
+ if (o.ok(u(i)), i.name == r)
1180
+ return i;
1181
+ return null;
1182
+ }, h.hasCauseWithName = function(e, r) {
1183
+ return h.findCauseByName(e, r) !== null;
1184
+ }, h.fullStack = function(e) {
1185
+ o.ok(u(e), "err must be an Error");
1186
+ var r = h.cause(e);
1187
+ return r ? e.stack + `
1188
+ caused by: ` + h.fullStack(r) : e.stack;
1189
+ }, h.errorFromList = function(e) {
1190
+ return o.arrayOfObject(e, "errors"), e.length === 0 ? null : (e.forEach(function(r) {
1191
+ o.ok(u(r));
1192
+ }), e.length == 1 ? e[0] : new n(e));
1193
+ }, h.errorForEach = function(e, r) {
1194
+ o.ok(u(e), "err must be an Error"), o.func(r, "func"), e instanceof n ? e.errors().forEach(function(f) {
1195
+ r(f);
1196
+ }) : r(e);
1197
+ };
1198
+ function s() {
1199
+ var e, r, i, f;
1200
+ return e = Array.prototype.slice.call(arguments, 0), this instanceof s ? (i = p({
1201
+ argv: e,
1202
+ strict: !0
1203
+ }), f = i.options, h.call(this, f, "%s", i.shortmessage), this) : (r = Object.create(s.prototype), s.apply(r, arguments), r);
1204
+ }
1205
+ g.inherits(s, h);
1206
+ function n(e) {
1207
+ o.array(e, "list of errors"), o.ok(e.length > 0, "must be at least one error"), this.ase_errors = e, h.call(this, {
1208
+ cause: e[0]
1209
+ }, "first of %d error%s", e.length, e.length == 1 ? "" : "s");
1210
+ }
1211
+ g.inherits(n, h), n.prototype.name = "MultiError", n.prototype.errors = function() {
1212
+ return this.ase_errors.slice(0);
1213
+ };
1214
+ function t() {
1215
+ var e, r, i, f;
1216
+ return e = Array.prototype.slice.call(arguments, 0), this instanceof t ? (i = p({
1217
+ argv: e,
1218
+ strict: !1
1219
+ }), f = i.options, f.skipCauseMessage = !0, h.call(this, f, "%s", i.shortmessage), this) : (r = Object.create(t.prototype), t.apply(r, e), r);
1220
+ }
1221
+ return g.inherits(t, h), t.prototype.name = "WError", t.prototype.toString = function() {
1222
+ var r = this.hasOwnProperty("name") && this.name || this.constructor.name || this.constructor.prototype.name;
1223
+ return this.message && (r += ": " + this.message), this.jse_cause && this.jse_cause.message && (r += "; caused by " + this.jse_cause.toString()), r;
1224
+ }, t.prototype.cause = function(r) {
1225
+ return u(r) && (this.jse_cause = r), this.jse_cause;
1226
+ }, Pe;
1227
+ }
1228
+ var Oe = { exports: {} }, dr = Oe.exports, ut;
1229
+ function hr() {
1230
+ return ut || (ut = 1, (function(o) {
1231
+ (function(g, m) {
1232
+ o.exports ? o.exports = m() : g.jsonSchema = m();
1233
+ })(dr, function() {
1234
+ var g = u;
1235
+ g.Integer = { type: "integer" };
1236
+ var m = {
1237
+ String,
1238
+ Boolean,
1239
+ Number,
1240
+ Object,
1241
+ Array,
1242
+ Date
1243
+ };
1244
+ g.validate = u;
1245
+ function u(l, p) {
1246
+ return u(l, p, { changing: !1 });
1247
+ }
1248
+ g.checkPropertyChange = function(l, p, h) {
1249
+ return u(l, p, { changing: h || "property" });
1250
+ };
1251
+ var u = g._validate = function(l, p, h) {
1252
+ h || (h = {});
1253
+ var s = h.changing;
1254
+ function n(i) {
1255
+ return i.type || m[i.name] == i && i.name.toLowerCase();
1256
+ }
1257
+ var t = [];
1258
+ function e(i, f, y, _) {
1259
+ var b;
1260
+ y += y ? typeof _ == "number" ? "[" + _ + "]" : typeof _ > "u" ? "" : "." + _ : _;
1261
+ function x(c) {
1262
+ t.push({ property: y, message: c });
1263
+ }
1264
+ if ((typeof f != "object" || f instanceof Array) && (y || typeof f != "function") && !(f && n(f)))
1265
+ return typeof f == "function" ? i instanceof f || x("is not an instance of the class/constructor " + f.name) : f && x("Invalid schema/property definition " + f), null;
1266
+ s && f.readonly && x("is a readonly field, it can not be changed"), f.extends && e(i, f.extends, y, _);
1267
+ function E(c, v) {
1268
+ if (c) {
1269
+ if (typeof c == "string" && c != "any" && (c == "null" ? v !== null : typeof v != c) && !(v instanceof Array && c == "array") && !(v instanceof Date && c == "date") && !(c == "integer" && v % 1 === 0))
1270
+ return [{ property: y, message: v + " - " + typeof v + " value found, but a " + c + " is required" }];
1271
+ if (c instanceof Array) {
1272
+ for (var O = [], P = 0; P < c.length && (O = E(c[P], v)).length; P++)
1273
+ ;
1274
+ if (O.length)
1275
+ return O;
1276
+ } else if (typeof c == "object") {
1277
+ var R = t;
1278
+ t = [], e(v, c, y);
1279
+ var M = t;
1280
+ return t = R, M;
1281
+ }
1282
+ }
1283
+ return [];
1284
+ }
1285
+ if (i === void 0)
1286
+ f.required && x("is missing and it is required");
1287
+ else if (t = t.concat(E(n(f), i)), f.disallow && !E(f.disallow, i).length && x(" disallowed value was matched"), i !== null) {
1288
+ if (i instanceof Array) {
1289
+ if (f.items) {
1290
+ var I = f.items instanceof Array, S = f.items;
1291
+ for (_ = 0, b = i.length; _ < b; _ += 1)
1292
+ I && (S = f.items[_]), h.coerce && (i[_] = h.coerce(i[_], S)), t.concat(e(i[_], S, y, _));
1293
+ }
1294
+ f.minItems && i.length < f.minItems && x("There must be a minimum of " + f.minItems + " in the array"), f.maxItems && i.length > f.maxItems && x("There must be a maximum of " + f.maxItems + " in the array");
1295
+ } else (f.properties || f.additionalProperties) && t.concat(r(i, f.properties, y, f.additionalProperties));
1296
+ if (f.pattern && typeof i == "string" && !i.match(f.pattern) && x("does not match the regex pattern " + f.pattern), f.maxLength && typeof i == "string" && i.length > f.maxLength && x("may only be " + f.maxLength + " characters long"), f.minLength && typeof i == "string" && i.length < f.minLength && x("must be at least " + f.minLength + " characters long"), typeof f.minimum < "u" && typeof i == typeof f.minimum && f.minimum > i && x("must have a minimum value of " + f.minimum), typeof f.maximum < "u" && typeof i == typeof f.maximum && f.maximum < i && x("must have a maximum value of " + f.maximum), f.enum) {
1297
+ var q = f.enum;
1298
+ b = q.length;
1299
+ for (var F, d = 0; d < b; d++)
1300
+ if (q[d] === i) {
1301
+ F = 1;
1302
+ break;
1303
+ }
1304
+ F || x("does not have a value in the enumeration " + q.join(", "));
1305
+ }
1306
+ typeof f.maxDecimal == "number" && i.toString().match(new RegExp("\\.[0-9]{" + (f.maxDecimal + 1) + ",}")) && x("may only have " + f.maxDecimal + " digits of decimal places");
1307
+ }
1308
+ return null;
1309
+ }
1310
+ function r(i, f, y, _) {
1311
+ if (typeof f == "object") {
1312
+ (typeof i != "object" || i instanceof Array) && t.push({ property: y, message: "an object is required" });
1313
+ for (var b in f)
1314
+ if (f.hasOwnProperty(b) && b != "__proto__" && b != "constructor") {
1315
+ var x = i.hasOwnProperty(b) ? i[b] : void 0;
1316
+ if (x === void 0 && h.existingOnly) continue;
1317
+ var E = f[b];
1318
+ x === void 0 && E.default && (x = i[b] = E.default), h.coerce && b in i && (x = i[b] = h.coerce(x, E)), e(x, E, y, b);
1319
+ }
1320
+ }
1321
+ for (b in i) {
1322
+ if (i.hasOwnProperty(b) && !(b.charAt(0) == "_" && b.charAt(1) == "_") && f && !f[b] && _ === !1)
1323
+ if (h.filter) {
1324
+ delete i[b];
1325
+ continue;
1326
+ } else
1327
+ t.push({ property: y, message: "The property " + b + " is not defined in the schema and the schema does not allow additional properties" });
1328
+ var I = f && f[b] && f[b].requires;
1329
+ I && !(I in i) && t.push({ property: y, message: "the presence of the property " + b + " requires that " + I + " also be present" }), x = i[b], _ && (!(f && typeof f == "object") || !(b in f)) && (h.coerce && (x = i[b] = h.coerce(x, _)), e(x, _, y, b)), !s && x && x.$schema && (t = t.concat(e(x, x.$schema, y, b)));
1330
+ }
1331
+ return t;
1332
+ }
1333
+ return p && e(l, p, "", s || ""), !s && l && l.$schema && e(l, l.$schema, "", ""), { valid: !t.length, errors: t };
1334
+ };
1335
+ return g.mustBeValid = function(l) {
1336
+ if (!l.valid)
1337
+ throw new TypeError(l.errors.map(function(p) {
1338
+ return "for property " + p.property + ": " + p.message;
1339
+ }).join(`,
1340
+ `));
1341
+ }, g;
1342
+ });
1343
+ })(Oe)), Oe.exports;
1344
+ }
1345
+ var ft;
1346
+ function pr() {
1347
+ if (ft) return B;
1348
+ ft = 1;
1349
+ var o = /* @__PURE__ */ qe(), g = /* @__PURE__ */ Mt(), m = /* @__PURE__ */ lr(), u = /* @__PURE__ */ hr();
1350
+ B.deepCopy = l, B.deepEqual = p, B.isEmpty = h, B.hasKey = s, B.forEachKey = n, B.pluck = t, B.flattenObject = f, B.flattenIter = r, B.validateJsonObject = Te, B.validateJsonObjectJS = Te, B.randElt = Wt, B.extraProperties = Zt, B.mergeObjects = $e, B.startsWith = y, B.endsWith = _, B.parseInteger = Lt, B.iso8601 = b, B.rfc1123 = I, B.parseDateTime = S, B.hrtimediff = Ne, B.hrtimeDiff = Ne, B.hrtimeAccum = ke, B.hrtimeAdd = Kt, B.hrtimeNanosec = Ht, B.hrtimeMicrosec = Gt, B.hrtimeMillisec = Jt;
1351
+ function l(a) {
1352
+ var w, A, C = "__deepCopy";
1353
+ if (a && a[C])
1354
+ throw new Error("attempted deep copy of cyclic object");
1355
+ if (a && a.constructor == Object) {
1356
+ w = {}, a[C] = !0;
1357
+ for (A in a)
1358
+ A != C && (w[A] = l(a[A]));
1359
+ return delete a[C], w;
1360
+ }
1361
+ if (a && a.constructor == Array) {
1362
+ for (w = [], a[C] = !0, A = 0; A < a.length; A++)
1363
+ w.push(l(a[A]));
1364
+ return delete a[C], w;
1365
+ }
1366
+ return a;
1367
+ }
1368
+ function p(a, w) {
1369
+ if (typeof a != typeof w)
1370
+ return !1;
1371
+ if (a === null || w === null || typeof a != "object")
1372
+ return a === w;
1373
+ if (a.constructor != w.constructor)
1374
+ return !1;
1375
+ var A;
1376
+ for (A in a)
1377
+ if (!(A in w) || !p(a[A], w[A]))
1378
+ return !1;
1379
+ for (A in w)
1380
+ if (!(A in a))
1381
+ return !1;
1382
+ return !0;
1383
+ }
1384
+ function h(a) {
1385
+ var w;
1386
+ for (w in a)
1387
+ return !1;
1388
+ return !0;
1389
+ }
1390
+ function s(a, w) {
1391
+ return o.equal(typeof w, "string"), Object.prototype.hasOwnProperty.call(a, w);
1392
+ }
1393
+ function n(a, w) {
1394
+ for (var A in a)
1395
+ s(a, A) && w(A, a[A]);
1396
+ }
1397
+ function t(a, w) {
1398
+ return o.equal(typeof w, "string"), e(a, w);
1399
+ }
1400
+ function e(a, w) {
1401
+ if (!(a === null || typeof a != "object")) {
1402
+ if (a.hasOwnProperty(w))
1403
+ return a[w];
1404
+ var A = w.indexOf(".");
1405
+ if (A != -1) {
1406
+ var C = w.substr(0, A);
1407
+ if (a.hasOwnProperty(C))
1408
+ return e(a[C], w.substr(A + 1));
1409
+ }
1410
+ }
1411
+ }
1412
+ function r(a, w, A) {
1413
+ i(a, w, [], A);
1414
+ }
1415
+ function i(a, w, A, C) {
1416
+ var j, k;
1417
+ if (w === 0) {
1418
+ j = A.slice(0), j.push(a), C(j);
1419
+ return;
1420
+ }
1421
+ o.ok(a !== null), o.equal(typeof a, "object"), o.equal(typeof w, "number"), o.ok(w >= 0);
1422
+ for (k in a)
1423
+ j = A.slice(0), j.push(k), i(a[k], w - 1, j, C);
1424
+ }
1425
+ function f(a, w) {
1426
+ if (w === 0)
1427
+ return [a];
1428
+ o.ok(a !== null), o.equal(typeof a, "object"), o.equal(typeof w, "number"), o.ok(w >= 0);
1429
+ var A = [], C;
1430
+ for (C in a)
1431
+ f(a[C], w - 1).forEach(function(j) {
1432
+ A.push([C].concat(j));
1433
+ });
1434
+ return A;
1435
+ }
1436
+ function y(a, w) {
1437
+ return a.substr(0, w.length) == w;
1438
+ }
1439
+ function _(a, w) {
1440
+ return a.substr(
1441
+ a.length - w.length,
1442
+ w.length
1443
+ ) == w;
1444
+ }
1445
+ function b(a) {
1446
+ return typeof a == "number" && (a = new Date(a)), o.ok(a.constructor === Date), g.sprintf(
1447
+ "%4d-%02d-%02dT%02d:%02d:%02d.%03dZ",
1448
+ a.getUTCFullYear(),
1449
+ a.getUTCMonth() + 1,
1450
+ a.getUTCDate(),
1451
+ a.getUTCHours(),
1452
+ a.getUTCMinutes(),
1453
+ a.getUTCSeconds(),
1454
+ a.getUTCMilliseconds()
1455
+ );
1456
+ }
1457
+ var x = [
1458
+ "Jan",
1459
+ "Feb",
1460
+ "Mar",
1461
+ "Apr",
1462
+ "May",
1463
+ "Jun",
1464
+ "Jul",
1465
+ "Aug",
1466
+ "Sep",
1467
+ "Oct",
1468
+ "Nov",
1469
+ "Dec"
1470
+ ], E = [
1471
+ "Sun",
1472
+ "Mon",
1473
+ "Tue",
1474
+ "Wed",
1475
+ "Thu",
1476
+ "Fri",
1477
+ "Sat"
1478
+ ];
1479
+ function I(a) {
1480
+ return g.sprintf(
1481
+ "%s, %02d %s %04d %02d:%02d:%02d GMT",
1482
+ E[a.getUTCDay()],
1483
+ a.getUTCDate(),
1484
+ x[a.getUTCMonth()],
1485
+ a.getUTCFullYear(),
1486
+ a.getUTCHours(),
1487
+ a.getUTCMinutes(),
1488
+ a.getUTCSeconds()
1489
+ );
1490
+ }
1491
+ function S(a) {
1492
+ var w = +a;
1493
+ return isNaN(w) ? new Date(a) : new Date(w);
1494
+ }
1495
+ var q = Number.MAX_SAFE_INTEGER || 9007199254740991, F = Number.MIN_SAFE_INTEGER || -9007199254740991, d = {
1496
+ base: 10,
1497
+ allowSign: !0,
1498
+ allowPrefix: !1,
1499
+ allowTrailing: !1,
1500
+ allowImprecise: !1,
1501
+ trimWhitespace: !1,
1502
+ leadingZeroIsOctal: !1
1503
+ }, c = 48, v = 57, O = 65, P = 66, R = 79, M = 84, $ = 88, L = 90, T = 97, he = 98, Ut = 111, Ft = 116, Dt = 120, Tt = 122, Nt = 48, kt = 55, $t = 87;
1504
+ function Lt(a, w) {
1505
+ o.string(a, "str"), o.optionalObject(w, "options");
1506
+ var A = !1, C = d;
1507
+ w && (A = s(w, "base"), C = $e(C, w), o.number(C.base, "options.base"), o.ok(C.base >= 2, "options.base >= 2"), o.ok(C.base <= 36, "options.base <= 36"), o.bool(C.allowSign, "options.allowSign"), o.bool(C.allowPrefix, "options.allowPrefix"), o.bool(
1508
+ C.allowTrailing,
1509
+ "options.allowTrailing"
1510
+ ), o.bool(
1511
+ C.allowImprecise,
1512
+ "options.allowImprecise"
1513
+ ), o.bool(
1514
+ C.trimWhitespace,
1515
+ "options.trimWhitespace"
1516
+ ), o.bool(
1517
+ C.leadingZeroIsOctal,
1518
+ "options.leadingZeroIsOctal"
1519
+ ), C.leadingZeroIsOctal && o.ok(
1520
+ !A,
1521
+ '"base" and "leadingZeroIsOctal" are mutually exclusive'
1522
+ ));
1523
+ var j, k = -1, z = C.base, X, ue = 1, fe = 0, D = 0, pe = a.length;
1524
+ if (C.trimWhitespace)
1525
+ for (; D < pe && De(a.charCodeAt(D)); )
1526
+ ++D;
1527
+ for (C.allowSign && (a[D] === "-" ? (D += 1, ue = -1) : a[D] === "+" && (D += 1)), a[D] === "0" && (C.allowPrefix && (k = Vt(a.charCodeAt(D + 1)), k !== -1 && (!A || k === z) && (z = k, D += 2)), k === -1 && C.leadingZeroIsOctal && (z = 8)), X = D; D < pe && (j = zt(a.charCodeAt(D)), j !== -1 && j < z); ++D)
1528
+ fe *= z, fe += j;
1529
+ if (X === D)
1530
+ return new Error("invalid number: " + JSON.stringify(a));
1531
+ if (C.trimWhitespace)
1532
+ for (; D < pe && De(a.charCodeAt(D)); )
1533
+ ++D;
1534
+ if (D < pe && !C.allowTrailing)
1535
+ return new Error("trailing characters after number: " + JSON.stringify(a.slice(D)));
1536
+ if (fe === 0)
1537
+ return 0;
1538
+ var Le = fe * ue;
1539
+ return !C.allowImprecise && (fe > q || Le < F) ? new Error("number is outside of the supported range: " + JSON.stringify(a.slice(X, D))) : Le;
1540
+ }
1541
+ function zt(a) {
1542
+ return a >= c && a <= v ? a - Nt : a >= O && a <= L ? a - kt : a >= T && a <= Tt ? a - $t : -1;
1543
+ }
1544
+ function De(a) {
1545
+ return a === 32 || a >= 9 && a <= 13 || a === 160 || a === 5760 || a === 6158 || a >= 8192 && a <= 8202 || a === 8232 || a === 8233 || a === 8239 || a === 8287 || a === 12288 || a === 65279;
1546
+ }
1547
+ function Vt(a) {
1548
+ return a === he || a === P ? 2 : a === Ut || a === R ? 8 : a === Ft || a === M ? 10 : a === Dt || a === $ ? 16 : -1;
1549
+ }
1550
+ function Te(a, w) {
1551
+ var A = u.validate(w, a);
1552
+ if (A.errors.length === 0)
1553
+ return null;
1554
+ var C = A.errors[0], j = C.property, k = C.message.toLowerCase(), z, X;
1555
+ (z = k.indexOf("the property ")) != -1 && (X = k.indexOf(" is not defined in the schema and the schema does not allow additional properties")) != -1 && (z += 13, j === "" ? j = k.substr(z, X - z) : j = j + "." + k.substr(z, X - z), k = "unsupported property");
1556
+ var ue = new m.VError('property "%s": %s', j, k);
1557
+ return ue.jsv_details = C, ue;
1558
+ }
1559
+ function Wt(a) {
1560
+ return o.ok(
1561
+ Array.isArray(a) && a.length > 0,
1562
+ "randElt argument must be a non-empty array"
1563
+ ), a[Math.floor(Math.random() * a.length)];
1564
+ }
1565
+ function Z(a) {
1566
+ o.ok(
1567
+ a[0] >= 0 && a[1] >= 0,
1568
+ "negative numbers not allowed in hrtimes"
1569
+ ), o.ok(a[1] < 1e9, "nanoseconds column overflow");
1570
+ }
1571
+ function Ne(a, w) {
1572
+ Z(a), Z(w), o.ok(
1573
+ a[0] > w[0] || a[0] == w[0] && a[1] >= w[1],
1574
+ "negative differences not allowed"
1575
+ );
1576
+ var A = [a[0] - w[0], 0];
1577
+ return a[1] >= w[1] ? A[1] = a[1] - w[1] : (A[0]--, A[1] = 1e9 - (w[1] - a[1])), A;
1578
+ }
1579
+ function Ht(a) {
1580
+ return Z(a), Math.floor(a[0] * 1e9 + a[1]);
1581
+ }
1582
+ function Gt(a) {
1583
+ return Z(a), Math.floor(a[0] * 1e6 + a[1] / 1e3);
1584
+ }
1585
+ function Jt(a) {
1586
+ return Z(a), Math.floor(a[0] * 1e3 + a[1] / 1e6);
1587
+ }
1588
+ function ke(a, w) {
1589
+ return Z(a), Z(w), a[1] += w[1], a[1] >= 1e9 && (a[0]++, a[1] -= 1e9), a[0] += w[0], a;
1590
+ }
1591
+ function Kt(a, w) {
1592
+ Z(a);
1593
+ var A = [a[0], a[1]];
1594
+ return ke(A, w);
1595
+ }
1596
+ function Zt(a, w) {
1597
+ o.ok(
1598
+ typeof a == "object" && a !== null,
1599
+ "obj argument must be a non-null object"
1600
+ ), o.ok(
1601
+ Array.isArray(w),
1602
+ "allowed argument must be an array of strings"
1603
+ );
1604
+ for (var A = 0; A < w.length; A++)
1605
+ o.ok(
1606
+ typeof w[A] == "string",
1607
+ "allowed argument must be an array of strings"
1608
+ );
1609
+ return Object.keys(a).filter(function(C) {
1610
+ return w.indexOf(C) === -1;
1611
+ });
1612
+ }
1613
+ function $e(a, w, A) {
1614
+ var C, j;
1615
+ if (C = {}, A)
1616
+ for (j in A)
1617
+ C[j] = A[j];
1618
+ if (a)
1619
+ for (j in a)
1620
+ C[j] = a[j];
1621
+ if (w)
1622
+ for (j in w)
1623
+ C[j] = w[j];
1624
+ return C;
1625
+ }
1626
+ return B;
1627
+ }
1628
+ var Se, ct;
1629
+ function _r() {
1630
+ if (ct) return Se;
1631
+ ct = 1;
1632
+ var o = /* @__PURE__ */ qe(), g = /* @__PURE__ */ pr(), m = de;
1633
+ function u(d, c, v) {
1634
+ Error.captureStackTrace && Error.captureStackTrace(this, u), this.input = d, this.message = c, v !== void 0 && (this.message += " at index " + v);
1635
+ }
1636
+ m.inherits(u, Error);
1637
+ function l(d, c) {
1638
+ return (c + d % c) % c;
1639
+ }
1640
+ function p(d) {
1641
+ var c;
1642
+ return c = (d[0] >> 8) + "." + (d[0] & 255) + ".", c += (d[1] >> 8) + "." + (d[1] & 255), c;
1643
+ }
1644
+ function h(d) {
1645
+ return !!(typeof d == "object" && Array.isArray(d._fields) && typeof d._attrs == "object");
1646
+ }
1647
+ function s(d) {
1648
+ if (typeof d == "string")
1649
+ return I(d);
1650
+ if (h(d))
1651
+ return d;
1652
+ throw new Error("Invalid argument: Addr or parsable string expected");
1653
+ }
1654
+ function n(d, c, v) {
1655
+ var O, P = null, R = 0;
1656
+ if (c) {
1657
+ var M = null, $ = null;
1658
+ for (O = 0; O < d.length; O++)
1659
+ d[O] === 0 ? M === null ? (M = O, $ = 1) : $++ : M !== null && ($ > R && (P = M, R = $), M = null);
1660
+ M !== null && $ > R && (P = M, R = $);
1661
+ }
1662
+ var L = [], T;
1663
+ for (O = 0; O < d.length; O++) {
1664
+ if (P !== null) {
1665
+ if (O === P) {
1666
+ if (R === 8)
1667
+ return ["::"];
1668
+ P === 0 || P + R === d.length ? L.push(":") : L.push("");
1669
+ }
1670
+ if (O >= P && O < P + R)
1671
+ continue;
1672
+ }
1673
+ T = d[O].toString(16), v && T.length != 4 && (T = "0000".slice(T.length) + T), L.push(T);
1674
+ }
1675
+ return L;
1676
+ }
1677
+ function t(d) {
1678
+ var c = [0, 0, 0, 0, 0, 65535], v;
1679
+ for (v = 0; v < 6; v++)
1680
+ if (d[v] != c[v])
1681
+ return !1;
1682
+ return !0;
1683
+ }
1684
+ function e(d) {
1685
+ o.number(d), d = d | 0, o.ok(d <= 128), o.ok(d >= 0);
1686
+ var c = new y(), v;
1687
+ for (v = 0; d > 16; v++, d -= 16)
1688
+ c._fields[v] = 65535;
1689
+ return d > 0 && (c._fields[v] = 65535 - ((1 << 16 - d) - 1)), c;
1690
+ }
1691
+ function r(d) {
1692
+ if (typeof d == "string")
1693
+ return new _(d);
1694
+ if (d instanceof _)
1695
+ return d;
1696
+ throw new Error("Invalid argument: CIDR or parsable string expected");
1697
+ }
1698
+ var i = {
1699
+ format: "auto",
1700
+ // Control format of printed address
1701
+ zeroElide: !0,
1702
+ // Elide longest run of zeros
1703
+ zeroPad: !1
1704
+ // Pad with zeros when a group would print as < 4 chars
1705
+ };
1706
+ function f(d, c) {
1707
+ return d && d.hasOwnProperty(c) ? d[c] : i[c];
1708
+ }
1709
+ function y() {
1710
+ this._fields = [0, 0, 0, 0, 0, 0, 0, 0], this._attrs = {};
1711
+ }
1712
+ y.prototype.kind = function() {
1713
+ return b.contains(this) ? "ipv4" : "ipv6";
1714
+ }, y.prototype.toString = function(c) {
1715
+ o.optionalObject(c, "opts");
1716
+ var v = f(c, "format"), O = f(c, "zeroElide"), P = f(c, "zeroPad");
1717
+ switch (o.string(v, "opts.format"), o.bool(O, "opts.zeroElide"), o.bool(P, "opts.zeroPad"), v === "auto" && (this._attrs.ipv4Bare ? v = "v4" : this._attrs.ipv4Mapped ? v = "v4-mapped" : v = "v6"), v) {
1718
+ // Print in dotted-quad notation (but only if truly IPv4)
1719
+ case "v4":
1720
+ if (!b.contains(this))
1721
+ throw new Error("cannot print non-v4 address in dotted quad notation");
1722
+ return p(this._fields.slice(6));
1723
+ // Print as an IPv4-mapped IPv6 address
1724
+ case "v4-mapped":
1725
+ if (!b.contains(this))
1726
+ throw new Error("cannot print non-v4 address as a v4-mapped address");
1727
+ var R = n(this._fields.slice(0, 6), O, P);
1728
+ return R.push(p(this._fields.slice(6))), R.join(":");
1729
+ // Print as an IPv6 address
1730
+ case "v6":
1731
+ return n(this._fields, O, P).join(":");
1732
+ // Unrecognized formatting method
1733
+ default:
1734
+ throw new Error('unrecognized format method "' + v + '"');
1735
+ }
1736
+ }, y.prototype.toBuffer = function(c) {
1737
+ if (c !== void 0) {
1738
+ if (!Buffer.isBuffer(c))
1739
+ throw new Error("optional arg must be Buffer");
1740
+ } else
1741
+ c = new Buffer(16);
1742
+ var v;
1743
+ for (v = 0; v < 8; v++)
1744
+ c.writeUInt16BE(this._fields[v], v * 2);
1745
+ return c;
1746
+ }, y.prototype.toLong = function() {
1747
+ if (!b.contains(this))
1748
+ throw new Error("only possible for ipv4-mapped addresses");
1749
+ return (this._fields[6] << 16 >>> 0) + this._fields[7];
1750
+ }, y.prototype.clone = function() {
1751
+ var c = new y();
1752
+ c._fields = this._fields.slice();
1753
+ for (var v in this._attrs)
1754
+ c._attrs[v] = this._attrs[v];
1755
+ return c;
1756
+ }, y.prototype.offset = function(c) {
1757
+ if (c < -4294967295 || c > 4294967295)
1758
+ throw new Error("offsets should be between -4294967295 and 4294967295");
1759
+ var v = this.clone(), O, P;
1760
+ for (O = 7; O >= 0 && (P = v._fields[O] + c, P > 65535 ? (c = P >>> 16, P = P & 65535) : P < 0 ? (c = Math.floor(P / 65536), P = l(P, 65536)) : c = 0, v._fields[O] = P, c !== 0); O--)
1761
+ if (O === 0 || O === 6 && this._attrs.ipv4Mapped)
1762
+ return null;
1763
+ return v;
1764
+ }, y.prototype.and = function(c) {
1765
+ c = s(c);
1766
+ var v, O = this.clone();
1767
+ for (v = 0; v < 8; v++)
1768
+ O._fields[v] = O._fields[v] & c._fields[v];
1769
+ return O;
1770
+ }, y.prototype.or = function(c) {
1771
+ c = s(c);
1772
+ var v, O = this.clone();
1773
+ for (v = 0; v < 8; v++)
1774
+ O._fields[v] = O._fields[v] | c._fields[v];
1775
+ return O;
1776
+ }, y.prototype.not = function() {
1777
+ var c, v = this.clone();
1778
+ for (c = 0; c < 8; c++)
1779
+ v._fields[c] = ~v._fields[c] & 65535;
1780
+ return v;
1781
+ }, y.prototype.compare = function(c) {
1782
+ return F(this, c);
1783
+ };
1784
+ function _(d, c) {
1785
+ if (c === void 0) {
1786
+ o.string(d);
1787
+ var v = d.match(/^([a-fA-F0-9:.]+)\/([0-9]+)$/);
1788
+ if (v === null)
1789
+ throw new Error("Invalid argument: <addr>/<prefix> expected");
1790
+ d = v[1], c = parseInt(v[2], 10);
1791
+ }
1792
+ if (o.number(c), c = c | 0, d = s(d), d._attrs.ipv4Bare && (c += 96), c < 0 || c > 128)
1793
+ throw new Error("Invalid prefix length");
1794
+ this._prefix = c, this._mask = e(c), this._addr = d.and(this._mask);
1795
+ }
1796
+ _.prototype.contains = function(c) {
1797
+ return c = s(c), this._addr.compare(c.and(this._mask)) === 0;
1798
+ }, _.prototype.first = function() {
1799
+ return this._prefix >= 127 ? this._addr : this._addr.offset(1);
1800
+ }, _.prototype.last = function() {
1801
+ var c = this._addr.or(this._mask.not());
1802
+ return this._prefix >= 127 ? c : this._addr._attrs.ipv4Mapped ? c.offset(-1) : c;
1803
+ }, _.prototype.broadcast = function() {
1804
+ if (!b.contains(this._addr))
1805
+ throw new Error("Only IPv4 networks have broadcast addresses");
1806
+ return this._addr.or(this._mask.not());
1807
+ }, _.prototype.compare = function(c) {
1808
+ return x(this, c);
1809
+ }, _.prototype.prefixLength = function(c) {
1810
+ switch (o.optionalString(c, "format"), (c === void 0 || c === "auto") && (c = this._addr._attrs.ipv4Bare ? "v4" : "v6"), c) {
1811
+ case "v4":
1812
+ if (!b.contains(this._addr))
1813
+ throw new Error("cannot return v4 prefix length for non-v4 address");
1814
+ return this._prefix - 96;
1815
+ case "v6":
1816
+ return this._prefix;
1817
+ default:
1818
+ throw new Error('unrecognized format method "' + c + '"');
1819
+ }
1820
+ }, _.prototype.address = function() {
1821
+ return this._addr;
1822
+ }, _.prototype.toString = function(c) {
1823
+ o.optionalObject(c, "opts");
1824
+ var v = f(c, "format");
1825
+ return v === "v4-mapped" && (v = "v6"), this._addr.toString(c) + "/" + this.prefixLength(v);
1826
+ };
1827
+ var b = new _("::ffff:0:0", 96);
1828
+ function x(d, c) {
1829
+ d = r(d), c = r(c);
1830
+ var v = F(d._addr, c._addr);
1831
+ return v === 0 ? c._prefix - d._prefix : v;
1832
+ }
1833
+ function E(d, c) {
1834
+ if (d = s(d), c = s(c), d.compare(c) > 0)
1835
+ throw new Error("begin address must be <= end address");
1836
+ this._begin = d, this._end = c;
1837
+ }
1838
+ E.prototype.contains = function(c) {
1839
+ return c = s(c), this._begin.compare(c) <= 0 && this._end.compare(c) >= 0;
1840
+ }, E.prototype.first = function() {
1841
+ return this._begin;
1842
+ }, E.prototype.last = function() {
1843
+ return this._end;
1844
+ };
1845
+ function I(d) {
1846
+ if (typeof d == "string")
1847
+ return S(d);
1848
+ if (typeof d == "number")
1849
+ return q(d);
1850
+ if (typeof d == "object" && h(d))
1851
+ return d;
1852
+ throw new Error("Invalid argument: only string|number allowed");
1853
+ }
1854
+ function S(d) {
1855
+ o.string(d), d = d.toLowerCase();
1856
+ var c = new y(), v = [], O = [], P = null, R = "", M, $;
1857
+ if (d.length > 40)
1858
+ throw new u(d, "Input too long");
1859
+ for (M = 0; M < d.length; M++)
1860
+ if ($ = d[M], $ === ":")
1861
+ if (M + 1 < d.length && d[M + 1] === ":") {
1862
+ if (P !== null)
1863
+ throw new u(d, "Multiple :: delimiters", M);
1864
+ R !== "" && (v.push(R), R = ""), P = v.length, M++;
1865
+ } else {
1866
+ if (R === "")
1867
+ throw new u(d, "illegal delimiter", M);
1868
+ v.push(R), R = "";
1869
+ }
1870
+ else $ === "." ? (O.push(R), R = "") : R = R + $;
1871
+ if (R !== "")
1872
+ O.length !== 0 ? O.push(R) : v.push(R), R = "";
1873
+ else if (P !== v.length || O.length > 0)
1874
+ throw new u(d, "Cannot end with delimiter besides ::");
1875
+ if (O.length === 0) {
1876
+ if (v.length > 8)
1877
+ throw new u(d, "Too many fields");
1878
+ if (v.length < 8 && P === null)
1879
+ throw new u(d, "Too few fields");
1880
+ } else {
1881
+ if (O.length !== 4)
1882
+ throw new u(d, "IPv4 portion must have 4 fields");
1883
+ if (v.length === 0 && P === null && (c._attrs.ipv4Bare = !0, v = ["ffff"], P = 0), v.length > 6)
1884
+ throw new u(d, "Too many fields");
1885
+ if (v.length < 6 && P === null)
1886
+ throw new u(d, "Too few fields");
1887
+ }
1888
+ var L, T;
1889
+ for (M = 0; M < v.length; M++) {
1890
+ if (L = v[M], T = g.parseInteger(L, { base: 16, allowSign: !1 }), T instanceof Error || T < 0 || T > 65535)
1891
+ throw new u(d, "Invalid field value: " + L);
1892
+ v[M] = T;
1893
+ }
1894
+ for (M = 0; M < O.length; M++) {
1895
+ if (L = O[M], T = g.parseInteger(L, { base: 10, allowSign: !1 }), T instanceof Error || T < 0 || T > 255)
1896
+ throw new u(d, "Invalid field value: " + L);
1897
+ O[M] = T;
1898
+ }
1899
+ if (O.length !== 0 && (v.push(O[0] * 256 + O[1]), v.push(O[2] * 256 + O[3])), v.length < 8 && P !== null) {
1900
+ var he = [];
1901
+ for (M = 0; M < 8 - v.length; M++)
1902
+ he.push(0);
1903
+ v = Array.prototype.concat(
1904
+ v.slice(0, P),
1905
+ he,
1906
+ v.slice(P)
1907
+ );
1908
+ }
1909
+ if (O.length !== 0)
1910
+ if (t(v))
1911
+ c._attrs.ipv4Mapped = !0;
1912
+ else
1913
+ throw new u(d, "invalid dotted-quad notation");
1914
+ return c._fields = v, c;
1915
+ }
1916
+ function q(d) {
1917
+ if (o.number(d), d !== Math.floor(d))
1918
+ throw new Error("Value must be integer");
1919
+ if (d < 0 || d > 4294967295)
1920
+ throw new Error("Value must be 32 bit");
1921
+ var c = new y();
1922
+ return c._fields[7] = d & 65535, c._fields[6] = d >>> 16, c._fields[5] = 65535, c._attrs.ipv4Bare = !0, c._attrs.ipv4Mapped = !0, c;
1923
+ }
1924
+ function F(d, c) {
1925
+ d = s(d), c = s(c);
1926
+ var v;
1927
+ for (v = 0; v < 8; v++) {
1928
+ if (d._fields[v] < c._fields[v])
1929
+ return -1;
1930
+ if (d._fields[v] > c._fields[v])
1931
+ return 1;
1932
+ }
1933
+ return 0;
1934
+ }
1935
+ return Se = {
1936
+ parse: I,
1937
+ compare: F,
1938
+ createCIDR: function(d, c) {
1939
+ return new _(d, c);
1940
+ },
1941
+ compareCIDR: x,
1942
+ createAddrRange: function(d, c) {
1943
+ return new E(d, c);
1944
+ }
1945
+ }, Se;
1946
+ }
1947
+ var U = {}, be = {}, lt;
1948
+ function vr() {
1949
+ if (lt) return be;
1950
+ lt = 1, Object.defineProperty(be, "__esModule", { value: !0 });
1951
+ let o = class {
1952
+ constructor(m, u, l) {
1953
+ this.ipAddress = u, this.isAnonymous = !!m.is_anonymous, this.isAnonymousVpn = !!m.is_anonymous_vpn, this.isHostingProvider = !!m.is_hosting_provider, this.isPublicProxy = !!m.is_public_proxy, this.isResidentialProxy = !!m.is_residential_proxy, this.isTorExitNode = !!m.is_tor_exit_node, this.network = l;
1954
+ }
1955
+ };
1956
+ return be.default = o, be;
1957
+ }
1958
+ var we = {}, dt;
1959
+ function Rt() {
1960
+ if (dt) return we;
1961
+ dt = 1, Object.defineProperty(we, "__esModule", { value: !0 });
1962
+ let o = class {
1963
+ constructor(m, u, l) {
1964
+ this.autonomousSystemNumber = m.autonomous_system_number, this.autonomousSystemOrganization = m.autonomous_system_organization, this.ipAddress = u, this.network = l;
1965
+ }
1966
+ };
1967
+ return we.default = o, we;
1968
+ }
1969
+ var ie = {}, Y = {}, ht;
1970
+ function jt() {
1971
+ if (ht) return Y;
1972
+ ht = 1, Object.defineProperty(Y, "__esModule", { value: !0 }), Y.camelcaseKeys = Y.snakeToCamelCase = void 0;
1973
+ function o(l) {
1974
+ return l.replace(/_+(\w?)/g, (p, h, s) => s === 0 ? h : h.toUpperCase());
1975
+ }
1976
+ Y.snakeToCamelCase = o;
1977
+ const g = (l) => typeof l == "object" && l !== null && !Array.isArray(l) && !(l instanceof RegExp) && !(l instanceof Error) && !(l instanceof Date), m = (l) => l.map((p) => Array.isArray(p) ? m(p) : g(p) ? u(p) : p);
1978
+ function u(l) {
1979
+ if (Array.isArray(l))
1980
+ return m(l);
1981
+ const p = {};
1982
+ for (const [h, s] of Object.entries(l))
1983
+ Array.isArray(s) ? p[o(h)] = m(s) : g(s) ? p[o(h)] = u(s) : p[o(h)] = s;
1984
+ return p;
1985
+ }
1986
+ return Y.camelcaseKeys = u, Y;
1987
+ }
1988
+ var Ee = {}, pt;
1989
+ function Bt() {
1990
+ if (pt) return Ee;
1991
+ pt = 1, Object.defineProperty(Ee, "__esModule", { value: !0 });
1992
+ const o = /* @__PURE__ */ jt();
1993
+ let g = class {
1994
+ constructor(u, l, p) {
1995
+ var h, s, n, t;
1996
+ const e = (0, o.camelcaseKeys)(u);
1997
+ this.continent = e.continent || void 0, this.country = e.country || void 0, this.maxmind = e.maxmind || void 0, this.registeredCountry = this.setBooleanRegisteredCountry(e.registeredCountry) || void 0, this.representedCountry = e.representedCountry || void 0, this.traits = this.setBooleanTraits(e.traits || {}), (h = (n = this.traits).ipAddress) !== null && h !== void 0 || (n.ipAddress = l), (s = (t = this.traits).network) !== null && s !== void 0 || (t.network = p);
1998
+ }
1999
+ setBooleanTraits(u) {
2000
+ return [
2001
+ "isAnonymous",
2002
+ "isAnonymousProxy",
2003
+ "isAnonymousVpn",
2004
+ "isAnycast",
2005
+ "isHostingProvider",
2006
+ "isLegitimateProxy",
2007
+ "isPublicProxy",
2008
+ "isResidentialProxy",
2009
+ "isSatelliteProvider",
2010
+ "isTorExitNode"
2011
+ ].forEach((p) => {
2012
+ u[p] = !!u[p];
2013
+ }), u;
2014
+ }
2015
+ setBooleanRegisteredCountry(u) {
2016
+ return u && (u.isInEuropeanUnion = !!u.isInEuropeanUnion), u;
2017
+ }
2018
+ };
2019
+ return Ee.default = g, Ee;
2020
+ }
2021
+ var _t;
2022
+ function Ue() {
2023
+ if (_t) return ie;
2024
+ _t = 1;
2025
+ var o = ie && ie.__importDefault || function(l) {
2026
+ return l && l.__esModule ? l : { default: l };
2027
+ };
2028
+ Object.defineProperty(ie, "__esModule", { value: !0 });
2029
+ const g = /* @__PURE__ */ jt(), m = o(/* @__PURE__ */ Bt());
2030
+ let u = class extends m.default {
2031
+ constructor(p, h, s) {
2032
+ super(p, h, s);
2033
+ const n = (0, g.camelcaseKeys)(p);
2034
+ this.city = n.city || void 0, this.location = n.location || void 0, this.postal = n.postal || void 0, this.subdivisions = n.subdivisions || void 0;
2035
+ }
2036
+ };
2037
+ return ie.default = u, ie;
2038
+ }
2039
+ var xe = {}, vt;
2040
+ function mr() {
2041
+ if (vt) return xe;
2042
+ vt = 1, Object.defineProperty(xe, "__esModule", { value: !0 });
2043
+ let o = class {
2044
+ constructor(m, u, l) {
2045
+ this.connectionType = m.connection_type, this.ipAddress = u, this.network = l;
2046
+ }
2047
+ };
2048
+ return xe.default = o, xe;
2049
+ }
2050
+ var Ie = {}, mt;
2051
+ function yr() {
2052
+ if (mt) return Ie;
2053
+ mt = 1, Object.defineProperty(Ie, "__esModule", { value: !0 });
2054
+ let o = class {
2055
+ constructor(m, u, l) {
2056
+ this.domain = m.domain, this.ipAddress = u, this.network = l;
2057
+ }
2058
+ };
2059
+ return Ie.default = o, Ie;
2060
+ }
2061
+ var oe = {}, yt;
2062
+ function gr() {
2063
+ if (yt) return oe;
2064
+ yt = 1;
2065
+ var o = oe && oe.__importDefault || function(u) {
2066
+ return u && u.__esModule ? u : { default: u };
2067
+ };
2068
+ Object.defineProperty(oe, "__esModule", { value: !0 });
2069
+ const g = o(/* @__PURE__ */ Ue());
2070
+ let m = class extends g.default {
2071
+ constructor(l, p, h) {
2072
+ super(l, p, h);
2073
+ }
2074
+ };
2075
+ return oe.default = m, oe;
2076
+ }
2077
+ var se = {}, gt;
2078
+ function br() {
2079
+ if (gt) return se;
2080
+ gt = 1;
2081
+ var o = se && se.__importDefault || function(u) {
2082
+ return u && u.__esModule ? u : { default: u };
2083
+ };
2084
+ Object.defineProperty(se, "__esModule", { value: !0 });
2085
+ const g = o(/* @__PURE__ */ Ue());
2086
+ let m = class extends g.default {
2087
+ constructor(l) {
2088
+ super(l);
2089
+ }
2090
+ };
2091
+ return se.default = m, se;
2092
+ }
2093
+ var ae = {}, bt;
2094
+ function wr() {
2095
+ if (bt) return ae;
2096
+ bt = 1;
2097
+ var o = ae && ae.__importDefault || function(u) {
2098
+ return u && u.__esModule ? u : { default: u };
2099
+ };
2100
+ Object.defineProperty(ae, "__esModule", { value: !0 });
2101
+ const g = o(/* @__PURE__ */ Rt());
2102
+ let m = class extends g.default {
2103
+ constructor(l, p, h) {
2104
+ super(l, p, h), this.isp = l.isp, this.mobileCountryCode = l.mobile_country_code, this.mobileNetworkCode = l.mobile_network_code, this.organization = l.organization;
2105
+ }
2106
+ };
2107
+ return ae.default = m, ae;
2108
+ }
2109
+ var wt;
2110
+ function Fe() {
2111
+ if (wt) return U;
2112
+ wt = 1;
2113
+ var o = U && U.__importDefault || function(e) {
2114
+ return e && e.__esModule ? e : { default: e };
2115
+ };
2116
+ Object.defineProperty(U, "__esModule", { value: !0 }), U.Isp = U.Insights = U.Enterprise = U.Domain = U.Country = U.ConnectionType = U.City = U.Asn = U.AnonymousIP = void 0;
2117
+ const g = o(/* @__PURE__ */ vr());
2118
+ U.AnonymousIP = g.default;
2119
+ const m = o(/* @__PURE__ */ Rt());
2120
+ U.Asn = m.default;
2121
+ const u = o(/* @__PURE__ */ Ue());
2122
+ U.City = u.default;
2123
+ const l = o(/* @__PURE__ */ mr());
2124
+ U.ConnectionType = l.default;
2125
+ const p = o(/* @__PURE__ */ Bt());
2126
+ U.Country = p.default;
2127
+ const h = o(/* @__PURE__ */ yr());
2128
+ U.Domain = h.default;
2129
+ const s = o(/* @__PURE__ */ gr());
2130
+ U.Enterprise = s.default;
2131
+ const n = o(/* @__PURE__ */ br());
2132
+ U.Insights = n.default;
2133
+ const t = o(/* @__PURE__ */ wr());
2134
+ return U.Isp = t.default, U;
2135
+ }
2136
+ var Et;
2137
+ function qt() {
2138
+ if (Et) return W;
2139
+ Et = 1;
2140
+ var o = W && W.__createBinding || (Object.create ? (function(n, t, e, r) {
2141
+ r === void 0 && (r = e);
2142
+ var i = Object.getOwnPropertyDescriptor(t, e);
2143
+ (!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = { enumerable: !0, get: function() {
2144
+ return t[e];
2145
+ } }), Object.defineProperty(n, r, i);
2146
+ }) : (function(n, t, e, r) {
2147
+ r === void 0 && (r = e), n[r] = t[e];
2148
+ })), g = W && W.__setModuleDefault || (Object.create ? (function(n, t) {
2149
+ Object.defineProperty(n, "default", { enumerable: !0, value: t });
2150
+ }) : function(n, t) {
2151
+ n.default = t;
2152
+ }), m = W && W.__importStar || function(n) {
2153
+ if (n && n.__esModule) return n;
2154
+ var t = {};
2155
+ if (n != null) for (var e in n) e !== "default" && Object.prototype.hasOwnProperty.call(n, e) && o(t, n, e);
2156
+ return g(t, n), t;
2157
+ };
2158
+ Object.defineProperty(W, "__esModule", { value: !0 });
2159
+ const u = /* @__PURE__ */ _r(), l = /* @__PURE__ */ je(), p = /* @__PURE__ */ Be(), h = m(/* @__PURE__ */ Fe());
2160
+ class s {
2161
+ constructor(t) {
2162
+ this.mmdbReader = t;
2163
+ }
2164
+ anonymousIP(t) {
2165
+ return this.modelFor(h.AnonymousIP, "GeoIP2-Anonymous-IP", t, "anonymousIP()");
2166
+ }
2167
+ city(t) {
2168
+ return this.modelFor(h.City, "City", t, "city()");
2169
+ }
2170
+ country(t) {
2171
+ return this.modelFor(h.Country, "Country", t, "country()");
2172
+ }
2173
+ asn(t) {
2174
+ return this.modelFor(h.Asn, "ASN", t, "asn()");
2175
+ }
2176
+ connectionType(t) {
2177
+ return this.modelFor(h.ConnectionType, "Connection-Type", t, "connectionType()");
2178
+ }
2179
+ domain(t) {
2180
+ return this.modelFor(h.Domain, "Domain", t, "domain()");
2181
+ }
2182
+ isp(t) {
2183
+ return this.modelFor(h.Isp, "ISP", t, "isp()");
2184
+ }
2185
+ enterprise(t) {
2186
+ return this.modelFor(h.Enterprise, "Enterprise", t, "enterprise()");
2187
+ }
2188
+ getRecord(t, e, r) {
2189
+ const i = this.mmdbReader.metadata.databaseType;
2190
+ if (!l.validate(e))
2191
+ throw new p.ValueError(`${e} is invalid`);
2192
+ if (!i.includes(t))
2193
+ throw new p.BadMethodCallError(`The ${r} method cannot be used with the ${i} database`);
2194
+ const [f, y] = this.mmdbReader.getWithPrefixLength(e);
2195
+ if (!f)
2196
+ throw new p.AddressNotFoundError(`The address ${e} is not in the database`);
2197
+ return [f, u.createCIDR(e, y).toString()];
2198
+ }
2199
+ modelFor(t, e, r, i) {
2200
+ const [f, y] = this.getRecord(e, r, i);
2201
+ return new t(f, r, y);
2202
+ }
2203
+ }
2204
+ return W.default = s, W;
2205
+ }
2206
+ var xt;
2207
+ function Er() {
2208
+ if (xt) return Q;
2209
+ xt = 1;
2210
+ var o = Q && Q.__importDefault || function(p) {
2211
+ return p && p.__esModule ? p : { default: p };
2212
+ };
2213
+ Object.defineProperty(Q, "__esModule", { value: !0 });
2214
+ const g = /* @__PURE__ */ je(), m = /* @__PURE__ */ Be(), u = o(/* @__PURE__ */ qt());
2215
+ class l {
2216
+ static open(h, s) {
2217
+ return g.open(h, s).then((n) => new u.default(n));
2218
+ }
2219
+ static openBuffer(h) {
2220
+ let s;
2221
+ try {
2222
+ s = new g.Reader(h);
2223
+ } catch (n) {
2224
+ throw new m.InvalidDbBufferError(n);
2225
+ }
2226
+ return new u.default(s);
2227
+ }
2228
+ }
2229
+ return Q.default = l, Q;
2230
+ }
2231
+ var H = {};
2232
+ const xr = "5.0.0", Ir = {
2233
+ version: xr
2234
+ };
2235
+ var It;
2236
+ function Or() {
2237
+ if (It) return H;
2238
+ It = 1;
2239
+ var o = H && H.__createBinding || (Object.create ? (function(n, t, e, r) {
2240
+ r === void 0 && (r = e);
2241
+ var i = Object.getOwnPropertyDescriptor(t, e);
2242
+ (!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = { enumerable: !0, get: function() {
2243
+ return t[e];
2244
+ } }), Object.defineProperty(n, r, i);
2245
+ }) : (function(n, t, e, r) {
2246
+ r === void 0 && (r = e), n[r] = t[e];
2247
+ })), g = H && H.__setModuleDefault || (Object.create ? (function(n, t) {
2248
+ Object.defineProperty(n, "default", { enumerable: !0, value: t });
2249
+ }) : function(n, t) {
2250
+ n.default = t;
2251
+ }), m = H && H.__importStar || function(n) {
2252
+ if (n && n.__esModule) return n;
2253
+ var t = {};
2254
+ if (n != null) for (var e in n) e !== "default" && Object.prototype.hasOwnProperty.call(n, e) && o(t, n, e);
2255
+ return g(t, n), t;
2256
+ };
2257
+ Object.defineProperty(H, "__esModule", { value: !0 });
2258
+ const u = Qt, l = /* @__PURE__ */ je(), p = Ir, h = m(/* @__PURE__ */ Fe());
2259
+ class s {
2260
+ constructor(t, e, r) {
2261
+ if (this.timeout = 3e3, this.host = "geoip.maxmind.com", this.accountID = t, this.licenseKey = e, r !== void 0) {
2262
+ if (typeof r == "object") {
2263
+ r.host !== void 0 && (this.host = r.host), r.timeout !== void 0 && (this.timeout = r.timeout);
2264
+ return;
2265
+ }
2266
+ this.timeout = r;
2267
+ }
2268
+ }
2269
+ city(t) {
2270
+ return this.responseFor("city", t, h.City);
2271
+ }
2272
+ country(t) {
2273
+ return this.responseFor("country", t, h.Country);
2274
+ }
2275
+ insights(t) {
2276
+ return this.responseFor("insights", t, h.Insights);
2277
+ }
2278
+ responseFor(t, e, r) {
2279
+ const i = `/geoip/v2.1/${t}/${e}`, f = `https://${this.host}${i}`;
2280
+ if (!l.validate(e))
2281
+ return Promise.reject({
2282
+ code: "IP_ADDRESS_INVALID",
2283
+ error: "The IP address provided is invalid",
2284
+ url: f
2285
+ });
2286
+ const y = {
2287
+ auth: `${this.accountID}:${this.licenseKey}`,
2288
+ headers: {
2289
+ Accept: "application/json",
2290
+ "User-Agent": `GeoIP2-node/${p.version}`
2291
+ },
2292
+ host: this.host,
2293
+ method: "GET",
2294
+ path: i,
2295
+ timeout: this.timeout
2296
+ };
2297
+ return new Promise((_, b) => {
2298
+ const x = u.request(y, (E) => {
2299
+ let I = "";
2300
+ E.on("data", (S) => {
2301
+ I += S;
2302
+ }), E.on("end", () => {
2303
+ try {
2304
+ I = JSON.parse(I);
2305
+ } catch {
2306
+ return b(this.handleError({}, E, f));
2307
+ }
2308
+ return E.statusCode && E.statusCode !== 200 ? b(this.handleError(I, E, f)) : _(new r(I));
2309
+ });
2310
+ });
2311
+ x.on("error", (E) => b({
2312
+ code: E.code,
2313
+ error: E.message,
2314
+ url: f
2315
+ })), x.end();
2316
+ });
2317
+ }
2318
+ handleError(t, e, r) {
2319
+ return e.statusCode && e.statusCode >= 500 && e.statusCode < 600 ? {
2320
+ code: "SERVER_ERROR",
2321
+ error: `Received a server error with HTTP status code: ${e.statusCode}`,
2322
+ url: r
2323
+ } : e.statusCode && (e.statusCode < 400 || e.statusCode >= 600) ? {
2324
+ code: "HTTP_STATUS_CODE_ERROR",
2325
+ error: `Received an unexpected HTTP status code: ${e.statusCode}`,
2326
+ url: r
2327
+ } : !t.code || !t.error ? {
2328
+ code: "INVALID_RESPONSE_BODY",
2329
+ error: "Received an invalid or unparseable response body",
2330
+ url: r
2331
+ } : Object.assign(Object.assign({}, t), { url: r });
2332
+ }
2333
+ }
2334
+ return H.default = s, H;
2335
+ }
2336
+ var Me = {}, Ot;
2337
+ function Ar() {
2338
+ return Ot || (Ot = 1, Object.defineProperty(Me, "__esModule", { value: !0 })), Me;
2339
+ }
2340
+ var At;
2341
+ function Cr() {
2342
+ return At || (At = 1, (function(o) {
2343
+ var g = G && G.__createBinding || (Object.create ? (function(s, n, t, e) {
2344
+ e === void 0 && (e = t);
2345
+ var r = Object.getOwnPropertyDescriptor(n, t);
2346
+ (!r || ("get" in r ? !n.__esModule : r.writable || r.configurable)) && (r = { enumerable: !0, get: function() {
2347
+ return n[t];
2348
+ } }), Object.defineProperty(s, e, r);
2349
+ }) : (function(s, n, t, e) {
2350
+ e === void 0 && (e = t), s[e] = n[t];
2351
+ })), m = G && G.__exportStar || function(s, n) {
2352
+ for (var t in s) t !== "default" && !Object.prototype.hasOwnProperty.call(n, t) && g(n, s, t);
2353
+ }, u = G && G.__importDefault || function(s) {
2354
+ return s && s.__esModule ? s : { default: s };
2355
+ };
2356
+ Object.defineProperty(o, "__esModule", { value: !0 }), o.WebServiceClient = o.ReaderModel = o.Reader = void 0;
2357
+ const l = u(/* @__PURE__ */ Er());
2358
+ o.Reader = l.default;
2359
+ const p = u(/* @__PURE__ */ Or());
2360
+ o.WebServiceClient = p.default;
2361
+ const h = u(/* @__PURE__ */ qt());
2362
+ o.ReaderModel = h.default, m(/* @__PURE__ */ Ar(), o), m(/* @__PURE__ */ Fe(), o), m(/* @__PURE__ */ Be(), o);
2363
+ })(G)), G;
2364
+ }
2365
+ var Pr = /* @__PURE__ */ Cr();
2366
+ const Vr = /* @__PURE__ */ er({
2367
+ __proto__: null
2368
+ }, [Pr]);
2369
+ export {
2370
+ Vr as i
2371
+ };