bmlt-query-client 1.0.9 → 1.2.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.
- package/AGENTS.md +14 -0
- package/CHANGELOG.md +59 -0
- package/README.md +38 -0
- package/dist/app.d.ts +27 -8
- package/dist/app.js +267 -243
- package/dist/app.js.map +1 -1
- package/package.json +3 -2
- package/vite.config.ts +3 -3
package/dist/app.js
CHANGED
|
@@ -21,7 +21,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
21
21
|
function f(e) {
|
|
22
22
|
if (!(e && u(e) && e.name === "TypeError" && typeof e.message == "string")) return !1;
|
|
23
23
|
let { message: t, stack: n } = e;
|
|
24
|
-
return t === "Load failed" ? n === void 0 || "__sentry_captured__" in e : t.startsWith("error sending request for url") || t === "Failed to fetch" || t.startsWith("Failed to fetch (") && t.endsWith(")") ? !0 : d.has(t);
|
|
24
|
+
return t === "Load failed" || t.startsWith("Load failed (") && t.endsWith(")") ? n === void 0 || "__sentry_captured__" in e : t.startsWith("error sending request for url") || t === "Failed to fetch" || t.startsWith("Failed to fetch (") && t.endsWith(")") ? !0 : d.has(t);
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region node_modules/p-retry/index.js
|
|
@@ -50,10 +50,10 @@ function te(e, t) {
|
|
|
50
50
|
let n = Math.max(1, e + 1), r = t.randomize ? Math.random() + 1 : 1, i = Math.round(r * t.minTimeout * t.factor ** (n - 1));
|
|
51
51
|
return i = Math.min(i, t.maxTimeout), i;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function ne(e, t) {
|
|
54
54
|
return Number.isFinite(t) ? t - (performance.now() - e) : t;
|
|
55
55
|
}
|
|
56
|
-
async function
|
|
56
|
+
async function re(e, t) {
|
|
57
57
|
e <= 0 || await new Promise((n, r) => {
|
|
58
58
|
let i = () => {
|
|
59
59
|
clearTimeout(a), t.signal?.removeEventListener("abort", i), r(t.signal.reason);
|
|
@@ -63,11 +63,11 @@ async function ne(e, t) {
|
|
|
63
63
|
t.unref && a.unref?.(), t.signal?.addEventListener("abort", i, { once: !0 });
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
async function
|
|
66
|
+
async function ie({ error: e, attemptNumber: t, retriesConsumed: n, startTime: r, options: i }) {
|
|
67
67
|
let a = e instanceof Error ? e : /* @__PURE__ */ TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);
|
|
68
68
|
if (a instanceof ee) throw a.originalError;
|
|
69
69
|
let o = Number.isFinite(i.retries) ? Math.max(0, i.retries - n) : i.retries, s = i.maxRetryTime ?? Infinity, c = te(n, i);
|
|
70
|
-
if (
|
|
70
|
+
if (ne(r, s) <= 0) {
|
|
71
71
|
let e = Object.freeze({
|
|
72
72
|
error: a,
|
|
73
73
|
attemptNumber: t,
|
|
@@ -90,14 +90,14 @@ async function re({ error: e, attemptNumber: t, retriesConsumed: n, startTime: r
|
|
|
90
90
|
retriesConsumed: n,
|
|
91
91
|
retryDelay: d
|
|
92
92
|
});
|
|
93
|
-
if (await i.onFailedAttempt(p),
|
|
94
|
-
let m =
|
|
93
|
+
if (await i.onFailedAttempt(p), ne(r, s) <= 0 || ne(r, s) <= 0 || o <= 0 || a instanceof TypeError && !f(a) || !await i.shouldRetry(p)) throw a;
|
|
94
|
+
let m = ne(r, s);
|
|
95
95
|
if (m <= 0) throw a;
|
|
96
96
|
if (!u) return i.signal?.throwIfAborted(), !1;
|
|
97
97
|
let h = Math.min(d, m);
|
|
98
|
-
return i.signal?.throwIfAborted(), await
|
|
98
|
+
return i.signal?.throwIfAborted(), await re(h, i), i.signal?.throwIfAborted(), !0;
|
|
99
99
|
}
|
|
100
|
-
async function
|
|
100
|
+
async function ae(e, t = {}) {
|
|
101
101
|
var n, r, i, a, o, s, c, l, u;
|
|
102
102
|
if (t = { ...t }, p(t.retries), Object.hasOwn(t, "forever")) throw Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");
|
|
103
103
|
(n = t).retries ?? (n.retries = 10), (r = t).factor ?? (r.factor = 2), (i = t).minTimeout ?? (i.minTimeout = 1e3), (a = t).maxTimeout ?? (a.maxTimeout = Infinity), (o = t).maxRetryTime ?? (o.maxRetryTime = Infinity), (s = t).randomize ?? (s.randomize = !1), (c = t).onFailedAttempt ?? (c.onFailedAttempt = () => {}), (l = t).shouldRetry ?? (l.shouldRetry = () => !0), (u = t).shouldConsumeRetry ?? (u.shouldConsumeRetry = () => !0), h("onFailedAttempt", t.onFailedAttempt), h("shouldRetry", t.shouldRetry), h("shouldConsumeRetry", t.shouldConsumeRetry), m("factor", t.factor, {
|
|
@@ -121,7 +121,7 @@ async function ie(e, t = {}) {
|
|
|
121
121
|
let n = await e(d);
|
|
122
122
|
return t.signal?.throwIfAborted(), n;
|
|
123
123
|
} catch (e) {
|
|
124
|
-
await
|
|
124
|
+
await ie({
|
|
125
125
|
error: e,
|
|
126
126
|
attemptNumber: d,
|
|
127
127
|
retriesConsumed: f,
|
|
@@ -134,7 +134,7 @@ async function ie(e, t = {}) {
|
|
|
134
134
|
}
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region node_modules/eventemitter3/index.mjs
|
|
137
|
-
var
|
|
137
|
+
var oe = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
138
138
|
var n = Object.prototype.hasOwnProperty, r = "~";
|
|
139
139
|
function i() {}
|
|
140
140
|
Object.create && (i.prototype = Object.create(null), new i().__proto__ || (r = !1));
|
|
@@ -223,37 +223,37 @@ var ae = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
|
223
223
|
}, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = r, c.EventEmitter = c, t !== void 0 && (t.exports = c);
|
|
224
224
|
})))(), 1);
|
|
225
225
|
//#endregion
|
|
226
|
-
//#region \0@oxc-project+runtime@0.
|
|
227
|
-
function
|
|
226
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
|
|
227
|
+
function g(e) {
|
|
228
228
|
"@babel/helpers - typeof";
|
|
229
|
-
return
|
|
229
|
+
return g = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
230
230
|
return typeof e;
|
|
231
231
|
} : function(e) {
|
|
232
232
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
233
|
-
},
|
|
233
|
+
}, g(e);
|
|
234
234
|
}
|
|
235
235
|
//#endregion
|
|
236
|
-
//#region \0@oxc-project+runtime@0.
|
|
237
|
-
function
|
|
238
|
-
if (
|
|
236
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
|
|
237
|
+
function se(e, t) {
|
|
238
|
+
if (g(e) != "object" || !e) return e;
|
|
239
239
|
var n = e[Symbol.toPrimitive];
|
|
240
240
|
if (n !== void 0) {
|
|
241
241
|
var r = n.call(e, t || "default");
|
|
242
|
-
if (
|
|
242
|
+
if (g(r) != "object") return r;
|
|
243
243
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
244
244
|
}
|
|
245
245
|
return (t === "string" ? String : Number)(e);
|
|
246
246
|
}
|
|
247
247
|
//#endregion
|
|
248
|
-
//#region \0@oxc-project+runtime@0.
|
|
249
|
-
function
|
|
250
|
-
var t =
|
|
251
|
-
return
|
|
248
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
|
|
249
|
+
function ce(e) {
|
|
250
|
+
var t = se(e, "string");
|
|
251
|
+
return g(t) == "symbol" ? t : t + "";
|
|
252
252
|
}
|
|
253
253
|
//#endregion
|
|
254
|
-
//#region \0@oxc-project+runtime@0.
|
|
255
|
-
function
|
|
256
|
-
return (t =
|
|
254
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
|
|
255
|
+
function _(e, t, n) {
|
|
256
|
+
return (t = ce(t)) in e ? Object.defineProperty(e, t, {
|
|
257
257
|
value: n,
|
|
258
258
|
enumerable: !0,
|
|
259
259
|
configurable: !0,
|
|
@@ -262,25 +262,25 @@ function v(e, t, n) {
|
|
|
262
262
|
}
|
|
263
263
|
//#endregion
|
|
264
264
|
//#region node_modules/p-timeout/index.js
|
|
265
|
-
var
|
|
265
|
+
var le = class e extends Error {
|
|
266
266
|
constructor(t, n) {
|
|
267
|
-
super(t, n),
|
|
267
|
+
super(t, n), _(this, "name", "TimeoutError"), Error.captureStackTrace?.(this, e);
|
|
268
268
|
}
|
|
269
|
-
},
|
|
270
|
-
function
|
|
269
|
+
}, ue = (e) => e.reason ?? new DOMException("This operation was aborted.", "AbortError");
|
|
270
|
+
function de(e, t) {
|
|
271
271
|
let { milliseconds: n, fallback: r, message: i, customTimers: a = {
|
|
272
272
|
setTimeout,
|
|
273
273
|
clearTimeout
|
|
274
274
|
}, signal: o } = t, s, c, l = new Promise((t, l) => {
|
|
275
275
|
if (typeof n != "number" || Math.sign(n) !== 1) throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);
|
|
276
276
|
if (o?.aborted) {
|
|
277
|
-
l(
|
|
277
|
+
l(ue(o));
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
280
|
if (o && (c = () => {
|
|
281
|
-
l(
|
|
281
|
+
l(ue(o));
|
|
282
282
|
}, o.addEventListener("abort", c, { once: !0 })), e.then(t, l), n === Infinity) return;
|
|
283
|
-
let u = new
|
|
283
|
+
let u = new le();
|
|
284
284
|
s = a.setTimeout.call(void 0, () => {
|
|
285
285
|
if (r) {
|
|
286
286
|
try {
|
|
@@ -301,7 +301,7 @@ function ue(e, t) {
|
|
|
301
301
|
}
|
|
302
302
|
//#endregion
|
|
303
303
|
//#region node_modules/p-queue/dist/lower-bound.js
|
|
304
|
-
function
|
|
304
|
+
function fe(e, t, n) {
|
|
305
305
|
let r = 0, i = e.length;
|
|
306
306
|
for (; i > 0;) {
|
|
307
307
|
let a = Math.trunc(i / 2), o = r + a;
|
|
@@ -310,119 +310,135 @@ function de(e, t, n) {
|
|
|
310
310
|
return r;
|
|
311
311
|
}
|
|
312
312
|
//#endregion
|
|
313
|
-
//#region \0@oxc-project+runtime@0.
|
|
314
|
-
function
|
|
313
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/checkPrivateRedeclaration.js
|
|
314
|
+
function pe(e, t) {
|
|
315
315
|
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
316
316
|
}
|
|
317
317
|
//#endregion
|
|
318
|
-
//#region \0@oxc-project+runtime@0.
|
|
319
|
-
function
|
|
320
|
-
|
|
318
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/classPrivateMethodInitSpec.js
|
|
319
|
+
function me(e, t) {
|
|
320
|
+
pe(e, t), t.add(e);
|
|
321
321
|
}
|
|
322
322
|
//#endregion
|
|
323
|
-
//#region \0@oxc-project+runtime@0.
|
|
324
|
-
function
|
|
323
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/classPrivateFieldInitSpec.js
|
|
324
|
+
function v(e, t, n) {
|
|
325
|
+
pe(e, t), t.set(e, n);
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/assertClassBrand.js
|
|
329
|
+
function y(e, t, n) {
|
|
325
330
|
if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
326
331
|
throw TypeError("Private element is not present on this object");
|
|
327
332
|
}
|
|
328
333
|
//#endregion
|
|
329
|
-
//#region \0@oxc-project+runtime@0.
|
|
330
|
-
function
|
|
331
|
-
return e.get(
|
|
334
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/classPrivateFieldGet2.js
|
|
335
|
+
function b(e, t) {
|
|
336
|
+
return e.get(y(e, t));
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region \0@oxc-project+runtime@0.128.0/helpers/classPrivateFieldSet2.js
|
|
340
|
+
function x(e, t, n) {
|
|
341
|
+
return e.set(y(e, t), n), n;
|
|
332
342
|
}
|
|
333
343
|
//#endregion
|
|
334
344
|
//#region node_modules/p-queue/dist/priority-queue.js
|
|
335
|
-
var S = /* @__PURE__ */ new WeakMap(),
|
|
345
|
+
var he = 100, S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakSet(), _e = class {
|
|
336
346
|
constructor() {
|
|
337
|
-
|
|
347
|
+
me(this, ge), v(this, S, []), v(this, C, 0);
|
|
338
348
|
}
|
|
339
349
|
enqueue(e, t) {
|
|
340
|
-
let { priority: n = 0, id: r } = t ?? {}, i = {
|
|
350
|
+
let { priority: n = 0, id: r } = t ?? {}, { size: i } = this, a = {
|
|
341
351
|
priority: n,
|
|
342
352
|
id: r,
|
|
343
353
|
run: e
|
|
344
354
|
};
|
|
345
|
-
if (
|
|
346
|
-
x(S, this).push(
|
|
355
|
+
if (i === 0) {
|
|
356
|
+
b(S, this).length = 0, x(C, this, 0), b(S, this).push(a);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (b(S, this).at(-1).priority >= n) {
|
|
360
|
+
b(S, this).push(a);
|
|
347
361
|
return;
|
|
348
362
|
}
|
|
349
|
-
|
|
350
|
-
|
|
363
|
+
y(ge, this, ve).call(this);
|
|
364
|
+
let o = fe(b(S, this), a, (e, t) => t.priority - e.priority);
|
|
365
|
+
b(S, this).splice(o, 0, a);
|
|
351
366
|
}
|
|
352
367
|
setPriority(e, t) {
|
|
353
|
-
let n =
|
|
368
|
+
let n = b(S, this).findIndex((t, n) => n >= b(C, this) && t.id === e);
|
|
354
369
|
if (n === -1) throw ReferenceError(`No promise function with the id "${e}" exists in the queue.`);
|
|
355
|
-
let [r] =
|
|
370
|
+
let [r] = b(S, this).splice(n, 1);
|
|
356
371
|
this.enqueue(r.run, {
|
|
357
372
|
priority: t,
|
|
358
373
|
id: e
|
|
359
374
|
});
|
|
360
375
|
}
|
|
361
376
|
remove(e) {
|
|
362
|
-
let t =
|
|
363
|
-
t !== -1 &&
|
|
377
|
+
let t = b(S, this).findIndex((t, n) => n < b(C, this) ? !1 : typeof e == "string" ? t.id === e : t.run === e);
|
|
378
|
+
t !== -1 && b(S, this).splice(t, 1);
|
|
364
379
|
}
|
|
365
380
|
dequeue() {
|
|
366
|
-
|
|
381
|
+
var e;
|
|
382
|
+
if (b(C, this) === b(S, this).length) return;
|
|
383
|
+
let t = b(S, this)[b(C, this)];
|
|
384
|
+
return x(C, this, (e = b(C, this), e++, e)), b(C, this) === b(S, this).length ? (b(S, this).length = 0, x(C, this, 0)) : b(C, this) > he && b(C, this) > b(S, this).length / 2 && y(ge, this, ve).call(this), t?.run;
|
|
367
385
|
}
|
|
368
386
|
filter(e) {
|
|
369
|
-
|
|
387
|
+
let t = [];
|
|
388
|
+
for (let n = b(C, this); n < b(S, this).length; n++) {
|
|
389
|
+
let r = b(S, this)[n];
|
|
390
|
+
r.priority === e.priority && t.push(r.run);
|
|
391
|
+
}
|
|
392
|
+
return t;
|
|
370
393
|
}
|
|
371
394
|
get size() {
|
|
372
|
-
return
|
|
395
|
+
return b(S, this).length - b(C, this);
|
|
373
396
|
}
|
|
374
397
|
};
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
function me(e, t) {
|
|
378
|
-
fe(e, t), t.add(e);
|
|
379
|
-
}
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region \0@oxc-project+runtime@0.127.0/helpers/classPrivateFieldSet2.js
|
|
382
|
-
function C(e, t, n) {
|
|
383
|
-
return e.set(b(e, t), n), n;
|
|
398
|
+
function ve() {
|
|
399
|
+
b(C, this) !== 0 && (b(S, this).splice(0, b(C, this)), x(C, this, 0));
|
|
384
400
|
}
|
|
385
401
|
//#endregion
|
|
386
402
|
//#region node_modules/p-queue/dist/index.js
|
|
387
|
-
var w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(),
|
|
403
|
+
var w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), Se = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakSet(), Ce = class extends oe.default {
|
|
388
404
|
constructor(e) {
|
|
389
|
-
if (super(), me(this,
|
|
405
|
+
if (super(), me(this, H), v(this, w, void 0), v(this, T, void 0), v(this, E, 0), v(this, D, void 0), v(this, O, !1), v(this, k, !1), v(this, A, void 0), v(this, ye, 0), v(this, be, 0), v(this, j, void 0), v(this, M, void 0), v(this, N, void 0), v(this, P, []), v(this, F, 0), v(this, I, void 0), v(this, xe, void 0), v(this, L, 0), v(this, R, void 0), v(this, z, void 0), v(this, Se, 1n), v(this, B, /* @__PURE__ */ new Map()), v(this, V, /* @__PURE__ */ new Set()), _(this, "timeout", void 0), e = {
|
|
390
406
|
carryoverIntervalCount: !1,
|
|
391
407
|
intervalCap: Infinity,
|
|
392
408
|
interval: 0,
|
|
393
409
|
concurrency: Infinity,
|
|
394
410
|
autoStart: !0,
|
|
395
|
-
queueClass:
|
|
411
|
+
queueClass: _e,
|
|
396
412
|
strict: !1,
|
|
397
413
|
...e
|
|
398
414
|
}, !(typeof e.intervalCap == "number" && e.intervalCap >= 1)) throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString() ?? ""}\` (${typeof e.intervalCap})`);
|
|
399
415
|
if (e.interval === void 0 || !(Number.isFinite(e.interval) && e.interval >= 0)) throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString() ?? ""}\` (${typeof e.interval})`);
|
|
400
416
|
if (e.strict && e.interval === 0) throw TypeError("The `strict` option requires a non-zero `interval`");
|
|
401
417
|
if (e.strict && e.intervalCap === Infinity) throw TypeError("The `strict` option requires a finite `intervalCap`");
|
|
402
|
-
if (
|
|
403
|
-
this.timeout = e.timeout,
|
|
418
|
+
if (x(w, this, e.carryoverIntervalCount ?? e.carryoverConcurrencyCount ?? !1), x(T, this, e.intervalCap === Infinity || e.interval === 0), x(D, this, e.intervalCap), x(A, this, e.interval), x(N, this, e.strict), x(I, this, new e.queueClass()), x(xe, this, e.queueClass), this.concurrency = e.concurrency, e.timeout !== void 0 && !(Number.isFinite(e.timeout) && e.timeout > 0)) throw TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);
|
|
419
|
+
this.timeout = e.timeout, x(z, this, e.autoStart === !1), y(H, this, Be).call(this);
|
|
404
420
|
}
|
|
405
421
|
get concurrency() {
|
|
406
|
-
return
|
|
422
|
+
return b(R, this);
|
|
407
423
|
}
|
|
408
424
|
set concurrency(e) {
|
|
409
425
|
if (!(typeof e == "number" && e >= 1)) throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);
|
|
410
|
-
|
|
426
|
+
x(R, this, e), y(H, this, ze).call(this);
|
|
411
427
|
}
|
|
412
428
|
setPriority(e, t) {
|
|
413
429
|
if (typeof t != "number" || !Number.isFinite(t)) throw TypeError(`Expected \`priority\` to be a finite number, got \`${t}\` (${typeof t})`);
|
|
414
|
-
|
|
430
|
+
b(I, this).setPriority(e, t);
|
|
415
431
|
}
|
|
416
432
|
async add(e, t = {}) {
|
|
417
433
|
var n, r;
|
|
418
434
|
return t = {
|
|
419
435
|
timeout: this.timeout,
|
|
420
436
|
...t,
|
|
421
|
-
id: t.id ?? (
|
|
437
|
+
id: t.id ?? (x(Se, this, (n = b(Se, this), r = n++, n)), r).toString()
|
|
422
438
|
}, new Promise((n, r) => {
|
|
423
439
|
let i = Symbol(`task-${t.id}`), a = () => void 0, o = async () => {
|
|
424
440
|
var o;
|
|
425
|
-
a(),
|
|
441
|
+
a(), x(L, this, (o = b(L, this), o++, o)), b(B, this).set(i, {
|
|
426
442
|
id: t.id,
|
|
427
443
|
priority: t.priority ?? 0,
|
|
428
444
|
startTime: Date.now(),
|
|
@@ -433,13 +449,13 @@ var w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /*
|
|
|
433
449
|
try {
|
|
434
450
|
t.signal?.throwIfAborted();
|
|
435
451
|
} catch (e) {
|
|
436
|
-
throw
|
|
452
|
+
throw y(H, this, Ve).call(this), b(B, this).delete(i), e;
|
|
437
453
|
}
|
|
438
|
-
|
|
454
|
+
x(be, this, Date.now());
|
|
439
455
|
let r = e({ signal: t.signal });
|
|
440
|
-
if (t.timeout && (r =
|
|
456
|
+
if (t.timeout && (r = de(Promise.resolve(r), {
|
|
441
457
|
milliseconds: t.timeout,
|
|
442
|
-
message: `Task timed out after ${t.timeout}ms (queue has ${
|
|
458
|
+
message: `Task timed out after ${t.timeout}ms (queue has ${b(L, this)} running, ${b(I, this).size} waiting)`
|
|
443
459
|
})), t.signal) {
|
|
444
460
|
let { signal: e } = t;
|
|
445
461
|
r = Promise.race([r, new Promise((t, n) => {
|
|
@@ -453,64 +469,64 @@ var w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /*
|
|
|
453
469
|
} catch (e) {
|
|
454
470
|
r(e), this.emit("error", e);
|
|
455
471
|
} finally {
|
|
456
|
-
s && t.signal?.removeEventListener("abort", s),
|
|
457
|
-
|
|
472
|
+
s && t.signal?.removeEventListener("abort", s), b(B, this).delete(i), queueMicrotask(() => {
|
|
473
|
+
y(H, this, Ae).call(this);
|
|
458
474
|
});
|
|
459
475
|
}
|
|
460
476
|
};
|
|
461
|
-
|
|
477
|
+
b(I, this).enqueue(o, t);
|
|
462
478
|
let s = () => {
|
|
463
|
-
if (
|
|
464
|
-
|
|
479
|
+
if (b(I, this) instanceof _e) {
|
|
480
|
+
b(I, this).remove(o);
|
|
465
481
|
return;
|
|
466
482
|
}
|
|
467
|
-
|
|
483
|
+
b(I, this).remove?.(t.id);
|
|
468
484
|
};
|
|
469
485
|
if (t.signal) {
|
|
470
486
|
let { signal: e } = t, n = () => {
|
|
471
|
-
a(), s(), r(e.reason),
|
|
487
|
+
a(), s(), r(e.reason), y(H, this, Ie).call(this), this.emit("next");
|
|
472
488
|
};
|
|
473
489
|
if (a = () => {
|
|
474
|
-
e.removeEventListener("abort", n),
|
|
490
|
+
e.removeEventListener("abort", n), b(V, this).delete(a);
|
|
475
491
|
}, e.aborted) {
|
|
476
492
|
n();
|
|
477
493
|
return;
|
|
478
494
|
}
|
|
479
|
-
e.addEventListener("abort", n, { once: !0 }),
|
|
495
|
+
e.addEventListener("abort", n, { once: !0 }), b(V, this).add(a);
|
|
480
496
|
}
|
|
481
|
-
this.emit("add"),
|
|
497
|
+
this.emit("add"), y(H, this, Ie).call(this);
|
|
482
498
|
});
|
|
483
499
|
}
|
|
484
500
|
async addAll(e, t) {
|
|
485
501
|
return Promise.all(e.map(async (e) => this.add(e, t)));
|
|
486
502
|
}
|
|
487
503
|
start() {
|
|
488
|
-
return
|
|
504
|
+
return b(z, this) ? (x(z, this, !1), y(H, this, ze).call(this), this) : this;
|
|
489
505
|
}
|
|
490
506
|
pause() {
|
|
491
|
-
|
|
507
|
+
x(z, this, !0);
|
|
492
508
|
}
|
|
493
509
|
clear() {
|
|
494
|
-
for (let e of
|
|
495
|
-
|
|
510
|
+
for (let e of b(V, this)) e();
|
|
511
|
+
x(I, this, new (b(xe, this))()), y(H, this, Pe).call(this), y(H, this, He).call(this), this.emit("empty"), b(L, this) === 0 && (y(H, this, Fe).call(this), this.emit("idle")), this.emit("next");
|
|
496
512
|
}
|
|
497
513
|
async onEmpty() {
|
|
498
|
-
|
|
514
|
+
b(I, this).size !== 0 && await y(H, this, U).call(this, "empty");
|
|
499
515
|
}
|
|
500
516
|
async onSizeLessThan(e) {
|
|
501
|
-
|
|
517
|
+
b(I, this).size < e || await y(H, this, U).call(this, "next", () => b(I, this).size < e);
|
|
502
518
|
}
|
|
503
519
|
async onIdle() {
|
|
504
|
-
|
|
520
|
+
b(L, this) === 0 && b(I, this).size === 0 || await y(H, this, U).call(this, "idle");
|
|
505
521
|
}
|
|
506
522
|
async onPendingZero() {
|
|
507
|
-
|
|
523
|
+
b(L, this) !== 0 && await y(H, this, U).call(this, "pendingZero");
|
|
508
524
|
}
|
|
509
525
|
async onRateLimit() {
|
|
510
|
-
this.isRateLimited || await
|
|
526
|
+
this.isRateLimited || await y(H, this, U).call(this, "rateLimit");
|
|
511
527
|
}
|
|
512
528
|
async onRateLimitCleared() {
|
|
513
|
-
this.isRateLimited && await
|
|
529
|
+
this.isRateLimited && await y(H, this, U).call(this, "rateLimitCleared");
|
|
514
530
|
}
|
|
515
531
|
onError() {
|
|
516
532
|
return new Promise((e, t) => {
|
|
@@ -521,129 +537,129 @@ var w = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /*
|
|
|
521
537
|
});
|
|
522
538
|
}
|
|
523
539
|
get size() {
|
|
524
|
-
return
|
|
540
|
+
return b(I, this).size;
|
|
525
541
|
}
|
|
526
542
|
sizeBy(e) {
|
|
527
|
-
return
|
|
543
|
+
return b(I, this).filter(e).length;
|
|
528
544
|
}
|
|
529
545
|
get pending() {
|
|
530
|
-
return
|
|
546
|
+
return b(L, this);
|
|
531
547
|
}
|
|
532
548
|
get isPaused() {
|
|
533
|
-
return
|
|
549
|
+
return b(z, this);
|
|
534
550
|
}
|
|
535
551
|
get isRateLimited() {
|
|
536
|
-
return
|
|
552
|
+
return b(O, this);
|
|
537
553
|
}
|
|
538
554
|
get isSaturated() {
|
|
539
|
-
return
|
|
555
|
+
return b(L, this) === b(R, this) && b(I, this).size > 0 || this.isRateLimited && b(I, this).size > 0;
|
|
540
556
|
}
|
|
541
557
|
get runningTasks() {
|
|
542
|
-
return [...
|
|
558
|
+
return [...b(B, this).values()].map((e) => ({ ...e }));
|
|
543
559
|
}
|
|
544
560
|
};
|
|
545
|
-
function
|
|
546
|
-
for (;
|
|
547
|
-
let n =
|
|
548
|
-
if (n !== void 0 && e - n >=
|
|
561
|
+
function we(e) {
|
|
562
|
+
for (; b(F, this) < b(P, this).length;) {
|
|
563
|
+
let n = b(P, this)[b(F, this)];
|
|
564
|
+
if (n !== void 0 && e - n >= b(A, this)) {
|
|
549
565
|
var t;
|
|
550
|
-
|
|
566
|
+
x(F, this, (t = b(F, this), t++, t));
|
|
551
567
|
} else break;
|
|
552
568
|
}
|
|
553
|
-
(
|
|
569
|
+
(b(F, this) > 100 && b(F, this) > b(P, this).length / 2 || b(F, this) === b(P, this).length) && (x(P, this, b(P, this).slice(b(F, this))), x(F, this, 0));
|
|
554
570
|
}
|
|
555
|
-
function
|
|
556
|
-
if (
|
|
571
|
+
function Te(e) {
|
|
572
|
+
if (b(N, this)) b(P, this).push(e);
|
|
557
573
|
else {
|
|
558
574
|
var t;
|
|
559
|
-
|
|
575
|
+
x(E, this, (t = b(E, this), t++, t));
|
|
560
576
|
}
|
|
561
577
|
}
|
|
562
|
-
function
|
|
563
|
-
if (
|
|
564
|
-
else if (
|
|
578
|
+
function Ee() {
|
|
579
|
+
if (b(N, this)) b(P, this).length > b(F, this) && b(P, this).pop();
|
|
580
|
+
else if (b(E, this) > 0) {
|
|
565
581
|
var e;
|
|
566
|
-
|
|
582
|
+
x(E, this, (e = b(E, this), e--, e));
|
|
567
583
|
}
|
|
568
584
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
585
|
+
function De() {
|
|
586
|
+
return b(P, this).length - b(F, this);
|
|
571
587
|
}
|
|
572
|
-
function
|
|
573
|
-
return
|
|
588
|
+
function Oe() {
|
|
589
|
+
return b(T, this) ? !0 : b(N, this) ? y(H, this, De).call(this) < b(D, this) : b(E, this) < b(D, this);
|
|
574
590
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
591
|
+
function ke() {
|
|
592
|
+
return b(L, this) < b(R, this);
|
|
577
593
|
}
|
|
578
|
-
function
|
|
594
|
+
function Ae() {
|
|
579
595
|
var e;
|
|
580
|
-
|
|
596
|
+
x(L, this, (e = b(L, this), e--, e)), b(L, this) === 0 && this.emit("pendingZero"), y(H, this, Ie).call(this), this.emit("next");
|
|
581
597
|
}
|
|
582
|
-
function
|
|
583
|
-
|
|
598
|
+
function je() {
|
|
599
|
+
x(M, this, void 0), y(H, this, Re).call(this), y(H, this, Le).call(this);
|
|
584
600
|
}
|
|
585
|
-
function
|
|
586
|
-
if (
|
|
587
|
-
if (
|
|
588
|
-
let t =
|
|
589
|
-
return
|
|
601
|
+
function Me(e) {
|
|
602
|
+
if (b(N, this)) {
|
|
603
|
+
if (y(H, this, we).call(this, e), y(H, this, De).call(this) >= b(D, this)) {
|
|
604
|
+
let t = b(P, this)[b(F, this)], n = b(A, this) - (e - t);
|
|
605
|
+
return y(H, this, Ne).call(this, n), !0;
|
|
590
606
|
}
|
|
591
607
|
return !1;
|
|
592
608
|
}
|
|
593
|
-
if (
|
|
594
|
-
let t =
|
|
609
|
+
if (b(j, this) === void 0) {
|
|
610
|
+
let t = b(ye, this) - e;
|
|
595
611
|
if (t < 0) {
|
|
596
|
-
if (
|
|
597
|
-
let t = e -
|
|
598
|
-
if (t <
|
|
612
|
+
if (b(be, this) > 0) {
|
|
613
|
+
let t = e - b(be, this);
|
|
614
|
+
if (t < b(A, this)) return y(H, this, Ne).call(this, b(A, this) - t), !0;
|
|
599
615
|
}
|
|
600
|
-
|
|
601
|
-
} else return
|
|
616
|
+
x(E, this, b(w, this) ? b(L, this) : 0);
|
|
617
|
+
} else return y(H, this, Ne).call(this, t), !0;
|
|
602
618
|
}
|
|
603
619
|
return !1;
|
|
604
620
|
}
|
|
605
|
-
function
|
|
606
|
-
|
|
607
|
-
|
|
621
|
+
function Ne(e) {
|
|
622
|
+
b(M, this) === void 0 && x(M, this, setTimeout(() => {
|
|
623
|
+
y(H, this, je).call(this);
|
|
608
624
|
}, e));
|
|
609
625
|
}
|
|
610
|
-
function
|
|
611
|
-
|
|
626
|
+
function Pe() {
|
|
627
|
+
b(j, this) && (clearInterval(b(j, this)), x(j, this, void 0));
|
|
612
628
|
}
|
|
613
|
-
function
|
|
614
|
-
|
|
629
|
+
function Fe() {
|
|
630
|
+
b(M, this) && (clearTimeout(b(M, this)), x(M, this, void 0));
|
|
615
631
|
}
|
|
616
|
-
function
|
|
617
|
-
if (
|
|
618
|
-
if (
|
|
619
|
-
if (
|
|
632
|
+
function Ie() {
|
|
633
|
+
if (b(I, this).size === 0) {
|
|
634
|
+
if (y(H, this, Pe).call(this), this.emit("empty"), b(L, this) === 0) {
|
|
635
|
+
if (y(H, this, Fe).call(this), b(N, this) && b(F, this) > 0) {
|
|
620
636
|
let e = Date.now();
|
|
621
|
-
|
|
637
|
+
y(H, this, we).call(this, e);
|
|
622
638
|
}
|
|
623
639
|
this.emit("idle");
|
|
624
640
|
}
|
|
625
641
|
return !1;
|
|
626
642
|
}
|
|
627
643
|
let e = !1;
|
|
628
|
-
if (!
|
|
629
|
-
let t = Date.now(), n = !
|
|
630
|
-
if (
|
|
631
|
-
let r =
|
|
632
|
-
|
|
644
|
+
if (!b(z, this)) {
|
|
645
|
+
let t = Date.now(), n = !y(H, this, Me).call(this, t);
|
|
646
|
+
if (Oe.call(y(H, this)) && ke.call(y(H, this))) {
|
|
647
|
+
let r = b(I, this).dequeue();
|
|
648
|
+
b(T, this) || (y(H, this, Te).call(this, t), y(H, this, W).call(this)), this.emit("active"), r(), n && y(H, this, Le).call(this), e = !0;
|
|
633
649
|
}
|
|
634
650
|
}
|
|
635
651
|
return e;
|
|
636
652
|
}
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
},
|
|
653
|
+
function Le() {
|
|
654
|
+
b(T, this) || b(j, this) !== void 0 || b(N, this) || (x(j, this, setInterval(() => {
|
|
655
|
+
y(H, this, Re).call(this);
|
|
656
|
+
}, b(A, this))), x(ye, this, Date.now() + b(A, this)));
|
|
641
657
|
}
|
|
642
|
-
function
|
|
643
|
-
|
|
658
|
+
function Re() {
|
|
659
|
+
b(N, this) || (b(E, this) === 0 && b(L, this) === 0 && b(j, this) && y(H, this, Pe).call(this), x(E, this, b(w, this) ? b(L, this) : 0)), y(H, this, ze).call(this), y(H, this, W).call(this);
|
|
644
660
|
}
|
|
645
|
-
function
|
|
646
|
-
for (;
|
|
661
|
+
function ze() {
|
|
662
|
+
for (; y(H, this, Ie).call(this););
|
|
647
663
|
}
|
|
648
664
|
async function U(e, t) {
|
|
649
665
|
return new Promise((n) => {
|
|
@@ -653,34 +669,34 @@ async function U(e, t) {
|
|
|
653
669
|
this.on(e, r);
|
|
654
670
|
});
|
|
655
671
|
}
|
|
656
|
-
function
|
|
657
|
-
|
|
658
|
-
|
|
672
|
+
function Be() {
|
|
673
|
+
b(T, this) || (this.on("add", () => {
|
|
674
|
+
b(I, this).size > 0 && y(H, this, W).call(this);
|
|
659
675
|
}), this.on("next", () => {
|
|
660
|
-
|
|
676
|
+
y(H, this, W).call(this);
|
|
661
677
|
}));
|
|
662
678
|
}
|
|
663
679
|
function W() {
|
|
664
|
-
|
|
665
|
-
|
|
680
|
+
b(T, this) || b(k, this) || (x(k, this, !0), queueMicrotask(() => {
|
|
681
|
+
x(k, this, !1), y(H, this, He).call(this);
|
|
666
682
|
}));
|
|
667
683
|
}
|
|
668
|
-
function
|
|
669
|
-
|
|
684
|
+
function Ve() {
|
|
685
|
+
b(T, this) || (y(H, this, Ee).call(this), y(H, this, W).call(this));
|
|
670
686
|
}
|
|
671
|
-
function
|
|
672
|
-
let e =
|
|
673
|
-
if (
|
|
674
|
-
e && (
|
|
687
|
+
function He() {
|
|
688
|
+
let e = b(O, this);
|
|
689
|
+
if (b(T, this) || b(I, this).size === 0) {
|
|
690
|
+
e && (x(O, this, !1), this.emit("rateLimitCleared"));
|
|
675
691
|
return;
|
|
676
692
|
}
|
|
677
693
|
let t;
|
|
678
|
-
if (
|
|
694
|
+
if (b(N, this)) {
|
|
679
695
|
let e = Date.now();
|
|
680
|
-
|
|
681
|
-
} else t =
|
|
682
|
-
let n = t >=
|
|
683
|
-
n !== e && (
|
|
696
|
+
y(H, this, we).call(this, e), t = y(H, this, De).call(this);
|
|
697
|
+
} else t = b(E, this);
|
|
698
|
+
let n = t >= b(D, this);
|
|
699
|
+
n !== e && (x(O, this, n), this.emit(n ? "rateLimit" : "rateLimitCleared"));
|
|
684
700
|
}
|
|
685
701
|
//#endregion
|
|
686
702
|
//#region src/utils/errors.ts
|
|
@@ -688,7 +704,7 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
688
704
|
return e.API_ERROR = "ApiError", e.NETWORK_ERROR = "NetworkError", e.VALIDATION_ERROR = "ValidationError", e.GEOCODING_ERROR = "GeocodingError", e.RATE_LIMIT_ERROR = "RateLimitError", e.TIMEOUT_ERROR = "TimeoutError", e.AUTHENTICATION_ERROR = "AuthenticationError", e.SERVER_ERROR = "ServerError", e.CLIENT_ERROR = "ClientError", e.CONFIGURATION_ERROR = "ConfigurationError", e;
|
|
689
705
|
}({}), K = class e extends Error {
|
|
690
706
|
constructor(t, n, r = {}) {
|
|
691
|
-
super(n),
|
|
707
|
+
super(n), _(this, "type", void 0), _(this, "statusCode", void 0), _(this, "response", void 0), _(this, "originalError", void 0), _(this, "context", void 0), this.name = "BmltQueryError", this.type = t, this.statusCode = r.statusCode, this.response = r.response, this.originalError = r.originalError, this.context = r.context, Object.setPrototypeOf(this, e.prototype);
|
|
692
708
|
}
|
|
693
709
|
isType(e) {
|
|
694
710
|
return this.type === e;
|
|
@@ -770,7 +786,7 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
770
786
|
static createConfigurationError(e, t) {
|
|
771
787
|
return new K(G.CONFIGURATION_ERROR, e, { context: t });
|
|
772
788
|
}
|
|
773
|
-
},
|
|
789
|
+
}, Ue = class e {
|
|
774
790
|
static handleFetchError(e, t) {
|
|
775
791
|
if (e instanceof Error && e.name === "AbortError") return q.createTimeoutError("Request timeout", e);
|
|
776
792
|
if (e instanceof TypeError) return q.createNetworkError("Network connection failed", e);
|
|
@@ -826,22 +842,22 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
826
842
|
}
|
|
827
843
|
}) : q.createApiError(r, void 0, void 0, e);
|
|
828
844
|
}
|
|
829
|
-
},
|
|
845
|
+
}, We = class {
|
|
830
846
|
static async withRetry(e, t) {
|
|
831
847
|
let { maxRetries: n, baseDelay: r, maxDelay: i, factor: a, onRetry: o } = t, s;
|
|
832
848
|
for (let t = 0; t <= n; t++) try {
|
|
833
849
|
return await e();
|
|
834
850
|
} catch (e) {
|
|
835
|
-
let c = e instanceof K ? e :
|
|
851
|
+
let c = e instanceof K ? e : Ue.wrapError(e, "Operation failed");
|
|
836
852
|
if (s = c, t === n || !c.isRetryable()) throw c;
|
|
837
853
|
let l = Math.min(r * a ** +t, i);
|
|
838
854
|
o && o(c, t + 1), await new Promise((e) => setTimeout(e, l));
|
|
839
855
|
}
|
|
840
856
|
throw s;
|
|
841
857
|
}
|
|
842
|
-
},
|
|
858
|
+
}, Ge = class {
|
|
843
859
|
constructor(e = {}) {
|
|
844
|
-
|
|
860
|
+
_(this, "baseURL", void 0), _(this, "queue", void 0), _(this, "defaultOptions", void 0);
|
|
845
861
|
let { retryCount: t = 3, timeout: n = 1e4, userAgent: r = "bmlt-query-client/1.0.0", countryCode: i = "us", viewbox: a, bounded: o = !1, intervalCap: s = 1, interval: c = 1e3, concurrency: l = 1, carryoverConcurrencyCount: u = !1, ...d } = e;
|
|
846
862
|
this.defaultOptions = {
|
|
847
863
|
retryCount: t,
|
|
@@ -850,7 +866,7 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
850
866
|
countryCode: i,
|
|
851
867
|
viewbox: a,
|
|
852
868
|
bounded: o
|
|
853
|
-
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new
|
|
869
|
+
}, this.baseURL = "https://nominatim.openstreetmap.org", this.queue = new Ce({
|
|
854
870
|
intervalCap: s,
|
|
855
871
|
interval: c,
|
|
856
872
|
concurrency: l,
|
|
@@ -896,7 +912,7 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
896
912
|
...this.defaultOptions,
|
|
897
913
|
...t
|
|
898
914
|
};
|
|
899
|
-
return this.queue.add(async () =>
|
|
915
|
+
return this.queue.add(async () => ae(async () => {
|
|
900
916
|
try {
|
|
901
917
|
let t = {
|
|
902
918
|
q: e,
|
|
@@ -962,7 +978,7 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
962
978
|
...this.defaultOptions,
|
|
963
979
|
...t
|
|
964
980
|
};
|
|
965
|
-
return this.queue.add(async () =>
|
|
981
|
+
return this.queue.add(async () => ae(async () => {
|
|
966
982
|
try {
|
|
967
983
|
let t = new URL(`${this.baseURL}/reverse`);
|
|
968
984
|
t.searchParams.append("lat", String(e.latitude)), t.searchParams.append("lon", String(e.longitude)), t.searchParams.append("format", "json"), t.searchParams.append("addressdetails", "1");
|
|
@@ -1028,14 +1044,14 @@ var G = /* @__PURE__ */ function(e) {
|
|
|
1028
1044
|
return e[e.SUNDAY = 1] = "SUNDAY", e[e.MONDAY = 2] = "MONDAY", e[e.TUESDAY = 3] = "TUESDAY", e[e.WEDNESDAY = 4] = "WEDNESDAY", e[e.THURSDAY = 5] = "THURSDAY", e[e.FRIDAY = 6] = "FRIDAY", e[e.SATURDAY = 7] = "SATURDAY", e;
|
|
1029
1045
|
}({}), Z = /* @__PURE__ */ function(e) {
|
|
1030
1046
|
return e[e.IN_PERSON = 1] = "IN_PERSON", e[e.VIRTUAL = 2] = "VIRTUAL", e[e.HYBRID = 3] = "HYBRID", e;
|
|
1031
|
-
}({}),
|
|
1047
|
+
}({}), Ke = /* @__PURE__ */ function(e) {
|
|
1032
1048
|
return e.WEEKDAY = "weekday", e.TIME = "time", e.TOWN = "town", e.STATE = "state", e.WEEKDAY_STATE = "weekday_state", e;
|
|
1033
|
-
}({}),
|
|
1034
|
-
return e.
|
|
1049
|
+
}({}), qe = /* @__PURE__ */ function(e) {
|
|
1050
|
+
return e.DANISH = "da", e.GERMAN = "de", e.GREEK = "el", e.ENGLISH = "en", e.SPANISH = "es", e.PERSIAN = "fa", e.FRENCH = "fr", e.ITALIAN = "it", e.POLISH = "pl", e.PORTUGUESE = "pt", e.RUSSIAN = "ru", e.SWEDISH = "sv", e;
|
|
1035
1051
|
}({});
|
|
1036
1052
|
//#endregion
|
|
1037
1053
|
//#region src/utils/url-builder.ts
|
|
1038
|
-
function
|
|
1054
|
+
function Je(e) {
|
|
1039
1055
|
let { serverURL: t, format: n, endpoint: r, parameters: i = {} } = e, a = `${t.endsWith("/") ? t : `${t}/`}client_interface/${n}/`, o = new URLSearchParams();
|
|
1040
1056
|
return o.set("switcher", r), Object.entries(i).forEach(([e, t]) => {
|
|
1041
1057
|
t != null && (Array.isArray(t) ? t.forEach((t, n) => {
|
|
@@ -1043,7 +1059,7 @@ function We(e) {
|
|
|
1043
1059
|
}) : typeof t == "boolean" ? o.set(e, t ? "1" : "0") : o.set(e, t.toString()));
|
|
1044
1060
|
}), `${a}?${o.toString()}`;
|
|
1045
1061
|
}
|
|
1046
|
-
function
|
|
1062
|
+
function Ye(e) {
|
|
1047
1063
|
let t = {};
|
|
1048
1064
|
return Object.entries(e).forEach(([e, n]) => {
|
|
1049
1065
|
if (n != null) if (Array.isArray(n)) t[e] = n.map((e) => {
|
|
@@ -1061,7 +1077,7 @@ function Ge(e) {
|
|
|
1061
1077
|
} else t[e] = n;
|
|
1062
1078
|
}), t;
|
|
1063
1079
|
}
|
|
1064
|
-
function
|
|
1080
|
+
function Xe(e, t) {
|
|
1065
1081
|
let n = {
|
|
1066
1082
|
[Y.GET_SEARCH_RESULTS]: [
|
|
1067
1083
|
J.JSON,
|
|
@@ -1079,7 +1095,7 @@ function Ke(e, t) {
|
|
|
1079
1095
|
}[e];
|
|
1080
1096
|
if (!n.includes(t)) throw Error(`Invalid format '${t}' for endpoint '${e}'. Valid formats: ${n.join(", ")}`);
|
|
1081
1097
|
}
|
|
1082
|
-
function
|
|
1098
|
+
function Ze(e) {
|
|
1083
1099
|
try {
|
|
1084
1100
|
let t = new URL(e);
|
|
1085
1101
|
if (!["http:", "https:"].includes(t.protocol)) throw Error("Server URL must use http or https protocol");
|
|
@@ -1089,10 +1105,10 @@ function qe(e) {
|
|
|
1089
1105
|
throw n.cause = t, n;
|
|
1090
1106
|
}
|
|
1091
1107
|
}
|
|
1092
|
-
function
|
|
1108
|
+
function Qe(e) {
|
|
1093
1109
|
return typeof e == "number" ? [e] : typeof e == "string" ? e.split(",").map((e) => parseInt(e.trim(), 10)).filter((e) => !isNaN(e)) : Array.isArray(e) ? e.map((e) => typeof e == "number" ? e : parseInt(String(e), 10)).filter((e) => !isNaN(e)) : [];
|
|
1094
1110
|
}
|
|
1095
|
-
function
|
|
1111
|
+
function $e(e, t) {
|
|
1096
1112
|
let n = {};
|
|
1097
1113
|
if (typeof e == "number") {
|
|
1098
1114
|
if (e < 0 || e > 23) throw Error("Hours must be between 0 and 23");
|
|
@@ -1104,7 +1120,7 @@ function Ye(e, t) {
|
|
|
1104
1120
|
}
|
|
1105
1121
|
return n;
|
|
1106
1122
|
}
|
|
1107
|
-
function
|
|
1123
|
+
function et(e, t) {
|
|
1108
1124
|
if (typeof e != "number" || isNaN(e)) throw Error("Latitude must be a valid number");
|
|
1109
1125
|
if (typeof t != "number" || isNaN(t)) throw Error("Longitude must be a valid number");
|
|
1110
1126
|
if (e < -90 || e > 90) throw Error("Latitude must be between -90 and 90 degrees");
|
|
@@ -1114,52 +1130,60 @@ function Q(e) {
|
|
|
1114
1130
|
if (typeof e != "number" || isNaN(e)) throw Error("Radius must be a valid number");
|
|
1115
1131
|
if (e <= 0) throw Error("Radius must be greater than 0");
|
|
1116
1132
|
}
|
|
1117
|
-
function
|
|
1133
|
+
function tt(e) {
|
|
1118
1134
|
return e * 1.60934;
|
|
1119
1135
|
}
|
|
1120
|
-
function
|
|
1136
|
+
function nt(e) {
|
|
1121
1137
|
return e / 1.60934;
|
|
1122
1138
|
}
|
|
1123
1139
|
//#endregion
|
|
1124
1140
|
//#region src/client/bmlt-client.ts
|
|
1125
|
-
var
|
|
1141
|
+
var rt = class {
|
|
1126
1142
|
constructor(e) {
|
|
1127
|
-
|
|
1143
|
+
_(this, "timeout", void 0), _(this, "userAgent", void 0), _(this, "geocodingService", void 0), _(this, "serverURL", void 0), _(this, "defaultFormat", void 0);
|
|
1128
1144
|
let { serverURL: t, defaultFormat: n = J.JSON, timeout: r = 3e4, userAgent: i = "bmlt-query-client/1.0.0", geocodingOptions: a = {}, enableGeocoding: o = !0 } = e;
|
|
1129
|
-
this.serverURL =
|
|
1145
|
+
this.serverURL = Ze(t), this.defaultFormat = n, this.timeout = r, this.userAgent = i, o && (this.geocodingService = new Ge(a));
|
|
1130
1146
|
}
|
|
1131
|
-
async
|
|
1147
|
+
async fetchAndParse(e, t, n = {}) {
|
|
1132
1148
|
let r;
|
|
1133
1149
|
try {
|
|
1134
|
-
|
|
1135
|
-
let i = We({
|
|
1136
|
-
serverURL: this.serverURL,
|
|
1137
|
-
format: n,
|
|
1138
|
-
endpoint: e,
|
|
1139
|
-
parameters: t
|
|
1140
|
-
}), a = new AbortController(), o = setTimeout(() => a.abort(), this.timeout);
|
|
1150
|
+
let i = new AbortController(), a = setTimeout(() => i.abort(), this.timeout);
|
|
1141
1151
|
try {
|
|
1142
|
-
r = await fetch(
|
|
1152
|
+
r = await fetch(e, {
|
|
1143
1153
|
method: "GET",
|
|
1144
1154
|
headers: { "User-Agent": this.userAgent },
|
|
1145
|
-
signal:
|
|
1155
|
+
signal: i.signal
|
|
1146
1156
|
});
|
|
1147
1157
|
} finally {
|
|
1148
|
-
clearTimeout(
|
|
1158
|
+
clearTimeout(a);
|
|
1149
1159
|
}
|
|
1150
|
-
if (!r.ok) throw
|
|
1151
|
-
let
|
|
1152
|
-
if (
|
|
1153
|
-
if (
|
|
1154
|
-
let e =
|
|
1155
|
-
if (!
|
|
1156
|
-
return JSON.parse(
|
|
1160
|
+
if (!r.ok) throw Ue.handleFetchError(/* @__PURE__ */ Error(`HTTP ${r.status}: ${r.statusText}`), r);
|
|
1161
|
+
let o = await r.text();
|
|
1162
|
+
if (t === J.CSV) return o;
|
|
1163
|
+
if (t === J.JSONP) {
|
|
1164
|
+
let e = n.callback || "callback", t = o.match(RegExp(`${e}\\((.+)\\);?$`));
|
|
1165
|
+
if (!t) throw Error("Invalid JSONP response format");
|
|
1166
|
+
return JSON.parse(t[1]);
|
|
1157
1167
|
}
|
|
1158
|
-
return
|
|
1168
|
+
return t === J.JSON || t === J.TSML ? JSON.parse(o) : o;
|
|
1159
1169
|
} catch (e) {
|
|
1160
|
-
throw
|
|
1170
|
+
throw Ue.handleFetchError(e, r);
|
|
1161
1171
|
}
|
|
1162
1172
|
}
|
|
1173
|
+
async makeRequest(e, t = {}, n = this.defaultFormat) {
|
|
1174
|
+
Xe(e, n);
|
|
1175
|
+
let r = Je({
|
|
1176
|
+
serverURL: this.serverURL,
|
|
1177
|
+
format: n,
|
|
1178
|
+
endpoint: e,
|
|
1179
|
+
parameters: t
|
|
1180
|
+
});
|
|
1181
|
+
return this.fetchAndParse(r, n, t);
|
|
1182
|
+
}
|
|
1183
|
+
async rawQuery(e, t = this.defaultFormat) {
|
|
1184
|
+
let n = `${this.serverURL.endsWith("/") ? this.serverURL : `${this.serverURL}/`}client_interface/${t}/`, r = e.split("&")[0].includes("=") ? e : `switcher=${e}`;
|
|
1185
|
+
return this.fetchAndParse(`${n}?${r}`, t);
|
|
1186
|
+
}
|
|
1163
1187
|
async searchMeetings(e = {}) {
|
|
1164
1188
|
let { format: t = this.defaultFormat, ...n } = e;
|
|
1165
1189
|
return this.makeRequest(Y.GET_SEARCH_RESULTS, n, t);
|
|
@@ -1182,7 +1206,7 @@ var $e = class {
|
|
|
1182
1206
|
return n === void 0 ? r !== void 0 && (Q(r), s.geo_width_km = r) : (Q(n), s.geo_width = n), this.searchMeetings(s);
|
|
1183
1207
|
}
|
|
1184
1208
|
async searchMeetingsByCoordinates(e, t, n, r = {}) {
|
|
1185
|
-
|
|
1209
|
+
et(e.latitude, e.longitude);
|
|
1186
1210
|
let i = {
|
|
1187
1211
|
...r,
|
|
1188
1212
|
lat_val: e.latitude,
|
|
@@ -1231,7 +1255,7 @@ var $e = class {
|
|
|
1231
1255
|
return this.serverURL;
|
|
1232
1256
|
}
|
|
1233
1257
|
setServerURL(e) {
|
|
1234
|
-
this.serverURL =
|
|
1258
|
+
this.serverURL = Ze(e);
|
|
1235
1259
|
}
|
|
1236
1260
|
getDefaultFormat() {
|
|
1237
1261
|
return this.defaultFormat;
|
|
@@ -1264,7 +1288,7 @@ var $e = class {
|
|
|
1264
1288
|
}
|
|
1265
1289
|
}, $ = class e {
|
|
1266
1290
|
constructor(e) {
|
|
1267
|
-
|
|
1291
|
+
_(this, "params", {}), _(this, "client", void 0), this.client = e;
|
|
1268
1292
|
}
|
|
1269
1293
|
meetingIds(e, t = !1) {
|
|
1270
1294
|
return Array.isArray(e) ? this.params.meeting_ids = t ? e.map((e) => -e) : e : this.params.meeting_ids = t ? -e : e, this;
|
|
@@ -1392,9 +1416,9 @@ var $e = class {
|
|
|
1392
1416
|
searchParams: this.params
|
|
1393
1417
|
});
|
|
1394
1418
|
}
|
|
1395
|
-
},
|
|
1419
|
+
}, it = class {
|
|
1396
1420
|
constructor(e) {
|
|
1397
|
-
|
|
1421
|
+
_(this, "client", void 0), this.client = e;
|
|
1398
1422
|
}
|
|
1399
1423
|
today() {
|
|
1400
1424
|
let e = (/* @__PURE__ */ new Date()).getDay(), t = e === 0 ? X.SUNDAY : e;
|
|
@@ -1421,23 +1445,23 @@ var $e = class {
|
|
|
1421
1445
|
byText(e) {
|
|
1422
1446
|
return new $(this.client).searchText(e);
|
|
1423
1447
|
}
|
|
1424
|
-
},
|
|
1448
|
+
}, at = [
|
|
1425
1449
|
"weekday_tinyint",
|
|
1426
1450
|
"start_time",
|
|
1427
1451
|
"meeting_name",
|
|
1428
1452
|
"location_text"
|
|
1429
1453
|
];
|
|
1430
|
-
function
|
|
1454
|
+
function ot(e, t) {
|
|
1431
1455
|
let n = e == null ? "" : String(e);
|
|
1432
1456
|
return t ? n.toLowerCase().trim() : n;
|
|
1433
1457
|
}
|
|
1434
|
-
function
|
|
1435
|
-
return t.map((t) =>
|
|
1458
|
+
function st(e, t, n) {
|
|
1459
|
+
return t.map((t) => ot(e[t], n)).join(" | ");
|
|
1436
1460
|
}
|
|
1437
|
-
function
|
|
1438
|
-
let { fields: n =
|
|
1461
|
+
function ct(e, t = {}) {
|
|
1462
|
+
let { fields: n = at, normalize: r = !0 } = t, i = /* @__PURE__ */ new Map();
|
|
1439
1463
|
for (let t = 0; t < e.length; t++) for (let a of e[t]) {
|
|
1440
|
-
let e =
|
|
1464
|
+
let e = st(a, n, r);
|
|
1441
1465
|
i.has(e) || i.set(e, []), i.get(e).push({
|
|
1442
1466
|
meeting: a,
|
|
1443
1467
|
listIndex: t
|
|
@@ -1450,7 +1474,7 @@ function it(e, t = {}) {
|
|
|
1450
1474
|
});
|
|
1451
1475
|
return a;
|
|
1452
1476
|
}
|
|
1453
|
-
function
|
|
1477
|
+
function lt(e) {
|
|
1454
1478
|
let t = /* @__PURE__ */ new Map();
|
|
1455
1479
|
for (let { service_body_bigint: n, meeting_name: r } of e) {
|
|
1456
1480
|
if (!n || !r) continue;
|
|
@@ -1462,6 +1486,6 @@ function at(e) {
|
|
|
1462
1486
|
return n;
|
|
1463
1487
|
}
|
|
1464
1488
|
//#endregion
|
|
1465
|
-
export {
|
|
1489
|
+
export { rt as BmltClient, J as BmltDataFormat, Y as BmltEndpoint, G as BmltErrorType, K as BmltQueryError, q as ErrorFactory, Ue as ErrorHandler, Ge as GeocodingService, qe as Language, $ as MeetingQueryBuilder, it as QuickSearch, We as RetryHandler, Ke as SortKey, Z as VenueType, X as Weekday, Je as buildBmltURL, lt as countUniqueGroups, Qe as extractIds, ct as findDuplicateMeetings, $e as formatTimeValue, nt as kilometersToMiles, tt as milesToKilometers, Ye as normalizeParameters, et as validateCoordinates, Xe as validateEndpointFormat, Q as validateRadius, Ze as validateServerURL };
|
|
1466
1490
|
|
|
1467
1491
|
//# sourceMappingURL=app.js.map
|