andoncloud-prometheus-widget 1.3.12 → 1.3.13

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/dist/index.js CHANGED
@@ -18,27 +18,7 @@ import { satisfies } from "compare-versions";
18
18
  import * as yup from "yup";
19
19
  import i18n from "i18next";
20
20
  //#region \0rolldown/runtime.js
21
- var __create = Object.create;
22
- var __defProp = Object.defineProperty;
23
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
24
- var __getOwnPropNames = Object.getOwnPropertyNames;
25
- var __getProtoOf = Object.getPrototypeOf;
26
- var __hasOwnProp = Object.prototype.hasOwnProperty;
27
21
  var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
28
- var __copyProps = (to, from, except, desc) => {
29
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
30
- key = keys[i];
31
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
32
- get: ((k) => from[k]).bind(null, key),
33
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
34
- });
35
- }
36
- return to;
37
- };
38
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
39
- value: mod,
40
- enumerable: true
41
- }) : target, mod));
42
22
  //#endregion
43
23
  //#region src/locales/en/translation.json
44
24
  var translation_default$1 = { prometheusWidget: {
@@ -96,7 +76,7 @@ const resources = {
96
76
  };
97
77
  //#endregion
98
78
  //#region src/version.ts
99
- const LIBRARY_VERSION = "1.3.12";
79
+ const LIBRARY_VERSION = "1.3.13";
100
80
  //#endregion
101
81
  //#region src/types.ts
102
82
  let QueriesPeriod = /* @__PURE__ */ function(QueriesPeriod) {
@@ -340,1943 +320,2152 @@ const SettingsFormContent = ({ formProps }) => {
340
320
  });
341
321
  };
342
322
  //#endregion
343
- //#region node_modules/chartjs-plugin-datasource-prometheus/dist/chartjs-plugin-datasource-prometheus.umd.js
344
- var require_chartjs_plugin_datasource_prometheus_umd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
345
- /*!
346
- * chartjs-plugin-datasource-prometheus v2.4.2
347
- * github.com/samber/chartjs-plugin-datasource-prometheus
348
- * (c) 2025 chartjs-plugin-datasource-prometheus Contributors
349
- * Released under the MIT License
350
- */
323
+ //#region node_modules/prometheus-query/dist/prometheus-query.umd.js
324
+ var require_prometheus_query_umd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
351
325
  /*!
352
- * chartjs-plugin-datasource-prometheus v2.4.2
353
- * github.com/samber/chartjs-plugin-datasource-prometheus
354
- * (c) 2025 chartjs-plugin-datasource-prometheus Contributors
326
+ * prometheus-query v3.5.1
327
+ * github.com/samber/prometheus-query-js
328
+ * (c) 2025 prometheus-query-js Contributors
355
329
  * Released under the MIT License
356
330
  */
357
331
  (function(e, t) {
358
- "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).ChartDatasourcePrometheusPlugin = t();
359
- })(exports, (function() {
332
+ "object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).Prometheus = {});
333
+ })(exports, (function(e) {
360
334
  "use strict";
361
- var e, t = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, r = { exports: {} };
362
- var n = (e || (e = 1, function(e, r) {
363
- (function(e) {
364
- function r(e, t) {
365
- return function() {
366
- return e.apply(t, arguments);
367
- };
368
- }
369
- const { toString: n } = Object.prototype, { getPrototypeOf: o } = Object, s = (i = Object.create(null), (e) => {
370
- const t = n.call(e);
371
- return i[t] || (i[t] = t.slice(8, -1).toLowerCase());
372
- });
373
- var i;
374
- const a = (e) => (e = e.toLowerCase(), (t) => s(t) === e), l = (e) => (t) => typeof t === e, { isArray: c } = Array, u = l("undefined"), d = a("ArrayBuffer"), f = l("string"), h = l("function"), p = l("number"), m = (e) => null !== e && "object" == typeof e, g = (e) => {
375
- if ("object" !== s(e)) return !1;
376
- const t = o(e);
377
- return !(null !== t && t !== Object.prototype && null !== Object.getPrototypeOf(t) || Symbol.toStringTag in e || Symbol.iterator in e);
378
- }, b = a("Date"), y = a("File"), w = a("Blob"), E = a("FileList"), R = a("URLSearchParams"), [T, v, S, O] = [
379
- "ReadableStream",
380
- "Request",
381
- "Response",
382
- "Headers"
383
- ].map(a);
384
- function x(e, t, { allOwnKeys: r = !1 } = {}) {
385
- if (null == e) return;
386
- let n, o;
387
- if ("object" != typeof e && (e = [e]), c(e)) for (n = 0, o = e.length; n < o; n++) t.call(null, e[n], n, e);
388
- else {
389
- const o = r ? Object.getOwnPropertyNames(e) : Object.keys(e), s = o.length;
390
- let i;
391
- for (n = 0; n < s; n++) i = o[n], t.call(null, e[i], i, e);
392
- }
335
+ function t(e, t) {
336
+ return function() {
337
+ return e.apply(t, arguments);
338
+ };
339
+ }
340
+ const { toString: r } = Object.prototype, { getPrototypeOf: n } = Object, { iterator: o, toStringTag: s } = Symbol, i = (a = Object.create(null), (e) => {
341
+ const t = r.call(e);
342
+ return a[t] || (a[t] = t.slice(8, -1).toLowerCase());
343
+ });
344
+ var a;
345
+ const c = (e) => (e = e.toLowerCase(), (t) => i(t) === e), l = (e) => (t) => typeof t === e, { isArray: u } = Array, f = l("undefined");
346
+ function d(e) {
347
+ return null !== e && !f(e) && null !== e.constructor && !f(e.constructor) && m(e.constructor.isBuffer) && e.constructor.isBuffer(e);
348
+ }
349
+ const h = c("ArrayBuffer");
350
+ const p = l("string"), m = l("function"), y = l("number"), b = (e) => null !== e && "object" == typeof e, g = (e) => {
351
+ if ("object" !== i(e)) return !1;
352
+ const t = n(e);
353
+ return !(null !== t && t !== Object.prototype && null !== Object.getPrototypeOf(t) || s in e || o in e);
354
+ }, w = c("Date"), E = c("File"), O = c("Blob"), T = c("FileList"), S = c("URLSearchParams"), [R, v, A, x] = [
355
+ "ReadableStream",
356
+ "Request",
357
+ "Response",
358
+ "Headers"
359
+ ].map(c);
360
+ function N(e, t, { allOwnKeys: r = !1 } = {}) {
361
+ if (null == e) return;
362
+ let n, o;
363
+ if ("object" != typeof e && (e = [e]), u(e)) for (n = 0, o = e.length; n < o; n++) t.call(null, e[n], n, e);
364
+ else {
365
+ if (d(e)) return;
366
+ const o = r ? Object.getOwnPropertyNames(e) : Object.keys(e), s = o.length;
367
+ let i;
368
+ for (n = 0; n < s; n++) i = o[n], t.call(null, e[i], i, e);
369
+ }
370
+ }
371
+ function P(e, t) {
372
+ if (d(e)) return null;
373
+ t = t.toLowerCase();
374
+ const r = Object.keys(e);
375
+ let n, o = r.length;
376
+ for (; o-- > 0;) if (n = r[o], t === n.toLowerCase()) return n;
377
+ return null;
378
+ }
379
+ const j = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : global, C = (e) => !f(e) && e !== j;
380
+ const U = (_ = "undefined" != typeof Uint8Array && n(Uint8Array), (e) => _ && e instanceof _);
381
+ var _;
382
+ const L = c("HTMLFormElement"), F = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), q = c("RegExp"), k = (e, t) => {
383
+ const r = Object.getOwnPropertyDescriptors(e), n = {};
384
+ N(r, ((r, o) => {
385
+ let s;
386
+ !1 !== (s = t(r, o, e)) && (n[o] = s || r);
387
+ })), Object.defineProperties(e, n);
388
+ };
389
+ const D = c("AsyncFunction"), B = (I = "function" == typeof setImmediate, J = m(j.postMessage), I ? setImmediate : J ? (M = `axios@${Math.random()}`, G = [], j.addEventListener("message", (({ source: e, data: t }) => {
390
+ e === j && t === M && G.length && G.shift()();
391
+ }), !1), (e) => {
392
+ G.push(e), j.postMessage(M, "*");
393
+ }) : (e) => setTimeout(e));
394
+ var I, J, M, G;
395
+ var $ = {
396
+ isArray: u,
397
+ isArrayBuffer: h,
398
+ isBuffer: d,
399
+ isFormData: (e) => {
400
+ let t;
401
+ return e && ("function" == typeof FormData && e instanceof FormData || m(e.append) && ("formdata" === (t = i(e)) || "object" === t && m(e.toString) && "[object FormData]" === e.toString()));
402
+ },
403
+ isArrayBufferView: function(e) {
404
+ let t;
405
+ return t = "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && h(e.buffer), t;
406
+ },
407
+ isString: p,
408
+ isNumber: y,
409
+ isBoolean: (e) => !0 === e || !1 === e,
410
+ isObject: b,
411
+ isPlainObject: g,
412
+ isEmptyObject: (e) => {
413
+ if (!b(e) || d(e)) return !1;
414
+ try {
415
+ return 0 === Object.keys(e).length && Object.getPrototypeOf(e) === Object.prototype;
416
+ } catch (e) {
417
+ return !1;
393
418
  }
394
- function A(e, t) {
395
- t = t.toLowerCase();
396
- const r = Object.keys(e);
397
- let n, o = r.length;
398
- for (; o-- > 0;) if (n = r[o], t === n.toLowerCase()) return n;
399
- return null;
419
+ },
420
+ isReadableStream: R,
421
+ isRequest: v,
422
+ isResponse: A,
423
+ isHeaders: x,
424
+ isUndefined: f,
425
+ isDate: w,
426
+ isFile: E,
427
+ isBlob: O,
428
+ isRegExp: q,
429
+ isFunction: m,
430
+ isStream: (e) => b(e) && m(e.pipe),
431
+ isURLSearchParams: S,
432
+ isTypedArray: U,
433
+ isFileList: T,
434
+ forEach: N,
435
+ merge: function e() {
436
+ const { caseless: t, skipUndefined: r } = C(this) && this || {}, n = {}, o = (o, s) => {
437
+ const i = t && P(n, s) || s;
438
+ g(n[i]) && g(o) ? n[i] = e(n[i], o) : g(o) ? n[i] = e({}, o) : u(o) ? n[i] = o.slice() : r && f(o) || (n[i] = o);
439
+ };
440
+ for (let e = 0, t = arguments.length; e < t; e++) arguments[e] && N(arguments[e], o);
441
+ return n;
442
+ },
443
+ extend: (e, r, n, { allOwnKeys: o } = {}) => (N(r, ((r, o) => {
444
+ n && m(r) ? e[o] = t(r, n) : e[o] = r;
445
+ }), { allOwnKeys: o }), e),
446
+ trim: (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""),
447
+ stripBOM: (e) => (65279 === e.charCodeAt(0) && (e = e.slice(1)), e),
448
+ inherits: (e, t, r, n) => {
449
+ e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", { value: t.prototype }), r && Object.assign(e.prototype, r);
450
+ },
451
+ toFlatObject: (e, t, r, o) => {
452
+ let s, i, a;
453
+ const c = {};
454
+ if (t = t || {}, null == e) return t;
455
+ do {
456
+ for (s = Object.getOwnPropertyNames(e), i = s.length; i-- > 0;) a = s[i], o && !o(a, e, t) || c[a] || (t[a] = e[a], c[a] = !0);
457
+ e = !1 !== r && n(e);
458
+ } while (e && (!r || r(e, t)) && e !== Object.prototype);
459
+ return t;
460
+ },
461
+ kindOf: i,
462
+ kindOfTest: c,
463
+ endsWith: (e, t, r) => {
464
+ e = String(e), (void 0 === r || r > e.length) && (r = e.length), r -= t.length;
465
+ const n = e.indexOf(t, r);
466
+ return -1 !== n && n === r;
467
+ },
468
+ toArray: (e) => {
469
+ if (!e) return null;
470
+ if (u(e)) return e;
471
+ let t = e.length;
472
+ if (!y(t)) return null;
473
+ const r = new Array(t);
474
+ for (; t-- > 0;) r[t] = e[t];
475
+ return r;
476
+ },
477
+ forEachEntry: (e, t) => {
478
+ const r = (e && e[o]).call(e);
479
+ let n;
480
+ for (; (n = r.next()) && !n.done;) {
481
+ const r = n.value;
482
+ t.call(e, r[0], r[1]);
400
483
  }
401
- const N = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : t, P = (e) => !u(e) && e !== N, C = (j = "undefined" != typeof Uint8Array && o(Uint8Array), (e) => j && e instanceof j);
402
- var j;
403
- const D = a("HTMLFormElement"), U = (({ hasOwnProperty: e }) => (t, r) => e.call(t, r))(Object.prototype), k = a("RegExp"), _ = (e, t) => {
404
- const r = Object.getOwnPropertyDescriptors(e), n = {};
405
- x(r, ((r, o) => {
406
- let s;
407
- !1 !== (s = t(r, o, e)) && (n[o] = s || r);
408
- })), Object.defineProperties(e, n);
409
- }, q = a("AsyncFunction"), B = (L = "function" == typeof setImmediate, F = h(N.postMessage), L ? setImmediate : F ? (M = `axios@${Math.random()}`, I = [], N.addEventListener("message", (({ source: e, data: t }) => {
410
- e === N && t === M && I.length && I.shift()();
411
- }), !1), (e) => {
412
- I.push(e), N.postMessage(M, "*");
413
- }) : (e) => setTimeout(e));
414
- var L, F, M, I;
415
- var G = {
416
- isArray: c,
417
- isArrayBuffer: d,
418
- isBuffer: function(e) {
419
- return null !== e && !u(e) && null !== e.constructor && !u(e.constructor) && h(e.constructor.isBuffer) && e.constructor.isBuffer(e);
420
- },
421
- isFormData: (e) => {
422
- let t;
423
- return e && ("function" == typeof FormData && e instanceof FormData || h(e.append) && ("formdata" === (t = s(e)) || "object" === t && h(e.toString) && "[object FormData]" === e.toString()));
424
- },
425
- isArrayBufferView: function(e) {
426
- let t;
427
- return t = "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && d(e.buffer), t;
428
- },
429
- isString: f,
430
- isNumber: p,
431
- isBoolean: (e) => !0 === e || !1 === e,
432
- isObject: m,
433
- isPlainObject: g,
434
- isReadableStream: T,
435
- isRequest: v,
436
- isResponse: S,
437
- isHeaders: O,
438
- isUndefined: u,
439
- isDate: b,
440
- isFile: y,
441
- isBlob: w,
442
- isRegExp: k,
443
- isFunction: h,
444
- isStream: (e) => m(e) && h(e.pipe),
445
- isURLSearchParams: R,
446
- isTypedArray: C,
447
- isFileList: E,
448
- forEach: x,
449
- merge: function e() {
450
- const { caseless: t } = P(this) && this || {}, r = {}, n = (n, o) => {
451
- const s = t && A(r, o) || o;
452
- g(r[s]) && g(n) ? r[s] = e(r[s], n) : g(n) ? r[s] = e({}, n) : c(n) ? r[s] = n.slice() : r[s] = n;
453
- };
454
- for (let e = 0, t = arguments.length; e < t; e++) arguments[e] && x(arguments[e], n);
455
- return r;
456
- },
457
- extend: (e, t, n, { allOwnKeys: o } = {}) => (x(t, ((t, o) => {
458
- n && h(t) ? e[o] = r(t, n) : e[o] = t;
459
- }), { allOwnKeys: o }), e),
460
- trim: (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""),
461
- stripBOM: (e) => (65279 === e.charCodeAt(0) && (e = e.slice(1)), e),
462
- inherits: (e, t, r, n) => {
463
- e.prototype = Object.create(t.prototype, n), e.prototype.constructor = e, Object.defineProperty(e, "super", { value: t.prototype }), r && Object.assign(e.prototype, r);
464
- },
465
- toFlatObject: (e, t, r, n) => {
466
- let s, i, a;
467
- const l = {};
468
- if (t = t || {}, null == e) return t;
469
- do {
470
- for (s = Object.getOwnPropertyNames(e), i = s.length; i-- > 0;) a = s[i], n && !n(a, e, t) || l[a] || (t[a] = e[a], l[a] = !0);
471
- e = !1 !== r && o(e);
472
- } while (e && (!r || r(e, t)) && e !== Object.prototype);
473
- return t;
474
- },
475
- kindOf: s,
476
- kindOfTest: a,
477
- endsWith: (e, t, r) => {
478
- e = String(e), (void 0 === r || r > e.length) && (r = e.length), r -= t.length;
479
- const n = e.indexOf(t, r);
480
- return -1 !== n && n === r;
481
- },
482
- toArray: (e) => {
483
- if (!e) return null;
484
- if (c(e)) return e;
485
- let t = e.length;
486
- if (!p(t)) return null;
487
- const r = new Array(t);
488
- for (; t-- > 0;) r[t] = e[t];
489
- return r;
490
- },
491
- forEachEntry: (e, t) => {
492
- const r = (e && e[Symbol.iterator]).call(e);
493
- let n;
494
- for (; (n = r.next()) && !n.done;) {
495
- const r = n.value;
496
- t.call(e, r[0], r[1]);
484
+ },
485
+ matchAll: (e, t) => {
486
+ let r;
487
+ const n = [];
488
+ for (; null !== (r = e.exec(t));) n.push(r);
489
+ return n;
490
+ },
491
+ isHTMLForm: L,
492
+ hasOwnProperty: F,
493
+ hasOwnProp: F,
494
+ reduceDescriptors: k,
495
+ freezeMethods: (e) => {
496
+ k(e, ((t, r) => {
497
+ if (m(e) && -1 !== [
498
+ "arguments",
499
+ "caller",
500
+ "callee"
501
+ ].indexOf(r)) return !1;
502
+ const n = e[r];
503
+ m(n) && (t.enumerable = !1, "writable" in t ? t.writable = !1 : t.set || (t.set = () => {
504
+ throw Error("Can not rewrite read-only method '" + r + "'");
505
+ }));
506
+ }));
507
+ },
508
+ toObjectSet: (e, t) => {
509
+ const r = {}, n = (e) => {
510
+ e.forEach(((e) => {
511
+ r[e] = !0;
512
+ }));
513
+ };
514
+ return u(e) ? n(e) : n(String(e).split(t)), r;
515
+ },
516
+ toCamelCase: (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, (function(e, t, r) {
517
+ return t.toUpperCase() + r;
518
+ })),
519
+ noop: () => {},
520
+ toFiniteNumber: (e, t) => null != e && Number.isFinite(e = +e) ? e : t,
521
+ findKey: P,
522
+ global: j,
523
+ isContextDefined: C,
524
+ isSpecCompliantForm: function(e) {
525
+ return !!(e && m(e.append) && "FormData" === e[s] && e[o]);
526
+ },
527
+ toJSONObject: (e) => {
528
+ const t = new Array(10), r = (e, n) => {
529
+ if (b(e)) {
530
+ if (t.indexOf(e) >= 0) return;
531
+ if (d(e)) return e;
532
+ if (!("toJSON" in e)) {
533
+ t[n] = e;
534
+ const o = u(e) ? [] : {};
535
+ return N(e, ((e, t) => {
536
+ const s = r(e, n + 1);
537
+ !f(s) && (o[t] = s);
538
+ })), t[n] = void 0, o;
497
539
  }
498
- },
499
- matchAll: (e, t) => {
500
- let r;
501
- const n = [];
502
- for (; null !== (r = e.exec(t));) n.push(r);
503
- return n;
504
- },
505
- isHTMLForm: D,
506
- hasOwnProperty: U,
507
- hasOwnProp: U,
508
- reduceDescriptors: _,
509
- freezeMethods: (e) => {
510
- _(e, ((t, r) => {
511
- if (h(e) && -1 !== [
512
- "arguments",
513
- "caller",
514
- "callee"
515
- ].indexOf(r)) return !1;
516
- const n = e[r];
517
- h(n) && (t.enumerable = !1, "writable" in t ? t.writable = !1 : t.set || (t.set = () => {
518
- throw Error("Can not rewrite read-only method '" + r + "'");
519
- }));
520
- }));
521
- },
522
- toObjectSet: (e, t) => {
523
- const r = {}, n = (e) => {
524
- e.forEach(((e) => {
525
- r[e] = !0;
526
- }));
527
- };
528
- return c(e) ? n(e) : n(String(e).split(t)), r;
529
- },
530
- toCamelCase: (e) => e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, (function(e, t, r) {
531
- return t.toUpperCase() + r;
532
- })),
533
- noop: () => {},
534
- toFiniteNumber: (e, t) => null != e && Number.isFinite(e = +e) ? e : t,
535
- findKey: A,
536
- global: N,
537
- isContextDefined: P,
538
- isSpecCompliantForm: function(e) {
539
- return !!(e && h(e.append) && "FormData" === e[Symbol.toStringTag] && e[Symbol.iterator]);
540
- },
541
- toJSONObject: (e) => {
542
- const t = new Array(10), r = (e, n) => {
543
- if (m(e)) {
544
- if (t.indexOf(e) >= 0) return;
545
- if (!("toJSON" in e)) {
546
- t[n] = e;
547
- const o = c(e) ? [] : {};
548
- return x(e, ((e, t) => {
549
- const s = r(e, n + 1);
550
- !u(s) && (o[t] = s);
551
- })), t[n] = void 0, o;
552
- }
553
- }
554
- return e;
555
- };
556
- return r(e, 0);
557
- },
558
- isAsyncFn: q,
559
- isThenable: (e) => e && (m(e) || h(e)) && h(e.then) && h(e.catch),
560
- setImmediate: B,
561
- asap: "undefined" != typeof queueMicrotask ? queueMicrotask.bind(N) : "undefined" != typeof process && process.nextTick || B
540
+ }
541
+ return e;
562
542
  };
563
- function z(e, t, r, n, o) {
564
- Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = (/* @__PURE__ */ new Error()).stack, this.message = e, this.name = "AxiosError", t && (this.code = t), r && (this.config = r), n && (this.request = n), o && (this.response = o, this.status = o.status ? o.status : null);
565
- }
566
- G.inherits(z, Error, { toJSON: function() {
567
- return {
568
- message: this.message,
569
- name: this.name,
570
- description: this.description,
571
- number: this.number,
572
- fileName: this.fileName,
573
- lineNumber: this.lineNumber,
574
- columnNumber: this.columnNumber,
575
- stack: this.stack,
576
- config: G.toJSONObject(this.config),
577
- code: this.code,
578
- status: this.status
579
- };
580
- } });
581
- const H = z.prototype, $ = {};
582
- function W(e) {
583
- return G.isPlainObject(e) || G.isArray(e);
584
- }
585
- function V(e) {
586
- return G.endsWith(e, "[]") ? e.slice(0, -2) : e;
543
+ return r(e, 0);
544
+ },
545
+ isAsyncFn: D,
546
+ isThenable: (e) => e && (b(e) || m(e)) && m(e.then) && m(e.catch),
547
+ setImmediate: B,
548
+ asap: "undefined" != typeof queueMicrotask ? queueMicrotask.bind(j) : "undefined" != typeof process && process.nextTick || B,
549
+ isIterable: (e) => null != e && m(e[o])
550
+ };
551
+ function H(e, t, r, n, o) {
552
+ Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = (/* @__PURE__ */ new Error()).stack, this.message = e, this.name = "AxiosError", t && (this.code = t), r && (this.config = r), n && (this.request = n), o && (this.response = o, this.status = o.status ? o.status : null);
553
+ }
554
+ $.inherits(H, Error, { toJSON: function() {
555
+ return {
556
+ message: this.message,
557
+ name: this.name,
558
+ description: this.description,
559
+ number: this.number,
560
+ fileName: this.fileName,
561
+ lineNumber: this.lineNumber,
562
+ columnNumber: this.columnNumber,
563
+ stack: this.stack,
564
+ config: $.toJSONObject(this.config),
565
+ code: this.code,
566
+ status: this.status
567
+ };
568
+ } });
569
+ const W = H.prototype, V = {};
570
+ [
571
+ "ERR_BAD_OPTION_VALUE",
572
+ "ERR_BAD_OPTION",
573
+ "ECONNABORTED",
574
+ "ETIMEDOUT",
575
+ "ERR_NETWORK",
576
+ "ERR_FR_TOO_MANY_REDIRECTS",
577
+ "ERR_DEPRECATED",
578
+ "ERR_BAD_RESPONSE",
579
+ "ERR_BAD_REQUEST",
580
+ "ERR_CANCELED",
581
+ "ERR_NOT_SUPPORT",
582
+ "ERR_INVALID_URL"
583
+ ].forEach(((e) => {
584
+ V[e] = { value: e };
585
+ })), Object.defineProperties(H, V), Object.defineProperty(W, "isAxiosError", { value: !0 }), H.from = (e, t, r, n, o, s) => {
586
+ const i = Object.create(W);
587
+ $.toFlatObject(e, i, (function(e) {
588
+ return e !== Error.prototype;
589
+ }), ((e) => "isAxiosError" !== e));
590
+ const a = e && e.message ? e.message : "Error", c = null == t && e ? e.code : t;
591
+ return H.call(i, a, c, r, n, o), e && null == i.cause && Object.defineProperty(i, "cause", {
592
+ value: e,
593
+ configurable: !0
594
+ }), i.name = e && e.name || "Error", s && Object.assign(i, s), i;
595
+ };
596
+ function K(e) {
597
+ return $.isPlainObject(e) || $.isArray(e);
598
+ }
599
+ function X(e) {
600
+ return $.endsWith(e, "[]") ? e.slice(0, -2) : e;
601
+ }
602
+ function Q(e, t, r) {
603
+ return e ? e.concat(t).map((function(e, t) {
604
+ return e = X(e), !r && t ? "[" + e + "]" : e;
605
+ })).join(r ? "." : "") : t;
606
+ }
607
+ const Z = $.toFlatObject($, {}, null, (function(e) {
608
+ return /^is[A-Z]/.test(e);
609
+ }));
610
+ function Y(e, t, r) {
611
+ if (!$.isObject(e)) throw new TypeError("target must be an object");
612
+ t = t || new FormData();
613
+ const n = (r = $.toFlatObject(r, {
614
+ metaTokens: !0,
615
+ dots: !1,
616
+ indexes: !1
617
+ }, !1, (function(e, t) {
618
+ return !$.isUndefined(t[e]);
619
+ }))).metaTokens, o = r.visitor || l, s = r.dots, i = r.indexes, a = (r.Blob || "undefined" != typeof Blob && Blob) && $.isSpecCompliantForm(t);
620
+ if (!$.isFunction(o)) throw new TypeError("visitor must be a function");
621
+ function c(e) {
622
+ if (null === e) return "";
623
+ if ($.isDate(e)) return e.toISOString();
624
+ if ($.isBoolean(e)) return e.toString();
625
+ if (!a && $.isBlob(e)) throw new H("Blob is not supported. Use a Buffer instead.");
626
+ return $.isArrayBuffer(e) || $.isTypedArray(e) ? a && "function" == typeof Blob ? new Blob([e]) : Buffer.from(e) : e;
627
+ }
628
+ function l(e, r, o) {
629
+ let a = e;
630
+ if (e && !o && "object" == typeof e) {
631
+ if ($.endsWith(r, "{}")) r = n ? r : r.slice(0, -2), e = JSON.stringify(e);
632
+ else if ($.isArray(e) && function(e) {
633
+ return $.isArray(e) && !e.some(K);
634
+ }(e) || ($.isFileList(e) || $.endsWith(r, "[]")) && (a = $.toArray(e))) return r = X(r), a.forEach((function(e, n) {
635
+ !$.isUndefined(e) && null !== e && t.append(!0 === i ? Q([r], n, s) : null === i ? r : r + "[]", c(e));
636
+ })), !1;
587
637
  }
588
- function K(e, t, r) {
589
- return e ? e.concat(t).map((function(e, t) {
590
- return e = V(e), !r && t ? "[" + e + "]" : e;
591
- })).join(r ? "." : "") : t;
638
+ return !!K(e) || (t.append(Q(o, r, s), c(e)), !1);
639
+ }
640
+ const u = [], f = Object.assign(Z, {
641
+ defaultVisitor: l,
642
+ convertValue: c,
643
+ isVisitable: K
644
+ });
645
+ if (!$.isObject(e)) throw new TypeError("data must be an object");
646
+ return function e(r, n) {
647
+ if (!$.isUndefined(r)) {
648
+ if (-1 !== u.indexOf(r)) throw Error("Circular reference detected in " + n.join("."));
649
+ u.push(r), $.forEach(r, (function(r, s) {
650
+ !0 === (!($.isUndefined(r) || null === r) && o.call(t, r, $.isString(s) ? s.trim() : s, n, f)) && e(r, n ? n.concat(s) : [s]);
651
+ })), u.pop();
592
652
  }
593
- [
594
- "ERR_BAD_OPTION_VALUE",
595
- "ERR_BAD_OPTION",
596
- "ECONNABORTED",
597
- "ETIMEDOUT",
598
- "ERR_NETWORK",
599
- "ERR_FR_TOO_MANY_REDIRECTS",
600
- "ERR_DEPRECATED",
601
- "ERR_BAD_RESPONSE",
602
- "ERR_BAD_REQUEST",
603
- "ERR_CANCELED",
604
- "ERR_NOT_SUPPORT",
605
- "ERR_INVALID_URL"
606
- ].forEach(((e) => {
607
- $[e] = { value: e };
608
- })), Object.defineProperties(z, $), Object.defineProperty(H, "isAxiosError", { value: !0 }), z.from = (e, t, r, n, o, s) => {
609
- const i = Object.create(H);
610
- return G.toFlatObject(e, i, (function(e) {
611
- return e !== Error.prototype;
612
- }), ((e) => "isAxiosError" !== e)), z.call(i, e.message, t, r, n, o), i.cause = e, i.name = e.name, s && Object.assign(i, s), i;
613
- };
614
- const Q = G.toFlatObject(G, {}, null, (function(e) {
615
- return /^is[A-Z]/.test(e);
653
+ }(e), t;
654
+ }
655
+ function ee(e) {
656
+ const t = {
657
+ "!": "%21",
658
+ "'": "%27",
659
+ "(": "%28",
660
+ ")": "%29",
661
+ "~": "%7E",
662
+ "%20": "+",
663
+ "%00": "\0"
664
+ };
665
+ return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, (function(e) {
666
+ return t[e];
667
+ }));
668
+ }
669
+ function te(e, t) {
670
+ this._pairs = [], e && Y(e, this, t);
671
+ }
672
+ const re = te.prototype;
673
+ function ne(e) {
674
+ return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
675
+ }
676
+ function oe(e, t, r) {
677
+ if (!t) return e;
678
+ const n = r && r.encode || ne;
679
+ $.isFunction(r) && (r = { serialize: r });
680
+ const o = r && r.serialize;
681
+ let s;
682
+ if (s = o ? o(t, r) : $.isURLSearchParams(t) ? t.toString() : new te(t, r).toString(n), s) {
683
+ const t = e.indexOf("#");
684
+ -1 !== t && (e = e.slice(0, t)), e += (-1 === e.indexOf("?") ? "?" : "&") + s;
685
+ }
686
+ return e;
687
+ }
688
+ re.append = function(e, t) {
689
+ this._pairs.push([e, t]);
690
+ }, re.toString = function(e) {
691
+ const t = e ? function(t) {
692
+ return e.call(this, t, ee);
693
+ } : ee;
694
+ return this._pairs.map((function(e) {
695
+ return t(e[0]) + "=" + t(e[1]);
696
+ }), "").join("&");
697
+ };
698
+ class se {
699
+ constructor() {
700
+ this.handlers = [];
701
+ }
702
+ use(e, t, r) {
703
+ return this.handlers.push({
704
+ fulfilled: e,
705
+ rejected: t,
706
+ synchronous: !!r && r.synchronous,
707
+ runWhen: r ? r.runWhen : null
708
+ }), this.handlers.length - 1;
709
+ }
710
+ eject(e) {
711
+ this.handlers[e] && (this.handlers[e] = null);
712
+ }
713
+ clear() {
714
+ this.handlers && (this.handlers = []);
715
+ }
716
+ forEach(e) {
717
+ $.forEach(this.handlers, (function(t) {
718
+ null !== t && e(t);
616
719
  }));
617
- function X(e, t, r) {
618
- if (!G.isObject(e)) throw new TypeError("target must be an object");
619
- t = t || new FormData();
620
- const n = (r = G.toFlatObject(r, {
621
- metaTokens: !0,
622
- dots: !1,
623
- indexes: !1
624
- }, !1, (function(e, t) {
625
- return !G.isUndefined(t[e]);
626
- }))).metaTokens, o = r.visitor || c, s = r.dots, i = r.indexes, a = (r.Blob || "undefined" != typeof Blob && Blob) && G.isSpecCompliantForm(t);
627
- if (!G.isFunction(o)) throw new TypeError("visitor must be a function");
628
- function l(e) {
629
- if (null === e) return "";
630
- if (G.isDate(e)) return e.toISOString();
631
- if (!a && G.isBlob(e)) throw new z("Blob is not supported. Use a Buffer instead.");
632
- return G.isArrayBuffer(e) || G.isTypedArray(e) ? a && "function" == typeof Blob ? new Blob([e]) : Buffer.from(e) : e;
720
+ }
721
+ }
722
+ var ie = {
723
+ silentJSONParsing: !0,
724
+ forcedJSONParsing: !0,
725
+ clarifyTimeoutError: !1
726
+ }, ae = {
727
+ isBrowser: !0,
728
+ classes: {
729
+ URLSearchParams: "undefined" != typeof URLSearchParams ? URLSearchParams : te,
730
+ FormData: "undefined" != typeof FormData ? FormData : null,
731
+ Blob: "undefined" != typeof Blob ? Blob : null
732
+ },
733
+ protocols: [
734
+ "http",
735
+ "https",
736
+ "file",
737
+ "blob",
738
+ "url",
739
+ "data"
740
+ ]
741
+ };
742
+ const ce = "undefined" != typeof window && "undefined" != typeof document, le = "object" == typeof navigator && navigator || void 0, ue = ce && (!le || [
743
+ "ReactNative",
744
+ "NativeScript",
745
+ "NS"
746
+ ].indexOf(le.product) < 0), fe = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && "function" == typeof self.importScripts, de = ce && window.location.href || "http://localhost";
747
+ var he = {
748
+ ...Object.freeze({
749
+ __proto__: null,
750
+ hasBrowserEnv: ce,
751
+ hasStandardBrowserEnv: ue,
752
+ hasStandardBrowserWebWorkerEnv: fe,
753
+ navigator: le,
754
+ origin: de
755
+ }),
756
+ ...ae
757
+ };
758
+ function pe(e) {
759
+ function t(e, r, n, o) {
760
+ let s = e[o++];
761
+ if ("__proto__" === s) return !0;
762
+ const i = Number.isFinite(+s), a = o >= e.length;
763
+ if (s = !s && $.isArray(n) ? n.length : s, a) return $.hasOwnProp(n, s) ? n[s] = [n[s], r] : n[s] = r, !i;
764
+ n[s] && $.isObject(n[s]) || (n[s] = []);
765
+ return t(e, r, n[s], o) && $.isArray(n[s]) && (n[s] = function(e) {
766
+ const t = {}, r = Object.keys(e);
767
+ let n;
768
+ const o = r.length;
769
+ let s;
770
+ for (n = 0; n < o; n++) s = r[n], t[s] = e[s];
771
+ return t;
772
+ }(n[s])), !i;
773
+ }
774
+ if ($.isFormData(e) && $.isFunction(e.entries)) {
775
+ const r = {};
776
+ return $.forEachEntry(e, ((e, n) => {
777
+ t(function(e) {
778
+ return $.matchAll(/\w+|\[(\w*)]/g, e).map(((e) => "[]" === e[0] ? "" : e[1] || e[0]));
779
+ }(e), n, r, 0);
780
+ })), r;
781
+ }
782
+ return null;
783
+ }
784
+ const me = {
785
+ transitional: ie,
786
+ adapter: [
787
+ "xhr",
788
+ "http",
789
+ "fetch"
790
+ ],
791
+ transformRequest: [function(e, t) {
792
+ const r = t.getContentType() || "", n = r.indexOf("application/json") > -1, o = $.isObject(e);
793
+ o && $.isHTMLForm(e) && (e = new FormData(e));
794
+ if ($.isFormData(e)) return n ? JSON.stringify(pe(e)) : e;
795
+ if ($.isArrayBuffer(e) || $.isBuffer(e) || $.isStream(e) || $.isFile(e) || $.isBlob(e) || $.isReadableStream(e)) return e;
796
+ if ($.isArrayBufferView(e)) return e.buffer;
797
+ if ($.isURLSearchParams(e)) return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
798
+ let s;
799
+ if (o) {
800
+ if (r.indexOf("application/x-www-form-urlencoded") > -1) return function(e, t) {
801
+ return Y(e, new he.classes.URLSearchParams(), {
802
+ visitor: function(e, t, r, n) {
803
+ return he.isNode && $.isBuffer(e) ? (this.append(t, e.toString("base64")), !1) : n.defaultVisitor.apply(this, arguments);
804
+ },
805
+ ...t
806
+ });
807
+ }(e, this.formSerializer).toString();
808
+ if ((s = $.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
809
+ const t = this.env && this.env.FormData;
810
+ return Y(s ? { "files[]": e } : e, t && new t(), this.formSerializer);
633
811
  }
634
- function c(e, r, o) {
635
- let a = e;
636
- if (e && !o && "object" == typeof e) {
637
- if (G.endsWith(r, "{}")) r = n ? r : r.slice(0, -2), e = JSON.stringify(e);
638
- else if (G.isArray(e) && function(e) {
639
- return G.isArray(e) && !e.some(W);
640
- }(e) || (G.isFileList(e) || G.endsWith(r, "[]")) && (a = G.toArray(e))) return r = V(r), a.forEach((function(e, n) {
641
- !G.isUndefined(e) && null !== e && t.append(!0 === i ? K([r], n, s) : null === i ? r : r + "[]", l(e));
642
- })), !1;
812
+ }
813
+ return o || n ? (t.setContentType("application/json", !1), function(e, t, r) {
814
+ if ($.isString(e)) try {
815
+ return (t || JSON.parse)(e), $.trim(e);
816
+ } catch (e) {
817
+ if ("SyntaxError" !== e.name) throw e;
818
+ }
819
+ return (r || JSON.stringify)(e);
820
+ }(e)) : e;
821
+ }],
822
+ transformResponse: [function(e) {
823
+ const t = this.transitional || me.transitional, r = t && t.forcedJSONParsing, n = "json" === this.responseType;
824
+ if ($.isResponse(e) || $.isReadableStream(e)) return e;
825
+ if (e && $.isString(e) && (r && !this.responseType || n)) {
826
+ const r = !(t && t.silentJSONParsing) && n;
827
+ try {
828
+ return JSON.parse(e, this.parseReviver);
829
+ } catch (e) {
830
+ if (r) {
831
+ if ("SyntaxError" === e.name) throw H.from(e, H.ERR_BAD_RESPONSE, this, null, this.response);
832
+ throw e;
643
833
  }
644
- return !!W(e) || (t.append(K(o, r, s), l(e)), !1);
645
834
  }
646
- const u = [], d = Object.assign(Q, {
647
- defaultVisitor: c,
648
- convertValue: l,
649
- isVisitable: W
650
- });
651
- if (!G.isObject(e)) throw new TypeError("data must be an object");
652
- return function e(r, n) {
653
- if (!G.isUndefined(r)) {
654
- if (-1 !== u.indexOf(r)) throw Error("Circular reference detected in " + n.join("."));
655
- u.push(r), G.forEach(r, (function(r, s) {
656
- !0 === (!(G.isUndefined(r) || null === r) && o.call(t, r, G.isString(s) ? s.trim() : s, n, d)) && e(r, n ? n.concat(s) : [s]);
657
- })), u.pop();
658
- }
659
- }(e), t;
660
835
  }
661
- function Z(e) {
662
- const t = {
663
- "!": "%21",
664
- "'": "%27",
665
- "(": "%28",
666
- ")": "%29",
667
- "~": "%7E",
668
- "%20": "+",
669
- "%00": "\0"
670
- };
671
- return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g, (function(e) {
672
- return t[e];
673
- }));
836
+ return e;
837
+ }],
838
+ timeout: 0,
839
+ xsrfCookieName: "XSRF-TOKEN",
840
+ xsrfHeaderName: "X-XSRF-TOKEN",
841
+ maxContentLength: -1,
842
+ maxBodyLength: -1,
843
+ env: {
844
+ FormData: he.classes.FormData,
845
+ Blob: he.classes.Blob
846
+ },
847
+ validateStatus: function(e) {
848
+ return e >= 200 && e < 300;
849
+ },
850
+ headers: { common: {
851
+ Accept: "application/json, text/plain, */*",
852
+ "Content-Type": void 0
853
+ } }
854
+ };
855
+ $.forEach([
856
+ "delete",
857
+ "get",
858
+ "head",
859
+ "post",
860
+ "put",
861
+ "patch"
862
+ ], ((e) => {
863
+ me.headers[e] = {};
864
+ }));
865
+ const ye = $.toObjectSet([
866
+ "age",
867
+ "authorization",
868
+ "content-length",
869
+ "content-type",
870
+ "etag",
871
+ "expires",
872
+ "from",
873
+ "host",
874
+ "if-modified-since",
875
+ "if-unmodified-since",
876
+ "last-modified",
877
+ "location",
878
+ "max-forwards",
879
+ "proxy-authorization",
880
+ "referer",
881
+ "retry-after",
882
+ "user-agent"
883
+ ]);
884
+ const be = Symbol("internals");
885
+ function ge(e) {
886
+ return e && String(e).trim().toLowerCase();
887
+ }
888
+ function we(e) {
889
+ return !1 === e || null == e ? e : $.isArray(e) ? e.map(we) : String(e);
890
+ }
891
+ function Ee(e, t, r, n, o) {
892
+ return $.isFunction(n) ? n.call(this, t, r) : (o && (t = r), $.isString(t) ? $.isString(n) ? -1 !== t.indexOf(n) : $.isRegExp(n) ? n.test(t) : void 0 : void 0);
893
+ }
894
+ let Oe = class {
895
+ constructor(e) {
896
+ e && this.set(e);
897
+ }
898
+ set(e, t, r) {
899
+ const n = this;
900
+ function o(e, t, r) {
901
+ const o = ge(t);
902
+ if (!o) throw new Error("header name must be a non-empty string");
903
+ const s = $.findKey(n, o);
904
+ (!s || void 0 === n[s] || !0 === r || void 0 === r && !1 !== n[s]) && (n[s || t] = we(e));
674
905
  }
675
- function Y(e, t) {
676
- this._pairs = [], e && X(e, this, t);
906
+ const s = (e, t) => $.forEach(e, ((e, r) => o(e, r, t)));
907
+ if ($.isPlainObject(e) || e instanceof this.constructor) s(e, t);
908
+ else if ($.isString(e) && (e = e.trim()) && !/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())) s(((e) => {
909
+ const t = {};
910
+ let r, n, o;
911
+ return e && e.split("\n").forEach((function(e) {
912
+ o = e.indexOf(":"), r = e.substring(0, o).trim().toLowerCase(), n = e.substring(o + 1).trim(), !r || t[r] && ye[r] || ("set-cookie" === r ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
913
+ })), t;
914
+ })(e), t);
915
+ else if ($.isObject(e) && $.isIterable(e)) {
916
+ let r, n, o = {};
917
+ for (const t of e) {
918
+ if (!$.isArray(t)) throw TypeError("Object iterator must return a key-value pair");
919
+ o[n = t[0]] = (r = o[n]) ? $.isArray(r) ? [...r, t[1]] : [r, t[1]] : t[1];
920
+ }
921
+ s(o, t);
922
+ } else null != e && o(t, e, r);
923
+ return this;
924
+ }
925
+ get(e, t) {
926
+ if (e = ge(e)) {
927
+ const r = $.findKey(this, e);
928
+ if (r) {
929
+ const e = this[r];
930
+ if (!t) return e;
931
+ if (!0 === t) return function(e) {
932
+ const t = Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
933
+ let n;
934
+ for (; n = r.exec(e);) t[n[1]] = n[2];
935
+ return t;
936
+ }(e);
937
+ if ($.isFunction(t)) return t.call(this, e, r);
938
+ if ($.isRegExp(t)) return t.exec(e);
939
+ throw new TypeError("parser must be boolean|regexp|function");
940
+ }
677
941
  }
678
- const ee = Y.prototype;
679
- function te(e) {
680
- return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
942
+ }
943
+ has(e, t) {
944
+ if (e = ge(e)) {
945
+ const r = $.findKey(this, e);
946
+ return !(!r || void 0 === this[r] || t && !Ee(0, this[r], r, t));
681
947
  }
682
- function re(e, t, r) {
683
- if (!t) return e;
684
- const n = r && r.encode || te;
685
- G.isFunction(r) && (r = { serialize: r });
686
- const o = r && r.serialize;
687
- let s;
688
- if (s = o ? o(t, r) : G.isURLSearchParams(t) ? t.toString() : new Y(t, r).toString(n), s) {
689
- const t = e.indexOf("#");
690
- -1 !== t && (e = e.slice(0, t)), e += (-1 === e.indexOf("?") ? "?" : "&") + s;
948
+ return !1;
949
+ }
950
+ delete(e, t) {
951
+ const r = this;
952
+ let n = !1;
953
+ function o(e) {
954
+ if (e = ge(e)) {
955
+ const o = $.findKey(r, e);
956
+ !o || t && !Ee(0, r[o], o, t) || (delete r[o], n = !0);
691
957
  }
692
- return e;
693
958
  }
694
- ee.append = function(e, t) {
695
- this._pairs.push([e, t]);
696
- }, ee.toString = function(e) {
697
- const t = e ? function(t) {
698
- return e.call(this, t, Z);
699
- } : Z;
700
- return this._pairs.map((function(e) {
701
- return t(e[0]) + "=" + t(e[1]);
702
- }), "").join("&");
959
+ return $.isArray(e) ? e.forEach(o) : o(e), n;
960
+ }
961
+ clear(e) {
962
+ const t = Object.keys(this);
963
+ let r = t.length, n = !1;
964
+ for (; r--;) {
965
+ const o = t[r];
966
+ e && !Ee(0, this[o], o, e, !0) || (delete this[o], n = !0);
967
+ }
968
+ return n;
969
+ }
970
+ normalize(e) {
971
+ const t = this, r = {};
972
+ return $.forEach(this, ((n, o) => {
973
+ const s = $.findKey(r, o);
974
+ if (s) return t[s] = we(n), void delete t[o];
975
+ const i = e ? function(e) {
976
+ return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, ((e, t, r) => t.toUpperCase() + r));
977
+ }(o) : String(o).trim();
978
+ i !== o && delete t[o], t[i] = we(n), r[i] = !0;
979
+ })), this;
980
+ }
981
+ concat(...e) {
982
+ return this.constructor.concat(this, ...e);
983
+ }
984
+ toJSON(e) {
985
+ const t = Object.create(null);
986
+ return $.forEach(this, ((r, n) => {
987
+ null != r && !1 !== r && (t[n] = e && $.isArray(r) ? r.join(", ") : r);
988
+ })), t;
989
+ }
990
+ [Symbol.iterator]() {
991
+ return Object.entries(this.toJSON())[Symbol.iterator]();
992
+ }
993
+ toString() {
994
+ return Object.entries(this.toJSON()).map((([e, t]) => e + ": " + t)).join("\n");
995
+ }
996
+ getSetCookie() {
997
+ return this.get("set-cookie") || [];
998
+ }
999
+ get [Symbol.toStringTag]() {
1000
+ return "AxiosHeaders";
1001
+ }
1002
+ static from(e) {
1003
+ return e instanceof this ? e : new this(e);
1004
+ }
1005
+ static concat(e, ...t) {
1006
+ const r = new this(e);
1007
+ return t.forEach(((e) => r.set(e))), r;
1008
+ }
1009
+ static accessor(e) {
1010
+ const t = (this[be] = this[be] = { accessors: {} }).accessors, r = this.prototype;
1011
+ function n(e) {
1012
+ const n = ge(e);
1013
+ t[n] || (function(e, t) {
1014
+ const r = $.toCamelCase(" " + t);
1015
+ [
1016
+ "get",
1017
+ "set",
1018
+ "has"
1019
+ ].forEach(((n) => {
1020
+ Object.defineProperty(e, n + r, {
1021
+ value: function(e, r, o) {
1022
+ return this[n].call(this, t, e, r, o);
1023
+ },
1024
+ configurable: !0
1025
+ });
1026
+ }));
1027
+ }(r, e), t[n] = !0);
1028
+ }
1029
+ return $.isArray(e) ? e.forEach(n) : n(e), this;
1030
+ }
1031
+ };
1032
+ function Te(e, t) {
1033
+ const r = this || me, n = t || r, o = Oe.from(n.headers);
1034
+ let s = n.data;
1035
+ return $.forEach(e, (function(e) {
1036
+ s = e.call(r, s, o.normalize(), t ? t.status : void 0);
1037
+ })), o.normalize(), s;
1038
+ }
1039
+ function Se(e) {
1040
+ return !(!e || !e.__CANCEL__);
1041
+ }
1042
+ function Re(e, t, r) {
1043
+ H.call(this, null == e ? "canceled" : e, H.ERR_CANCELED, t, r), this.name = "CanceledError";
1044
+ }
1045
+ function ve(e, t, r) {
1046
+ const n = r.config.validateStatus;
1047
+ r.status && n && !n(r.status) ? t(new H("Request failed with status code " + r.status, [H.ERR_BAD_REQUEST, H.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], r.config, r.request, r)) : e(r);
1048
+ }
1049
+ Oe.accessor([
1050
+ "Content-Type",
1051
+ "Content-Length",
1052
+ "Accept",
1053
+ "Accept-Encoding",
1054
+ "User-Agent",
1055
+ "Authorization"
1056
+ ]), $.reduceDescriptors(Oe.prototype, (({ value: e }, t) => {
1057
+ let r = t[0].toUpperCase() + t.slice(1);
1058
+ return {
1059
+ get: () => e,
1060
+ set(e) {
1061
+ this[r] = e;
1062
+ }
1063
+ };
1064
+ })), $.freezeMethods(Oe), $.inherits(Re, H, { __CANCEL__: !0 });
1065
+ const Ae = (e, t, r = 3) => {
1066
+ let n = 0;
1067
+ const o = function(e, t) {
1068
+ e = e || 10;
1069
+ const r = new Array(e), n = new Array(e);
1070
+ let o, s = 0, i = 0;
1071
+ return t = void 0 !== t ? t : 1e3, function(a) {
1072
+ const c = Date.now(), l = n[i];
1073
+ o || (o = c), r[s] = a, n[s] = c;
1074
+ let u = i, f = 0;
1075
+ for (; u !== s;) f += r[u++], u %= e;
1076
+ if (s = (s + 1) % e, s === i && (i = (i + 1) % e), c - o < t) return;
1077
+ const d = l && c - l;
1078
+ return d ? Math.round(1e3 * f / d) : void 0;
703
1079
  };
704
- class ne {
705
- constructor() {
706
- this.handlers = [];
707
- }
708
- use(e, t, r) {
709
- return this.handlers.push({
710
- fulfilled: e,
711
- rejected: t,
712
- synchronous: !!r && r.synchronous,
713
- runWhen: r ? r.runWhen : null
714
- }), this.handlers.length - 1;
1080
+ }(50, 250);
1081
+ return function(e, t) {
1082
+ let r, n, o = 0, s = 1e3 / t;
1083
+ const i = (t, s = Date.now()) => {
1084
+ o = s, r = null, n && (clearTimeout(n), n = null), e(...t);
1085
+ };
1086
+ return [(...e) => {
1087
+ const t = Date.now(), a = t - o;
1088
+ a >= s ? i(e, t) : (r = e, n || (n = setTimeout((() => {
1089
+ n = null, i(r);
1090
+ }), s - a)));
1091
+ }, () => r && i(r)];
1092
+ }(((r) => {
1093
+ const s = r.loaded, i = r.lengthComputable ? r.total : void 0, a = s - n, c = o(a);
1094
+ n = s;
1095
+ e({
1096
+ loaded: s,
1097
+ total: i,
1098
+ progress: i ? s / i : void 0,
1099
+ bytes: a,
1100
+ rate: c || void 0,
1101
+ estimated: c && i && s <= i ? (i - s) / c : void 0,
1102
+ event: r,
1103
+ lengthComputable: null != i,
1104
+ [t ? "download" : "upload"]: !0
1105
+ });
1106
+ }), r);
1107
+ }, xe = (e, t) => {
1108
+ const r = null != e;
1109
+ return [(n) => t[0]({
1110
+ lengthComputable: r,
1111
+ total: e,
1112
+ loaded: n
1113
+ }), t[1]];
1114
+ }, Ne = (e) => (...t) => $.asap((() => e(...t)));
1115
+ var Pe = he.hasStandardBrowserEnv ? ((e, t) => (r) => (r = new URL(r, he.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(new URL(he.origin), he.navigator && /(msie|trident)/i.test(he.navigator.userAgent)) : () => !0, je = he.hasStandardBrowserEnv ? {
1116
+ write(e, t, r, n, o, s) {
1117
+ const i = [e + "=" + encodeURIComponent(t)];
1118
+ $.isNumber(r) && i.push("expires=" + new Date(r).toGMTString()), $.isString(n) && i.push("path=" + n), $.isString(o) && i.push("domain=" + o), !0 === s && i.push("secure"), document.cookie = i.join("; ");
1119
+ },
1120
+ read(e) {
1121
+ const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
1122
+ return t ? decodeURIComponent(t[3]) : null;
1123
+ },
1124
+ remove(e) {
1125
+ this.write(e, "", Date.now() - 864e5);
1126
+ }
1127
+ } : {
1128
+ write() {},
1129
+ read: () => null,
1130
+ remove() {}
1131
+ };
1132
+ function Ce(e, t, r) {
1133
+ let n = !/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
1134
+ return e && (n || 0 == r) ? function(e, t) {
1135
+ return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
1136
+ }(e, t) : t;
1137
+ }
1138
+ const Ue = (e) => e instanceof Oe ? { ...e } : e;
1139
+ function _e(e, t) {
1140
+ t = t || {};
1141
+ const r = {};
1142
+ function n(e, t, r, n) {
1143
+ return $.isPlainObject(e) && $.isPlainObject(t) ? $.merge.call({ caseless: n }, e, t) : $.isPlainObject(t) ? $.merge({}, t) : $.isArray(t) ? t.slice() : t;
1144
+ }
1145
+ function o(e, t, r, o) {
1146
+ return $.isUndefined(t) ? $.isUndefined(e) ? void 0 : n(void 0, e, 0, o) : n(e, t, 0, o);
1147
+ }
1148
+ function s(e, t) {
1149
+ if (!$.isUndefined(t)) return n(void 0, t);
1150
+ }
1151
+ function i(e, t) {
1152
+ return $.isUndefined(t) ? $.isUndefined(e) ? void 0 : n(void 0, e) : n(void 0, t);
1153
+ }
1154
+ function a(r, o, s) {
1155
+ return s in t ? n(r, o) : s in e ? n(void 0, r) : void 0;
1156
+ }
1157
+ const c = {
1158
+ url: s,
1159
+ method: s,
1160
+ data: s,
1161
+ baseURL: i,
1162
+ transformRequest: i,
1163
+ transformResponse: i,
1164
+ paramsSerializer: i,
1165
+ timeout: i,
1166
+ timeoutMessage: i,
1167
+ withCredentials: i,
1168
+ withXSRFToken: i,
1169
+ adapter: i,
1170
+ responseType: i,
1171
+ xsrfCookieName: i,
1172
+ xsrfHeaderName: i,
1173
+ onUploadProgress: i,
1174
+ onDownloadProgress: i,
1175
+ decompress: i,
1176
+ maxContentLength: i,
1177
+ maxBodyLength: i,
1178
+ beforeRedirect: i,
1179
+ transport: i,
1180
+ httpAgent: i,
1181
+ httpsAgent: i,
1182
+ cancelToken: i,
1183
+ socketPath: i,
1184
+ responseEncoding: i,
1185
+ validateStatus: a,
1186
+ headers: (e, t, r) => o(Ue(e), Ue(t), 0, !0)
1187
+ };
1188
+ return $.forEach(Object.keys({
1189
+ ...e,
1190
+ ...t
1191
+ }), (function(n) {
1192
+ const s = c[n] || o, i = s(e[n], t[n], n);
1193
+ $.isUndefined(i) && s !== a || (r[n] = i);
1194
+ })), r;
1195
+ }
1196
+ var Le = (e) => {
1197
+ const t = _e({}, e);
1198
+ let { data: r, withXSRFToken: n, xsrfHeaderName: o, xsrfCookieName: s, headers: i, auth: a } = t;
1199
+ if (t.headers = i = Oe.from(i), t.url = oe(Ce(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), a && i.set("Authorization", "Basic " + btoa((a.username || "") + ":" + (a.password ? unescape(encodeURIComponent(a.password)) : ""))), $.isFormData(r)) {
1200
+ if (he.hasStandardBrowserEnv || he.hasStandardBrowserWebWorkerEnv) i.setContentType(void 0);
1201
+ else if ($.isFunction(r.getHeaders)) {
1202
+ const e = r.getHeaders(), t = ["content-type", "content-length"];
1203
+ Object.entries(e).forEach((([e, r]) => {
1204
+ t.includes(e.toLowerCase()) && i.set(e, r);
1205
+ }));
1206
+ }
1207
+ }
1208
+ if (he.hasStandardBrowserEnv && (n && $.isFunction(n) && (n = n(t)), n || !1 !== n && Pe(t.url))) {
1209
+ const e = o && s && je.read(s);
1210
+ e && i.set(o, e);
1211
+ }
1212
+ return t;
1213
+ };
1214
+ var Fe = "undefined" != typeof XMLHttpRequest && function(e) {
1215
+ return new Promise((function(t, r) {
1216
+ const n = Le(e);
1217
+ let o = n.data;
1218
+ const s = Oe.from(n.headers).normalize();
1219
+ let i, a, c, l, u, { responseType: f, onUploadProgress: d, onDownloadProgress: h } = n;
1220
+ function p() {
1221
+ l && l(), u && u(), n.cancelToken && n.cancelToken.unsubscribe(i), n.signal && n.signal.removeEventListener("abort", i);
1222
+ }
1223
+ let m = new XMLHttpRequest();
1224
+ function y() {
1225
+ if (!m) return;
1226
+ const n = Oe.from("getAllResponseHeaders" in m && m.getAllResponseHeaders());
1227
+ ve((function(e) {
1228
+ t(e), p();
1229
+ }), (function(e) {
1230
+ r(e), p();
1231
+ }), {
1232
+ data: f && "text" !== f && "json" !== f ? m.response : m.responseText,
1233
+ status: m.status,
1234
+ statusText: m.statusText,
1235
+ headers: n,
1236
+ config: e,
1237
+ request: m
1238
+ }), m = null;
1239
+ }
1240
+ m.open(n.method.toUpperCase(), n.url, !0), m.timeout = n.timeout, "onloadend" in m ? m.onloadend = y : m.onreadystatechange = function() {
1241
+ m && 4 === m.readyState && (0 !== m.status || m.responseURL && 0 === m.responseURL.indexOf("file:")) && setTimeout(y);
1242
+ }, m.onabort = function() {
1243
+ m && (r(new H("Request aborted", H.ECONNABORTED, e, m)), m = null);
1244
+ }, m.onerror = function(t) {
1245
+ const n = new H(t && t.message ? t.message : "Network Error", H.ERR_NETWORK, e, m);
1246
+ n.event = t || null, r(n), m = null;
1247
+ }, m.ontimeout = function() {
1248
+ let t = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
1249
+ const o = n.transitional || ie;
1250
+ n.timeoutErrorMessage && (t = n.timeoutErrorMessage), r(new H(t, o.clarifyTimeoutError ? H.ETIMEDOUT : H.ECONNABORTED, e, m)), m = null;
1251
+ }, void 0 === o && s.setContentType(null), "setRequestHeader" in m && $.forEach(s.toJSON(), (function(e, t) {
1252
+ m.setRequestHeader(t, e);
1253
+ })), $.isUndefined(n.withCredentials) || (m.withCredentials = !!n.withCredentials), f && "json" !== f && (m.responseType = n.responseType), h && ([c, u] = Ae(h, !0), m.addEventListener("progress", c)), d && m.upload && ([a, l] = Ae(d), m.upload.addEventListener("progress", a), m.upload.addEventListener("loadend", l)), (n.cancelToken || n.signal) && (i = (t) => {
1254
+ m && (r(!t || t.type ? new Re(null, e, m) : t), m.abort(), m = null);
1255
+ }, n.cancelToken && n.cancelToken.subscribe(i), n.signal && (n.signal.aborted ? i() : n.signal.addEventListener("abort", i)));
1256
+ const b = function(e) {
1257
+ const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
1258
+ return t && t[1] || "";
1259
+ }(n.url);
1260
+ b && -1 === he.protocols.indexOf(b) ? r(new H("Unsupported protocol " + b + ":", H.ERR_BAD_REQUEST, e)) : m.send(o || null);
1261
+ }));
1262
+ };
1263
+ const qe = (e, t) => {
1264
+ const { length: r } = e = e ? e.filter(Boolean) : [];
1265
+ if (t || r) {
1266
+ let r, n = new AbortController();
1267
+ const o = function(e) {
1268
+ if (!r) {
1269
+ r = !0, i();
1270
+ const t = e instanceof Error ? e : this.reason;
1271
+ n.abort(t instanceof H ? t : new Re(t instanceof Error ? t.message : t));
715
1272
  }
716
- eject(e) {
717
- this.handlers[e] && (this.handlers[e] = null);
1273
+ };
1274
+ let s = t && setTimeout((() => {
1275
+ s = null, o(new H(`timeout ${t} of ms exceeded`, H.ETIMEDOUT));
1276
+ }), t);
1277
+ const i = () => {
1278
+ e && (s && clearTimeout(s), s = null, e.forEach(((e) => {
1279
+ e.unsubscribe ? e.unsubscribe(o) : e.removeEventListener("abort", o);
1280
+ })), e = null);
1281
+ };
1282
+ e.forEach(((e) => e.addEventListener("abort", o)));
1283
+ const { signal: a } = n;
1284
+ return a.unsubscribe = () => $.asap(i), a;
1285
+ }
1286
+ }, ke = function* (e, t) {
1287
+ let r = e.byteLength;
1288
+ if (r < t) return void (yield e);
1289
+ let n, o = 0;
1290
+ for (; o < r;) n = o + t, yield e.slice(o, n), o = n;
1291
+ }, De = async function* (e) {
1292
+ if (e[Symbol.asyncIterator]) return void (yield* e);
1293
+ const t = e.getReader();
1294
+ try {
1295
+ for (;;) {
1296
+ const { done: e, value: r } = await t.read();
1297
+ if (e) break;
1298
+ yield r;
1299
+ }
1300
+ } finally {
1301
+ await t.cancel();
1302
+ }
1303
+ }, Be = (e, t, r, n) => {
1304
+ const o = async function* (e, t) {
1305
+ for await (const r of De(e)) yield* ke(r, t);
1306
+ }(e, t);
1307
+ let s, i = 0, a = (e) => {
1308
+ s || (s = !0, n && n(e));
1309
+ };
1310
+ return new ReadableStream({
1311
+ async pull(e) {
1312
+ try {
1313
+ const { done: t, value: n } = await o.next();
1314
+ if (t) return a(), void e.close();
1315
+ let s = n.byteLength;
1316
+ if (r) r(i += s);
1317
+ e.enqueue(new Uint8Array(n));
1318
+ } catch (e) {
1319
+ throw a(e), e;
718
1320
  }
719
- clear() {
720
- this.handlers && (this.handlers = []);
1321
+ },
1322
+ cancel: (e) => (a(e), o.return())
1323
+ }, { highWaterMark: 2 });
1324
+ }, { isFunction: Ie } = $, Je = (({ fetch: e, Request: t, Response: r }) => ({
1325
+ fetch: e,
1326
+ Request: t,
1327
+ Response: r
1328
+ }))($.global), { ReadableStream: Me, TextEncoder: Ge } = $.global, ze = (e, ...t) => {
1329
+ try {
1330
+ return !!e(...t);
1331
+ } catch (e) {
1332
+ return !1;
1333
+ }
1334
+ }, $e = (e) => {
1335
+ const { fetch: t, Request: r, Response: n } = Object.assign({}, Je, e), o = Ie(t), s = Ie(r), i = Ie(n);
1336
+ if (!o) return !1;
1337
+ const a = o && Ie(Me), c = o && ("function" == typeof Ge ? (l = new Ge(), (e) => l.encode(e)) : async (e) => new Uint8Array(await new r(e).arrayBuffer()));
1338
+ var l;
1339
+ const u = s && a && ze((() => {
1340
+ let e = !1;
1341
+ const t = new r(he.origin, {
1342
+ body: new Me(),
1343
+ method: "POST",
1344
+ get duplex() {
1345
+ return e = !0, "half";
1346
+ }
1347
+ }).headers.has("Content-Type");
1348
+ return e && !t;
1349
+ })), f = i && a && ze((() => $.isReadableStream(new n("").body))), d = { stream: f && ((e) => e.body) };
1350
+ o && [
1351
+ "text",
1352
+ "arrayBuffer",
1353
+ "blob",
1354
+ "formData",
1355
+ "stream"
1356
+ ].forEach(((e) => {
1357
+ !d[e] && (d[e] = (t, r) => {
1358
+ let n = t && t[e];
1359
+ if (n) return n.call(t);
1360
+ throw new H(`Response type '${e}' is not supported`, H.ERR_NOT_SUPPORT, r);
1361
+ });
1362
+ }));
1363
+ const h = async (e, t) => {
1364
+ const n = $.toFiniteNumber(e.getContentLength());
1365
+ return null == n ? (async (e) => {
1366
+ if (null == e) return 0;
1367
+ if ($.isBlob(e)) return e.size;
1368
+ if ($.isSpecCompliantForm(e)) return (await new r(he.origin, {
1369
+ method: "POST",
1370
+ body: e
1371
+ }).arrayBuffer()).byteLength;
1372
+ return $.isArrayBufferView(e) || $.isArrayBuffer(e) ? e.byteLength : ($.isURLSearchParams(e) && (e += ""), $.isString(e) ? (await c(e)).byteLength : void 0);
1373
+ })(t) : n;
1374
+ };
1375
+ return async (e) => {
1376
+ let { url: o, method: i, data: a, signal: c, cancelToken: l, timeout: p, onDownloadProgress: m, onUploadProgress: y, responseType: b, headers: g, withCredentials: w = "same-origin", fetchOptions: E } = Le(e);
1377
+ b = b ? (b + "").toLowerCase() : "text";
1378
+ let O = qe([c, l && l.toAbortSignal()], p), T = null;
1379
+ const S = O && O.unsubscribe && (() => {
1380
+ O.unsubscribe();
1381
+ });
1382
+ let R;
1383
+ try {
1384
+ if (y && u && "get" !== i && "head" !== i && 0 !== (R = await h(g, a))) {
1385
+ let e, t = new r(o, {
1386
+ method: "POST",
1387
+ body: a,
1388
+ duplex: "half"
1389
+ });
1390
+ if ($.isFormData(a) && (e = t.headers.get("content-type")) && g.setContentType(e), t.body) {
1391
+ const [e, r] = xe(R, Ae(Ne(y)));
1392
+ a = Be(t.body, 65536, e, r);
1393
+ }
721
1394
  }
722
- forEach(e) {
723
- G.forEach(this.handlers, (function(t) {
724
- null !== t && e(t);
1395
+ $.isString(w) || (w = w ? "include" : "omit");
1396
+ const c = s && "credentials" in r.prototype, l = {
1397
+ ...E,
1398
+ signal: O,
1399
+ method: i.toUpperCase(),
1400
+ headers: g.normalize().toJSON(),
1401
+ body: a,
1402
+ duplex: "half",
1403
+ credentials: c ? w : void 0
1404
+ };
1405
+ T = s && new r(o, l);
1406
+ let p = await (s ? t(T, E) : t(o, l));
1407
+ const v = f && ("stream" === b || "response" === b);
1408
+ if (f && (m || v && S)) {
1409
+ const e = {};
1410
+ [
1411
+ "status",
1412
+ "statusText",
1413
+ "headers"
1414
+ ].forEach(((t) => {
1415
+ e[t] = p[t];
725
1416
  }));
726
- }
1417
+ const t = $.toFiniteNumber(p.headers.get("content-length")), [r, o] = m && xe(t, Ae(Ne(m), !0)) || [];
1418
+ p = new n(Be(p.body, 65536, r, (() => {
1419
+ o && o(), S && S();
1420
+ })), e);
1421
+ }
1422
+ b = b || "text";
1423
+ let A = await d[$.findKey(d, b) || "text"](p, e);
1424
+ return !v && S && S(), await new Promise(((t, r) => {
1425
+ ve(t, r, {
1426
+ data: A,
1427
+ headers: Oe.from(p.headers),
1428
+ status: p.status,
1429
+ statusText: p.statusText,
1430
+ config: e,
1431
+ request: T
1432
+ });
1433
+ }));
1434
+ } catch (t) {
1435
+ if (S && S(), t && "TypeError" === t.name && /Load failed|fetch/i.test(t.message)) throw Object.assign(new H("Network Error", H.ERR_NETWORK, e, T), { cause: t.cause || t });
1436
+ throw H.from(t, t && t.code, e, T);
727
1437
  }
728
- var oe = {
729
- silentJSONParsing: !0,
730
- forcedJSONParsing: !0,
731
- clarifyTimeoutError: !1
732
- }, se = {
733
- isBrowser: !0,
734
- classes: {
735
- URLSearchParams: "undefined" != typeof URLSearchParams ? URLSearchParams : Y,
736
- FormData: "undefined" != typeof FormData ? FormData : null,
737
- Blob: "undefined" != typeof Blob ? Blob : null
738
- },
739
- protocols: [
740
- "http",
741
- "https",
742
- "file",
743
- "blob",
744
- "url",
745
- "data"
746
- ]
747
- };
748
- const ie = "undefined" != typeof window && "undefined" != typeof document, ae = "object" == typeof navigator && navigator || void 0, le = ie && (!ae || [
749
- "ReactNative",
750
- "NativeScript",
751
- "NS"
752
- ].indexOf(ae.product) < 0), ce = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && "function" == typeof self.importScripts, ue = ie && window.location.href || "http://localhost";
753
- var de = {
754
- ...Object.freeze({
755
- __proto__: null,
756
- hasBrowserEnv: ie,
757
- hasStandardBrowserEnv: le,
758
- hasStandardBrowserWebWorkerEnv: ce,
759
- navigator: ae,
760
- origin: ue
761
- }),
762
- ...se
1438
+ };
1439
+ }, He = /* @__PURE__ */ new Map(), We = (e) => {
1440
+ let t = $.merge.call({ skipUndefined: !0 }, Je, e ? e.env : null);
1441
+ const { fetch: r, Request: n, Response: o } = t, s = [
1442
+ n,
1443
+ o,
1444
+ r
1445
+ ];
1446
+ let i, a, c = s.length, l = He;
1447
+ for (; c--;) i = s[c], a = l.get(i), void 0 === a && l.set(i, a = c ? /* @__PURE__ */ new Map() : $e(t)), l = a;
1448
+ return a;
1449
+ };
1450
+ We();
1451
+ const Ve = {
1452
+ http: null,
1453
+ xhr: Fe,
1454
+ fetch: { get: We }
1455
+ };
1456
+ $.forEach(Ve, ((e, t) => {
1457
+ if (e) {
1458
+ try {
1459
+ Object.defineProperty(e, "name", { value: t });
1460
+ } catch (e) {}
1461
+ Object.defineProperty(e, "adapterName", { value: t });
1462
+ }
1463
+ }));
1464
+ const Ke = (e) => `- ${e}`, Xe = (e) => $.isFunction(e) || null === e || !1 === e;
1465
+ var Qe = (e, t) => {
1466
+ e = $.isArray(e) ? e : [e];
1467
+ const { length: r } = e;
1468
+ let n, o;
1469
+ const s = {};
1470
+ for (let i = 0; i < r; i++) {
1471
+ let r;
1472
+ if (n = e[i], o = n, !Xe(n) && (o = Ve[(r = String(n)).toLowerCase()], void 0 === o)) throw new H(`Unknown adapter '${r}'`);
1473
+ if (o && ($.isFunction(o) || (o = o.get(t)))) break;
1474
+ s[r || "#" + i] = o;
1475
+ }
1476
+ if (!o) {
1477
+ const e = Object.entries(s).map((([e, t]) => `adapter ${e} ` + (!1 === t ? "is not supported by the environment" : "is not available in the build")));
1478
+ throw new H("There is no suitable adapter to dispatch the request " + (r ? e.length > 1 ? "since :\n" + e.map(Ke).join("\n") : " " + Ke(e[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
1479
+ }
1480
+ return o;
1481
+ };
1482
+ function Ze(e) {
1483
+ if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted) throw new Re(null, e);
1484
+ }
1485
+ function Ye(e) {
1486
+ Ze(e), e.headers = Oe.from(e.headers), e.data = Te.call(e, e.transformRequest), -1 !== [
1487
+ "post",
1488
+ "put",
1489
+ "patch"
1490
+ ].indexOf(e.method) && e.headers.setContentType("application/x-www-form-urlencoded", !1);
1491
+ return Qe(e.adapter || me.adapter, e)(e).then((function(t) {
1492
+ return Ze(e), t.data = Te.call(e, e.transformResponse, t), t.headers = Oe.from(t.headers), t;
1493
+ }), (function(t) {
1494
+ return Se(t) || (Ze(e), t && t.response && (t.response.data = Te.call(e, e.transformResponse, t.response), t.response.headers = Oe.from(t.response.headers))), Promise.reject(t);
1495
+ }));
1496
+ }
1497
+ const et = "1.12.0", tt = {};
1498
+ [
1499
+ "object",
1500
+ "boolean",
1501
+ "number",
1502
+ "function",
1503
+ "string",
1504
+ "symbol"
1505
+ ].forEach(((e, t) => {
1506
+ tt[e] = function(r) {
1507
+ return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1508
+ };
1509
+ }));
1510
+ const rt = {};
1511
+ tt.transitional = function(e, t, r) {
1512
+ function n(e, t) {
1513
+ return "[Axios v" + et + "] Transitional option '" + e + "'" + t + (r ? ". " + r : "");
1514
+ }
1515
+ return (r, o, s) => {
1516
+ if (!1 === e) throw new H(n(o, " has been removed" + (t ? " in " + t : "")), H.ERR_DEPRECATED);
1517
+ return t && !rt[o] && (rt[o] = !0, console.warn(n(o, " has been deprecated since v" + t + " and will be removed in the near future"))), !e || e(r, o, s);
1518
+ };
1519
+ }, tt.spelling = function(e) {
1520
+ return (t, r) => (console.warn(`${r} is likely a misspelling of ${e}`), !0);
1521
+ };
1522
+ var nt = {
1523
+ assertOptions: function(e, t, r) {
1524
+ if ("object" != typeof e) throw new H("options must be an object", H.ERR_BAD_OPTION_VALUE);
1525
+ const n = Object.keys(e);
1526
+ let o = n.length;
1527
+ for (; o-- > 0;) {
1528
+ const s = n[o], i = t[s];
1529
+ if (i) {
1530
+ const t = e[s], r = void 0 === t || i(t, s, e);
1531
+ if (!0 !== r) throw new H("option " + s + " must be " + r, H.ERR_BAD_OPTION_VALUE);
1532
+ } else if (!0 !== r) throw new H("Unknown option " + s, H.ERR_BAD_OPTION);
1533
+ }
1534
+ },
1535
+ validators: tt
1536
+ };
1537
+ const ot = nt.validators;
1538
+ let st = class {
1539
+ constructor(e) {
1540
+ this.defaults = e || {}, this.interceptors = {
1541
+ request: new se(),
1542
+ response: new se()
763
1543
  };
764
- function fe(e) {
765
- function t(e, r, n, o) {
766
- let s = e[o++];
767
- if ("__proto__" === s) return !0;
768
- const i = Number.isFinite(+s), a = o >= e.length;
769
- return s = !s && G.isArray(n) ? n.length : s, a ? (G.hasOwnProp(n, s) ? n[s] = [n[s], r] : n[s] = r, !i) : (n[s] && G.isObject(n[s]) || (n[s] = []), t(e, r, n[s], o) && G.isArray(n[s]) && (n[s] = function(e) {
770
- const t = {}, r = Object.keys(e);
771
- let n;
772
- const o = r.length;
773
- let s;
774
- for (n = 0; n < o; n++) s = r[n], t[s] = e[s];
775
- return t;
776
- }(n[s])), !i);
777
- }
778
- if (G.isFormData(e) && G.isFunction(e.entries)) {
779
- const r = {};
780
- return G.forEachEntry(e, ((e, n) => {
781
- t(function(e) {
782
- return G.matchAll(/\w+|\[(\w*)]/g, e).map(((e) => "[]" === e[0] ? "" : e[1] || e[0]));
783
- }(e), n, r, 0);
784
- })), r;
1544
+ }
1545
+ async request(e, t) {
1546
+ try {
1547
+ return await this._request(e, t);
1548
+ } catch (e) {
1549
+ if (e instanceof Error) {
1550
+ let t = {};
1551
+ Error.captureStackTrace ? Error.captureStackTrace(t) : t = /* @__PURE__ */ new Error();
1552
+ const r = t.stack ? t.stack.replace(/^.+\n/, "") : "";
1553
+ try {
1554
+ e.stack ? r && !String(e.stack).endsWith(r.replace(/^.+\n.+\n/, "")) && (e.stack += "\n" + r) : e.stack = r;
1555
+ } catch (e) {}
785
1556
  }
786
- return null;
1557
+ throw e;
787
1558
  }
788
- const he = {
789
- transitional: oe,
790
- adapter: [
791
- "xhr",
792
- "http",
793
- "fetch"
794
- ],
795
- transformRequest: [function(e, t) {
796
- const r = t.getContentType() || "", n = r.indexOf("application/json") > -1, o = G.isObject(e);
797
- if (o && G.isHTMLForm(e) && (e = new FormData(e)), G.isFormData(e)) return n ? JSON.stringify(fe(e)) : e;
798
- if (G.isArrayBuffer(e) || G.isBuffer(e) || G.isStream(e) || G.isFile(e) || G.isBlob(e) || G.isReadableStream(e)) return e;
799
- if (G.isArrayBufferView(e)) return e.buffer;
800
- if (G.isURLSearchParams(e)) return t.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), e.toString();
801
- let s;
802
- if (o) {
803
- if (r.indexOf("application/x-www-form-urlencoded") > -1) return function(e, t) {
804
- return X(e, new de.classes.URLSearchParams(), Object.assign({ visitor: function(e, t, r, n) {
805
- return de.isNode && G.isBuffer(e) ? (this.append(t, e.toString("base64")), !1) : n.defaultVisitor.apply(this, arguments);
806
- } }, t));
807
- }(e, this.formSerializer).toString();
808
- if ((s = G.isFileList(e)) || r.indexOf("multipart/form-data") > -1) {
809
- const t = this.env && this.env.FormData;
810
- return X(s ? { "files[]": e } : e, t && new t(), this.formSerializer);
811
- }
812
- }
813
- return o || n ? (t.setContentType("application/json", !1), function(e, t, r) {
814
- if (G.isString(e)) try {
815
- return (t || JSON.parse)(e), G.trim(e);
816
- } catch (e) {
817
- if ("SyntaxError" !== e.name) throw e;
818
- }
819
- return (r || JSON.stringify)(e);
820
- }(e)) : e;
821
- }],
822
- transformResponse: [function(e) {
823
- const t = this.transitional || he.transitional, r = t && t.forcedJSONParsing, n = "json" === this.responseType;
824
- if (G.isResponse(e) || G.isReadableStream(e)) return e;
825
- if (e && G.isString(e) && (r && !this.responseType || n)) {
826
- const r = !(t && t.silentJSONParsing) && n;
827
- try {
828
- return JSON.parse(e);
829
- } catch (e) {
830
- if (r) {
831
- if ("SyntaxError" === e.name) throw z.from(e, z.ERR_BAD_RESPONSE, this, null, this.response);
832
- throw e;
833
- }
834
- }
835
- }
836
- return e;
837
- }],
838
- timeout: 0,
839
- xsrfCookieName: "XSRF-TOKEN",
840
- xsrfHeaderName: "X-XSRF-TOKEN",
841
- maxContentLength: -1,
842
- maxBodyLength: -1,
843
- env: {
844
- FormData: de.classes.FormData,
845
- Blob: de.classes.Blob
846
- },
847
- validateStatus: function(e) {
848
- return e >= 200 && e < 300;
849
- },
850
- headers: { common: {
851
- Accept: "application/json, text/plain, */*",
852
- "Content-Type": void 0
853
- } }
854
- };
855
- G.forEach([
1559
+ }
1560
+ _request(e, t) {
1561
+ "string" == typeof e ? (t = t || {}).url = e : t = e || {}, t = _e(this.defaults, t);
1562
+ const { transitional: r, paramsSerializer: n, headers: o } = t;
1563
+ void 0 !== r && nt.assertOptions(r, {
1564
+ silentJSONParsing: ot.transitional(ot.boolean),
1565
+ forcedJSONParsing: ot.transitional(ot.boolean),
1566
+ clarifyTimeoutError: ot.transitional(ot.boolean)
1567
+ }, !1), null != n && ($.isFunction(n) ? t.paramsSerializer = { serialize: n } : nt.assertOptions(n, {
1568
+ encode: ot.function,
1569
+ serialize: ot.function
1570
+ }, !0)), void 0 !== t.allowAbsoluteUrls || (void 0 !== this.defaults.allowAbsoluteUrls ? t.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : t.allowAbsoluteUrls = !0), nt.assertOptions(t, {
1571
+ baseUrl: ot.spelling("baseURL"),
1572
+ withXsrfToken: ot.spelling("withXSRFToken")
1573
+ }, !0), t.method = (t.method || this.defaults.method || "get").toLowerCase();
1574
+ let s = o && $.merge(o.common, o[t.method]);
1575
+ o && $.forEach([
856
1576
  "delete",
857
1577
  "get",
858
1578
  "head",
859
1579
  "post",
860
1580
  "put",
861
- "patch"
1581
+ "patch",
1582
+ "common"
862
1583
  ], ((e) => {
863
- he.headers[e] = {};
1584
+ delete o[e];
1585
+ })), t.headers = Oe.concat(s, o);
1586
+ const i = [];
1587
+ let a = !0;
1588
+ this.interceptors.request.forEach((function(e) {
1589
+ "function" == typeof e.runWhen && !1 === e.runWhen(t) || (a = a && e.synchronous, i.unshift(e.fulfilled, e.rejected));
864
1590
  }));
865
- const pe = G.toObjectSet([
866
- "age",
867
- "authorization",
868
- "content-length",
869
- "content-type",
870
- "etag",
871
- "expires",
872
- "from",
873
- "host",
874
- "if-modified-since",
875
- "if-unmodified-since",
876
- "last-modified",
877
- "location",
878
- "max-forwards",
879
- "proxy-authorization",
880
- "referer",
881
- "retry-after",
882
- "user-agent"
883
- ]), me = Symbol("internals");
884
- function ge(e) {
885
- return e && String(e).trim().toLowerCase();
886
- }
887
- function be(e) {
888
- return !1 === e || null == e ? e : G.isArray(e) ? e.map(be) : String(e);
889
- }
890
- function ye(e, t, r, n, o) {
891
- return G.isFunction(n) ? n.call(this, t, r) : (o && (t = r), G.isString(t) ? G.isString(n) ? -1 !== t.indexOf(n) : G.isRegExp(n) ? n.test(t) : void 0 : void 0);
1591
+ const c = [];
1592
+ let l;
1593
+ this.interceptors.response.forEach((function(e) {
1594
+ c.push(e.fulfilled, e.rejected);
1595
+ }));
1596
+ let u, f = 0;
1597
+ if (!a) {
1598
+ const e = [Ye.bind(this), void 0];
1599
+ for (e.unshift(...i), e.push(...c), u = e.length, l = Promise.resolve(t); f < u;) l = l.then(e[f++], e[f++]);
1600
+ return l;
892
1601
  }
893
- let we = class {
894
- constructor(e) {
895
- e && this.set(e);
896
- }
897
- set(e, t, r) {
898
- const n = this;
899
- function o(e, t, r) {
900
- const o = ge(t);
901
- if (!o) throw new Error("header name must be a non-empty string");
902
- const s = G.findKey(n, o);
903
- (!s || void 0 === n[s] || !0 === r || void 0 === r && !1 !== n[s]) && (n[s || t] = be(e));
904
- }
905
- const s = (e, t) => G.forEach(e, ((e, r) => o(e, r, t)));
906
- if (G.isPlainObject(e) || e instanceof this.constructor) s(e, t);
907
- else if (G.isString(e) && (e = e.trim()) && !/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())) s(((e) => {
908
- const t = {};
909
- let r, n, o;
910
- return e && e.split("\n").forEach((function(e) {
911
- o = e.indexOf(":"), r = e.substring(0, o).trim().toLowerCase(), n = e.substring(o + 1).trim(), !r || t[r] && pe[r] || ("set-cookie" === r ? t[r] ? t[r].push(n) : t[r] = [n] : t[r] = t[r] ? t[r] + ", " + n : n);
912
- })), t;
913
- })(e), t);
914
- else if (G.isHeaders(e)) for (const [t, n] of e.entries()) o(n, t, r);
915
- else null != e && o(t, e, r);
916
- return this;
917
- }
918
- get(e, t) {
919
- if (e = ge(e)) {
920
- const r = G.findKey(this, e);
921
- if (r) {
922
- const e = this[r];
923
- if (!t) return e;
924
- if (!0 === t) return function(e) {
925
- const t = Object.create(null), r = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
926
- let n;
927
- for (; n = r.exec(e);) t[n[1]] = n[2];
928
- return t;
929
- }(e);
930
- if (G.isFunction(t)) return t.call(this, e, r);
931
- if (G.isRegExp(t)) return t.exec(e);
932
- throw new TypeError("parser must be boolean|regexp|function");
933
- }
934
- }
935
- }
936
- has(e, t) {
937
- if (e = ge(e)) {
938
- const r = G.findKey(this, e);
939
- return !(!r || void 0 === this[r] || t && !ye(0, this[r], r, t));
940
- }
941
- return !1;
942
- }
943
- delete(e, t) {
944
- const r = this;
945
- let n = !1;
946
- function o(e) {
947
- if (e = ge(e)) {
948
- const o = G.findKey(r, e);
949
- !o || t && !ye(0, r[o], o, t) || (delete r[o], n = !0);
950
- }
951
- }
952
- return G.isArray(e) ? e.forEach(o) : o(e), n;
953
- }
954
- clear(e) {
955
- const t = Object.keys(this);
956
- let r = t.length, n = !1;
957
- for (; r--;) {
958
- const o = t[r];
959
- e && !ye(0, this[o], o, e, !0) || (delete this[o], n = !0);
960
- }
961
- return n;
962
- }
963
- normalize(e) {
964
- const t = this, r = {};
965
- return G.forEach(this, ((n, o) => {
966
- const s = G.findKey(r, o);
967
- if (s) return t[s] = be(n), void delete t[o];
968
- const i = e ? function(e) {
969
- return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, ((e, t, r) => t.toUpperCase() + r));
970
- }(o) : String(o).trim();
971
- i !== o && delete t[o], t[i] = be(n), r[i] = !0;
972
- })), this;
973
- }
974
- concat(...e) {
975
- return this.constructor.concat(this, ...e);
976
- }
977
- toJSON(e) {
978
- const t = Object.create(null);
979
- return G.forEach(this, ((r, n) => {
980
- null != r && !1 !== r && (t[n] = e && G.isArray(r) ? r.join(", ") : r);
981
- })), t;
982
- }
983
- [Symbol.iterator]() {
984
- return Object.entries(this.toJSON())[Symbol.iterator]();
985
- }
986
- toString() {
987
- return Object.entries(this.toJSON()).map((([e, t]) => e + ": " + t)).join("\n");
988
- }
989
- get [Symbol.toStringTag]() {
990
- return "AxiosHeaders";
991
- }
992
- static from(e) {
993
- return e instanceof this ? e : new this(e);
994
- }
995
- static concat(e, ...t) {
996
- const r = new this(e);
997
- return t.forEach(((e) => r.set(e))), r;
998
- }
999
- static accessor(e) {
1000
- const t = (this[me] = this[me] = { accessors: {} }).accessors, r = this.prototype;
1001
- function n(e) {
1002
- const n = ge(e);
1003
- t[n] || (function(e, t) {
1004
- const r = G.toCamelCase(" " + t);
1005
- [
1006
- "get",
1007
- "set",
1008
- "has"
1009
- ].forEach(((n) => {
1010
- Object.defineProperty(e, n + r, {
1011
- value: function(e, r, o) {
1012
- return this[n].call(this, t, e, r, o);
1013
- },
1014
- configurable: !0
1015
- });
1016
- }));
1017
- }(r, e), t[n] = !0);
1018
- }
1019
- return G.isArray(e) ? e.forEach(n) : n(e), this;
1602
+ u = i.length;
1603
+ let d = t;
1604
+ for (f = 0; f < u;) {
1605
+ const e = i[f++], t = i[f++];
1606
+ try {
1607
+ d = e(d);
1608
+ } catch (e) {
1609
+ t.call(this, e);
1610
+ break;
1020
1611
  }
1021
- };
1022
- function Ee(e, t) {
1023
- const r = this || he, n = t || r, o = we.from(n.headers);
1024
- let s = n.data;
1025
- return G.forEach(e, (function(e) {
1026
- s = e.call(r, s, o.normalize(), t ? t.status : void 0);
1027
- })), o.normalize(), s;
1028
- }
1029
- function Re(e) {
1030
- return !(!e || !e.__CANCEL__);
1031
1612
  }
1032
- function Te(e, t, r) {
1033
- z.call(this, null == e ? "canceled" : e, z.ERR_CANCELED, t, r), this.name = "CanceledError";
1613
+ try {
1614
+ l = Ye.call(this, d);
1615
+ } catch (e) {
1616
+ return Promise.reject(e);
1034
1617
  }
1035
- function ve(e, t, r) {
1036
- const n = r.config.validateStatus;
1037
- r.status && n && !n(r.status) ? t(new z("Request failed with status code " + r.status, [z.ERR_BAD_REQUEST, z.ERR_BAD_RESPONSE][Math.floor(r.status / 100) - 4], r.config, r.request, r)) : e(r);
1038
- }
1039
- we.accessor([
1040
- "Content-Type",
1041
- "Content-Length",
1042
- "Accept",
1043
- "Accept-Encoding",
1044
- "User-Agent",
1045
- "Authorization"
1046
- ]), G.reduceDescriptors(we.prototype, (({ value: e }, t) => {
1047
- let r = t[0].toUpperCase() + t.slice(1);
1048
- return {
1049
- get: () => e,
1050
- set(e) {
1051
- this[r] = e;
1052
- }
1053
- };
1054
- })), G.freezeMethods(we), G.inherits(Te, z, { __CANCEL__: !0 });
1055
- const Se = (e, t, r = 3) => {
1056
- let n = 0;
1057
- const o = function(e, t) {
1058
- e = e || 10;
1059
- const r = new Array(e), n = new Array(e);
1060
- let o, s = 0, i = 0;
1061
- return t = void 0 !== t ? t : 1e3, function(a) {
1062
- const l = Date.now(), c = n[i];
1063
- o || (o = l), r[s] = a, n[s] = l;
1064
- let u = i, d = 0;
1065
- for (; u !== s;) d += r[u++], u %= e;
1066
- if (s = (s + 1) % e, s === i && (i = (i + 1) % e), l - o < t) return;
1067
- const f = c && l - c;
1068
- return f ? Math.round(1e3 * d / f) : void 0;
1069
- };
1070
- }(50, 250);
1071
- return function(e, t) {
1072
- let r, n, o = 0, s = 1e3 / t;
1073
- const i = (t, s = Date.now()) => {
1074
- o = s, r = null, n && (clearTimeout(n), n = null), e.apply(null, t);
1075
- };
1076
- return [(...e) => {
1077
- const t = Date.now(), a = t - o;
1078
- a >= s ? i(e, t) : (r = e, n || (n = setTimeout((() => {
1079
- n = null, i(r);
1080
- }), s - a)));
1081
- }, () => r && i(r)];
1082
- }(((r) => {
1083
- const s = r.loaded, i = r.lengthComputable ? r.total : void 0, a = s - n, l = o(a);
1084
- n = s, e({
1085
- loaded: s,
1086
- total: i,
1087
- progress: i ? s / i : void 0,
1088
- bytes: a,
1089
- rate: l || void 0,
1090
- estimated: l && i && s <= i ? (i - s) / l : void 0,
1091
- event: r,
1092
- lengthComputable: null != i,
1093
- [t ? "download" : "upload"]: !0
1094
- });
1095
- }), r);
1096
- }, Oe = (e, t) => {
1097
- const r = null != e;
1098
- return [(n) => t[0]({
1099
- lengthComputable: r,
1100
- total: e,
1101
- loaded: n
1102
- }), t[1]];
1103
- }, xe = (e) => (...t) => G.asap((() => e(...t)));
1104
- var Ae = de.hasStandardBrowserEnv ? ((e, t) => (r) => (r = new URL(r, de.origin), e.protocol === r.protocol && e.host === r.host && (t || e.port === r.port)))(new URL(de.origin), de.navigator && /(msie|trident)/i.test(de.navigator.userAgent)) : () => !0, Ne = de.hasStandardBrowserEnv ? {
1105
- write(e, t, r, n, o, s) {
1106
- const i = [e + "=" + encodeURIComponent(t)];
1107
- G.isNumber(r) && i.push("expires=" + new Date(r).toGMTString()), G.isString(n) && i.push("path=" + n), G.isString(o) && i.push("domain=" + o), !0 === s && i.push("secure"), document.cookie = i.join("; ");
1108
- },
1109
- read(e) {
1110
- const t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));
1111
- return t ? decodeURIComponent(t[3]) : null;
1112
- },
1113
- remove(e) {
1114
- this.write(e, "", Date.now() - 864e5);
1115
- }
1116
- } : {
1117
- write() {},
1118
- read: () => null,
1119
- remove() {}
1120
- };
1121
- function Pe(e, t, r) {
1122
- let n = !/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
1123
- return e && (n || 0 == r) ? function(e, t) {
1124
- return t ? e.replace(/\/?\/$/, "") + "/" + t.replace(/^\/+/, "") : e;
1125
- }(e, t) : t;
1126
- }
1127
- const Ce = (e) => e instanceof we ? { ...e } : e;
1128
- function je(e, t) {
1129
- t = t || {};
1130
- const r = {};
1131
- function n(e, t, r, n) {
1132
- return G.isPlainObject(e) && G.isPlainObject(t) ? G.merge.call({ caseless: n }, e, t) : G.isPlainObject(t) ? G.merge({}, t) : G.isArray(t) ? t.slice() : t;
1133
- }
1134
- function o(e, t, r, o) {
1135
- return G.isUndefined(t) ? G.isUndefined(e) ? void 0 : n(void 0, e, 0, o) : n(e, t, 0, o);
1136
- }
1137
- function s(e, t) {
1138
- if (!G.isUndefined(t)) return n(void 0, t);
1139
- }
1140
- function i(e, t) {
1141
- return G.isUndefined(t) ? G.isUndefined(e) ? void 0 : n(void 0, e) : n(void 0, t);
1142
- }
1143
- function a(r, o, s) {
1144
- return s in t ? n(r, o) : s in e ? n(void 0, r) : void 0;
1145
- }
1146
- const l = {
1147
- url: s,
1148
- method: s,
1149
- data: s,
1150
- baseURL: i,
1151
- transformRequest: i,
1152
- transformResponse: i,
1153
- paramsSerializer: i,
1154
- timeout: i,
1155
- timeoutMessage: i,
1156
- withCredentials: i,
1157
- withXSRFToken: i,
1158
- adapter: i,
1159
- responseType: i,
1160
- xsrfCookieName: i,
1161
- xsrfHeaderName: i,
1162
- onUploadProgress: i,
1163
- onDownloadProgress: i,
1164
- decompress: i,
1165
- maxContentLength: i,
1166
- maxBodyLength: i,
1167
- beforeRedirect: i,
1168
- transport: i,
1169
- httpAgent: i,
1170
- httpsAgent: i,
1171
- cancelToken: i,
1172
- socketPath: i,
1173
- responseEncoding: i,
1174
- validateStatus: a,
1175
- headers: (e, t, r) => o(Ce(e), Ce(t), 0, !0)
1176
- };
1177
- return G.forEach(Object.keys(Object.assign({}, e, t)), (function(n) {
1178
- const s = l[n] || o, i = s(e[n], t[n], n);
1179
- G.isUndefined(i) && s !== a || (r[n] = i);
1180
- })), r;
1181
- }
1182
- var De = (e) => {
1183
- const t = je({}, e);
1184
- let r, { data: n, withXSRFToken: o, xsrfHeaderName: s, xsrfCookieName: i, headers: a, auth: l } = t;
1185
- if (t.headers = a = we.from(a), t.url = re(Pe(t.baseURL, t.url, t.allowAbsoluteUrls), e.params, e.paramsSerializer), l && a.set("Authorization", "Basic " + btoa((l.username || "") + ":" + (l.password ? unescape(encodeURIComponent(l.password)) : ""))), G.isFormData(n)) {
1186
- if (de.hasStandardBrowserEnv || de.hasStandardBrowserWebWorkerEnv) a.setContentType(void 0);
1187
- else if (!1 !== (r = a.getContentType())) {
1188
- const [e, ...t] = r ? r.split(";").map(((e) => e.trim())).filter(Boolean) : [];
1189
- a.setContentType([e || "multipart/form-data", ...t].join("; "));
1190
- }
1191
- }
1192
- if (de.hasStandardBrowserEnv && (o && G.isFunction(o) && (o = o(t)), o || !1 !== o && Ae(t.url))) {
1193
- const e = s && i && Ne.read(i);
1194
- e && a.set(s, e);
1195
- }
1196
- return t;
1197
- }, Ue = "undefined" != typeof XMLHttpRequest && function(e) {
1198
- return new Promise((function(t, r) {
1199
- const n = De(e);
1200
- let o = n.data;
1201
- const s = we.from(n.headers).normalize();
1202
- let i, a, l, c, u, { responseType: d, onUploadProgress: f, onDownloadProgress: h } = n;
1203
- function p() {
1204
- c && c(), u && u(), n.cancelToken && n.cancelToken.unsubscribe(i), n.signal && n.signal.removeEventListener("abort", i);
1205
- }
1206
- let m = new XMLHttpRequest();
1207
- function g() {
1208
- if (!m) return;
1209
- const n = we.from("getAllResponseHeaders" in m && m.getAllResponseHeaders());
1210
- ve((function(e) {
1211
- t(e), p();
1212
- }), (function(e) {
1213
- r(e), p();
1214
- }), {
1215
- data: d && "text" !== d && "json" !== d ? m.response : m.responseText,
1216
- status: m.status,
1217
- statusText: m.statusText,
1218
- headers: n,
1219
- config: e,
1220
- request: m
1221
- }), m = null;
1222
- }
1223
- m.open(n.method.toUpperCase(), n.url, !0), m.timeout = n.timeout, "onloadend" in m ? m.onloadend = g : m.onreadystatechange = function() {
1224
- m && 4 === m.readyState && (0 !== m.status || m.responseURL && 0 === m.responseURL.indexOf("file:")) && setTimeout(g);
1225
- }, m.onabort = function() {
1226
- m && (r(new z("Request aborted", z.ECONNABORTED, e, m)), m = null);
1227
- }, m.onerror = function() {
1228
- r(new z("Network Error", z.ERR_NETWORK, e, m)), m = null;
1229
- }, m.ontimeout = function() {
1230
- let t = n.timeout ? "timeout of " + n.timeout + "ms exceeded" : "timeout exceeded";
1231
- const o = n.transitional || oe;
1232
- n.timeoutErrorMessage && (t = n.timeoutErrorMessage), r(new z(t, o.clarifyTimeoutError ? z.ETIMEDOUT : z.ECONNABORTED, e, m)), m = null;
1233
- }, void 0 === o && s.setContentType(null), "setRequestHeader" in m && G.forEach(s.toJSON(), (function(e, t) {
1234
- m.setRequestHeader(t, e);
1235
- })), G.isUndefined(n.withCredentials) || (m.withCredentials = !!n.withCredentials), d && "json" !== d && (m.responseType = n.responseType), h && ([l, u] = Se(h, !0), m.addEventListener("progress", l)), f && m.upload && ([a, c] = Se(f), m.upload.addEventListener("progress", a), m.upload.addEventListener("loadend", c)), (n.cancelToken || n.signal) && (i = (t) => {
1236
- m && (r(!t || t.type ? new Te(null, e, m) : t), m.abort(), m = null);
1237
- }, n.cancelToken && n.cancelToken.subscribe(i), n.signal && (n.signal.aborted ? i() : n.signal.addEventListener("abort", i)));
1238
- const b = function(e) {
1239
- const t = /^([-+\w]{1,25})(:?\/\/|:)/.exec(e);
1240
- return t && t[1] || "";
1241
- }(n.url);
1242
- b && -1 === de.protocols.indexOf(b) ? r(new z("Unsupported protocol " + b + ":", z.ERR_BAD_REQUEST, e)) : m.send(o || null);
1243
- }));
1244
- };
1245
- const ke = (e, t) => {
1246
- const { length: r } = e = e ? e.filter(Boolean) : [];
1247
- if (t || r) {
1248
- let r, n = new AbortController();
1249
- const o = function(e) {
1250
- if (!r) {
1251
- r = !0, i();
1252
- const t = e instanceof Error ? e : this.reason;
1253
- n.abort(t instanceof z ? t : new Te(t instanceof Error ? t.message : t));
1254
- }
1255
- };
1256
- let s = t && setTimeout((() => {
1257
- s = null, o(new z(`timeout ${t} of ms exceeded`, z.ETIMEDOUT));
1258
- }), t);
1259
- const i = () => {
1260
- e && (s && clearTimeout(s), s = null, e.forEach(((e) => {
1261
- e.unsubscribe ? e.unsubscribe(o) : e.removeEventListener("abort", o);
1262
- })), e = null);
1263
- };
1264
- e.forEach(((e) => e.addEventListener("abort", o)));
1265
- const { signal: a } = n;
1266
- return a.unsubscribe = () => G.asap(i), a;
1267
- }
1268
- }, _e = function* (e, t) {
1269
- let r = e.byteLength;
1270
- if (r < t) return void (yield e);
1271
- let n, o = 0;
1272
- for (; o < r;) n = o + t, yield e.slice(o, n), o = n;
1273
- }, qe = async function* (e) {
1274
- if (e[Symbol.asyncIterator]) return void (yield* e);
1275
- const t = e.getReader();
1276
- try {
1277
- for (;;) {
1278
- const { done: e, value: r } = await t.read();
1279
- if (e) break;
1280
- yield r;
1281
- }
1282
- } finally {
1283
- await t.cancel();
1284
- }
1285
- }, Be = (e, t, r, n) => {
1286
- const o = async function* (e, t) {
1287
- for await (const r of qe(e)) yield* _e(r, t);
1288
- }(e, t);
1289
- let s, i = 0, a = (e) => {
1290
- s || (s = !0, n && n(e));
1291
- };
1292
- return new ReadableStream({
1293
- async pull(e) {
1294
- try {
1295
- const { done: t, value: n } = await o.next();
1296
- if (t) return a(), void e.close();
1297
- let s = n.byteLength;
1298
- if (r) r(i += s);
1299
- e.enqueue(new Uint8Array(n));
1300
- } catch (e) {
1301
- throw a(e), e;
1302
- }
1303
- },
1304
- cancel: (e) => (a(e), o.return())
1305
- }, { highWaterMark: 2 });
1306
- }, Le = "function" == typeof fetch && "function" == typeof Request && "function" == typeof Response, Fe = Le && "function" == typeof ReadableStream, Me = Le && ("function" == typeof TextEncoder ? (Ie = new TextEncoder(), (e) => Ie.encode(e)) : async (e) => new Uint8Array(await new Response(e).arrayBuffer()));
1307
- var Ie;
1308
- const Je = (e, ...t) => {
1309
- try {
1310
- return !!e(...t);
1311
- } catch (e) {
1312
- return !1;
1313
- }
1314
- }, Ge = Fe && Je((() => {
1315
- let e = !1;
1316
- const t = new Request(de.origin, {
1317
- body: new ReadableStream(),
1318
- method: "POST",
1319
- get duplex() {
1320
- return e = !0, "half";
1321
- }
1322
- }).headers.has("Content-Type");
1323
- return e && !t;
1324
- })), ze = Fe && Je((() => G.isReadableStream(new Response("").body))), He = { stream: ze && ((e) => e.body) };
1325
- var $e;
1326
- Le && ($e = new Response(), [
1327
- "text",
1328
- "arrayBuffer",
1329
- "blob",
1330
- "formData",
1331
- "stream"
1332
- ].forEach(((e) => {
1333
- !He[e] && (He[e] = G.isFunction($e[e]) ? (t) => t[e]() : (t, r) => {
1334
- throw new z(`Response type '${e}' is not supported`, z.ERR_NOT_SUPPORT, r);
1335
- });
1336
- })));
1337
- const We = async (e, t) => {
1338
- const r = G.toFiniteNumber(e.getContentLength());
1339
- return null == r ? (async (e) => {
1340
- if (null == e) return 0;
1341
- if (G.isBlob(e)) return e.size;
1342
- if (G.isSpecCompliantForm(e)) return (await new Request(de.origin, {
1343
- method: "POST",
1344
- body: e
1345
- }).arrayBuffer()).byteLength;
1346
- return G.isArrayBufferView(e) || G.isArrayBuffer(e) ? e.byteLength : (G.isURLSearchParams(e) && (e += ""), G.isString(e) ? (await Me(e)).byteLength : void 0);
1347
- })(t) : r;
1348
- }, Ve = {
1349
- http: null,
1350
- xhr: Ue,
1351
- fetch: Le && (async (e) => {
1352
- let { url: t, method: r, data: n, signal: o, cancelToken: s, timeout: i, onDownloadProgress: a, onUploadProgress: l, responseType: c, headers: u, withCredentials: d = "same-origin", fetchOptions: f } = De(e);
1353
- c = c ? (c + "").toLowerCase() : "text";
1354
- let h, p = ke([o, s && s.toAbortSignal()], i);
1355
- const m = p && p.unsubscribe && (() => {
1356
- p.unsubscribe();
1357
- });
1358
- let g;
1359
- try {
1360
- if (l && Ge && "get" !== r && "head" !== r && 0 !== (g = await We(u, n))) {
1361
- let e, r = new Request(t, {
1362
- method: "POST",
1363
- body: n,
1364
- duplex: "half"
1365
- });
1366
- if (G.isFormData(n) && (e = r.headers.get("content-type")) && u.setContentType(e), r.body) {
1367
- const [e, t] = Oe(g, Se(xe(l)));
1368
- n = Be(r.body, 65536, e, t);
1369
- }
1370
- }
1371
- G.isString(d) || (d = d ? "include" : "omit");
1372
- const o = "credentials" in Request.prototype;
1373
- h = new Request(t, {
1374
- ...f,
1375
- signal: p,
1376
- method: r.toUpperCase(),
1377
- headers: u.normalize().toJSON(),
1378
- body: n,
1379
- duplex: "half",
1380
- credentials: o ? d : void 0
1381
- });
1382
- let s = await fetch(h);
1383
- const i = ze && ("stream" === c || "response" === c);
1384
- if (ze && (a || i && m)) {
1385
- const e = {};
1386
- [
1387
- "status",
1388
- "statusText",
1389
- "headers"
1390
- ].forEach(((t) => {
1391
- e[t] = s[t];
1392
- }));
1393
- const t = G.toFiniteNumber(s.headers.get("content-length")), [r, n] = a && Oe(t, Se(xe(a), !0)) || [];
1394
- s = new Response(Be(s.body, 65536, r, (() => {
1395
- n && n(), m && m();
1396
- })), e);
1397
- }
1398
- c = c || "text";
1399
- let b = await He[G.findKey(He, c) || "text"](s, e);
1400
- return !i && m && m(), await new Promise(((t, r) => {
1401
- ve(t, r, {
1402
- data: b,
1403
- headers: we.from(s.headers),
1404
- status: s.status,
1405
- statusText: s.statusText,
1406
- config: e,
1407
- request: h
1408
- });
1409
- }));
1410
- } catch (t) {
1411
- if (m && m(), t && "TypeError" === t.name && /fetch/i.test(t.message)) throw Object.assign(new z("Network Error", z.ERR_NETWORK, e, h), { cause: t.cause || t });
1412
- throw z.from(t, t && t.code, e, h);
1413
- }
1414
- })
1415
- };
1416
- G.forEach(Ve, ((e, t) => {
1417
- if (e) {
1418
- try {
1419
- Object.defineProperty(e, "name", { value: t });
1420
- } catch (e) {}
1421
- Object.defineProperty(e, "adapterName", { value: t });
1422
- }
1618
+ for (f = 0, u = c.length; f < u;) l = l.then(c[f++], c[f++]);
1619
+ return l;
1620
+ }
1621
+ getUri(e) {
1622
+ return oe(Ce((e = _e(this.defaults, e)).baseURL, e.url, e.allowAbsoluteUrls), e.params, e.paramsSerializer);
1623
+ }
1624
+ };
1625
+ $.forEach([
1626
+ "delete",
1627
+ "get",
1628
+ "head",
1629
+ "options"
1630
+ ], (function(e) {
1631
+ st.prototype[e] = function(t, r) {
1632
+ return this.request(_e(r || {}, {
1633
+ method: e,
1634
+ url: t,
1635
+ data: (r || {}).data
1423
1636
  }));
1424
- const Ke = (e) => `- ${e}`, Qe = (e) => G.isFunction(e) || null === e || !1 === e;
1425
- var Xe = (e) => {
1426
- e = G.isArray(e) ? e : [e];
1427
- const { length: t } = e;
1428
- let r, n;
1429
- const o = {};
1430
- for (let s = 0; s < t; s++) {
1431
- let t;
1432
- if (r = e[s], n = r, !Qe(r) && (n = Ve[(t = String(r)).toLowerCase()], void 0 === n)) throw new z(`Unknown adapter '${t}'`);
1433
- if (n) break;
1434
- o[t || "#" + s] = n;
1435
- }
1436
- if (!n) {
1437
- const e = Object.entries(o).map((([e, t]) => `adapter ${e} ` + (!1 === t ? "is not supported by the environment" : "is not available in the build")));
1438
- throw new z("There is no suitable adapter to dispatch the request " + (t ? e.length > 1 ? "since :\n" + e.map(Ke).join("\n") : " " + Ke(e[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
1439
- }
1440
- return n;
1441
- };
1442
- function Ze(e) {
1443
- if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted) throw new Te(null, e);
1444
- }
1445
- function Ye(e) {
1446
- return Ze(e), e.headers = we.from(e.headers), e.data = Ee.call(e, e.transformRequest), -1 !== [
1447
- "post",
1448
- "put",
1449
- "patch"
1450
- ].indexOf(e.method) && e.headers.setContentType("application/x-www-form-urlencoded", !1), Xe(e.adapter || he.adapter)(e).then((function(t) {
1451
- return Ze(e), t.data = Ee.call(e, e.transformResponse, t), t.headers = we.from(t.headers), t;
1452
- }), (function(t) {
1453
- return Re(t) || (Ze(e), t && t.response && (t.response.data = Ee.call(e, e.transformResponse, t.response), t.response.headers = we.from(t.response.headers))), Promise.reject(t);
1637
+ };
1638
+ })), $.forEach([
1639
+ "post",
1640
+ "put",
1641
+ "patch"
1642
+ ], (function(e) {
1643
+ function t(t) {
1644
+ return function(r, n, o) {
1645
+ return this.request(_e(o || {}, {
1646
+ method: e,
1647
+ headers: t ? { "Content-Type": "multipart/form-data" } : {},
1648
+ url: r,
1649
+ data: n
1454
1650
  }));
1455
- }
1456
- const et = "1.8.4", tt = {};
1457
- [
1458
- "object",
1459
- "boolean",
1460
- "number",
1461
- "function",
1462
- "string",
1463
- "symbol"
1464
- ].forEach(((e, t) => {
1465
- tt[e] = function(r) {
1466
- return typeof r === e || "a" + (t < 1 ? "n " : " ") + e;
1467
- };
1468
- }));
1469
- const rt = {};
1470
- tt.transitional = function(e, t, r) {
1471
- function n(e, t) {
1472
- return "[Axios v1.8.4] Transitional option '" + e + "'" + t + (r ? ". " + r : "");
1473
- }
1474
- return (r, o, s) => {
1475
- if (!1 === e) throw new z(n(o, " has been removed" + (t ? " in " + t : "")), z.ERR_DEPRECATED);
1476
- return t && !rt[o] && (rt[o] = !0, console.warn(n(o, " has been deprecated since v" + t + " and will be removed in the near future"))), !e || e(r, o, s);
1477
- };
1478
- }, tt.spelling = function(e) {
1479
- return (t, r) => (console.warn(`${r} is likely a misspelling of ${e}`), !0);
1480
- };
1481
- var nt = {
1482
- assertOptions: function(e, t, r) {
1483
- if ("object" != typeof e) throw new z("options must be an object", z.ERR_BAD_OPTION_VALUE);
1484
- const n = Object.keys(e);
1485
- let o = n.length;
1486
- for (; o-- > 0;) {
1487
- const s = n[o], i = t[s];
1488
- if (i) {
1489
- const t = e[s], r = void 0 === t || i(t, s, e);
1490
- if (!0 !== r) throw new z("option " + s + " must be " + r, z.ERR_BAD_OPTION_VALUE);
1491
- } else if (!0 !== r) throw new z("Unknown option " + s, z.ERR_BAD_OPTION);
1492
- }
1493
- },
1494
- validators: tt
1495
- };
1496
- const ot = nt.validators;
1497
- let st = class {
1498
- constructor(e) {
1499
- this.defaults = e, this.interceptors = {
1500
- request: new ne(),
1501
- response: new ne()
1502
- };
1503
- }
1504
- async request(e, t) {
1505
- try {
1506
- return await this._request(e, t);
1507
- } catch (e) {
1508
- if (e instanceof Error) {
1509
- let t = {};
1510
- Error.captureStackTrace ? Error.captureStackTrace(t) : t = /* @__PURE__ */ new Error();
1511
- const r = t.stack ? t.stack.replace(/^.+\n/, "") : "";
1512
- try {
1513
- e.stack ? r && !String(e.stack).endsWith(r.replace(/^.+\n.+\n/, "")) && (e.stack += "\n" + r) : e.stack = r;
1514
- } catch (e) {}
1515
- }
1516
- throw e;
1517
- }
1518
- }
1519
- _request(e, t) {
1520
- "string" == typeof e ? (t = t || {}).url = e : t = e || {}, t = je(this.defaults, t);
1521
- const { transitional: r, paramsSerializer: n, headers: o } = t;
1522
- void 0 !== r && nt.assertOptions(r, {
1523
- silentJSONParsing: ot.transitional(ot.boolean),
1524
- forcedJSONParsing: ot.transitional(ot.boolean),
1525
- clarifyTimeoutError: ot.transitional(ot.boolean)
1526
- }, !1), null != n && (G.isFunction(n) ? t.paramsSerializer = { serialize: n } : nt.assertOptions(n, {
1527
- encode: ot.function,
1528
- serialize: ot.function
1529
- }, !0)), void 0 !== t.allowAbsoluteUrls || (void 0 !== this.defaults.allowAbsoluteUrls ? t.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls : t.allowAbsoluteUrls = !0), nt.assertOptions(t, {
1530
- baseUrl: ot.spelling("baseURL"),
1531
- withXsrfToken: ot.spelling("withXSRFToken")
1532
- }, !0), t.method = (t.method || this.defaults.method || "get").toLowerCase();
1533
- let s = o && G.merge(o.common, o[t.method]);
1534
- o && G.forEach([
1535
- "delete",
1536
- "get",
1537
- "head",
1538
- "post",
1539
- "put",
1540
- "patch",
1541
- "common"
1542
- ], ((e) => {
1543
- delete o[e];
1544
- })), t.headers = we.concat(s, o);
1545
- const i = [];
1546
- let a = !0;
1547
- this.interceptors.request.forEach((function(e) {
1548
- "function" == typeof e.runWhen && !1 === e.runWhen(t) || (a = a && e.synchronous, i.unshift(e.fulfilled, e.rejected));
1549
- }));
1550
- const l = [];
1551
- let c;
1552
- this.interceptors.response.forEach((function(e) {
1553
- l.push(e.fulfilled, e.rejected);
1554
- }));
1555
- let u, d = 0;
1556
- if (!a) {
1557
- const e = [Ye.bind(this), void 0];
1558
- for (e.unshift.apply(e, i), e.push.apply(e, l), u = e.length, c = Promise.resolve(t); d < u;) c = c.then(e[d++], e[d++]);
1559
- return c;
1560
- }
1561
- u = i.length;
1562
- let f = t;
1563
- for (d = 0; d < u;) {
1564
- const t = i[d++], r = i[d++];
1565
- try {
1566
- f = t(f);
1567
- } catch (e) {
1568
- r.call(this, e);
1569
- break;
1570
- }
1571
- }
1572
- try {
1573
- c = Ye.call(this, f);
1574
- } catch (e) {
1575
- return Promise.reject(e);
1576
- }
1577
- for (d = 0, u = l.length; d < u;) c = c.then(l[d++], l[d++]);
1578
- return c;
1579
- }
1580
- getUri(e) {
1581
- return re(Pe((e = je(this.defaults, e)).baseURL, e.url, e.allowAbsoluteUrls), e.params, e.paramsSerializer);
1582
- }
1583
1651
  };
1584
- G.forEach([
1585
- "delete",
1586
- "get",
1587
- "head",
1588
- "options"
1589
- ], (function(e) {
1590
- st.prototype[e] = function(t, r) {
1591
- return this.request(je(r || {}, {
1592
- method: e,
1593
- url: t,
1594
- data: (r || {}).data
1595
- }));
1596
- };
1597
- })), G.forEach([
1598
- "post",
1599
- "put",
1600
- "patch"
1601
- ], (function(e) {
1602
- function t(t) {
1603
- return function(r, n, o) {
1604
- return this.request(je(o || {}, {
1605
- method: e,
1606
- headers: t ? { "Content-Type": "multipart/form-data" } : {},
1607
- url: r,
1608
- data: n
1609
- }));
1610
- };
1611
- }
1612
- st.prototype[e] = t(), st.prototype[e + "Form"] = t(!0);
1652
+ }
1653
+ st.prototype[e] = t(), st.prototype[e + "Form"] = t(!0);
1654
+ }));
1655
+ const it = {
1656
+ Continue: 100,
1657
+ SwitchingProtocols: 101,
1658
+ Processing: 102,
1659
+ EarlyHints: 103,
1660
+ Ok: 200,
1661
+ Created: 201,
1662
+ Accepted: 202,
1663
+ NonAuthoritativeInformation: 203,
1664
+ NoContent: 204,
1665
+ ResetContent: 205,
1666
+ PartialContent: 206,
1667
+ MultiStatus: 207,
1668
+ AlreadyReported: 208,
1669
+ ImUsed: 226,
1670
+ MultipleChoices: 300,
1671
+ MovedPermanently: 301,
1672
+ Found: 302,
1673
+ SeeOther: 303,
1674
+ NotModified: 304,
1675
+ UseProxy: 305,
1676
+ Unused: 306,
1677
+ TemporaryRedirect: 307,
1678
+ PermanentRedirect: 308,
1679
+ BadRequest: 400,
1680
+ Unauthorized: 401,
1681
+ PaymentRequired: 402,
1682
+ Forbidden: 403,
1683
+ NotFound: 404,
1684
+ MethodNotAllowed: 405,
1685
+ NotAcceptable: 406,
1686
+ ProxyAuthenticationRequired: 407,
1687
+ RequestTimeout: 408,
1688
+ Conflict: 409,
1689
+ Gone: 410,
1690
+ LengthRequired: 411,
1691
+ PreconditionFailed: 412,
1692
+ PayloadTooLarge: 413,
1693
+ UriTooLong: 414,
1694
+ UnsupportedMediaType: 415,
1695
+ RangeNotSatisfiable: 416,
1696
+ ExpectationFailed: 417,
1697
+ ImATeapot: 418,
1698
+ MisdirectedRequest: 421,
1699
+ UnprocessableEntity: 422,
1700
+ Locked: 423,
1701
+ FailedDependency: 424,
1702
+ TooEarly: 425,
1703
+ UpgradeRequired: 426,
1704
+ PreconditionRequired: 428,
1705
+ TooManyRequests: 429,
1706
+ RequestHeaderFieldsTooLarge: 431,
1707
+ UnavailableForLegalReasons: 451,
1708
+ InternalServerError: 500,
1709
+ NotImplemented: 501,
1710
+ BadGateway: 502,
1711
+ ServiceUnavailable: 503,
1712
+ GatewayTimeout: 504,
1713
+ HttpVersionNotSupported: 505,
1714
+ VariantAlsoNegotiates: 506,
1715
+ InsufficientStorage: 507,
1716
+ LoopDetected: 508,
1717
+ NotExtended: 510,
1718
+ NetworkAuthenticationRequired: 511
1719
+ };
1720
+ Object.entries(it).forEach((([e, t]) => {
1721
+ it[t] = e;
1722
+ }));
1723
+ const at = function e(r) {
1724
+ const n = new st(r), o = t(st.prototype.request, n);
1725
+ return $.extend(o, st.prototype, n, { allOwnKeys: !0 }), $.extend(o, n, null, { allOwnKeys: !0 }), o.create = function(t) {
1726
+ return e(_e(r, t));
1727
+ }, o;
1728
+ }(me);
1729
+ at.Axios = st, at.CanceledError = Re, at.CancelToken = class e {
1730
+ constructor(e) {
1731
+ if ("function" != typeof e) throw new TypeError("executor must be a function.");
1732
+ let t;
1733
+ this.promise = new Promise((function(e) {
1734
+ t = e;
1613
1735
  }));
1614
- const it = {
1615
- Continue: 100,
1616
- SwitchingProtocols: 101,
1617
- Processing: 102,
1618
- EarlyHints: 103,
1619
- Ok: 200,
1620
- Created: 201,
1621
- Accepted: 202,
1622
- NonAuthoritativeInformation: 203,
1623
- NoContent: 204,
1624
- ResetContent: 205,
1625
- PartialContent: 206,
1626
- MultiStatus: 207,
1627
- AlreadyReported: 208,
1628
- ImUsed: 226,
1629
- MultipleChoices: 300,
1630
- MovedPermanently: 301,
1631
- Found: 302,
1632
- SeeOther: 303,
1633
- NotModified: 304,
1634
- UseProxy: 305,
1635
- Unused: 306,
1636
- TemporaryRedirect: 307,
1637
- PermanentRedirect: 308,
1638
- BadRequest: 400,
1639
- Unauthorized: 401,
1640
- PaymentRequired: 402,
1641
- Forbidden: 403,
1642
- NotFound: 404,
1643
- MethodNotAllowed: 405,
1644
- NotAcceptable: 406,
1645
- ProxyAuthenticationRequired: 407,
1646
- RequestTimeout: 408,
1647
- Conflict: 409,
1648
- Gone: 410,
1649
- LengthRequired: 411,
1650
- PreconditionFailed: 412,
1651
- PayloadTooLarge: 413,
1652
- UriTooLong: 414,
1653
- UnsupportedMediaType: 415,
1654
- RangeNotSatisfiable: 416,
1655
- ExpectationFailed: 417,
1656
- ImATeapot: 418,
1657
- MisdirectedRequest: 421,
1658
- UnprocessableEntity: 422,
1659
- Locked: 423,
1660
- FailedDependency: 424,
1661
- TooEarly: 425,
1662
- UpgradeRequired: 426,
1663
- PreconditionRequired: 428,
1664
- TooManyRequests: 429,
1665
- RequestHeaderFieldsTooLarge: 431,
1666
- UnavailableForLegalReasons: 451,
1667
- InternalServerError: 500,
1668
- NotImplemented: 501,
1669
- BadGateway: 502,
1670
- ServiceUnavailable: 503,
1671
- GatewayTimeout: 504,
1672
- HttpVersionNotSupported: 505,
1673
- VariantAlsoNegotiates: 506,
1674
- InsufficientStorage: 507,
1675
- LoopDetected: 508,
1676
- NotExtended: 510,
1677
- NetworkAuthenticationRequired: 511
1678
- };
1679
- Object.entries(it).forEach((([e, t]) => {
1680
- it[t] = e;
1736
+ const r = this;
1737
+ this.promise.then(((e) => {
1738
+ if (!r._listeners) return;
1739
+ let t = r._listeners.length;
1740
+ for (; t-- > 0;) r._listeners[t](e);
1741
+ r._listeners = null;
1742
+ })), this.promise.then = (e) => {
1743
+ let t;
1744
+ const n = new Promise(((e) => {
1745
+ r.subscribe(e), t = e;
1746
+ })).then(e);
1747
+ return n.cancel = function() {
1748
+ r.unsubscribe(t);
1749
+ }, n;
1750
+ }, e((function(e, n, o) {
1751
+ r.reason || (r.reason = new Re(e, n, o), t(r.reason));
1681
1752
  }));
1682
- const at = function e(t) {
1683
- const n = new st(t), o = r(st.prototype.request, n);
1684
- return G.extend(o, st.prototype, n, { allOwnKeys: !0 }), G.extend(o, n, null, { allOwnKeys: !0 }), o.create = function(r) {
1685
- return e(je(t, r));
1686
- }, o;
1687
- }(he);
1688
- var lt;
1689
- at.Axios = st, at.CanceledError = Te, at.CancelToken = class e {
1690
- constructor(e) {
1691
- if ("function" != typeof e) throw new TypeError("executor must be a function.");
1692
- let t;
1693
- this.promise = new Promise((function(e) {
1694
- t = e;
1695
- }));
1696
- const r = this;
1697
- this.promise.then(((e) => {
1698
- if (!r._listeners) return;
1699
- let t = r._listeners.length;
1700
- for (; t-- > 0;) r._listeners[t](e);
1701
- r._listeners = null;
1702
- })), this.promise.then = (e) => {
1703
- let t;
1704
- const n = new Promise(((e) => {
1705
- r.subscribe(e), t = e;
1706
- })).then(e);
1707
- return n.cancel = function() {
1708
- r.unsubscribe(t);
1709
- }, n;
1710
- }, e((function(e, n, o) {
1711
- r.reason || (r.reason = new Te(e, n, o), t(r.reason));
1712
- }));
1713
- }
1714
- throwIfRequested() {
1715
- if (this.reason) throw this.reason;
1716
- }
1717
- subscribe(e) {
1718
- this.reason ? e(this.reason) : this._listeners ? this._listeners.push(e) : this._listeners = [e];
1719
- }
1720
- unsubscribe(e) {
1721
- if (!this._listeners) return;
1722
- const t = this._listeners.indexOf(e);
1723
- -1 !== t && this._listeners.splice(t, 1);
1724
- }
1725
- toAbortSignal() {
1726
- const e = new AbortController(), t = (t) => {
1727
- e.abort(t);
1728
- };
1729
- return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
1730
- }
1731
- static source() {
1732
- let t;
1733
- return {
1734
- token: new e((function(e) {
1735
- t = e;
1736
- })),
1737
- cancel: t
1738
- };
1739
- }
1740
- }, at.isCancel = Re, at.VERSION = et, at.toFormData = X, at.AxiosError = z, at.Cancel = at.CanceledError, at.all = function(e) {
1741
- return Promise.all(e);
1742
- }, at.spread = function(e) {
1743
- return function(t) {
1744
- return e.apply(null, t);
1745
- };
1746
- }, at.isAxiosError = function(e) {
1747
- return G.isObject(e) && !0 === e.isAxiosError;
1748
- }, at.mergeConfig = je, at.AxiosHeaders = we, at.formToJSON = (e) => fe(G.isHTMLForm(e) ? new FormData(e) : e), at.getAdapter = Xe, at.HttpStatusCode = it, at.default = at, e.ResponseType = void 0, (lt = e.ResponseType || (e.ResponseType = {})).MATRIX = "matrix", lt.VECTOR = "vector", lt.SCALAR = "scalar", lt.STRING = "string";
1749
- class ct {
1750
- constructor(e, t) {
1751
- if (e && "string" != typeof e) throw new Error("Wrong name format. Expected string.");
1752
- if (t && "object" != typeof t) throw new Error("Wrong labels format. Expected object.");
1753
- this.name = e, this.labels = t;
1754
- }
1755
- static fromJSON(e) {
1756
- const t = e.__name__, r = Object.assign({}, e);
1757
- return delete r.__name__, new ct(t, r);
1758
- }
1759
- toString() {
1760
- return (this.name ? this.name : "") + "{" + Object.keys(this.labels).map(((e) => e + "=\"" + this.labels[e] + "\"")).join(", ") + "}";
1761
- }
1762
- }
1763
- class ut {
1764
- constructor(e, t) {
1765
- if ("object" != typeof e || "Date" != e.constructor.name) throw new Error("Wrong time format. Expected Date.");
1766
- if ("number" != typeof t) throw new Error("Wrong value format. Expected float.");
1767
- this.time = e, this.value = t;
1768
- }
1769
- static fromJSON(e) {
1770
- return new ut(/* @__PURE__ */ new Date(1e3 * e[0]), parseFloat(e[1]));
1771
- }
1772
- toString() {
1773
- return this.time + ": " + this.value;
1774
- }
1775
- }
1776
- class dt {
1777
- constructor(e, t) {
1778
- this.metric = e, this.values = t;
1779
- }
1780
- static fromJSON(e) {
1781
- return new dt(e.metric ? ct.fromJSON(e.metric) : null, e.values.map(ut.fromJSON));
1782
- }
1783
- }
1784
- class ft {
1785
- constructor(e, t) {
1786
- this.metric = e, this.value = t;
1787
- }
1788
- static fromJSON(e) {
1789
- return new ft(e.metric ? ct.fromJSON(e.metric) : null, ut.fromJSON(e.value));
1790
- }
1791
- }
1792
- class ht {
1793
- constructor(e, t) {
1794
- this.resultType = e, this.result = t;
1795
- }
1796
- static fromJSON(t) {
1797
- const r = t.resultType;
1798
- let n = null;
1799
- switch (r) {
1800
- case e.ResponseType.MATRIX:
1801
- n = t.result.map(dt.fromJSON);
1802
- break;
1803
- case e.ResponseType.VECTOR:
1804
- n = t.result.map(ft.fromJSON);
1805
- break;
1806
- case e.ResponseType.SCALAR:
1807
- case e.ResponseType.STRING:
1808
- n = t.result;
1809
- break;
1810
- default: throw new Error(`Unexpected resultType: ${r}`);
1811
- }
1812
- return new ht(r, n);
1813
- }
1814
- }
1815
- class pt {
1816
- constructor(e, t, r, n, o, s, i, a) {
1817
- if (e && "object" != typeof e) throw new Error(`Unexpected format for discoveredLabels. Got ${typeof e} instead of object`);
1818
- if (t && "object" != typeof t) throw new Error(`Unexpected format for labels. Got ${typeof t} instead of object`);
1819
- if (r && "string" != typeof r) throw new Error(`Unexpected format for scrapePool. Got ${typeof r} instead of string`);
1820
- if (n && "string" != typeof n) throw new Error(`Unexpected format for scrapeUrl. Got ${typeof n} instead of string`);
1821
- if (o && "string" != typeof o) throw new Error(`Unexpected format for lastError. Got ${typeof o} instead of string`);
1822
- if (s && ("object" != typeof s || "Date" != s.constructor.name)) throw new Error(`Unexpected format for lastScrape. Got ${typeof s} instead of object`);
1823
- if (i && "number" != typeof i) throw new Error(`Unexpected format for lastScrapeDuration. Got ${typeof i} instead of number`);
1824
- if (a && "string" != typeof a) throw new Error(`Unexpected format for health. Got ${typeof a} instead of string`);
1825
- this.discoveredLabels = e, this.labels = t, this.scrapePool = r, this.scrapeUrl = n, this.lastError = o, this.lastScrape = s, this.lastScrapeDuration = i, this.health = a;
1826
- }
1827
- static fromJSON(e) {
1828
- return new pt(e.discoveredLabels, e.labels, e.scrapePool, e.scrapeUrl, e.lastError, e.lastScrape ? new Date(e.lastScrape) : null, e.lastScrapeDuration ? parseFloat(e.lastScrapeDuration) : null, e.health);
1829
- }
1830
- }
1831
- class mt {
1832
- constructor(e, t, r, n, o) {
1833
- if (e && ("object" != typeof e || "Date" != e.constructor.name)) throw new Error(`Unexpected format for activeAt. Got ${typeof e} instead of object`);
1834
- if (t && "object" != typeof t) throw new Error(`Unexpected format for annotations. Got ${typeof t} instead of object`);
1835
- if (r && "object" != typeof r) throw new Error(`Unexpected format for labels. Got ${typeof r} instead of object`);
1836
- if (o && "number" != typeof o) throw new Error(`Unexpected format for value. Got ${typeof o} instead of number`);
1837
- this.activeAt = e, this.annotations = t, this.labels = r, this.state = n, this.value = o;
1838
- }
1839
- static fromJSON(e) {
1840
- return new mt(e.activeAt ? new Date(e.activeAt) : null, e.annotations, e.labels, e.state, e.value ? parseFloat(e.value) : null);
1841
- }
1842
- }
1843
- class gt {
1844
- constructor(e, t, r, n, o, s, i, a) {
1845
- this.alerts = e, this.annotations = t, this.duration = r, this.health = n, this.labels = o, this.name = s, this.query = i, this.type = a;
1846
- }
1847
- static fromJSON(e) {
1848
- return new gt(e.alerts ? e.alerts.map(mt.fromJSON) : [], e.annotations, e.duration, e.health, e.labels, e.name, e.query, e.type);
1849
- }
1850
- }
1851
- class bt {
1852
- constructor(e, t, r, n) {
1853
- this.rules = e, this.file = t, this.interval = r, this.name = n;
1854
- }
1855
- static fromJSON(e) {
1856
- return new bt(e.rules ? e.rules.map(gt.fromJSON) : [], e.file, e.interval, e.name);
1857
- }
1858
- }
1859
- class yt {
1860
- constructor() {
1861
- this.baseURL = "/api/v1/", this.headers = {}, this.auth = null, this.proxy = null, this.withCredentials = !1, this.timeout = 1e4, this.preferPost = !1, this.warningHook = null;
1862
- }
1863
- }
1864
- e.Alert = mt, e.InstantVector = ft, e.Metric = ct, e.PrometheusConnectionOptions = yt, e.PrometheusDriver = class {
1865
- constructor(e) {
1866
- if (this.listifyIfNeeded = (e) => e instanceof Array ? e : [e], this.formatPromQlParams = (e) => Object.entries(null != e ? e : {}).reduce(((e, [t, r]) => (null != r && (r instanceof Array ? r.filter(((e) => null != e)).forEach(((r) => e.append(`${t}[]`, r))) : e.append(t, r)), e)), new URLSearchParams()), !(e = e || new yt()).endpoint) throw "Endpoint is required";
1867
- e.endpoint = e.endpoint.replace(/\/$/, ""), e.baseURL = e.baseURL || "/api/v1/", e.withCredentials = e.withCredentials || !1, e.timeout = e.timeout || 1e4, this.options = e, this.axiosInstance = at.create(), this.options.requestInterceptor && this.axiosInstance.interceptors.request.use(this.options.requestInterceptor.onFulfilled, this.options.requestInterceptor.onRejected), this.options.responseInterceptor && this.axiosInstance.interceptors.response.use(this.options.responseInterceptor.onFulfilled, this.options.responseInterceptor.onRejected);
1868
- }
1869
- request(e, t, r, n) {
1870
- var o, s, i, a, l, c;
1871
- const u = Object.assign({}, this.options.headers || {});
1872
- return this.axiosInstance.request({
1873
- baseURL: this.options.endpoint + this.options.baseURL,
1874
- url: t,
1875
- method: e,
1876
- params: this.formatPromQlParams(r),
1877
- data: this.formatPromQlParams(n),
1878
- headers: u,
1879
- auth: (null === (o = this.options.auth) || void 0 === o ? void 0 : o.username) && (null === (s = this.options.auth) || void 0 === s ? void 0 : s.password) ? {
1880
- username: this.options.auth.username,
1881
- password: this.options.auth.password
1882
- } : null,
1883
- proxy: (null === (i = this.options.proxy) || void 0 === i ? void 0 : i.host) && (null === (a = this.options.proxy) || void 0 === a ? void 0 : a.port) ? {
1884
- host: null === (l = this.options.proxy) || void 0 === l ? void 0 : l.host,
1885
- port: null === (c = this.options.proxy) || void 0 === c ? void 0 : c.port
1886
- } : null,
1887
- withCredentials: this.options.withCredentials,
1888
- timeout: this.options.timeout
1889
- }).then(((e) => this.handleResponse(e))).catch(((e) => this.handleResponse(e, !0)));
1890
- }
1891
- handleResponse(e, t = !1) {
1892
- var r, n, o, s, i;
1893
- const a = !0 === (null == e ? void 0 : e.isAxiosError), l = t || a, c = a ? e : void 0, u = a ? c.response : l ? null == e ? void 0 : e.response : e;
1894
- if (!u) {
1895
- const t = null !== (r = null == c ? void 0 : c.code) && void 0 !== r ? r : null == e ? void 0 : e.code, i = null !== (o = null !== (n = null == c ? void 0 : c.message) && void 0 !== n ? n : null == e ? void 0 : e.message) && void 0 !== o ? o : "unexpected network error";
1896
- throw {
1897
- status: "error",
1898
- errorType: "ECONNABORTED" === t ? "timeout_error" : (null === (s = null == t ? void 0 : t.startsWith) || void 0 === s ? void 0 : s.call(t, "ERR_SSL")) ? "ssl_error" : "network_error",
1899
- error: i,
1900
- code: t,
1901
- original: e
1902
- };
1903
- }
1904
- this.options.warningHook && Array.isArray(u.warnings) && u.warnings.length && this.options.warningHook(u.warnings);
1905
- const d = u.data;
1906
- if (!d || null == d.status) throw {
1907
- status: "error",
1908
- errorType: "client_error",
1909
- error: "unexpected client error",
1910
- data: d
1911
- };
1912
- if (l) throw {
1913
- status: "error",
1914
- errorType: "http_error",
1915
- httpStatus: u.status,
1916
- error: null !== (i = d.error) && void 0 !== i ? i : u.statusText,
1917
- prometheus: d
1918
- };
1919
- return d.data;
1920
- }
1921
- formatTimeToPrometheus(e, t) {
1922
- var r;
1923
- if (e || (e = t), "number" == typeof e) return e / 1e3;
1924
- if ("object" == typeof e && "Date" == (null === (r = null == e ? void 0 : e.constructor) || void 0 === r ? void 0 : r.name)) return e.getTime() / 1e3;
1925
- throw new Error("Wrong time format. Expected number or Date.");
1926
- }
1927
- instantQuery(e, t, r) {
1928
- const n = {
1929
- query: e,
1930
- time: this.formatTimeToPrometheus(t, /* @__PURE__ */ new Date()),
1931
- timeout: r
1932
- };
1933
- return (this.options.preferPost ? this.request("POST", "query", null, n) : this.request("GET", "query", n)).then(((e) => ht.fromJSON(e)));
1934
- }
1935
- rangeQuery(e, t, r, n, o) {
1936
- const s = {
1937
- query: e,
1938
- start: this.formatTimeToPrometheus(t),
1939
- end: this.formatTimeToPrometheus(r),
1940
- step: n,
1941
- timeout: o
1942
- };
1943
- return (this.options.preferPost ? this.request("POST", "query_range", null, s) : this.request("GET", "query_range", s)).then(((e) => ht.fromJSON(e)));
1944
- }
1945
- series(e, t, r) {
1946
- const n = {
1947
- match: this.listifyIfNeeded(e),
1948
- start: this.formatTimeToPrometheus(t),
1949
- end: this.formatTimeToPrometheus(r)
1950
- };
1951
- return (this.options.preferPost ? this.request("POST", "series", null, n) : this.request("GET", "series", n)).then(((e) => e.map(ct.fromJSON)));
1952
- }
1953
- labelNames(e, t, r) {
1954
- const n = {
1955
- match: this.listifyIfNeeded(e),
1956
- start: t ? this.formatTimeToPrometheus(t) : void 0,
1957
- end: r ? this.formatTimeToPrometheus(r) : void 0
1958
- };
1959
- return this.options.preferPost ? this.request("POST", "labels", null, n) : this.request("GET", "labels", n);
1960
- }
1961
- labelValues(e, t, r, n) {
1962
- const o = {
1963
- match: this.listifyIfNeeded(t),
1964
- start: r ? this.formatTimeToPrometheus(r) : void 0,
1965
- end: n ? this.formatTimeToPrometheus(n) : void 0
1966
- };
1967
- return this.request("GET", `label/${e}/values`, o);
1968
- }
1969
- targets(e) {
1970
- const t = { query: e || "any" };
1971
- return this.request("GET", "targets", t).then(((e) => ({
1972
- activeTargets: e.activeTargets ? e.activeTargets.map(pt.fromJSON) : [],
1973
- droppedTargets: e.droppedTargets ? e.droppedTargets.map(pt.fromJSON) : []
1974
- })));
1975
- }
1976
- targetsMetadata(e, t, r) {
1977
- const n = {
1978
- match_target: e,
1979
- metric: t,
1980
- limit: r
1981
- };
1982
- return this.request("GET", "targets/metadata", n);
1983
- }
1984
- metadata(e, t) {
1985
- const r = {
1986
- metric: e,
1987
- limit: t
1988
- };
1989
- return this.request("GET", "metadata", r);
1990
- }
1991
- rules() {
1992
- return this.request("GET", "rules").then(((e) => (e.groups ? e.groups : []).map(bt.fromJSON)));
1993
- }
1994
- alerts() {
1995
- return this.request("GET", "alerts").then(((e) => (e.alerts ? e.alerts : []).map(mt.fromJSON)));
1996
- }
1997
- alertmanagers() {
1998
- return this.request("GET", "alertmanagers");
1999
- }
2000
- status() {
2001
- return this.request("GET", "status/config");
2002
- }
2003
- statusFlags() {
2004
- return this.request("GET", "status/flags");
2005
- }
2006
- statusRuntimeInfo() {
2007
- return this.request("GET", "status/runtimeinfo");
2008
- }
2009
- statusBuildinfo() {
2010
- return this.request("GET", "status/buildinfo");
2011
- }
2012
- statusTSDB() {
2013
- return this.request("GET", "status/tsdb");
2014
- }
2015
- adminSnapshot(e) {
2016
- const t = { skip_head: e };
2017
- return this.request("POST", "admin/tsdb/snapshot", t);
2018
- }
2019
- adminDeleteSeries(e, t, r) {
2020
- const n = {
2021
- match: this.listifyIfNeeded(e),
2022
- start: this.formatTimeToPrometheus(t),
2023
- end: this.formatTimeToPrometheus(r)
2024
- };
2025
- return this.request("POST", "admin/tsdb/delete_series", n);
2026
- }
2027
- adminCleanTombstones() {
2028
- return this.request("POST", "admin/tsdb/clean_tombstones");
2029
- }
2030
- }, e.QueryResult = ht, e.RangeVector = dt, e.Rule = gt, e.RuleGroup = bt, e.SampleValue = ut, e.Target = pt;
2031
- })(r);
2032
- }(0, r.exports)), r.exports);
2033
- var o = {
2034
- getPrometheusStepAuto: (e, t, r) => {
2035
- const n = (t.getTime() - e.getTime()) / 1e3, o = 25 * Math.floor(n / r);
2036
- return o < 1 ? 1 : o;
2037
- },
2038
- getStartAndEndDates(e) {
2039
- if (e.type = e.type ? e.type : "absolute", "absolute" === e.type) return {
2040
- type: "absolute",
2041
- start: e.start,
2042
- end: e.end
1753
+ }
1754
+ throwIfRequested() {
1755
+ if (this.reason) throw this.reason;
1756
+ }
1757
+ subscribe(e) {
1758
+ this.reason ? e(this.reason) : this._listeners ? this._listeners.push(e) : this._listeners = [e];
1759
+ }
1760
+ unsubscribe(e) {
1761
+ if (!this._listeners) return;
1762
+ const t = this._listeners.indexOf(e);
1763
+ -1 !== t && this._listeners.splice(t, 1);
1764
+ }
1765
+ toAbortSignal() {
1766
+ const e = new AbortController(), t = (t) => {
1767
+ e.abort(t);
2043
1768
  };
2044
- if ("relative" === e.type) return {
2045
- type: "absolute",
2046
- start: new Date((/* @__PURE__ */ new Date()).getTime() + e.start),
2047
- end: new Date((/* @__PURE__ */ new Date()).getTime() + e.end)
1769
+ return this.subscribe(t), e.signal.unsubscribe = () => this.unsubscribe(t), e.signal;
1770
+ }
1771
+ static source() {
1772
+ let t;
1773
+ return {
1774
+ token: new e((function(e) {
1775
+ t = e;
1776
+ })),
1777
+ cancel: t
2048
1778
  };
2049
- throw new Error("Unexpected options.timeRange value.");
2050
- },
2051
- executeQueries: (e, t, r, o, s) => {
2052
- const i = null != t.find(((e) => "string" == typeof e)), a = e && i ? new n.PrometheusDriver(e) : null;
2053
- return t.map(((e) => "string" == typeof e ? a.rangeQuery(e, r, o, s) : e(r, o, s).then(((e) => n.QueryResult.fromJSON(e)))));
2054
1779
  }
2055
- };
2056
- class s {
2057
- constructor() {
2058
- this.message = "No data to display", this.font = "16px normal 'Helvetica Nueue'", this.textAlign = "center", this.textBaseline = "middle", this.direction = "ltr";
1780
+ }, at.isCancel = Se, at.VERSION = et, at.toFormData = Y, at.AxiosError = H, at.Cancel = at.CanceledError, at.all = function(e) {
1781
+ return Promise.all(e);
1782
+ }, at.spread = function(e) {
1783
+ return function(t) {
1784
+ return e.apply(null, t);
1785
+ };
1786
+ }, at.isAxiosError = function(e) {
1787
+ return $.isObject(e) && !0 === e.isAxiosError;
1788
+ }, at.mergeConfig = _e, at.AxiosHeaders = Oe, at.formToJSON = (e) => pe($.isHTMLForm(e) ? new FormData(e) : e), at.getAdapter = Qe, at.HttpStatusCode = it, at.default = at;
1789
+ const { Axios: ct, AxiosError: lt, CanceledError: ut, isCancel: ft, CancelToken: dt, VERSION: ht, all: pt, Cancel: mt, isAxiosError: yt, spread: bt, toFormData: gt, AxiosHeaders: wt, HttpStatusCode: Et, formToJSON: Ot, getAdapter: Tt, mergeConfig: St } = at;
1790
+ var Rt;
1791
+ e.ResponseType = void 0, (Rt = e.ResponseType || (e.ResponseType = {})).MATRIX = "matrix", Rt.VECTOR = "vector", Rt.SCALAR = "scalar", Rt.STRING = "string";
1792
+ class vt {
1793
+ constructor(e, t) {
1794
+ if (e && "string" != typeof e) throw new Error("Wrong name format. Expected string.");
1795
+ if (t && "object" != typeof t) throw new Error("Wrong labels format. Expected object.");
1796
+ this.name = e, this.labels = t;
1797
+ }
1798
+ static fromJSON(e) {
1799
+ const t = e.__name__, r = Object.assign({}, e);
1800
+ return delete r.__name__, new vt(t, r);
1801
+ }
1802
+ toString() {
1803
+ return (this.name ? this.name : "") + "{" + Object.keys(this.labels).map(((e) => e + "=\"" + this.labels[e] + "\"")).join(", ") + "}";
2059
1804
  }
2060
1805
  }
2061
- class i {
2062
- constructor() {
2063
- this.message = null, this.font = "16px normal 'Helvetica Nueue'", this.textAlign = "center", this.textBaseline = "middle", this.direction = "ltr";
1806
+ class At {
1807
+ constructor(e, t) {
1808
+ if ("object" != typeof e || "Date" != e.constructor.name) throw new Error("Wrong time format. Expected Date.");
1809
+ if ("number" != typeof t) throw new Error("Wrong value format. Expected float.");
1810
+ this.time = e, this.value = t;
1811
+ }
1812
+ static fromJSON(e) {
1813
+ return new At(/* @__PURE__ */ new Date(1e3 * e[0]), parseFloat(e[1]));
1814
+ }
1815
+ toString() {
1816
+ return this.time + ": " + this.value;
2064
1817
  }
2065
1818
  }
2066
- class a {
2067
- constructor() {
2068
- this.message = "Loading data...", this.font = "16px normal 'Helvetica Nueue'", this.textAlign = "center", this.textBaseline = "middle", this.direction = "ltr";
1819
+ class xt {
1820
+ constructor(e, t) {
1821
+ this.metric = e, this.values = t;
1822
+ }
1823
+ static fromJSON(e) {
1824
+ return new xt(e.metric ? vt.fromJSON(e.metric) : null, e.values.map(At.fromJSON));
2069
1825
  }
2070
1826
  }
2071
- const l = [
2072
- "rgba(255, 99, 132, 1)",
2073
- "rgba(54, 162, 235, 1)",
2074
- "rgba(255, 206, 86, 1)",
2075
- "rgba(75, 192, 192, 1)",
2076
- "rgba(153, 102, 255, 1)",
2077
- "rgba(255, 159, 64, 1)"
2078
- ];
2079
- class c {
2080
- constructor() {
2081
- this.chartType = "timeseries", this.prometheus = null, this.fillGaps = !1, this.tension = .4, this.cubicInterpolationMode = "default", this.stepped = !1, this.fill = !1, this.stacked = !1, this.borderWidth = 3, this.borderColor = l, this.backgroundColor = l, this.noDataMsg = new s(), this.errorMsg = new i(), this.loadingMsg = new a(), this.findInLabelMap = null, this.findInBorderColorMap = null, this.findInBackgroundColorMap = null, this.dataSetHook = null;
2082
- }
2083
- assertPluginOptions() {
2084
- if (!this.query) throw new Error("options.query is undefined");
2085
- if (!this.timeRange) throw new Error("options.timeRange is undefined");
2086
- if (null == this.timeRange.start) throw new Error("options.timeRange.start is undefined");
2087
- if (null == this.timeRange.end) throw new Error("options.timeRange.end is undefined");
2088
- if ("object" != typeof this.timeRange) throw new Error("options.timeRange must be a object");
2089
- if ("string" != typeof this.timeRange.type) throw new Error("options.timeRange.type must be a string");
2090
- if ("relative" != this.timeRange.type && "absolute" != this.timeRange.type) throw new Error("options.timeRange.type must be either \"relative\" or \"absolute\"");
2091
- if ("number" != typeof this.timeRange.start && ("object" != typeof this.timeRange.start || "Date" != this.timeRange.start.constructor.name)) throw new Error("options.timeRange.start must be a Date object (absolute) or integer (relative)");
2092
- if ("number" != typeof this.timeRange.end && ("object" != typeof this.timeRange.end || "Date" != this.timeRange.end.constructor.name)) throw new Error("options.timeRange.end must be a Date object (absolute) or integer (relative)");
2093
- if (null != this.timeRange.msUpdateInterval && "number" != typeof this.timeRange.msUpdateInterval) throw new Error("options.timeRange.msUpdateInterval must be a integer");
2094
- if (null != this.timeRange.msUpdateInterval && this.timeRange.msUpdateInterval < 1e3) throw new Error("options.timeRange.msUpdateInterval must be greater than 1s.");
2095
- }
2096
- getQueries() {
2097
- var e, t;
2098
- return "Array" != (null === (t = null === (e = this.query) || void 0 === e ? void 0 : e.constructor) || void 0 === t ? void 0 : t.name) ? [this.query] : this.query;
1827
+ class Nt {
1828
+ constructor(e, t) {
1829
+ this.metric = e, this.value = t;
1830
+ }
1831
+ static fromJSON(e) {
1832
+ return new Nt(e.metric ? vt.fromJSON(e.metric) : null, At.fromJSON(e.value));
2099
1833
  }
2100
1834
  }
2101
- function u(e) {
2102
- const t = e.config.options.plugins["datasource-prometheus"];
2103
- if (t && "stat" === t.chartType) return;
2104
- e.config.options.scales = e.config.options.scales ? e.config.options.scales : {}, e.config.options.scales.x = e.config.options.scales.x ? e.config.options.scales.x : {}, e.config.options.scales.y = e.config.options.scales.y ? e.config.options.scales.y : {};
2105
- const { ticks: r, time: n } = JSON.parse(JSON.stringify(e.config.options.scales.x));
2106
- Object.assign(e.config.options.scales.x, {
2107
- type: "timeseries",
2108
- ticks: Object.assign({
2109
- maxRotation: 0,
2110
- minRotation: 0,
2111
- major: { enabled: !0 }
2112
- }, r),
2113
- stacked: t.stacked,
2114
- time: Object.assign({ minUnit: "second" }, n)
2115
- }), Object.assign(e.config.options.scales.y, { stacked: t.stacked });
1835
+ class Pt {
1836
+ constructor(e, t) {
1837
+ this.resultType = e, this.result = t;
1838
+ }
1839
+ static fromJSON(t) {
1840
+ const r = t.resultType;
1841
+ let n = null;
1842
+ switch (r) {
1843
+ case e.ResponseType.MATRIX:
1844
+ n = t.result.map(xt.fromJSON);
1845
+ break;
1846
+ case e.ResponseType.VECTOR:
1847
+ n = t.result.map(Nt.fromJSON);
1848
+ break;
1849
+ case e.ResponseType.SCALAR:
1850
+ case e.ResponseType.STRING:
1851
+ n = t.result;
1852
+ break;
1853
+ default: throw new Error(`Unexpected resultType: ${r}`);
1854
+ }
1855
+ return new Pt(r, n);
1856
+ }
2116
1857
  }
2117
- function d(e, t, r) {
2118
- const n = t.metric.toString();
2119
- return e.findInLabelMap && e.findInLabelMap(t.metric) || n;
1858
+ class jt {
1859
+ constructor(e, t, r, n, o, s, i, a) {
1860
+ if (e && "object" != typeof e) throw new Error(`Unexpected format for discoveredLabels. Got ${typeof e} instead of object`);
1861
+ if (t && "object" != typeof t) throw new Error(`Unexpected format for labels. Got ${typeof t} instead of object`);
1862
+ if (r && "string" != typeof r) throw new Error(`Unexpected format for scrapePool. Got ${typeof r} instead of string`);
1863
+ if (n && "string" != typeof n) throw new Error(`Unexpected format for scrapeUrl. Got ${typeof n} instead of string`);
1864
+ if (o && "string" != typeof o) throw new Error(`Unexpected format for lastError. Got ${typeof o} instead of string`);
1865
+ if (s && ("object" != typeof s || "Date" != s.constructor.name)) throw new Error(`Unexpected format for lastScrape. Got ${typeof s} instead of object`);
1866
+ if (i && "number" != typeof i) throw new Error(`Unexpected format for lastScrapeDuration. Got ${typeof i} instead of number`);
1867
+ if (a && "string" != typeof a) throw new Error(`Unexpected format for health. Got ${typeof a} instead of string`);
1868
+ this.discoveredLabels = e, this.labels = t, this.scrapePool = r, this.scrapeUrl = n, this.lastError = o, this.lastScrape = s, this.lastScrapeDuration = i, this.health = a;
1869
+ }
1870
+ static fromJSON(e) {
1871
+ return new jt(e.discoveredLabels, e.labels, e.scrapePool, e.scrapeUrl, e.lastError, e.lastScrape ? new Date(e.lastScrape) : null, e.lastScrapeDuration ? parseFloat(e.lastScrapeDuration) : null, e.health);
1872
+ }
2120
1873
  }
2121
- function f(e, t, r) {
2122
- const n = e.fill ? e.backgroundColor[r % e.backgroundColor.length] : "transparent";
2123
- return e.findInBackgroundColorMap && e.findInBackgroundColorMap(t.metric) || n;
1874
+ class Ct {
1875
+ constructor(e, t, r, n, o) {
1876
+ if (e && ("object" != typeof e || "Date" != e.constructor.name)) throw new Error(`Unexpected format for activeAt. Got ${typeof e} instead of object`);
1877
+ if (t && "object" != typeof t) throw new Error(`Unexpected format for annotations. Got ${typeof t} instead of object`);
1878
+ if (r && "object" != typeof r) throw new Error(`Unexpected format for labels. Got ${typeof r} instead of object`);
1879
+ if (o && "number" != typeof o) throw new Error(`Unexpected format for value. Got ${typeof o} instead of number`);
1880
+ this.activeAt = e, this.annotations = t, this.labels = r, this.state = n, this.value = o;
1881
+ }
1882
+ static fromJSON(e) {
1883
+ return new Ct(e.activeAt ? new Date(e.activeAt) : null, e.annotations, e.labels, e.state, e.value ? parseFloat(e.value) : null);
1884
+ }
2124
1885
  }
2125
- function h(e, t, r) {
2126
- const n = e.borderColor[r % e.borderColor.length];
2127
- return e.findInBorderColorMap && e.findInBorderColorMap(t.metric) || n;
1886
+ class Ut {
1887
+ constructor(e, t, r, n, o, s, i, a) {
1888
+ this.alerts = e, this.annotations = t, this.duration = r, this.health = n, this.labels = o, this.name = s, this.query = i, this.type = a;
1889
+ }
1890
+ static fromJSON(e) {
1891
+ return new Ut(e.alerts ? e.alerts.map(Ct.fromJSON) : [], e.annotations, e.duration, e.health, e.labels, e.name, e.query, e.type);
1892
+ }
2128
1893
  }
2129
- class p {
2130
- constructor() {
2131
- this.loading = !1, this.rendering = !1, this.updateInterval = null, this.error = null;
1894
+ class _t {
1895
+ constructor(e, t, r, n) {
1896
+ this.rules = e, this.file = t, this.interval = r, this.name = n;
1897
+ }
1898
+ static fromJSON(e) {
1899
+ return new _t(e.rules ? e.rules.map(Ut.fromJSON) : [], e.file, e.interval, e.name);
2132
1900
  }
2133
1901
  }
2134
- return new class {
1902
+ class Lt {
2135
1903
  constructor() {
2136
- this.id = "datasource-prometheus";
2137
- }
2138
- beforeInit(e, t) {
2139
- e["datasource-prometheus"] = new p();
2140
- }
2141
- afterInit(e, t, r) {
2142
- if (!r) throw "ChartDatasourcePrometheusPlugin.options is undefined";
2143
- const n = Object.assign(new c(), r);
2144
- if ("stat" === n.chartType);
2145
- else if ("line" !== e.config.type && "bar" !== e.config.type) throw "ChartDatasourcePrometheusPlugin is only compatible with Line chart\nFeel free to contribute for more!";
2146
- n.assertPluginOptions(), n && n.timeRange && (n.timeRange.msUpdateInterval ? e["datasource-prometheus"].updateInterval = setInterval((() => {
2147
- e.update();
2148
- }), n.timeRange.msUpdateInterval) : e.update());
2149
- }
2150
- beforeUpdate(e, t, r) {
2151
- if (e["datasource-prometheus"] && (!0 === e["datasource-prometheus"].loading || !0 === e["datasource-prometheus"].rendering)) return;
2152
- const n = Object.assign(new c(), r), s = n.prometheus, i = n.getQueries(), { start: a, end: l } = o.getStartAndEndDates(n.timeRange), p = n.timeRange.step || o.getPrometheusStepAuto(a, l, e.width), m = n.timeRange.minStep || p, g = m >= p ? m : p;
2153
- if (e["datasource-prometheus"] && e["datasource-prometheus"].step == g && e["datasource-prometheus"].start == a && e["datasource-prometheus"].end == l) return;
2154
- e["datasource-prometheus"].step = g, e["datasource-prometheus"].start = a, e["datasource-prometheus"].end = l, e["datasource-prometheus"].error = null;
2155
- const b = o.executeQueries(s, i, a, l, g);
2156
- let y = {};
2157
- for (let t = 0; t < e.data.datasets.length; t++) {
2158
- const r = e.data.datasets[t];
2159
- y[r.label] = !e.isDatasetVisible(t);
2160
- }
2161
- return e["datasource-prometheus"].loading = !0, this.updateMessage(e, r), Promise.all(b).then(((t) => {
2162
- if ("stat" === n.chartType) {
2163
- const r = t.reduce(((e, t, r) => e.concat(t.result.map(((e, t) => {
2164
- const r = e.values;
2165
- if (0 === r.length) return null;
2166
- const o = r[r.length - 1], s = r.length > 1 ? r[r.length - 2] : null, i = s ? (o.value - s.value) / s.value * 100 : null;
2167
- return {
2168
- label: d(n, e),
2169
- value: o.value,
2170
- percentChange: i,
2171
- sparklineData: r.slice(-20),
2172
- backgroundColor: f(n, e, t),
2173
- borderColor: h(n, e, t)
2174
- };
2175
- })).filter(Boolean))), []);
2176
- e["datasource-prometheus"].statData = r, e.data.datasets = [];
2177
- } else {
2178
- const r = t.reduce(((e, t, r) => {
2179
- const o = e.length, s = t.result.map(((e, t) => ({
2180
- tension: n.tension,
2181
- cubicInterpolationMode: n.cubicInterpolationMode || "default",
2182
- stepped: n.stepped,
2183
- fill: n.fill || !1,
2184
- label: d(n, e),
2185
- data: e.values.map(((e, t) => ({
2186
- x: e.time,
2187
- y: e.value
2188
- }))),
2189
- backgroundColor: f(n, e, o + t),
2190
- borderColor: h(n, e, o + t),
2191
- borderWidth: n.borderWidth,
2192
- hidden: y[d(n, e)] || !1
2193
- })));
2194
- return e.concat(...s);
2195
- }), []);
2196
- e.data.datasets = r, e.data.datasets.length > 0 && (n.fillGaps && function(e, t, r, n, o) {
2197
- let s = o.timeRange.minStep || n;
2198
- s = s >= n ? s : n, e.data.datasets.forEach(((n, o) => {
2199
- for (let e = n.data.length - 2; e > 0; e--) if (n.data[e + 1].x - n.data[e].x > 1100 * s) for (let t = (n.data[e + 1].x - n.data[e].x) / (1e3 * s); t > 1; t--) {
2200
- const t = {
2201
- x: /* @__PURE__ */ new Date(n.data[e + 1].x.getTime() - 1e3 * s),
2202
- v: NaN
2203
- };
2204
- n.data.splice(e + 1, 0, t);
2205
- }
2206
- if (Math.abs(t.getTime() - n.data[0].x) > 1100 * s) for (let r = Math.abs(t.getTime() - n.data[0].x) / (1e3 * s); r > 1; r--) e.data.datasets[o].data.unshift({
2207
- x: /* @__PURE__ */ new Date(n.data[0].x.getTime() - 1e3 * s),
2208
- v: NaN
2209
- });
2210
- if (Math.abs(r.getTime() - n.data[n.data.length - 1].x) > 1100 * s) for (let t = Math.abs(r.getTime() - n.data[n.data.length - 1].x) / (1e3 * s); t > 1; t--) e.data.datasets[o].data.push({
2211
- x: new Date(n.data[e.data.datasets[o].data.length - 1].x.getTime() + 1e3 * s),
2212
- v: NaN
2213
- });
2214
- }));
2215
- }(e, a, l, g, n), n.dataSetHook && (e.data.datasets = n.dataSetHook(e.data.datasets)), u(e));
2216
- }
2217
- this.resumeRendering(e);
2218
- })).catch(((t) => {
2219
- throw e.data.datasets = [], e["datasource-prometheus"].error = "Failed to fetch data", u(e), this.resumeRendering(e), t;
2220
- })), !1;
1904
+ this.baseURL = "/api/v1/", this.headers = {}, this.auth = null, this.proxy = null, this.withCredentials = !1, this.timeout = 1e4, this.preferPost = !1, this.warningHook = null;
1905
+ }
1906
+ }
1907
+ e.Alert = Ct, e.InstantVector = Nt, e.Metric = vt, e.PrometheusConnectionOptions = Lt, e.PrometheusDriver = class {
1908
+ constructor(e) {
1909
+ if (this.listifyIfNeeded = (e) => e instanceof Array ? e : [e], this.formatPromQlParams = (e) => Object.entries(null != e ? e : {}).reduce(((e, [t, r]) => (null != r && (r instanceof Array ? r.filter(((e) => null != e)).forEach(((r) => e.append(`${t}[]`, r))) : e.append(t, r)), e)), new URLSearchParams()), !(e = e || new Lt()).endpoint) throw "Endpoint is required";
1910
+ e.endpoint = e.endpoint.replace(/\/$/, ""), e.baseURL = e.baseURL || "/api/v1/", e.withCredentials = e.withCredentials || !1, e.timeout = e.timeout || 1e4, this.options = e, this.axiosInstance = at.create(), this.options.requestInterceptor && this.axiosInstance.interceptors.request.use(this.options.requestInterceptor.onFulfilled, this.options.requestInterceptor.onRejected), this.options.responseInterceptor && this.axiosInstance.interceptors.response.use(this.options.responseInterceptor.onFulfilled, this.options.responseInterceptor.onRejected);
2221
1911
  }
2222
- afterDraw(e, t, r) {
2223
- const n = Object.assign(new c(), r);
2224
- "stat" === n.chartType && e["datasource-prometheus"].statData && this.renderStatVisualization(e, e["datasource-prometheus"].statData, n), this.updateMessage(e, r);
1912
+ request(e, t, r, n) {
1913
+ var o, s, i, a, c, l;
1914
+ const u = Object.assign({}, this.options.headers || {});
1915
+ return this.axiosInstance.request({
1916
+ baseURL: this.options.endpoint + this.options.baseURL,
1917
+ url: t,
1918
+ method: e,
1919
+ params: this.formatPromQlParams(r),
1920
+ data: this.formatPromQlParams(n),
1921
+ headers: u,
1922
+ auth: (null === (o = this.options.auth) || void 0 === o ? void 0 : o.username) && (null === (s = this.options.auth) || void 0 === s ? void 0 : s.password) ? {
1923
+ username: this.options.auth.username,
1924
+ password: this.options.auth.password
1925
+ } : null,
1926
+ proxy: (null === (i = this.options.proxy) || void 0 === i ? void 0 : i.host) && (null === (a = this.options.proxy) || void 0 === a ? void 0 : a.port) ? {
1927
+ host: null === (c = this.options.proxy) || void 0 === c ? void 0 : c.host,
1928
+ port: null === (l = this.options.proxy) || void 0 === l ? void 0 : l.port
1929
+ } : null,
1930
+ withCredentials: this.options.withCredentials,
1931
+ timeout: this.options.timeout
1932
+ }).then(((e) => this.handleResponse(e))).catch(((e) => this.handleResponse(e, !0)));
2225
1933
  }
2226
- updateMessage(e, t) {
1934
+ handleResponse(e, t = !1) {
1935
+ var r, n, o, s, i;
1936
+ const a = !0 === (null == e ? void 0 : e.isAxiosError), c = t || a, l = a ? e : void 0, u = a ? l.response : c ? null == e ? void 0 : e.response : e;
1937
+ if (!u) {
1938
+ const t = null !== (r = null == l ? void 0 : l.code) && void 0 !== r ? r : null == e ? void 0 : e.code, i = null !== (o = null !== (n = null == l ? void 0 : l.message) && void 0 !== n ? n : null == e ? void 0 : e.message) && void 0 !== o ? o : "unexpected network error";
1939
+ throw {
1940
+ status: "error",
1941
+ errorType: "ECONNABORTED" === t ? "timeout_error" : (null === (s = null == t ? void 0 : t.startsWith) || void 0 === s ? void 0 : s.call(t, "ERR_SSL")) ? "ssl_error" : "network_error",
1942
+ error: i,
1943
+ code: t,
1944
+ original: e
1945
+ };
1946
+ }
1947
+ this.options.warningHook && Array.isArray(u.warnings) && u.warnings.length && this.options.warningHook(u.warnings);
1948
+ const f = u.data;
1949
+ if (!f || null == f.status) throw {
1950
+ status: "error",
1951
+ errorType: "client_error",
1952
+ error: "unexpected client error",
1953
+ data: f
1954
+ };
1955
+ if (c) throw {
1956
+ status: "error",
1957
+ errorType: "http_error",
1958
+ httpStatus: u.status,
1959
+ error: null !== (i = f.error) && void 0 !== i ? i : u.statusText,
1960
+ prometheus: f
1961
+ };
1962
+ return f.data;
1963
+ }
1964
+ formatTimeToPrometheus(e, t) {
2227
1965
  var r;
2228
- const n = Object.assign(new c(), t);
2229
- null != e["datasource-prometheus"].error ? this.writeText(e, (null === (r = n.errorMsg) || void 0 === r ? void 0 : r.message) || e["datasource-prometheus"].error, ((e) => {
2230
- e.direction = n.errorMsg.direction, e.textAlign = n.errorMsg.textAlign, e.textBaseline = n.errorMsg.textBaseline, e.font = "16px normal 'Helvetica Nueue'";
2231
- })) : 1 == e["datasource-prometheus"].loading ? n.loadingMsg && this.writeText(e, n.loadingMsg.message, ((e) => {
2232
- e.direction = n.loadingMsg.direction, e.textAlign = n.loadingMsg.textAlign, e.textBaseline = n.loadingMsg.textBaseline, e.font = n.loadingMsg.font;
2233
- })) : 0 != e.data.datasets.length || n.chartType && "stat" === n.chartType && e["datasource-prometheus"].statData && 0 !== e["datasource-prometheus"].statData.length || this.writeText(e, n.noDataMsg.message, ((e) => {
2234
- e.direction = n.noDataMsg.direction, e.textAlign = n.noDataMsg.textAlign, e.textBaseline = n.noDataMsg.textBaseline, e.font = n.noDataMsg.font;
2235
- }));
1966
+ if (e || (e = t), "number" == typeof e) return e / 1e3;
1967
+ if ("object" == typeof e && "Date" == (null === (r = null == e ? void 0 : e.constructor) || void 0 === r ? void 0 : r.name)) return e.getTime() / 1e3;
1968
+ throw new Error("Wrong time format. Expected number or Date.");
2236
1969
  }
2237
- writeText(e, t, r) {
2238
- const n = e.ctx, o = e.width, s = e.height;
2239
- e.clear(), n.save(), r && r(n), n.fillText(t, o / 2, s / 2), n.restore();
2240
- }
2241
- afterDestroy(e, t, r) {
2242
- e["datasource-prometheus"].updateInterval && clearInterval(e["datasource-prometheus"].updateInterval);
2243
- }
2244
- resumeRendering(e) {
2245
- e["datasource-prometheus"].loading = !1, e["datasource-prometheus"].rendering = !0, e.update(), e["datasource-prometheus"].rendering = !1;
2246
- }
2247
- renderStatVisualization(e, t, r) {
2248
- const n = e.ctx, o = e.width, s = e.height;
2249
- e.clear();
2250
- const i = Math.ceil(Math.sqrt(t.length)), a = o / i, l = s / Math.ceil(t.length / i);
2251
- t.forEach(((e, t) => {
2252
- const r = Math.floor(t / i), o = t % i * a, s = r * l;
2253
- n.save(), e.sparklineData && e.sparklineData.length > 1 && this.drawSparkline(n, e.sparklineData, o, s, a, l, e.borderColor), n.fillStyle = e.borderColor || "#333", n.font = "bold 48px Arial", n.textAlign = "center", n.textBaseline = "middle";
2254
- const c = this.formatStatValue(e.value);
2255
- if (n.fillText(c, o + a / 2, s + l / 2 - 20), null !== e.percentChange) {
2256
- n.font = "24px Arial", n.fillStyle = e.percentChange >= 0 ? "#28a745" : "#dc3545";
2257
- const t = `${e.percentChange >= 0 ? "+" : ""}${e.percentChange.toFixed(1)}%`;
2258
- n.fillText(t, o + a / 2, s + l / 2 + 30);
2259
- }
2260
- n.font = "16px Arial", n.fillStyle = "#666", n.fillText(e.label, o + a / 2, s + l - 20), n.restore();
2261
- }));
1970
+ instantQuery(e, t, r) {
1971
+ const n = {
1972
+ query: e,
1973
+ time: this.formatTimeToPrometheus(t, /* @__PURE__ */ new Date()),
1974
+ timeout: r
1975
+ };
1976
+ return (this.options.preferPost ? this.request("POST", "query", null, n) : this.request("GET", "query", n)).then(((e) => Pt.fromJSON(e)));
1977
+ }
1978
+ rangeQuery(e, t, r, n, o) {
1979
+ const s = {
1980
+ query: e,
1981
+ start: this.formatTimeToPrometheus(t),
1982
+ end: this.formatTimeToPrometheus(r),
1983
+ step: n,
1984
+ timeout: o
1985
+ };
1986
+ return (this.options.preferPost ? this.request("POST", "query_range", null, s) : this.request("GET", "query_range", s)).then(((e) => Pt.fromJSON(e)));
1987
+ }
1988
+ series(e, t, r) {
1989
+ const n = {
1990
+ match: this.listifyIfNeeded(e),
1991
+ start: this.formatTimeToPrometheus(t),
1992
+ end: this.formatTimeToPrometheus(r)
1993
+ };
1994
+ return (this.options.preferPost ? this.request("POST", "series", null, n) : this.request("GET", "series", n)).then(((e) => e.map(vt.fromJSON)));
1995
+ }
1996
+ labelNames(e, t, r) {
1997
+ const n = {
1998
+ match: this.listifyIfNeeded(e),
1999
+ start: t ? this.formatTimeToPrometheus(t) : void 0,
2000
+ end: r ? this.formatTimeToPrometheus(r) : void 0
2001
+ };
2002
+ return this.options.preferPost ? this.request("POST", "labels", null, n) : this.request("GET", "labels", n);
2262
2003
  }
2263
- drawSparkline(e, t, r, n, o, s, i) {
2264
- if (t.length < 2) return;
2265
- const a = t.map(((e) => e.value)), l = Math.min(...a), c = Math.max(...a) - l || 1;
2266
- e.save(), e.globalAlpha = .3, e.strokeStyle = i || "#007bff", e.lineWidth = 2, e.beginPath(), t.forEach(((i, a) => {
2267
- const u = r + a / (t.length - 1) * o, d = n + s - (i.value - l) / c * (.6 * s);
2268
- 0 === a ? e.moveTo(u, d) : e.lineTo(u, d);
2269
- })), e.stroke(), e.restore();
2004
+ labelValues(e, t, r, n) {
2005
+ const o = {
2006
+ match: this.listifyIfNeeded(t),
2007
+ start: r ? this.formatTimeToPrometheus(r) : void 0,
2008
+ end: n ? this.formatTimeToPrometheus(n) : void 0
2009
+ };
2010
+ return this.request("GET", `label/${e}/values`, o);
2011
+ }
2012
+ targets(e) {
2013
+ const t = { query: e || "any" };
2014
+ return this.request("GET", "targets", t).then(((e) => ({
2015
+ activeTargets: e.activeTargets ? e.activeTargets.map(jt.fromJSON) : [],
2016
+ droppedTargets: e.droppedTargets ? e.droppedTargets.map(jt.fromJSON) : []
2017
+ })));
2018
+ }
2019
+ targetsMetadata(e, t, r) {
2020
+ const n = {
2021
+ match_target: e,
2022
+ metric: t,
2023
+ limit: r
2024
+ };
2025
+ return this.request("GET", "targets/metadata", n);
2026
+ }
2027
+ metadata(e, t) {
2028
+ const r = {
2029
+ metric: e,
2030
+ limit: t
2031
+ };
2032
+ return this.request("GET", "metadata", r);
2033
+ }
2034
+ rules() {
2035
+ return this.request("GET", "rules").then(((e) => (e.groups ? e.groups : []).map(_t.fromJSON)));
2036
+ }
2037
+ alerts() {
2038
+ return this.request("GET", "alerts").then(((e) => (e.alerts ? e.alerts : []).map(Ct.fromJSON)));
2039
+ }
2040
+ alertmanagers() {
2041
+ return this.request("GET", "alertmanagers");
2042
+ }
2043
+ status() {
2044
+ return this.request("GET", "status/config");
2045
+ }
2046
+ statusFlags() {
2047
+ return this.request("GET", "status/flags");
2048
+ }
2049
+ statusRuntimeInfo() {
2050
+ return this.request("GET", "status/runtimeinfo");
2051
+ }
2052
+ statusBuildinfo() {
2053
+ return this.request("GET", "status/buildinfo");
2054
+ }
2055
+ statusTSDB() {
2056
+ return this.request("GET", "status/tsdb");
2057
+ }
2058
+ adminSnapshot(e) {
2059
+ const t = { skip_head: e };
2060
+ return this.request("POST", "admin/tsdb/snapshot", t);
2061
+ }
2062
+ adminDeleteSeries(e, t, r) {
2063
+ const n = {
2064
+ match: this.listifyIfNeeded(e),
2065
+ start: this.formatTimeToPrometheus(t),
2066
+ end: this.formatTimeToPrometheus(r)
2067
+ };
2068
+ return this.request("POST", "admin/tsdb/delete_series", n);
2270
2069
  }
2271
- formatStatValue(e) {
2272
- return e >= 1e6 ? (e / 1e6).toFixed(1) + "M" : e >= 1e3 ? (e / 1e3).toFixed(1) + "K" : e.toFixed(1);
2070
+ adminCleanTombstones() {
2071
+ return this.request("POST", "admin/tsdb/clean_tombstones");
2273
2072
  }
2274
- }();
2073
+ }, e.QueryResult = Pt, e.RangeVector = xt, e.Rule = Ut, e.RuleGroup = _t, e.SampleValue = At, e.Target = jt;
2275
2074
  }));
2276
2075
  }));
2277
2076
  //#endregion
2077
+ //#region node_modules/chartjs-plugin-datasource-prometheus/dist/chartjs-plugin-datasource-prometheus.esm.js
2078
+ var import_prometheus_query_umd = require_prometheus_query_umd();
2079
+ const PROMETHEUS_QUERY_RANGE_MIN_STEP = 1;
2080
+ var datasource = {
2081
+ getPrometheusStepAuto: (start, end, chartWidth) => {
2082
+ const secondDuration = (end.getTime() - start.getTime()) / 1e3;
2083
+ const step = Math.floor(secondDuration / chartWidth) * 25;
2084
+ return step < PROMETHEUS_QUERY_RANGE_MIN_STEP ? PROMETHEUS_QUERY_RANGE_MIN_STEP : step;
2085
+ },
2086
+ getStartAndEndDates(timeRange) {
2087
+ timeRange.type = !!timeRange.type ? timeRange.type : "absolute";
2088
+ if (timeRange.type === "absolute") return {
2089
+ type: "absolute",
2090
+ start: timeRange["start"],
2091
+ end: timeRange["end"]
2092
+ };
2093
+ else if (timeRange.type === "relative") return {
2094
+ type: "absolute",
2095
+ start: new Date((/* @__PURE__ */ new Date()).getTime() + timeRange.start),
2096
+ end: new Date((/* @__PURE__ */ new Date()).getTime() + timeRange.end)
2097
+ };
2098
+ throw new Error("Unexpected options.timeRange value.");
2099
+ },
2100
+ executeQueries: (prometheus, queries, start, end, step) => {
2101
+ const haveDirectPrometheusRequests = queries.find((q) => typeof q === "string") != null;
2102
+ const p = !!prometheus && haveDirectPrometheusRequests ? new import_prometheus_query_umd.PrometheusDriver(prometheus) : null;
2103
+ return queries.map((query) => {
2104
+ if (typeof query === "string") return p.rangeQuery(query, start, end, step);
2105
+ return query(start, end, step).then((data) => import_prometheus_query_umd.QueryResult.fromJSON(data));
2106
+ });
2107
+ }
2108
+ };
2109
+ var ChartDatasourcePrometheusPluginNoDataMsg = class {
2110
+ constructor() {
2111
+ this.message = "No data to display";
2112
+ this.font = "16px normal 'Helvetica Nueue'";
2113
+ this.textAlign = "center";
2114
+ this.textBaseline = "middle";
2115
+ this.direction = "ltr";
2116
+ }
2117
+ };
2118
+ var ChartDatasourcePrometheusPluginErrorMsg = class {
2119
+ constructor() {
2120
+ this.message = null;
2121
+ this.font = "16px normal 'Helvetica Nueue'";
2122
+ this.textAlign = "center";
2123
+ this.textBaseline = "middle";
2124
+ this.direction = "ltr";
2125
+ }
2126
+ };
2127
+ var ChartDatasourcePrometheusPluginLoadingMsg = class {
2128
+ constructor() {
2129
+ this.message = "Loading data...";
2130
+ this.font = "16px normal 'Helvetica Nueue'";
2131
+ this.textAlign = "center";
2132
+ this.textBaseline = "middle";
2133
+ this.direction = "ltr";
2134
+ }
2135
+ };
2136
+ const colorList = [
2137
+ "rgba(255, 99, 132, 1)",
2138
+ "rgba(54, 162, 235, 1)",
2139
+ "rgba(255, 206, 86, 1)",
2140
+ "rgba(75, 192, 192, 1)",
2141
+ "rgba(153, 102, 255, 1)",
2142
+ "rgba(255, 159, 64, 1)"
2143
+ ];
2144
+ var ChartDatasourcePrometheusPluginOptions = class {
2145
+ constructor() {
2146
+ /**
2147
+ * Chart visualization type
2148
+ */
2149
+ this.chartType = "timeseries";
2150
+ /**
2151
+ * Options for Prometheus requests
2152
+ */
2153
+ this.prometheus = null;
2154
+ /**
2155
+ * Options for designing Charts
2156
+ * See https://learnui.design/tools/data-color-picker.html#palette
2157
+ */
2158
+ this.fillGaps = false;
2159
+ this.tension = .4;
2160
+ this.cubicInterpolationMode = "default";
2161
+ this.stepped = false;
2162
+ this.fill = false;
2163
+ this.stacked = false;
2164
+ this.borderWidth = 3;
2165
+ this.borderColor = colorList;
2166
+ this.backgroundColor = colorList;
2167
+ this.noDataMsg = new ChartDatasourcePrometheusPluginNoDataMsg();
2168
+ this.errorMsg = new ChartDatasourcePrometheusPluginErrorMsg();
2169
+ this.loadingMsg = new ChartDatasourcePrometheusPluginLoadingMsg();
2170
+ this.findInLabelMap = null;
2171
+ this.findInBorderColorMap = null;
2172
+ this.findInBackgroundColorMap = null;
2173
+ this.dataSetHook = null;
2174
+ }
2175
+ /**
2176
+ * Compute a step for range_query (interval between 2 points in second)
2177
+ */
2178
+ assertPluginOptions() {
2179
+ if (!this.query) throw new Error("options.query is undefined");
2180
+ if (!this.timeRange) throw new Error("options.timeRange is undefined");
2181
+ if (this.timeRange.start == null) throw new Error("options.timeRange.start is undefined");
2182
+ if (this.timeRange.end == null) throw new Error("options.timeRange.end is undefined");
2183
+ if (typeof this.timeRange != "object") throw new Error("options.timeRange must be a object");
2184
+ if (typeof this.timeRange.type != "string") throw new Error("options.timeRange.type must be a string");
2185
+ if (this.timeRange.type != "relative" && this.timeRange.type != "absolute") throw new Error("options.timeRange.type must be either \"relative\" or \"absolute\"");
2186
+ if (!(typeof this.timeRange.start == "number" || typeof this.timeRange.start == "object" && this.timeRange.start.constructor.name == "Date")) throw new Error("options.timeRange.start must be a Date object (absolute) or integer (relative)");
2187
+ if (!(typeof this.timeRange.end == "number" || typeof this.timeRange.end == "object" && this.timeRange.end.constructor.name == "Date")) throw new Error("options.timeRange.end must be a Date object (absolute) or integer (relative)");
2188
+ if (this.timeRange["msUpdateInterval"] != null && typeof this.timeRange["msUpdateInterval"] != "number") throw new Error("options.timeRange.msUpdateInterval must be a integer");
2189
+ if (this.timeRange["msUpdateInterval"] != null && this.timeRange["msUpdateInterval"] < 1e3) throw new Error("options.timeRange.msUpdateInterval must be greater than 1s.");
2190
+ }
2191
+ getQueries() {
2192
+ var _a, _b;
2193
+ if (((_b = (_a = this.query) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name) != "Array") return [this.query];
2194
+ return this.query;
2195
+ }
2196
+ };
2197
+ function setTimeAxesOptions(chart) {
2198
+ const options = chart.config.options.plugins["datasource-prometheus"];
2199
+ if (options && options.chartType === "stat") return;
2200
+ chart.config.options.scales = !!chart.config.options.scales ? chart.config.options.scales : {};
2201
+ chart.config.options.scales.x = !!chart.config.options.scales.x ? chart.config.options.scales.x : {};
2202
+ chart.config.options.scales.y = !!chart.config.options.scales.y ? chart.config.options.scales.y : {};
2203
+ const { ticks, time } = JSON.parse(JSON.stringify(chart.config.options.scales.x));
2204
+ Object.assign(chart.config.options.scales.x, {
2205
+ type: "timeseries",
2206
+ ticks: Object.assign({
2207
+ maxRotation: 0,
2208
+ minRotation: 0,
2209
+ major: { enabled: true }
2210
+ }, ticks),
2211
+ stacked: options.stacked,
2212
+ time: Object.assign({ minUnit: "second" }, time)
2213
+ });
2214
+ Object.assign(chart.config.options.scales.y, { stacked: options.stacked });
2215
+ }
2216
+ function fillGaps(chart, start, end, step, options) {
2217
+ let minStep = options.timeRange.minStep || step;
2218
+ minStep = minStep >= step ? minStep : step;
2219
+ chart.data.datasets.forEach((dataSet, index) => {
2220
+ for (let i = dataSet.data.length - 2; i > 0; i--) if (dataSet.data[i + 1]["x"] - dataSet.data[i]["x"] > 1100 * minStep) for (let steps = (dataSet.data[i + 1]["x"] - dataSet.data[i]["x"]) / (minStep * 1e3); steps > 1; steps--) {
2221
+ const value = {
2222
+ x: /* @__PURE__ */ new Date(dataSet.data[i + 1]["x"].getTime() - minStep * 1e3),
2223
+ v: NaN
2224
+ };
2225
+ dataSet.data.splice(i + 1, 0, value);
2226
+ }
2227
+ if (Math.abs(start.getTime() - dataSet.data[0]["x"]) > 1100 * minStep) for (let i = Math.abs(start.getTime() - dataSet.data[0]["x"]) / (minStep * 1e3); i > 1; i--) chart.data.datasets[index].data.unshift({
2228
+ x: /* @__PURE__ */ new Date(dataSet.data[0]["x"].getTime() - minStep * 1e3),
2229
+ v: NaN
2230
+ });
2231
+ if (Math.abs(end.getTime() - dataSet.data[dataSet.data.length - 1]["x"]) > 1100 * minStep) for (let i = Math.abs(end.getTime() - dataSet.data[dataSet.data.length - 1]["x"]) / (minStep * 1e3); i > 1; i--) chart.data.datasets[index].data.push({
2232
+ x: new Date(dataSet.data[chart.data.datasets[index].data.length - 1]["x"].getTime() + minStep * 1e3),
2233
+ v: NaN
2234
+ });
2235
+ });
2236
+ }
2237
+ function selectLabel(options, serie, i) {
2238
+ const defaultValue = serie.metric.toString();
2239
+ if (options.findInLabelMap) return options.findInLabelMap(serie.metric) || defaultValue;
2240
+ return defaultValue;
2241
+ }
2242
+ function selectBackGroundColor(options, serie, i) {
2243
+ const defaultValue = !options.fill ? "transparent" : options.backgroundColor[i % options.backgroundColor.length];
2244
+ if (options.findInBackgroundColorMap) return options.findInBackgroundColorMap(serie.metric) || defaultValue;
2245
+ return defaultValue;
2246
+ }
2247
+ function selectBorderColor(options, serie, i) {
2248
+ const defaultValue = options.borderColor[i % options.borderColor.length];
2249
+ if (options.findInBorderColorMap) return options.findInBorderColorMap(serie.metric) || defaultValue;
2250
+ return defaultValue;
2251
+ }
2252
+ var ChartDatasourcePrometheusPluginInternals = class {
2253
+ constructor() {
2254
+ this.loading = false;
2255
+ this.rendering = false;
2256
+ this.updateInterval = null;
2257
+ this.error = null;
2258
+ }
2259
+ };
2260
+ var ChartDatasourcePrometheusPlugin = class {
2261
+ constructor() {
2262
+ this.id = "datasource-prometheus";
2263
+ }
2264
+ beforeInit(chart, options) {
2265
+ chart["datasource-prometheus"] = new ChartDatasourcePrometheusPluginInternals();
2266
+ }
2267
+ afterInit(chart, args, _options) {
2268
+ if (!_options) throw "ChartDatasourcePrometheusPlugin.options is undefined";
2269
+ const options = Object.assign(new ChartDatasourcePrometheusPluginOptions(), _options);
2270
+ if (options.chartType === "stat");
2271
+ else if (chart.config["type"] !== "line" && chart.config["type"] !== "bar") throw "ChartDatasourcePrometheusPlugin is only compatible with Line chart\nFeel free to contribute for more!";
2272
+ options.assertPluginOptions();
2273
+ if (!!options && !!options.timeRange) if (!!options.timeRange.msUpdateInterval) chart["datasource-prometheus"].updateInterval = setInterval(() => {
2274
+ chart.update();
2275
+ }, options.timeRange.msUpdateInterval);
2276
+ else chart.update();
2277
+ }
2278
+ beforeUpdate(chart, args, _options) {
2279
+ if (!!chart["datasource-prometheus"] && (chart["datasource-prometheus"].loading === true || chart["datasource-prometheus"].rendering === true)) return;
2280
+ const options = Object.assign(new ChartDatasourcePrometheusPluginOptions(), _options);
2281
+ const prometheus = options.prometheus;
2282
+ const queries = options.getQueries();
2283
+ const { start, end } = datasource.getStartAndEndDates(options.timeRange);
2284
+ const expectedStep = options.timeRange.step || datasource.getPrometheusStepAuto(start, end, chart.width);
2285
+ const minStep = options.timeRange.minStep || expectedStep;
2286
+ const step = minStep >= expectedStep ? minStep : expectedStep;
2287
+ if (!!chart["datasource-prometheus"] && chart["datasource-prometheus"].step == step && chart["datasource-prometheus"].start == start && chart["datasource-prometheus"].end == end) return;
2288
+ chart["datasource-prometheus"].step = step;
2289
+ chart["datasource-prometheus"].start = start;
2290
+ chart["datasource-prometheus"].end = end;
2291
+ chart["datasource-prometheus"].error = null;
2292
+ const reqs = datasource.executeQueries(prometheus, queries, start, end, step);
2293
+ let isHiddenMap = {};
2294
+ for (let i = 0; i < chart.data.datasets.length; i++) {
2295
+ const oldDataSet = chart.data.datasets[i];
2296
+ isHiddenMap[oldDataSet.label] = !chart.isDatasetVisible(i);
2297
+ }
2298
+ chart["datasource-prometheus"].loading = true;
2299
+ this.updateMessage(chart, _options);
2300
+ Promise.all(reqs).then((results) => {
2301
+ if (options.chartType === "stat") {
2302
+ const statData = results.reduce((stats, result, queryIndex) => {
2303
+ return stats.concat(result.result.map((serie, i) => {
2304
+ const values = serie.values;
2305
+ if (values.length === 0) return null;
2306
+ const latestValue = values[values.length - 1];
2307
+ const previousValue = values.length > 1 ? values[values.length - 2] : null;
2308
+ const percentChange = previousValue ? (latestValue.value - previousValue.value) / previousValue.value * 100 : null;
2309
+ return {
2310
+ label: selectLabel(options, serie),
2311
+ value: latestValue.value,
2312
+ percentChange,
2313
+ sparklineData: values.slice(-20),
2314
+ backgroundColor: selectBackGroundColor(options, serie, i),
2315
+ borderColor: selectBorderColor(options, serie, i)
2316
+ };
2317
+ }).filter(Boolean));
2318
+ }, []);
2319
+ chart["datasource-prometheus"].statData = statData;
2320
+ chart.data.datasets = [];
2321
+ } else {
2322
+ const datasets = results.reduce((datasets, result, queryIndex) => {
2323
+ const seriesCount = datasets.length;
2324
+ const data = result.result.map((serie, i) => {
2325
+ return {
2326
+ tension: options.tension,
2327
+ cubicInterpolationMode: options.cubicInterpolationMode || "default",
2328
+ stepped: options.stepped,
2329
+ fill: options.fill || false,
2330
+ label: selectLabel(options, serie),
2331
+ data: serie.values.map((v, j) => {
2332
+ return {
2333
+ x: v.time,
2334
+ y: v.value
2335
+ };
2336
+ }),
2337
+ backgroundColor: selectBackGroundColor(options, serie, seriesCount + i),
2338
+ borderColor: selectBorderColor(options, serie, seriesCount + i),
2339
+ borderWidth: options.borderWidth,
2340
+ hidden: isHiddenMap[selectLabel(options, serie)] || false
2341
+ };
2342
+ });
2343
+ return datasets.concat(...data);
2344
+ }, []);
2345
+ chart.data.datasets = datasets;
2346
+ if (chart.data.datasets.length > 0) {
2347
+ if (options.fillGaps) fillGaps(chart, start, end, step, options);
2348
+ if (options.dataSetHook) chart.data.datasets = options.dataSetHook(chart.data.datasets);
2349
+ setTimeAxesOptions(chart);
2350
+ }
2351
+ }
2352
+ this.resumeRendering(chart);
2353
+ }).catch((err) => {
2354
+ chart.data.datasets = [];
2355
+ chart["datasource-prometheus"].error = "Failed to fetch data";
2356
+ setTimeAxesOptions(chart);
2357
+ this.resumeRendering(chart);
2358
+ throw err;
2359
+ });
2360
+ return false;
2361
+ }
2362
+ afterDraw(chart, args, _options) {
2363
+ const options = Object.assign(new ChartDatasourcePrometheusPluginOptions(), _options);
2364
+ if (options.chartType === "stat" && chart["datasource-prometheus"].statData) this.renderStatVisualization(chart, chart["datasource-prometheus"].statData, options);
2365
+ this.updateMessage(chart, _options);
2366
+ }
2367
+ updateMessage(chart, _options) {
2368
+ var _a;
2369
+ const options = Object.assign(new ChartDatasourcePrometheusPluginOptions(), _options);
2370
+ if (chart["datasource-prometheus"].error != null) this.writeText(chart, ((_a = options.errorMsg) === null || _a === void 0 ? void 0 : _a.message) || chart["datasource-prometheus"].error, (ctx) => {
2371
+ ctx.direction = options.errorMsg.direction;
2372
+ ctx.textAlign = options.errorMsg.textAlign;
2373
+ ctx.textBaseline = options.errorMsg.textBaseline;
2374
+ ctx.font = "16px normal 'Helvetica Nueue'";
2375
+ });
2376
+ else if (chart["datasource-prometheus"].loading == true) {
2377
+ if (options.loadingMsg) this.writeText(chart, options.loadingMsg.message, (ctx) => {
2378
+ ctx.direction = options.loadingMsg.direction;
2379
+ ctx.textAlign = options.loadingMsg.textAlign;
2380
+ ctx.textBaseline = options.loadingMsg.textBaseline;
2381
+ ctx.font = options.loadingMsg.font;
2382
+ });
2383
+ } else if (chart.data.datasets.length == 0 && (!options.chartType || options.chartType !== "stat" || !chart["datasource-prometheus"].statData || chart["datasource-prometheus"].statData.length === 0)) this.writeText(chart, options.noDataMsg.message, (ctx) => {
2384
+ ctx.direction = options.noDataMsg.direction;
2385
+ ctx.textAlign = options.noDataMsg.textAlign;
2386
+ ctx.textBaseline = options.noDataMsg.textBaseline;
2387
+ ctx.font = options.noDataMsg.font;
2388
+ });
2389
+ }
2390
+ writeText(chart, message, fn) {
2391
+ const ctx = chart.ctx;
2392
+ const width = chart.width;
2393
+ const height = chart.height;
2394
+ chart.clear();
2395
+ ctx.save();
2396
+ if (fn) fn(ctx);
2397
+ ctx.fillText(message, width / 2, height / 2);
2398
+ ctx.restore();
2399
+ }
2400
+ afterDestroy(chart, args, _options) {
2401
+ if (!!chart["datasource-prometheus"].updateInterval) clearInterval(chart["datasource-prometheus"].updateInterval);
2402
+ }
2403
+ resumeRendering(chart) {
2404
+ chart["datasource-prometheus"].loading = false;
2405
+ chart["datasource-prometheus"].rendering = true;
2406
+ chart.update();
2407
+ chart["datasource-prometheus"].rendering = false;
2408
+ }
2409
+ renderStatVisualization(chart, statData, options) {
2410
+ const ctx = chart.ctx;
2411
+ const width = chart.width;
2412
+ const height = chart.height;
2413
+ chart.clear();
2414
+ const statsPerRow = Math.ceil(Math.sqrt(statData.length));
2415
+ const statWidth = width / statsPerRow;
2416
+ const statHeight = height / Math.ceil(statData.length / statsPerRow);
2417
+ statData.forEach((stat, index) => {
2418
+ const row = Math.floor(index / statsPerRow);
2419
+ const x = index % statsPerRow * statWidth;
2420
+ const y = row * statHeight;
2421
+ ctx.save();
2422
+ if (stat.sparklineData && stat.sparklineData.length > 1) this.drawSparkline(ctx, stat.sparklineData, x, y, statWidth, statHeight, stat.borderColor);
2423
+ ctx.fillStyle = stat.borderColor || "#333";
2424
+ ctx.font = "bold 48px Arial";
2425
+ ctx.textAlign = "center";
2426
+ ctx.textBaseline = "middle";
2427
+ const valueText = this.formatStatValue(stat.value);
2428
+ ctx.fillText(valueText, x + statWidth / 2, y + statHeight / 2 - 20);
2429
+ if (stat.percentChange !== null) {
2430
+ ctx.font = "24px Arial";
2431
+ ctx.fillStyle = stat.percentChange >= 0 ? "#28a745" : "#dc3545";
2432
+ const changeText = `${stat.percentChange >= 0 ? "+" : ""}${stat.percentChange.toFixed(1)}%`;
2433
+ ctx.fillText(changeText, x + statWidth / 2, y + statHeight / 2 + 30);
2434
+ }
2435
+ ctx.font = "16px Arial";
2436
+ ctx.fillStyle = "#666";
2437
+ ctx.fillText(stat.label, x + statWidth / 2, y + statHeight - 20);
2438
+ ctx.restore();
2439
+ });
2440
+ }
2441
+ drawSparkline(ctx, data, x, y, width, height, color) {
2442
+ if (data.length < 2) return;
2443
+ const values = data.map((d) => d.value);
2444
+ const minValue = Math.min(...values);
2445
+ const valueRange = Math.max(...values) - minValue || 1;
2446
+ ctx.save();
2447
+ ctx.globalAlpha = .3;
2448
+ ctx.strokeStyle = color || "#007bff";
2449
+ ctx.lineWidth = 2;
2450
+ ctx.beginPath();
2451
+ data.forEach((point, index) => {
2452
+ const px = x + index / (data.length - 1) * width;
2453
+ const py = y + height - (point.value - minValue) / valueRange * (height * .6);
2454
+ if (index === 0) ctx.moveTo(px, py);
2455
+ else ctx.lineTo(px, py);
2456
+ });
2457
+ ctx.stroke();
2458
+ ctx.restore();
2459
+ }
2460
+ formatStatValue(value) {
2461
+ if (value >= 1e6) return (value / 1e6).toFixed(1) + "M";
2462
+ else if (value >= 1e3) return (value / 1e3).toFixed(1) + "K";
2463
+ else return value.toFixed(1);
2464
+ }
2465
+ };
2466
+ var index = new ChartDatasourcePrometheusPlugin();
2467
+ //#endregion
2278
2468
  //#region src/helpers.ts
2279
- var import_chartjs_plugin_datasource_prometheus_umd = /* @__PURE__ */ __toESM(require_chartjs_plugin_datasource_prometheus_umd());
2280
2469
  const getQueriesTimeRange = (period, data) => {
2281
2470
  const currentDate = dayjs();
2282
2471
  const normalizedShifts = normalizeShifts(data?.shifts, currentDate);
@@ -2371,7 +2560,7 @@ const PrometheusChart = ({ data, settings }) => {
2371
2560
  ref: chart,
2372
2561
  type: "line",
2373
2562
  data: chartData,
2374
- plugins: [import_chartjs_plugin_datasource_prometheus_umd.default, GradientPlugin],
2563
+ plugins: [index, GradientPlugin],
2375
2564
  options: {
2376
2565
  scales: {
2377
2566
  x: {