@kong-ui-public/analytics-geo-map 1.4.5 → 1.4.6

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.
@@ -1,14 +1,14 @@
1
- import { defineComponent as V0, useId as z0, ref as p0, computed as L, onMounted as T0, watch as n0, createElementBlock as U, openBlock as R, createCommentVNode as r0, createElementVNode as E, renderSlot as a0, createVNode as C0, unref as A, createTextVNode as D0, toDisplayString as Z, Fragment as N0, renderList as I0, normalizeStyle as O0 } from "vue";
2
- import { Map as U0, Popup as R0 } from "maplibre-gl";
3
- import { createI18n as E0, i18nTComponent as A0 } from "@kong-ui-public/i18n";
1
+ import { computed as M, defineComponent as _0, createElementBlock as A, openBlock as N, createCommentVNode as a0, toDisplayString as X, Fragment as z0, renderList as T0, createElementVNode as $, normalizeStyle as C0, toRef as f0, useId as D0, ref as h0, onMounted as N0, watch as n0, createBlock as U0, renderSlot as r0, createVNode as I0, unref as D, createTextVNode as O0 } from "vue";
2
+ import { Map as R0, Popup as E0 } from "maplibre-gl";
3
+ import { createI18n as A0, i18nTComponent as $0 } from "@kong-ui-public/i18n";
4
4
  import { AnalyticsIcon as H0 } from "@kong/icons";
5
- const $0 = {
5
+ const G0 = {
6
6
  ms: "ms",
7
7
  bytes: "Byte{plural}",
8
8
  count: "request{plural}",
9
9
  "count/minute": "rpm",
10
10
  requests: "request{plural}"
11
- }, G0 = {
11
+ }, q0 = {
12
12
  request_count: "Request count",
13
13
  request_per_minute: "Requests per minute",
14
14
  response_latency_average: "Response latency (avg)",
@@ -33,60 +33,98 @@ const $0 = {
33
33
  request_size_p95: "Request size (p95)",
34
34
  request_size_p50: "Request size (p50)",
35
35
  request_size_sum: "Request size (sum)"
36
- }, q0 = {
36
+ }, K0 = {
37
37
  windows_zoom_help_text: "Use Ctrl + Scroll to zoom the map",
38
38
  mac_zoom_help_text: "Use ⌘ + Scroll to zoom the map",
39
39
  mobile_zoom_help_text: "Use two fingers to zoom the map"
40
- }, K0 = "No location", j0 = "No location data found.", W0 = {
41
- metricUnits: $0,
42
- metrics: G0,
43
- cooperative_gestures: q0,
44
- no_location_data: K0,
45
- no_location_data_description: j0
40
+ }, j0 = "No location", W0 = "No location data found.", Z0 = {
41
+ metricUnits: G0,
42
+ metrics: q0,
43
+ cooperative_gestures: K0,
44
+ no_location_data: j0,
45
+ no_location_data_description: W0
46
46
  };
47
- function Z0() {
48
- const e = E0("en-us", W0);
47
+ function J0() {
48
+ const e = A0("en-us", Z0);
49
49
  return {
50
50
  i18n: e,
51
- i18nT: A0(e)
51
+ i18nT: $0(e)
52
52
  // Translation component <i18n-t>
53
53
  };
54
54
  }
55
- const J0 = {
56
- useI18n: Z0
57
- };
58
55
  function F0(e) {
59
56
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
60
57
  }
61
- var _0 = { exports: {} };
58
+ var w0 = { exports: {} };
62
59
  (function(e) {
63
60
  (function() {
64
- function t(s, l) {
65
- if (l.separator === !1 || s < 1e3)
66
- return s.toString();
67
- var u = typeof l.separator == "string" ? l.separator : ",", y = [], g = Math.round(s).toString().split("");
68
- return g.reverse().forEach(function(T, I) {
69
- I && I % 3 === 0 && y.push(u), y.push(T);
70
- }), y.reverse().join("");
61
+ function t(r, l) {
62
+ if (l.separator === !1 || r < 1e3)
63
+ return r.toString();
64
+ var u = typeof l.separator == "string" ? l.separator : ",", p = [], y = Math.round(r).toString().split("");
65
+ return y.reverse().forEach(function(_, w) {
66
+ w && w % 3 === 0 && p.push(u), p.push(_);
67
+ }), p.reverse().join("");
71
68
  }
72
- function i(s, l, u) {
73
- var y = s / l, g = u.round ? "round" : "floor";
74
- return u.decimal === !1 ? (s = Math[g](y), s.toString()) : (u.precision ? s = y : s = y < 10 ? Math[g](y * 10) / 10 : Math[g](y), s = s.toString(), typeof u.decimal == "string" && (s = s.replace(".", u.decimal)), s);
69
+ function i(r, l, u) {
70
+ var p = r / l, y = u.round ? "round" : "floor";
71
+ return u.decimal === !1 ? (r = Math[y](p), r.toString()) : (u.precision ? r = p : r = p < 10 ? Math[y](p * 10) / 10 : Math[y](p), r = r.toString(), typeof u.decimal == "string" && (r = r.replace(".", u.decimal)), r);
75
72
  }
76
- var a = 1e3, n = 1e4, o = 1e6, r = 1e9, d = 1e12;
77
- function p(s, l) {
73
+ var a = 1e3, n = 1e4, o = 1e6, s = 1e9, c = 1e12;
74
+ function f(r, l) {
78
75
  var u;
79
76
  l = l || {};
80
- var y = s < 0;
81
- y && (s = Math.abs(s)), l.precision && (s = parseFloat(s.toPrecision(l.precision)));
82
- var g = l.min10k ? n : a;
83
- return s < g || l.precision && l.precision > Math.log10(s) ? u = t(i(s, 1, l), l) : s < o ? u = i(s, a, l) + "k" : s < r ? u = i(s, o, l) + "m" : s < d ? u = t(i(s, r, l), l) + "b" : u = t(i(s, d, l), l) + "t", y && (u = "-" + u), l.capital && (u = u.toUpperCase()), l.prefix && (u = l.prefix + u), l.suffix && (u = u + l.suffix), u;
77
+ var p = r < 0;
78
+ p && (r = Math.abs(r)), l.precision && (r = parseFloat(r.toPrecision(l.precision)));
79
+ var y = l.min10k ? n : a;
80
+ return r < y || l.precision && l.precision > Math.log10(r) ? u = t(i(r, 1, l), l) : r < o ? u = i(r, a, l) + "k" : r < s ? u = i(r, o, l) + "m" : r < c ? u = t(i(r, s, l), l) + "b" : u = t(i(r, c, l), l) + "t", p && (u = "-" + u), l.capital && (u = u.toUpperCase()), l.prefix && (u = l.prefix + u), l.suffix && (u = u + l.suffix), u;
84
81
  }
85
- p.addCommas = t, e.exports = p;
82
+ f.addCommas = t, e.exports = f;
86
83
  })();
87
- })(_0);
88
- var X0 = _0.exports;
89
- const Q0 = /* @__PURE__ */ F0(X0), Y0 = "FeatureCollection", b0 = [
84
+ })(w0);
85
+ var X0 = w0.exports;
86
+ const Q0 = /* @__PURE__ */ F0(X0);
87
+ function Y0({
88
+ countryMetrics: e,
89
+ metric: t
90
+ }) {
91
+ const i = M(() => Math.log(Math.min(...Object.values(e.value)))), a = M(() => Math.log(Math.max(...Object.values(e.value)))), n = M(() => {
92
+ var f;
93
+ return !((f = t.value) != null && f.includes("latency"));
94
+ }), o = M(() => {
95
+ const r = (a.value - i.value) / 5, l = [
96
+ i.value + 4 * r,
97
+ i.value + 3 * r,
98
+ i.value + 2 * r,
99
+ i.value + 1 * r,
100
+ i.value
101
+ ];
102
+ return l.map((u, p) => {
103
+ const y = p === 0 ? a.value : l[p - 1], _ = Math.exp(u), w = Math.exp(y);
104
+ let S = "";
105
+ return p === 0 ? S = `> ${c(_)}` : p === l.length - 1 ? S = `< ${c(w)}` : S = `${c(_)} - ${c(w)}`, {
106
+ color: s(_),
107
+ range: S
108
+ };
109
+ });
110
+ }), s = (f) => {
111
+ const r = Math.log(f), u = (a.value - i.value) / 5;
112
+ return r >= i.value + 4 * u ? "#00819d" : r >= i.value + 3 * u ? "#00abd2" : r >= i.value + 2 * u ? "#00c8f4" : r >= i.value + 1 * u ? "#67e3ff" : "#b3f1ff";
113
+ }, c = (f) => {
114
+ var l;
115
+ const r = Math.trunc(f);
116
+ return n.value ? Q0(r, { capital: !0 }) : new Intl.NumberFormat(((l = document == null ? void 0 : document.documentElement) == null ? void 0 : l.lang) || "en-US").format(r);
117
+ };
118
+ return {
119
+ getColor: s,
120
+ formatMetric: c,
121
+ legendData: o
122
+ };
123
+ }
124
+ const p0 = {
125
+ useI18n: J0,
126
+ useMetricUtils: Y0
127
+ }, b0 = "FeatureCollection", ee = [
90
128
  {
91
129
  type: "Feature",
92
130
  properties: {
@@ -2518,11 +2556,11 @@ const Q0 = /* @__PURE__ */ F0(X0), Y0 = "FeatureCollection", b0 = [
2518
2556
  ]
2519
2557
  }
2520
2558
  }
2521
- ], ee = {
2522
- type: Y0,
2523
- features: b0
2559
+ ], te = {
2560
+ type: b0,
2561
+ features: ee
2524
2562
  };
2525
- var te = ne, Q, G, v, Y, e0, ie = [
2563
+ var ie = re, Q, H, v, Y, e0, ne = [
2526
2564
  "Point",
2527
2565
  "MultiPoint",
2528
2566
  "LineString",
@@ -2531,36 +2569,36 @@ var te = ne, Q, G, v, Y, e0, ie = [
2531
2569
  "MultiPolygon",
2532
2570
  "GeometryCollection"
2533
2571
  ];
2534
- function ne(e) {
2535
- Y = 2, e0 = Math.pow(10, 6), v = null, Q = [], G = [];
2536
- var t = e.readFields(re, {});
2572
+ function re(e) {
2573
+ Y = 2, e0 = Math.pow(10, 6), v = null, Q = [], H = [];
2574
+ var t = e.readFields(ae, {});
2537
2575
  return Q = null, t;
2538
2576
  }
2539
- function re(e, t, i) {
2540
- e === 1 ? Q.push(i.readString()) : e === 2 ? Y = i.readVarint() : e === 3 ? e0 = Math.pow(10, i.readVarint()) : e === 4 ? ae(i, t) : e === 5 ? w0(i, t) : e === 6 && s0(i, t);
2577
+ function ae(e, t, i) {
2578
+ e === 1 ? Q.push(i.readString()) : e === 2 ? Y = i.readVarint() : e === 3 ? e0 = Math.pow(10, i.readVarint()) : e === 4 ? oe(i, t) : e === 5 ? k0(i, t) : e === 6 && s0(i, t);
2541
2579
  }
2542
- function ae(e, t) {
2543
- return t.type = "FeatureCollection", t.features = [], e.readMessage(oe, t);
2580
+ function oe(e, t) {
2581
+ return t.type = "FeatureCollection", t.features = [], e.readMessage(se, t);
2544
2582
  }
2545
- function w0(e, t) {
2583
+ function k0(e, t) {
2546
2584
  t.type = "Feature";
2547
- var i = e.readMessage(se, t);
2585
+ var i = e.readMessage(le, t);
2548
2586
  return "geometry" in i || (i.geometry = null), i;
2549
2587
  }
2550
2588
  function s0(e, t) {
2551
- return t.type = "Point", e.readMessage(le, t);
2552
- }
2553
- function oe(e, t, i) {
2554
- e === 1 ? t.features.push(w0(i, {})) : e === 13 ? G.push(l0(i)) : e === 15 && b(i, t);
2589
+ return t.type = "Point", e.readMessage(ue, t);
2555
2590
  }
2556
2591
  function se(e, t, i) {
2557
- e === 1 ? t.geometry = s0(i, {}) : e === 11 ? t.id = i.readString() : e === 12 ? t.id = i.readSVarint() : e === 13 ? G.push(l0(i)) : e === 14 ? t.properties = b(i, {}) : e === 15 && b(i, t);
2592
+ e === 1 ? t.features.push(k0(i, {})) : e === 13 ? H.push(l0(i)) : e === 15 && b(i, t);
2558
2593
  }
2559
2594
  function le(e, t, i) {
2560
- e === 1 ? t.type = ie[i.readVarint()] : e === 2 ? v = i.readPackedVarint() : e === 3 ? ue(t, i, t.type) : e === 4 ? (t.geometries = t.geometries || [], t.geometries.push(s0(i, {}))) : e === 13 ? G.push(l0(i)) : e === 15 && b(i, t);
2595
+ e === 1 ? t.geometry = s0(i, {}) : e === 11 ? t.id = i.readString() : e === 12 ? t.id = i.readSVarint() : e === 13 ? H.push(l0(i)) : e === 14 ? t.properties = b(i, {}) : e === 15 && b(i, t);
2561
2596
  }
2562
2597
  function ue(e, t, i) {
2563
- i === "Point" ? e.coordinates = ce(t) : i === "MultiPoint" || i === "LineString" ? e.coordinates = m0(t) : i === "MultiLineString" ? e.coordinates = y0(t) : i === "Polygon" ? e.coordinates = y0(t, !0) : i === "MultiPolygon" && (e.coordinates = de(t));
2598
+ e === 1 ? t.type = ne[i.readVarint()] : e === 2 ? v = i.readPackedVarint() : e === 3 ? ce(t, i, t.type) : e === 4 ? (t.geometries = t.geometries || [], t.geometries.push(s0(i, {}))) : e === 13 ? H.push(l0(i)) : e === 15 && b(i, t);
2599
+ }
2600
+ function ce(e, t, i) {
2601
+ i === "Point" ? e.coordinates = de(t) : i === "MultiPoint" || i === "LineString" ? e.coordinates = m0(t) : i === "MultiLineString" ? e.coordinates = y0(t) : i === "Polygon" ? e.coordinates = y0(t, !0) : i === "MultiPolygon" && (e.coordinates = fe(t));
2564
2602
  }
2565
2603
  function l0(e) {
2566
2604
  for (var t = e.readVarint() + e.pos, i = null; e.pos < t; ) {
@@ -2570,20 +2608,20 @@ function l0(e) {
2570
2608
  return i;
2571
2609
  }
2572
2610
  function b(e, t) {
2573
- for (var i = e.readVarint() + e.pos; e.pos < i; ) t[Q[e.readVarint()]] = G[e.readVarint()];
2574
- return G = [], t;
2611
+ for (var i = e.readVarint() + e.pos; e.pos < i; ) t[Q[e.readVarint()]] = H[e.readVarint()];
2612
+ return H = [], t;
2575
2613
  }
2576
- function ce(e) {
2614
+ function de(e) {
2577
2615
  for (var t = e.readVarint() + e.pos, i = []; e.pos < t; ) i.push(e.readSVarint() / e0);
2578
2616
  return i;
2579
2617
  }
2580
2618
  function K(e, t, i, a) {
2581
- var n = 0, o = [], r, d, p = [];
2582
- for (d = 0; d < Y; d++) p[d] = 0;
2619
+ var n = 0, o = [], s, c, f = [];
2620
+ for (c = 0; c < Y; c++) f[c] = 0;
2583
2621
  for (; i ? n < i : e.pos < t; ) {
2584
- for (r = [], d = 0; d < Y; d++)
2585
- p[d] += e.readSVarint(), r[d] = p[d] / e0;
2586
- o.push(r), n++;
2622
+ for (s = [], c = 0; c < Y; c++)
2623
+ f[c] += e.readSVarint(), s[c] = f[c] / e0;
2624
+ o.push(s), n++;
2587
2625
  }
2588
2626
  return a && o.push(o[0]), o;
2589
2627
  }
@@ -2596,41 +2634,41 @@ function y0(e, t) {
2596
2634
  for (var a = [], n = 0; n < v.length; n++) a.push(K(e, i, v[n], t));
2597
2635
  return v = null, a;
2598
2636
  }
2599
- function de(e) {
2637
+ function fe(e) {
2600
2638
  var t = e.readVarint() + e.pos;
2601
2639
  if (!v) return [[K(e, t, null, !0)]];
2602
2640
  for (var i = [], a = 1, n = 0; n < v[0]; n++) {
2603
- for (var o = [], r = 0; r < v[a]; r++) o.push(K(e, t, v[a + 1 + r], !0));
2641
+ for (var o = [], s = 0; s < v[a]; s++) o.push(K(e, t, v[a + 1 + s], !0));
2604
2642
  a += v[a] + 1, i.push(o);
2605
2643
  }
2606
2644
  return v = null, i;
2607
2645
  }
2608
- var fe = te, u0 = {};
2646
+ var he = ie, u0 = {};
2609
2647
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
2610
2648
  u0.read = function(e, t, i, a, n) {
2611
- var o, r, d = n * 8 - a - 1, p = (1 << d) - 1, s = p >> 1, l = -7, u = i ? n - 1 : 0, y = i ? -1 : 1, g = e[t + u];
2612
- for (u += y, o = g & (1 << -l) - 1, g >>= -l, l += d; l > 0; o = o * 256 + e[t + u], u += y, l -= 8)
2649
+ var o, s, c = n * 8 - a - 1, f = (1 << c) - 1, r = f >> 1, l = -7, u = i ? n - 1 : 0, p = i ? -1 : 1, y = e[t + u];
2650
+ for (u += p, o = y & (1 << -l) - 1, y >>= -l, l += c; l > 0; o = o * 256 + e[t + u], u += p, l -= 8)
2613
2651
  ;
2614
- for (r = o & (1 << -l) - 1, o >>= -l, l += a; l > 0; r = r * 256 + e[t + u], u += y, l -= 8)
2652
+ for (s = o & (1 << -l) - 1, o >>= -l, l += a; l > 0; s = s * 256 + e[t + u], u += p, l -= 8)
2615
2653
  ;
2616
2654
  if (o === 0)
2617
- o = 1 - s;
2655
+ o = 1 - r;
2618
2656
  else {
2619
- if (o === p)
2620
- return r ? NaN : (g ? -1 : 1) * (1 / 0);
2621
- r = r + Math.pow(2, a), o = o - s;
2657
+ if (o === f)
2658
+ return s ? NaN : (y ? -1 : 1) * (1 / 0);
2659
+ s = s + Math.pow(2, a), o = o - r;
2622
2660
  }
2623
- return (g ? -1 : 1) * r * Math.pow(2, o - a);
2661
+ return (y ? -1 : 1) * s * Math.pow(2, o - a);
2624
2662
  };
2625
2663
  u0.write = function(e, t, i, a, n, o) {
2626
- var r, d, p, s = o * 8 - n - 1, l = (1 << s) - 1, u = l >> 1, y = n === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = a ? 0 : o - 1, T = a ? 1 : -1, I = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
2627
- for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (d = isNaN(t) ? 1 : 0, r = l) : (r = Math.floor(Math.log(t) / Math.LN2), t * (p = Math.pow(2, -r)) < 1 && (r--, p *= 2), r + u >= 1 ? t += y / p : t += y * Math.pow(2, 1 - u), t * p >= 2 && (r++, p /= 2), r + u >= l ? (d = 0, r = l) : r + u >= 1 ? (d = (t * p - 1) * Math.pow(2, n), r = r + u) : (d = t * Math.pow(2, u - 1) * Math.pow(2, n), r = 0)); n >= 8; e[i + g] = d & 255, g += T, d /= 256, n -= 8)
2664
+ var s, c, f, r = o * 8 - n - 1, l = (1 << r) - 1, u = l >> 1, p = n === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, y = a ? 0 : o - 1, _ = a ? 1 : -1, w = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
2665
+ for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (c = isNaN(t) ? 1 : 0, s = l) : (s = Math.floor(Math.log(t) / Math.LN2), t * (f = Math.pow(2, -s)) < 1 && (s--, f *= 2), s + u >= 1 ? t += p / f : t += p * Math.pow(2, 1 - u), t * f >= 2 && (s++, f /= 2), s + u >= l ? (c = 0, s = l) : s + u >= 1 ? (c = (t * f - 1) * Math.pow(2, n), s = s + u) : (c = t * Math.pow(2, u - 1) * Math.pow(2, n), s = 0)); n >= 8; e[i + y] = c & 255, y += _, c /= 256, n -= 8)
2628
2666
  ;
2629
- for (r = r << n | d, s += n; s > 0; e[i + g] = r & 255, g += T, r /= 256, s -= 8)
2667
+ for (s = s << n | c, r += n; r > 0; e[i + y] = s & 255, y += _, s /= 256, r -= 8)
2630
2668
  ;
2631
- e[i + g - T] |= I * 128;
2669
+ e[i + y - _] |= w * 128;
2632
2670
  };
2633
- var he = h, J = u0;
2671
+ var pe = h, Z = u0;
2634
2672
  function h(e) {
2635
2673
  this.buf = ArrayBuffer.isView && ArrayBuffer.isView(e) ? e : new Uint8Array(e || 0), this.pos = 0, this.type = 0, this.length = this.buf.length;
2636
2674
  }
@@ -2638,7 +2676,7 @@ h.Varint = 0;
2638
2676
  h.Fixed64 = 1;
2639
2677
  h.Bytes = 2;
2640
2678
  h.Fixed32 = 5;
2641
- var o0 = 65536 * 65536, x0 = 1 / o0, pe = 12, k0 = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
2679
+ var o0 = 65536 * 65536, x0 = 1 / o0, me = 12, M0 = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8");
2642
2680
  h.prototype = {
2643
2681
  destroy: function() {
2644
2682
  this.buf = null;
@@ -2655,7 +2693,7 @@ h.prototype = {
2655
2693
  return this.readFields(e, t, this.readVarint() + this.pos);
2656
2694
  },
2657
2695
  readFixed32: function() {
2658
- var e = X(this.buf, this.pos);
2696
+ var e = J(this.buf, this.pos);
2659
2697
  return this.pos += 4, e;
2660
2698
  },
2661
2699
  readSFixed32: function() {
@@ -2664,24 +2702,24 @@ h.prototype = {
2664
2702
  },
2665
2703
  // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
2666
2704
  readFixed64: function() {
2667
- var e = X(this.buf, this.pos) + X(this.buf, this.pos + 4) * o0;
2705
+ var e = J(this.buf, this.pos) + J(this.buf, this.pos + 4) * o0;
2668
2706
  return this.pos += 8, e;
2669
2707
  },
2670
2708
  readSFixed64: function() {
2671
- var e = X(this.buf, this.pos) + v0(this.buf, this.pos + 4) * o0;
2709
+ var e = J(this.buf, this.pos) + v0(this.buf, this.pos + 4) * o0;
2672
2710
  return this.pos += 8, e;
2673
2711
  },
2674
2712
  readFloat: function() {
2675
- var e = J.read(this.buf, this.pos, !0, 23, 4);
2713
+ var e = Z.read(this.buf, this.pos, !0, 23, 4);
2676
2714
  return this.pos += 4, e;
2677
2715
  },
2678
2716
  readDouble: function() {
2679
- var e = J.read(this.buf, this.pos, !0, 52, 8);
2717
+ var e = Z.read(this.buf, this.pos, !0, 52, 8);
2680
2718
  return this.pos += 8, e;
2681
2719
  },
2682
2720
  readVarint: function(e) {
2683
2721
  var t = this.buf, i, a;
2684
- return a = t[this.pos++], i = a & 127, a < 128 || (a = t[this.pos++], i |= (a & 127) << 7, a < 128) || (a = t[this.pos++], i |= (a & 127) << 14, a < 128) || (a = t[this.pos++], i |= (a & 127) << 21, a < 128) ? i : (a = t[this.pos], i |= (a & 15) << 28, me(i, e, this));
2722
+ return a = t[this.pos++], i = a & 127, a < 128 || (a = t[this.pos++], i |= (a & 127) << 7, a < 128) || (a = t[this.pos++], i |= (a & 127) << 14, a < 128) || (a = t[this.pos++], i |= (a & 127) << 21, a < 128) ? i : (a = t[this.pos], i |= (a & 15) << 28, ye(i, e, this));
2685
2723
  },
2686
2724
  readVarint64: function() {
2687
2725
  return this.readVarint(!0);
@@ -2695,7 +2733,7 @@ h.prototype = {
2695
2733
  },
2696
2734
  readString: function() {
2697
2735
  var e = this.readVarint() + this.pos, t = this.pos;
2698
- return this.pos = e, e - t >= pe && k0 ? Ve(this.buf, t, e) : Se(this.buf, t, e);
2736
+ return this.pos = e, e - t >= me && M0 ? ze(this.buf, t, e) : Ve(this.buf, t, e);
2699
2737
  },
2700
2738
  readBytes: function() {
2701
2739
  var e = this.readVarint() + this.pos, t = this.buf.subarray(this.pos, e);
@@ -2704,55 +2742,55 @@ h.prototype = {
2704
2742
  // verbose for performance reasons; doesn't affect gzipped size
2705
2743
  readPackedVarint: function(e, t) {
2706
2744
  if (this.type !== h.Bytes) return e.push(this.readVarint(t));
2707
- var i = P(this);
2745
+ var i = k(this);
2708
2746
  for (e = e || []; this.pos < i; ) e.push(this.readVarint(t));
2709
2747
  return e;
2710
2748
  },
2711
2749
  readPackedSVarint: function(e) {
2712
2750
  if (this.type !== h.Bytes) return e.push(this.readSVarint());
2713
- var t = P(this);
2751
+ var t = k(this);
2714
2752
  for (e = e || []; this.pos < t; ) e.push(this.readSVarint());
2715
2753
  return e;
2716
2754
  },
2717
2755
  readPackedBoolean: function(e) {
2718
2756
  if (this.type !== h.Bytes) return e.push(this.readBoolean());
2719
- var t = P(this);
2757
+ var t = k(this);
2720
2758
  for (e = e || []; this.pos < t; ) e.push(this.readBoolean());
2721
2759
  return e;
2722
2760
  },
2723
2761
  readPackedFloat: function(e) {
2724
2762
  if (this.type !== h.Bytes) return e.push(this.readFloat());
2725
- var t = P(this);
2763
+ var t = k(this);
2726
2764
  for (e = e || []; this.pos < t; ) e.push(this.readFloat());
2727
2765
  return e;
2728
2766
  },
2729
2767
  readPackedDouble: function(e) {
2730
2768
  if (this.type !== h.Bytes) return e.push(this.readDouble());
2731
- var t = P(this);
2769
+ var t = k(this);
2732
2770
  for (e = e || []; this.pos < t; ) e.push(this.readDouble());
2733
2771
  return e;
2734
2772
  },
2735
2773
  readPackedFixed32: function(e) {
2736
2774
  if (this.type !== h.Bytes) return e.push(this.readFixed32());
2737
- var t = P(this);
2775
+ var t = k(this);
2738
2776
  for (e = e || []; this.pos < t; ) e.push(this.readFixed32());
2739
2777
  return e;
2740
2778
  },
2741
2779
  readPackedSFixed32: function(e) {
2742
2780
  if (this.type !== h.Bytes) return e.push(this.readSFixed32());
2743
- var t = P(this);
2781
+ var t = k(this);
2744
2782
  for (e = e || []; this.pos < t; ) e.push(this.readSFixed32());
2745
2783
  return e;
2746
2784
  },
2747
2785
  readPackedFixed64: function(e) {
2748
2786
  if (this.type !== h.Bytes) return e.push(this.readFixed64());
2749
- var t = P(this);
2787
+ var t = k(this);
2750
2788
  for (e = e || []; this.pos < t; ) e.push(this.readFixed64());
2751
2789
  return e;
2752
2790
  },
2753
2791
  readPackedSFixed64: function(e) {
2754
2792
  if (this.type !== h.Bytes) return e.push(this.readSFixed64());
2755
- var t = P(this);
2793
+ var t = k(this);
2756
2794
  for (e = e || []; this.pos < t; ) e.push(this.readSFixed64());
2757
2795
  return e;
2758
2796
  },
@@ -2780,20 +2818,20 @@ h.prototype = {
2780
2818
  return this.length = this.pos, this.pos = 0, this.buf.subarray(0, this.length);
2781
2819
  },
2782
2820
  writeFixed32: function(e) {
2783
- this.realloc(4), $(this.buf, e, this.pos), this.pos += 4;
2821
+ this.realloc(4), E(this.buf, e, this.pos), this.pos += 4;
2784
2822
  },
2785
2823
  writeSFixed32: function(e) {
2786
- this.realloc(4), $(this.buf, e, this.pos), this.pos += 4;
2824
+ this.realloc(4), E(this.buf, e, this.pos), this.pos += 4;
2787
2825
  },
2788
2826
  writeFixed64: function(e) {
2789
- this.realloc(8), $(this.buf, e & -1, this.pos), $(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2827
+ this.realloc(8), E(this.buf, e & -1, this.pos), E(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2790
2828
  },
2791
2829
  writeSFixed64: function(e) {
2792
- this.realloc(8), $(this.buf, e & -1, this.pos), $(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2830
+ this.realloc(8), E(this.buf, e & -1, this.pos), E(this.buf, Math.floor(e * x0), this.pos + 4), this.pos += 8;
2793
2831
  },
2794
2832
  writeVarint: function(e) {
2795
2833
  if (e = +e || 0, e > 268435455 || e < 0) {
2796
- ye(e, this);
2834
+ xe(e, this);
2797
2835
  return;
2798
2836
  }
2799
2837
  this.realloc(4), this.buf[this.pos++] = e & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = (e >>>= 7) & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = (e >>>= 7) & 127 | (e > 127 ? 128 : 0), !(e <= 127) && (this.buf[this.pos++] = e >>> 7 & 127)));
@@ -2807,15 +2845,15 @@ h.prototype = {
2807
2845
  writeString: function(e) {
2808
2846
  e = String(e), this.realloc(e.length * 4), this.pos++;
2809
2847
  var t = this.pos;
2810
- this.pos = ze(this.buf, e, this.pos);
2848
+ this.pos = Te(this.buf, e, this.pos);
2811
2849
  var i = this.pos - t;
2812
2850
  i >= 128 && g0(t, i, this), this.pos = t - 1, this.writeVarint(i), this.pos += i;
2813
2851
  },
2814
2852
  writeFloat: function(e) {
2815
- this.realloc(4), J.write(this.buf, e, this.pos, !0, 23, 4), this.pos += 4;
2853
+ this.realloc(4), Z.write(this.buf, e, this.pos, !0, 23, 4), this.pos += 4;
2816
2854
  },
2817
2855
  writeDouble: function(e) {
2818
- this.realloc(8), J.write(this.buf, e, this.pos, !0, 52, 8), this.pos += 8;
2856
+ this.realloc(8), Z.write(this.buf, e, this.pos, !0, 52, 8), this.pos += 8;
2819
2857
  },
2820
2858
  writeBytes: function(e) {
2821
2859
  var t = e.length;
@@ -2833,31 +2871,31 @@ h.prototype = {
2833
2871
  this.writeTag(e, h.Bytes), this.writeRawMessage(t, i);
2834
2872
  },
2835
2873
  writePackedVarint: function(e, t) {
2836
- t.length && this.writeMessage(e, ve, t);
2874
+ t.length && this.writeMessage(e, _e, t);
2837
2875
  },
2838
2876
  writePackedSVarint: function(e, t) {
2839
2877
  t.length && this.writeMessage(e, Fe, t);
2840
2878
  },
2841
2879
  writePackedBoolean: function(e, t) {
2842
- t.length && this.writeMessage(e, ke, t);
2880
+ t.length && this.writeMessage(e, Me, t);
2843
2881
  },
2844
2882
  writePackedFloat: function(e, t) {
2845
- t.length && this.writeMessage(e, _e, t);
2883
+ t.length && this.writeMessage(e, we, t);
2846
2884
  },
2847
2885
  writePackedDouble: function(e, t) {
2848
- t.length && this.writeMessage(e, we, t);
2886
+ t.length && this.writeMessage(e, ke, t);
2849
2887
  },
2850
2888
  writePackedFixed32: function(e, t) {
2851
- t.length && this.writeMessage(e, Me, t);
2889
+ t.length && this.writeMessage(e, Le, t);
2852
2890
  },
2853
2891
  writePackedSFixed32: function(e, t) {
2854
- t.length && this.writeMessage(e, Le, t);
2892
+ t.length && this.writeMessage(e, Be, t);
2855
2893
  },
2856
2894
  writePackedFixed64: function(e, t) {
2857
2895
  t.length && this.writeMessage(e, Pe, t);
2858
2896
  },
2859
2897
  writePackedSFixed64: function(e, t) {
2860
- t.length && this.writeMessage(e, Be, t);
2898
+ t.length && this.writeMessage(e, Se, t);
2861
2899
  },
2862
2900
  writeBytesField: function(e, t) {
2863
2901
  this.writeTag(e, h.Bytes), this.writeBytes(t);
@@ -2893,27 +2931,27 @@ h.prototype = {
2893
2931
  this.writeVarintField(e, !!t);
2894
2932
  }
2895
2933
  };
2896
- function me(e, t, i) {
2934
+ function ye(e, t, i) {
2897
2935
  var a = i.buf, n, o;
2898
- if (o = a[i.pos++], n = (o & 112) >> 4, o < 128 || (o = a[i.pos++], n |= (o & 127) << 3, o < 128) || (o = a[i.pos++], n |= (o & 127) << 10, o < 128) || (o = a[i.pos++], n |= (o & 127) << 17, o < 128) || (o = a[i.pos++], n |= (o & 127) << 24, o < 128) || (o = a[i.pos++], n |= (o & 1) << 31, o < 128)) return H(e, n, t);
2936
+ if (o = a[i.pos++], n = (o & 112) >> 4, o < 128 || (o = a[i.pos++], n |= (o & 127) << 3, o < 128) || (o = a[i.pos++], n |= (o & 127) << 10, o < 128) || (o = a[i.pos++], n |= (o & 127) << 17, o < 128) || (o = a[i.pos++], n |= (o & 127) << 24, o < 128) || (o = a[i.pos++], n |= (o & 1) << 31, o < 128)) return R(e, n, t);
2899
2937
  throw new Error("Expected varint not more than 10 bytes");
2900
2938
  }
2901
- function P(e) {
2939
+ function k(e) {
2902
2940
  return e.type === h.Bytes ? e.readVarint() + e.pos : e.pos + 1;
2903
2941
  }
2904
- function H(e, t, i) {
2942
+ function R(e, t, i) {
2905
2943
  return i ? t * 4294967296 + (e >>> 0) : (t >>> 0) * 4294967296 + (e >>> 0);
2906
2944
  }
2907
- function ye(e, t) {
2945
+ function xe(e, t) {
2908
2946
  var i, a;
2909
2947
  if (e >= 0 ? (i = e % 4294967296 | 0, a = e / 4294967296 | 0) : (i = ~(-e % 4294967296), a = ~(-e / 4294967296), i ^ 4294967295 ? i = i + 1 | 0 : (i = 0, a = a + 1 | 0)), e >= 18446744073709552e3 || e < -18446744073709552e3)
2910
2948
  throw new Error("Given varint doesn't fit into 10 bytes");
2911
- t.realloc(10), xe(i, a, t), ge(a, t);
2949
+ t.realloc(10), ge(i, a, t), ve(a, t);
2912
2950
  }
2913
- function xe(e, t, i) {
2951
+ function ge(e, t, i) {
2914
2952
  i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos++] = e & 127 | 128, e >>>= 7, i.buf[i.pos] = e & 127;
2915
2953
  }
2916
- function ge(e, t) {
2954
+ function ve(e, t) {
2917
2955
  var i = (e & 7) << 4;
2918
2956
  t.buf[t.pos++] |= i | ((e >>>= 3) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127 | ((e >>>= 7) ? 128 : 0), e && (t.buf[t.pos++] = e & 127)))));
2919
2957
  }
@@ -2922,55 +2960,55 @@ function g0(e, t, i) {
2922
2960
  i.realloc(a);
2923
2961
  for (var n = i.pos - 1; n >= e; n--) i.buf[n + a] = i.buf[n];
2924
2962
  }
2925
- function ve(e, t) {
2963
+ function _e(e, t) {
2926
2964
  for (var i = 0; i < e.length; i++) t.writeVarint(e[i]);
2927
2965
  }
2928
2966
  function Fe(e, t) {
2929
2967
  for (var i = 0; i < e.length; i++) t.writeSVarint(e[i]);
2930
2968
  }
2931
- function _e(e, t) {
2969
+ function we(e, t) {
2932
2970
  for (var i = 0; i < e.length; i++) t.writeFloat(e[i]);
2933
2971
  }
2934
- function we(e, t) {
2972
+ function ke(e, t) {
2935
2973
  for (var i = 0; i < e.length; i++) t.writeDouble(e[i]);
2936
2974
  }
2937
- function ke(e, t) {
2975
+ function Me(e, t) {
2938
2976
  for (var i = 0; i < e.length; i++) t.writeBoolean(e[i]);
2939
2977
  }
2940
- function Me(e, t) {
2978
+ function Le(e, t) {
2941
2979
  for (var i = 0; i < e.length; i++) t.writeFixed32(e[i]);
2942
2980
  }
2943
- function Le(e, t) {
2981
+ function Be(e, t) {
2944
2982
  for (var i = 0; i < e.length; i++) t.writeSFixed32(e[i]);
2945
2983
  }
2946
2984
  function Pe(e, t) {
2947
2985
  for (var i = 0; i < e.length; i++) t.writeFixed64(e[i]);
2948
2986
  }
2949
- function Be(e, t) {
2987
+ function Se(e, t) {
2950
2988
  for (var i = 0; i < e.length; i++) t.writeSFixed64(e[i]);
2951
2989
  }
2952
- function X(e, t) {
2990
+ function J(e, t) {
2953
2991
  return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + e[t + 3] * 16777216;
2954
2992
  }
2955
- function $(e, t, i) {
2993
+ function E(e, t, i) {
2956
2994
  e[i] = t, e[i + 1] = t >>> 8, e[i + 2] = t >>> 16, e[i + 3] = t >>> 24;
2957
2995
  }
2958
2996
  function v0(e, t) {
2959
2997
  return (e[t] | e[t + 1] << 8 | e[t + 2] << 16) + (e[t + 3] << 24);
2960
2998
  }
2961
- function Se(e, t, i) {
2999
+ function Ve(e, t, i) {
2962
3000
  for (var a = "", n = t; n < i; ) {
2963
- var o = e[n], r = null, d = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
2964
- if (n + d > i) break;
2965
- var p, s, l;
2966
- d === 1 ? o < 128 && (r = o) : d === 2 ? (p = e[n + 1], (p & 192) === 128 && (r = (o & 31) << 6 | p & 63, r <= 127 && (r = null))) : d === 3 ? (p = e[n + 1], s = e[n + 2], (p & 192) === 128 && (s & 192) === 128 && (r = (o & 15) << 12 | (p & 63) << 6 | s & 63, (r <= 2047 || r >= 55296 && r <= 57343) && (r = null))) : d === 4 && (p = e[n + 1], s = e[n + 2], l = e[n + 3], (p & 192) === 128 && (s & 192) === 128 && (l & 192) === 128 && (r = (o & 15) << 18 | (p & 63) << 12 | (s & 63) << 6 | l & 63, (r <= 65535 || r >= 1114112) && (r = null))), r === null ? (r = 65533, d = 1) : r > 65535 && (r -= 65536, a += String.fromCharCode(r >>> 10 & 1023 | 55296), r = 56320 | r & 1023), a += String.fromCharCode(r), n += d;
3001
+ var o = e[n], s = null, c = o > 239 ? 4 : o > 223 ? 3 : o > 191 ? 2 : 1;
3002
+ if (n + c > i) break;
3003
+ var f, r, l;
3004
+ c === 1 ? o < 128 && (s = o) : c === 2 ? (f = e[n + 1], (f & 192) === 128 && (s = (o & 31) << 6 | f & 63, s <= 127 && (s = null))) : c === 3 ? (f = e[n + 1], r = e[n + 2], (f & 192) === 128 && (r & 192) === 128 && (s = (o & 15) << 12 | (f & 63) << 6 | r & 63, (s <= 2047 || s >= 55296 && s <= 57343) && (s = null))) : c === 4 && (f = e[n + 1], r = e[n + 2], l = e[n + 3], (f & 192) === 128 && (r & 192) === 128 && (l & 192) === 128 && (s = (o & 15) << 18 | (f & 63) << 12 | (r & 63) << 6 | l & 63, (s <= 65535 || s >= 1114112) && (s = null))), s === null ? (s = 65533, c = 1) : s > 65535 && (s -= 65536, a += String.fromCharCode(s >>> 10 & 1023 | 55296), s = 56320 | s & 1023), a += String.fromCharCode(s), n += c;
2967
3005
  }
2968
3006
  return a;
2969
3007
  }
2970
- function Ve(e, t, i) {
2971
- return k0.decode(e.subarray(t, i));
2972
- }
2973
3008
  function ze(e, t, i) {
3009
+ return M0.decode(e.subarray(t, i));
3010
+ }
3011
+ function Te(e, t, i) {
2974
3012
  for (var a = 0, n, o; a < t.length; a++) {
2975
3013
  if (n = t.charCodeAt(a), n > 55295 && n < 57344)
2976
3014
  if (o)
@@ -2988,34 +3026,58 @@ function ze(e, t, i) {
2988
3026
  }
2989
3027
  return i;
2990
3028
  }
2991
- const Te = /* @__PURE__ */ F0(he), Xe = (e) => {
3029
+ const Ce = /* @__PURE__ */ F0(pe), Ye = (e) => {
2992
3030
  var a, n;
2993
3031
  if (!e || !e.data)
2994
3032
  return {};
2995
3033
  const t = {}, i = e.data;
2996
3034
  if (i)
2997
3035
  for (const o of i) {
2998
- const r = (a = o == null ? void 0 : o.event) == null ? void 0 : a.country_code, d = (n = e.meta.metric_names) == null ? void 0 : n[0];
2999
- r && (t[r] = d ? o.event[d] : 0);
3036
+ const s = (a = o == null ? void 0 : o.event) == null ? void 0 : a.country_code, c = (n = e.meta.metric_names) == null ? void 0 : n[0];
3037
+ s && (t[s] = c ? o.event[c] : 0);
3000
3038
  }
3001
3039
  return t;
3002
3040
  };
3003
- function Ce(e, t = 0) {
3041
+ function De(e, t = 0) {
3004
3042
  let i = null;
3005
3043
  return (...a) => {
3006
3044
  i && clearTimeout(i), i = setTimeout(() => e(...a), t);
3007
3045
  };
3008
3046
  }
3009
- const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-map" }, Oe = {
3010
- key: 0,
3011
- class: "no-location-overlay"
3012
- }, Ue = { class: "no-location-overlay-title" }, Re = { class: "no-location-overlay-description" }, Ee = ["id"], Ae = {
3013
- key: 1,
3014
- class: "legend"
3015
- }, He = {
3047
+ const Ne = "#828a9e", Ue = "32px", Ie = { class: "legend" }, Oe = {
3016
3048
  key: 0,
3017
3049
  class: "legend-title"
3018
- }, $e = { class: "legend-text" }, Ge = /* @__PURE__ */ V0({
3050
+ }, Re = { class: "legend-text" }, Ee = /* @__PURE__ */ _0({
3051
+ __name: "MapLegend",
3052
+ props: {
3053
+ metric: {},
3054
+ title: {},
3055
+ data: {}
3056
+ },
3057
+ setup(e) {
3058
+ return (t, i) => (N(), A("div", Ie, [
3059
+ t.metric ? (N(), A("div", Oe, X(t.title), 1)) : a0("", !0),
3060
+ (N(!0), A(z0, null, T0(t.data, (a, n) => (N(), A("div", {
3061
+ key: n,
3062
+ class: "legend-item"
3063
+ }, [
3064
+ $("span", {
3065
+ class: "legend-color",
3066
+ style: C0({ backgroundColor: a.color })
3067
+ }, null, 4),
3068
+ $("span", Re, X(a.range), 1)
3069
+ ]))), 128))
3070
+ ]));
3071
+ }
3072
+ }), L0 = (e, t) => {
3073
+ const i = e.__vccOpts || e;
3074
+ for (const [a, n] of t)
3075
+ i[a] = n;
3076
+ return i;
3077
+ }, Ae = /* @__PURE__ */ L0(Ee, [["__scopeId", "data-v-5f034736"]]), $e = { class: "kong-ui-public-analytics-geo-map" }, He = {
3078
+ key: 0,
3079
+ class: "no-location-overlay"
3080
+ }, Ge = { class: "no-location-overlay-title" }, qe = { class: "no-location-overlay-description" }, Ke = ["id"], je = /* @__PURE__ */ _0({
3019
3081
  __name: "AnalyticsGeoMap",
3020
3082
  props: {
3021
3083
  countryMetrics: {},
@@ -3030,7 +3092,10 @@ const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-m
3030
3092
  },
3031
3093
  emits: ["boundsChange"],
3032
3094
  setup(e, { emit: t }) {
3033
- const i = import("./countries-simple-geo-BFUDnSiE.js").then((c) => c.default), a = t, { i18n: n } = J0.useI18n(), o = z0(), r = p0(), d = p0(null), p = L(() => Object.keys(e.countryMetrics).length === 0 && !e.fitToCountry), s = L(() => ({
3095
+ const i = import("./countries-simple-geo-BFUDnSiE.js").then((d) => d.default), a = t, { i18n: n } = p0.useI18n(), { getColor: o, formatMetric: s, legendData: c } = p0.useMetricUtils({
3096
+ countryMetrics: f0(() => e.countryMetrics),
3097
+ metric: f0(() => e.metric)
3098
+ }), f = D0(), r = h0(), l = h0(null), u = M(() => Object.keys(e.countryMetrics).length === 0 && !e.fitToCountry), p = M(() => ({
3034
3099
  "fill-color": [
3035
3100
  "match",
3036
3101
  [
@@ -3043,86 +3108,60 @@ const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-m
3043
3108
  ],
3044
3109
  ["get", "ISO_A2"]
3045
3110
  ],
3046
- ...Object.keys(e.countryMetrics).length ? Object.entries(e.countryMetrics).flatMap(([c, f]) => [
3047
- c,
3048
- g(f)
3111
+ ...Object.keys(e.countryMetrics).length ? Object.entries(e.countryMetrics).flatMap(([d, m]) => [
3112
+ d,
3113
+ o(m)
3049
3114
  ]) : ["#ccc", "#ccc"],
3050
3115
  "#ccc"
3051
3116
  // default color if no match
3052
3117
  ],
3053
3118
  "fill-opacity": 0.7
3054
- })), l = L(() => e.withLegend && Object.keys(e.countryMetrics).length > 0), u = L(() => Math.log(Math.min(...Object.values(e.countryMetrics)))), y = L(() => Math.log(Math.max(...Object.values(e.countryMetrics)))), g = (c) => {
3055
- const f = Math.log(c), x = (y.value - u.value) / 5;
3056
- return f >= u.value + 4 * x ? "#00819d" : f >= u.value + 3 * x ? "#00abd2" : f >= u.value + 2 * x ? "#00c8f4" : f >= u.value + 1 * x ? "#67e3ff" : "#b3f1ff";
3057
- }, T = L(() => e.metric && n.t(`metrics.${e.metric}`) || ""), I = L(() => {
3058
- const f = (y.value - u.value) / 5, m = [
3059
- u.value + 4 * f,
3060
- u.value + 3 * f,
3061
- u.value + 2 * f,
3062
- u.value + 1 * f,
3063
- u.value
3064
- ];
3065
- return m.map((x, w) => {
3066
- const B = w === 0 ? y.value : m[w - 1], F = Math.exp(x), M = Math.exp(B);
3067
- let k = "";
3068
- return w === 0 ? k = `> ${q(F)}` : w === m.length - 1 ? k = `< ${q(M)}` : k = `${q(F)} - ${q(M)}`, {
3069
- color: g(F),
3070
- range: k
3071
- };
3072
- });
3073
- }), M0 = L(() => {
3074
- var c;
3075
- return !((c = e.metric) != null && c.includes("latency"));
3076
- }), q = (c) => {
3077
- var m;
3078
- const f = Math.trunc(c);
3079
- return M0.value ? Q0(f, { capital: !0 }) : new Intl.NumberFormat(((m = document == null ? void 0 : document.documentElement) == null ? void 0 : m.lang) || "en-US").format(f);
3080
- }, c0 = (c) => {
3081
- const f = c.flat(1);
3082
- return Array.isArray(f[0]) && Array.isArray(f[0][0]) ? c0(f) : f;
3083
- }, d0 = (c) => {
3084
- var m, x, w, B, F, M, k;
3085
- if (c === "RU") {
3086
- (m = r.value) == null || m.fitBounds([
3119
+ })), y = M(() => e.withLegend && Object.keys(e.countryMetrics).length > 0), _ = M(() => e.metric && n.t(`metrics.${e.metric}`) || ""), w = (d) => {
3120
+ const m = d.flat(1);
3121
+ return Array.isArray(m[0]) && Array.isArray(m[0][0]) ? w(m) : m;
3122
+ }, S = (d) => {
3123
+ var x, g, G, U, z, I, q;
3124
+ if (d === "RU") {
3125
+ (x = r.value) == null || x.fitBounds([
3087
3126
  [20, 40],
3088
3127
  [180, 80]
3089
3128
  ]);
3090
3129
  return;
3091
- } else if (c === "US") {
3092
- (x = r.value) == null || x.fitBounds([
3130
+ } else if (d === "US") {
3131
+ (g = r.value) == null || g.fitBounds([
3093
3132
  [-130, 20],
3094
3133
  [-60, 50]
3095
3134
  ]);
3096
3135
  return;
3097
- } else if (c === "FR") {
3098
- (w = r.value) == null || w.fitBounds([
3136
+ } else if (d === "FR") {
3137
+ (G = r.value) == null || G.fitBounds([
3099
3138
  [-5, 42],
3100
3139
  [9, 51]
3101
3140
  ]);
3102
3141
  return;
3103
- } else if (c === "NO") {
3104
- (B = r.value) == null || B.fitBounds([
3142
+ } else if (d === "NO") {
3143
+ (U = r.value) == null || U.fitBounds([
3105
3144
  [4, 57],
3106
3145
  [32, 71]
3107
3146
  ]);
3108
3147
  return;
3109
3148
  }
3110
- const f = (F = d.value) == null ? void 0 : F.features.find((_) => {
3111
- var S, V, z, D, N;
3112
- return (S = _.properties) != null && S.ISO_A2 ? ((V = _.properties) == null ? void 0 : V.ISO_A2) === c : ((z = _.properties) == null ? void 0 : z.iso_a2) === "-99" ? ((D = _.properties) == null ? void 0 : D.iso_a2_eh) === c : ((N = _.properties) == null ? void 0 : N.iso_a2) === c;
3149
+ const m = (z = l.value) == null ? void 0 : z.features.find((F) => {
3150
+ var L, B, P, T, C;
3151
+ return (L = F.properties) != null && L.ISO_A2 ? ((B = F.properties) == null ? void 0 : B.ISO_A2) === d : ((P = F.properties) == null ? void 0 : P.iso_a2) === "-99" ? ((T = F.properties) == null ? void 0 : T.iso_a2_eh) === d : ((C = F.properties) == null ? void 0 : C.iso_a2) === d;
3113
3152
  });
3114
- if (f) {
3115
- const _ = (M = f.geometry) == null ? void 0 : M.coordinates;
3116
- if (!_) return;
3117
- const S = c0(_), V = S.map((O) => O[1]), z = S.map((O) => O[0]), D = Math.min(...V), N = Math.max(...V), j = Math.min(...z), W = Math.max(...z);
3118
- (k = r.value) == null || k.fitBounds([
3119
- [j, D],
3120
- [W, N]
3153
+ if (m) {
3154
+ const F = (I = m.geometry) == null ? void 0 : I.coordinates;
3155
+ if (!F) return;
3156
+ const L = w(F), B = L.map((O) => O[1]), P = L.map((O) => O[0]), T = Math.min(...B), C = Math.max(...B), j = Math.min(...P), W = Math.max(...P);
3157
+ (q = r.value) == null || q.fitBounds([
3158
+ [j, T],
3159
+ [W, C]
3121
3160
  ]);
3122
3161
  }
3123
- }, C = L(() => {
3124
- const c = {
3125
- container: o,
3162
+ }, V = M(() => {
3163
+ const d = {
3164
+ container: f,
3126
3165
  style: { version: 8, sources: {}, layers: [] },
3127
3166
  attributionControl: !1,
3128
3167
  // fit bounds for whole world minus antarctica
@@ -3138,33 +3177,33 @@ const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-m
3138
3177
  "CooperativeGesturesHandler.MobileHelpText": n.t("cooperative_gestures.mobile_zoom_help_text")
3139
3178
  }
3140
3179
  };
3141
- return e.bounds && (c.bounds = e.bounds), c;
3142
- }), L0 = Ce(() => {
3180
+ return e.bounds && (d.bounds = e.bounds), d;
3181
+ }), B0 = De(() => {
3143
3182
  if (!r.value) return;
3144
- const c = r.value.getBounds(), f = c.getSouthWest(), m = c.getNorthEast();
3183
+ const d = r.value.getBounds(), m = d.getSouthWest(), x = d.getNorthEast();
3145
3184
  a("boundsChange", [
3146
- [f.lng, f.lat],
3147
- [m.lng, m.lat]
3185
+ [m.lng, m.lat],
3186
+ [x.lng, x.lat]
3148
3187
  ]);
3149
3188
  }, 300);
3150
- return T0(async () => {
3151
- var c, f, m;
3189
+ return N0(async () => {
3190
+ var d, m, x;
3152
3191
  try {
3153
- const x = await i, w = await fetch(x), B = new Uint8Array(await w.arrayBuffer()), F = fe(new Te(B));
3154
- d.value = F, r.value = new U0(C.value), r.value.on("load", () => {
3155
- var k, _, S, V, z, D, N;
3156
- (k = r.value) == null || k.addSource("countries", {
3192
+ const g = await i, G = await fetch(g), U = new Uint8Array(await G.arrayBuffer()), z = he(new Ce(U));
3193
+ l.value = z, r.value = new R0(V.value), r.value.on("load", () => {
3194
+ var q, F, L, B, P, T, C;
3195
+ (q = r.value) == null || q.addSource("countries", {
3157
3196
  type: "geojson",
3158
- data: F
3159
- }), (_ = r.value) == null || _.addLayer({
3197
+ data: z
3198
+ }), (F = r.value) == null || F.addLayer({
3160
3199
  id: "countries-layer",
3161
3200
  type: "fill",
3162
3201
  source: "countries",
3163
- paint: s.value
3164
- }), (S = r.value) == null || S.addSource("lakes", {
3202
+ paint: p.value
3203
+ }), (L = r.value) == null || L.addSource("lakes", {
3165
3204
  type: "geojson",
3166
- data: ee
3167
- }), (V = r.value) == null || V.addLayer({
3205
+ data: te
3206
+ }), (B = r.value) == null || B.addLayer({
3168
3207
  id: "lakes-layer",
3169
3208
  type: "fill",
3170
3209
  source: "lakes",
@@ -3172,36 +3211,36 @@ const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-m
3172
3211
  "fill-color": "#FFFFFF"
3173
3212
  }
3174
3213
  });
3175
- const M = new R0({
3214
+ const I = new E0({
3176
3215
  closeButton: !1,
3177
3216
  closeOnClick: !1
3178
3217
  });
3179
- (z = r.value) == null || z.on("mousemove", "countries-layer", (j) => {
3218
+ (P = r.value) == null || P.on("mousemove", "countries-layer", (j) => {
3180
3219
  var O;
3181
3220
  const W = (O = j.features) == null ? void 0 : O[0];
3182
3221
  if (W) {
3183
- const { iso_a2: f0, iso_a2_eh: P0, ISO_A2: B0, admin: h0 } = W.properties, S0 = B0 ?? f0 === "-99" ? P0 : f0, t0 = e.countryMetrics[S0];
3222
+ const { iso_a2: c0, iso_a2_eh: P0, ISO_A2: S0, admin: d0 } = W.properties, V0 = S0 ?? c0 === "-99" ? P0 : c0, t0 = e.countryMetrics[V0];
3184
3223
  if (t0 !== void 0) {
3185
3224
  let i0;
3186
- e.showTooltipValue ? i0 = `<strong data-testid="geo-map-tooltip">${h0}</strong>: ${q(t0)} ${n.t(`metricUnits.${e.metricUnit}`, { plural: t0 > 1 ? "s" : "" })}` : i0 = `<strong data-testid="geo-map-tooltip">${h0}</strong>`, M.setLngLat(j.lngLat).setHTML(i0).addTo(r.value);
3225
+ e.showTooltipValue ? i0 = `<strong data-testid="geo-map-tooltip">${d0}</strong>: ${s(t0)} ${n.t(`metricUnits.${e.metricUnit}`, { plural: t0 > 1 ? "s" : "" })}` : i0 = `<strong data-testid="geo-map-tooltip">${d0}</strong>`, I.setLngLat(j.lngLat).setHTML(i0).addTo(r.value);
3187
3226
  } else
3188
- M.remove();
3227
+ I.remove();
3189
3228
  }
3190
- }), (D = r.value) == null || D.on("mouseleave", "countries-layer", () => {
3191
- M.remove();
3192
- }), (N = r.value) == null || N.on("move", L0), e.fitToCountry && d0(e.fitToCountry);
3193
- }), (c = r.value) == null || c.dragRotate.disable(), (f = r.value) == null || f.keyboard.disable(), (m = r.value) == null || m.touchZoomRotate.disableRotation();
3194
- } catch (x) {
3195
- console.error(x);
3229
+ }), (T = r.value) == null || T.on("mouseleave", "countries-layer", () => {
3230
+ I.remove();
3231
+ }), (C = r.value) == null || C.on("move", B0), e.fitToCountry && S(e.fitToCountry);
3232
+ }), (d = r.value) == null || d.dragRotate.disable(), (m = r.value) == null || m.keyboard.disable(), (x = r.value) == null || x.touchZoomRotate.disableRotation();
3233
+ } catch (g) {
3234
+ console.error(g);
3196
3235
  }
3197
3236
  }), n0(() => e.countryMetrics, () => {
3198
- var c;
3237
+ var d;
3199
3238
  r.value && r.value.isStyleLoaded() && (r.value.getLayer("countries-layer") && r.value.removeLayer("countries-layer"), r.value.addLayer({
3200
3239
  id: "countries-layer",
3201
3240
  type: "fill",
3202
3241
  source: "countries",
3203
- paint: s.value
3204
- }), r.value.removeLayer("lakes-layer"), (c = r.value) == null || c.addLayer({
3242
+ paint: p.value
3243
+ }), r.value.removeLayer("lakes-layer"), (d = r.value) == null || d.addLayer({
3205
3244
  id: "lakes-layer",
3206
3245
  type: "fill",
3207
3246
  source: "lakes",
@@ -3209,62 +3248,51 @@ const De = "#828a9e", Ne = "32px", Ie = { class: "kong-ui-public-analytics-geo-m
3209
3248
  "fill-color": "#FFFFFF"
3210
3249
  }
3211
3250
  }));
3212
- }), n0(() => e.fitToCountry, (c) => {
3213
- var f, m, x;
3214
- r.value && c ? d0(c) : !C.value.center && !C.value.zoom ? (f = r.value) == null || f.fitBounds([
3251
+ }), n0(() => e.fitToCountry, (d) => {
3252
+ var m, x, g;
3253
+ r.value && d ? S(d) : !V.value.center && !V.value.zoom ? (m = r.value) == null || m.fitBounds([
3215
3254
  [-180, -90],
3216
3255
  [180, 90]
3217
- ]) : (C.value.zoom && ((m = r.value) == null || m.setZoom(C.value.zoom)), C.value.center && ((x = r.value) == null || x.flyTo({ center: C.value.center })));
3218
- }), n0(() => e.bounds, (c, f) => {
3219
- if (!c) return;
3220
- const m = c == null ? void 0 : c.flat(), x = f == null ? void 0 : f.flat();
3221
- !(m && x && m.length === x.length && m.every((B, F) => Math.round(B * 100) / 100 === Math.round(x[F] * 100) / 100)) && r.value && r.value.fitBounds(c);
3222
- }), (c, f) => (R(), U("div", Ie, [
3223
- p.value ? (R(), U("div", Oe, [
3224
- a0(c.$slots, "no-location-icon", {}, () => [
3225
- C0(A(H0), {
3226
- color: A(De),
3227
- size: A(Ne)
3256
+ ]) : (V.value.zoom && ((x = r.value) == null || x.setZoom(V.value.zoom)), V.value.center && ((g = r.value) == null || g.flyTo({ center: V.value.center })));
3257
+ }), n0(() => e.bounds, (d, m) => {
3258
+ if (!d) return;
3259
+ const x = d == null ? void 0 : d.flat(), g = m == null ? void 0 : m.flat();
3260
+ !(x && g && x.length === g.length && x.every((U, z) => Math.round(U * 100) / 100 === Math.round(g[z] * 100) / 100)) && r.value && r.value.fitBounds(d);
3261
+ }), (d, m) => (N(), A("div", $e, [
3262
+ u.value ? (N(), A("div", He, [
3263
+ r0(d.$slots, "no-location-icon", {}, () => [
3264
+ I0(D(H0), {
3265
+ color: D(Ne),
3266
+ size: D(Ue)
3228
3267
  }, null, 8, ["color", "size"])
3229
3268
  ], !0),
3230
- E("div", Ue, [
3231
- a0(c.$slots, "no-location-title", {}, () => [
3232
- D0(Z(A(n).t("no_location_data")), 1)
3269
+ $("div", Ge, [
3270
+ r0(d.$slots, "no-location-title", {}, () => [
3271
+ O0(X(D(n).t("no_location_data")), 1)
3233
3272
  ], !0)
3234
3273
  ]),
3235
- E("div", Re, [
3236
- a0(c.$slots, "no-location-description", {}, () => [
3237
- E("p", null, Z(A(n).t("no_location_data_description")), 1)
3274
+ $("div", qe, [
3275
+ r0(d.$slots, "no-location-description", {}, () => [
3276
+ $("p", null, X(D(n).t("no_location_data_description")), 1)
3238
3277
  ], !0)
3239
3278
  ])
3240
- ])) : r0("", !0),
3241
- E("div", {
3242
- id: A(o),
3279
+ ])) : a0("", !0),
3280
+ $("div", {
3281
+ id: D(f),
3243
3282
  class: "analytics-geo-map-container"
3244
- }, null, 8, Ee),
3245
- l.value ? (R(), U("div", Ae, [
3246
- c.metric ? (R(), U("div", He, Z(T.value), 1)) : r0("", !0),
3247
- (R(!0), U(N0, null, I0(I.value, (m, x) => (R(), U("div", {
3248
- key: x,
3249
- class: "legend-item"
3250
- }, [
3251
- E("span", {
3252
- class: "legend-color",
3253
- style: O0({ backgroundColor: m.color })
3254
- }, null, 4),
3255
- E("span", $e, Z(m.range), 1)
3256
- ]))), 128))
3257
- ])) : r0("", !0)
3283
+ }, null, 8, Ke),
3284
+ y.value ? (N(), U0(Ae, {
3285
+ key: 1,
3286
+ class: "legend-container",
3287
+ data: D(c),
3288
+ metric: d.metric,
3289
+ title: _.value
3290
+ }, null, 8, ["data", "metric", "title"])) : a0("", !0)
3258
3291
  ]));
3259
3292
  }
3260
- }), qe = (e, t) => {
3261
- const i = e.__vccOpts || e;
3262
- for (const [a, n] of t)
3263
- i[a] = n;
3264
- return i;
3265
- }, Qe = /* @__PURE__ */ qe(Ge, [["__scopeId", "data-v-0fc07407"]]);
3293
+ }), be = /* @__PURE__ */ L0(je, [["__scopeId", "data-v-bd038b4a"]]);
3266
3294
  export {
3267
- Qe as AnalyticsGeoMap,
3268
- Ce as debounce,
3269
- Xe as exploreResultToCountryMetrics
3295
+ be as AnalyticsGeoMap,
3296
+ De as debounce,
3297
+ Ye as exploreResultToCountryMetrics
3270
3298
  };