"use client";
import { jsx as P, jsxs as un, Fragment as lt } from "react/jsx-runtime";
import { forwardRef as Un, useRef as nn, useEffect as pn, memo as Jt, useCallback as mn, useState as ne, useMemo as en, useLayoutEffect as te } from "react";
import { W as ee, X as re, Y as oe, Z as ie, _ as le } from "./vendor-base-ui-elpbzr8xeffrz4h2.js";
import { c as dn } from "./vendor-styling-ofvnbcuht98q88oo.js";
var Ot = /* @__PURE__ */ ((n) => (n.Attention = "#FC574A", n.Warning = "#F8A054", n.Success = "#00A63E", n.Neutral = "#B9D6FF", n.Disabled = "#CBCBCB", n.Skeleton = "#DDDDDD", n))(Ot || {}), Bt = /* @__PURE__ */ ((n) => (n.Attention = "#FC574A", n.Warning = "#F8A054", n.Success = "#00A63E", n.Neutral = "#8EC5FF", n.Disabled = "#878787", n.Skeleton = "#5C5C5C", n))(Bt || {});
const ae = {
  blues: ["#E1EAF4", "#8EBCF6", "#4290F0", "#0E58B4", "#03254F"]
}, ue = {
  blues: ["#03254F", "#0E58B4", "#4290F0", "#A6BFDD", "#E1EAF4"]
}, se = {
  light: "#E5E7EB",
  dark: "#2B2C31"
}, ce = {
  light: ["#C8DEFB", "#8FBDF6", "#4290F0", "#1E60BE", "#0A3A7A"],
  dark: ["#26456C", "#2C68BE", "#4290F0", "#79AEF4", "#BBD6FA"]
}, jn = [
  "#4290F0",
  "#F5B647",
  "#E8649D",
  "#8D58EE",
  "#50C3B6",
  "#D37536"
  /* Orange */
], Jn = [
  "#4290F0",
  "#EEB720",
  "#E8649D",
  "#8D58EE",
  "#50C3B6",
  "#D37536"
  /* Orange */
];
var gn;
((n) => {
  function t(a, s = !1) {
    return s ? Bt[a] : Ot[a];
  }
  n.semantic = t;
  function r(a, s = !1) {
    return s ? Jn[a % Jn.length] : jn[a % jn.length];
  }
  n.categorical = r;
  function e(a, s = !1) {
    return s ? [...ue[a]] : [...ae[a]];
  }
  n.sequential = e;
  function o(a, s = !1) {
    const h = {
      light: { primary: "#6B7280", secondary: "#9CA3AF" },
      dark: { primary: "#9CA3AF", secondary: "#6B7280" }
    };
    return s ? h.dark[a] : h.light[a];
  }
  n.text = o;
  function l(a = !1) {
    const s = a ? "dark" : "light";
    return {
      area: se[s],
      bubble: r(0, a),
      scale: [...ce[s]]
    };
  }
  n.mapColors = l;
})(gn || (gn = {}));
const pt = (n) => {
  const { dangerousHtmlFormatter: t, ...r } = n;
  return {
    ...r,
    formatter: t
  };
}, fe = ({
  options: n,
  isDarkMode: t
}) => {
  const r = {
    backgroundColor: "transparent",
    color: t ? Jn : jn,
    ...n
  };
  return r.tooltip ? {
    ...r,
    tooltip: Array.isArray(r.tooltip) ? r.tooltip.map(pt) : pt(r.tooltip)
  } : r;
}, Ln = Un(function({
  echarts: t,
  options: r,
  optionUpdateBehavior: e,
  className: o,
  isDarkMode: l,
  height: a = 350,
  aspectRatio: s,
  onEvents: h
}, p) {
  const i = nn(null), u = nn(null), c = nn({}), m = nn({}), d = nn(/* @__PURE__ */ new Set());
  return pn(() => {
    if (!i.current) return;
    const S = t.init(i.current, l ? "dark" : void 0);
    return u.current = S, typeof p == "function" ? p(S) : p && (p.current = S), () => {
      for (const v of d.current) {
        const w = m.current[v];
        w && S.off(v, w);
      }
      d.current.clear(), typeof p == "function" ? p(null) : p && (p.current = null), u.current = null, S.dispose();
    };
  }, [i, l]), pn(() => {
    const S = u.current;
    S && S.setOption(fe({ options: r, isDarkMode: l }), {
      notMerge: !1,
      lazyUpdate: !0,
      ...e
    });
  }, [l, e, r]), pn(() => {
    c.current = h ?? {};
  }, [h]), pn(() => {
    const S = u.current;
    if (!S) return;
    const v = /* @__PURE__ */ new Set();
    for (const [w, y] of Object.entries(h ?? {}))
      typeof y == "function" && (v.add(w), m.current[w] || (m.current[w] = (M) => {
        c.current[w]?.(M);
      }), d.current.has(w) || S.on(w, m.current[w]));
    for (const w of d.current) {
      if (v.has(w)) continue;
      const y = m.current[w];
      y && S.off(w, y);
    }
    d.current = v;
  }, [t, l, h]), pn(() => {
    const S = u.current, v = i.current;
    if (!S || !v) return;
    let w = !0;
    const y = new ResizeObserver(() => {
      if (w) {
        w = !1;
        return;
      }
      S.resize();
    });
    return y.observe(v), () => y.disconnect();
  }, []), /* @__PURE__ */ P(
    "div",
    {
      ref: i,
      className: dn("w-full", o),
      style: s !== void 0 ? { aspectRatio: String(s) } : { height: a },
      tabIndex: r.aria?.enabled ? 0 : void 0,
      role: r.aria?.enabled ? "img" : void 0
    }
  );
});
Ln.displayName = "Chart";
function pe(n, t) {
  if (n.length === 0) return;
  const r = {
    backgroundColor: t.labelBackgroundColor,
    padding: [2, 4],
    borderRadius: 6,
    shadowBlur: 8,
    shadowColor: t.labelBackgroundColor
  };
  return {
    markLine: {
      symbol: "none",
      silent: !1,
      animation: !1,
      z: 10,
      lineStyle: {
        type: "dashed",
        color: t.color,
        width: 1
      },
      emphasis: {
        lineStyle: { width: 2 }
      },
      blur: {
        lineStyle: { opacity: 1 },
        label: { opacity: 1 }
      },
      label: {
        show: !0,
        formatter: (e) => e.name ?? "",
        position: "insideEndTop",
        color: t.color,
        ...r
      },
      data: n.map((e) => ({
        name: e.label,
        xAxis: e.timestamp,
        lineStyle: {
          type: e.lineStyle ?? "dashed",
          color: e.color ?? t.color,
          width: 1
        },
        emphasis: {
          lineStyle: { width: 2 }
        },
        blur: {
          lineStyle: { opacity: 1 },
          label: { opacity: 1 }
        },
        label: {
          show: !!e.label,
          color: e.color ?? t.color,
          ...r
        },
        tooltip: { marker: e }
      }))
    }
  };
}
function de(n, t) {
  if (!n?.length) return [];
  const r = [...n].sort((o, l) => o.timestamp - l.timestamp), e = [];
  for (const o of r) {
    const l = e.at(-1);
    l && o.timestamp - l[l.length - 1].timestamp <= t ? l.push(o) : e.push([o]);
  }
  return e.map((o) => {
    const l = o[0];
    return {
      timestamp: l.timestamp,
      label: o.length === 1 ? l.label : `${o.length} changes`,
      color: l.color,
      lineStyle: l.lineStyle,
      markers: o
    };
  });
}
function me(n, t) {
  return n.length < 2 ? 0 : (Math.max(...n) - Math.min(...n)) / t;
}
function dt(n) {
  if (n.componentType === "markLine")
    return n.data?.tooltip?.marker;
}
const he = Jt(function({
  state: t,
  formatValue: r,
  formatTimestamp: e
}) {
  return t.type === "marker" ? /* @__PURE__ */ P(
    ge,
    {
      state: t,
      formatValue: r,
      formatTimestamp: e
    }
  ) : /* @__PURE__ */ un(lt, { children: [
    /* @__PURE__ */ P("div", { className: "text-xs font-semibold text-kumo-default mb-1", children: e(t.ts) }),
    /* @__PURE__ */ P(
      Pt,
      {
        rows: t.rows,
        hiddenCount: t.hiddenCount,
        formatValue: r
      }
    )
  ] });
});
function ge({
  state: n,
  formatValue: t,
  formatTimestamp: r
}) {
  return /* @__PURE__ */ un(lt, { children: [
    n.markers.length === 1 && /* @__PURE__ */ P("div", { className: "text-xs font-semibold text-kumo-default mb-1", children: r(n.markers[0].timestamp) }),
    /* @__PURE__ */ P("div", { className: "space-y-1", children: n.markers.map((e, o) => /* @__PURE__ */ un("div", { children: [
      /* @__PURE__ */ un("div", { className: "flex items-center gap-2 text-xs text-kumo-default", children: [
        /* @__PURE__ */ P(
          "span",
          {
            className: "w-3 h-3 rounded-full shrink-0",
            style: { backgroundColor: e.color ?? n.color }
          }
        ),
        /* @__PURE__ */ P("span", { className: "font-medium", children: e.label ?? "Reference marker" }),
        n.markers.length > 1 && /* @__PURE__ */ P("span", { className: "text-kumo-subtle", children: r(e.timestamp) })
      ] }),
      e.description && /* @__PURE__ */ P("div", { className: "text-xs text-kumo-default mt-0.5 ml-5", children: e.description })
    ] }, `${e.timestamp}-${e.label}-${o}`)) }),
    n.rows.length > 0 && /* @__PURE__ */ P("div", { className: "border-t border-kumo-line mt-2 pt-2", children: /* @__PURE__ */ P(
      Pt,
      {
        rows: n.rows,
        hiddenCount: n.hiddenCount,
        formatValue: t
      }
    ) })
  ] });
}
function Pt({
  rows: n,
  hiddenCount: t,
  formatValue: r
}) {
  return /* @__PURE__ */ un(lt, { children: [
    n.map((e) => /* @__PURE__ */ un(
      "div",
      {
        className: "flex items-center justify-between gap-4 py-0.5",
        children: [
          /* @__PURE__ */ un("div", { className: "flex items-center gap-2 min-w-0", children: [
            /* @__PURE__ */ P(
              "span",
              {
                className: "w-3 h-3 rounded-full shrink-0",
                style: { backgroundColor: e.color }
              }
            ),
            /* @__PURE__ */ P(
              "span",
              {
                className: "text-xs font-medium text-kumo-default truncate",
                title: e.name,
                children: e.name
              }
            )
          ] }),
          /* @__PURE__ */ P("span", { className: "text-xs font-semibold text-kumo-default shrink-0", children: r ? r(e.value) : ye(e.value) })
        ]
      },
      e.name
    )),
    t > 0 && /* @__PURE__ */ un("div", { className: "text-xs text-kumo-subtle mt-1", children: [
      "+",
      t,
      " more"
    ] })
  ] });
}
const ve = new Intl.NumberFormat(void 0, {
  maximumFractionDigits: 3
});
function ye(n) {
  return Number.isInteger(n) ? String(n) : ve.format(n);
}
function Se(n) {
  if (n?.length)
    return {
      markLine: {
        symbol: "none",
        silent: !0,
        animation: !1,
        z: 9,
        lineStyle: {
          type: "dashed",
          width: 1
        },
        blur: {
          lineStyle: { opacity: 1 },
          label: { opacity: 1 }
        },
        label: {
          show: !0,
          position: "insideEndTop",
          formatter: (t) => t.name ?? ""
        },
        data: n.map((t) => ({
          name: t.label,
          yAxis: t.value,
          lineStyle: {
            color: t.color,
            width: 1,
            type: "dashed"
          },
          blur: {
            lineStyle: { opacity: 1 },
            label: { opacity: 1 }
          },
          label: {
            show: !!t.label,
            color: t.color
          }
        }))
      }
    };
}
function xe(n) {
  if (!n?.length) return;
  const t = n.map((r) => r.value);
  return {
    min: Math.min(...t),
    max: Math.max(...t)
  };
}
const mt = 5, we = Un(function({
  echarts: t,
  type: r = "line",
  data: e,
  markers: o,
  thresholds: l,
  xAxisName: a,
  xAxisTickCount: s,
  xAxisTickFormat: h,
  yAxisTickFormat: p,
  yAxisTickLabelFormat: i,
  yAxisName: u,
  yAxisTickCount: c,
  tooltipValueFormat: m,
  onTimeRangeChange: d,
  height: S = 350,
  incomplete: v,
  enableLegendSelection: w = !1,
  isDarkMode: y,
  gradient: M,
  loading: E,
  ariaDescription: b,
  optionUpdateBehavior: C,
  tooltipMode: L = "all",
  tooltipMaxItems: A = 10,
  tooltipFollowCursor: $ = "both",
  tooltipBoundary: N
}, x) {
  const B = nn(null), I = nn(null), T = mn(
    (O) => {
      B.current = O, typeof x == "function" ? x(O) : x && (x.current = O);
    },
    [x]
  ), f = nn(e);
  f.current = e;
  const g = nn(null);
  pn(() => {
    g.current = null;
  }, [w, y]);
  const R = nn(!1), k = nn(null), F = nn(L);
  F.current = L;
  const K = nn(A);
  K.current = A;
  const [Q, V] = ne(null), Y = nn({ x: 0, y: 0 });
  pn(() => {
    const O = I.current;
    if (!O) return;
    const D = (X) => {
      const J = O.getBoundingClientRect();
      Y.current = {
        x: X.clientX - J.left,
        y: X.clientY - J.top
      };
    };
    return O.addEventListener("mousemove", D), () => O.removeEventListener("mousemove", D);
  }, []);
  const tn = v?.before, W = v?.after, ln = gn.text("primary", y), rn = y ? "rgba(0, 0, 0, 0.5)" : "rgba(255, 255, 255, 0.5)", on = en(() => {
    const O = [], D = r === "bar" ? { type: "bar", stack: "total" } : { type: "line", showSymbol: !1 }, X = Se(l), J = xe(l), hn = de(
      o,
      me(
        Me(e, o),
        s ?? mt
      )
    ), wn = pe(hn, {
      color: ln,
      labelBackgroundColor: rn
    });
    for (const _ of e) {
      const vn = tn && r === "line" ? _.data.filter((Kn) => Kn[0] <= tn) : [], Cn = W && r === "line" ? _.data.filter((Kn) => Kn[0] >= W) : [], Fn = vn.length > 0 || Cn.length > 0 ? _.data.slice(
        Math.max(0, vn.length - 1),
        Math.max(0, _.data.length - Cn.length + 1)
      ) : _.data, Nn = M && r === "line" ? {
        color: new t.graphic.LinearGradient(0, 0, 0, 1, [
          { offset: 0, color: ht(_.color, 0.4) },
          { offset: 1, color: ht(_.color, 0) }
        ])
      } : void 0;
      O.push({
        data: Fn,
        color: _.color,
        name: _.name,
        emphasis: { focus: "series" },
        ...Nn ? { areaStyle: Nn } : {},
        ...D
      });
      const ft = {
        color: _.color,
        name: _.name,
        type: "line",
        lineStyle: { type: "dashed" },
        showSymbol: !1,
        emphasis: { focus: "series" }
      };
      vn.length > 0 && O.push({
        ...ft,
        data: vn
      }), Cn.length > 0 && O.push({
        ...ft,
        data: Cn
      });
    }
    return wn && O.push({
      data: [],
      name: "Markers",
      type: r === "bar" ? "bar" : "line",
      animation: !1,
      markLine: wn.markLine
    }), X && O.push({
      data: [],
      name: "Thresholds",
      type: r === "bar" ? "bar" : "line",
      animation: !1,
      markLine: X.markLine
    }), {
      aria: {
        enabled: !0,
        ...b && { label: { description: b } }
      },
      brush: {
        xAxisIndex: "all",
        brushType: "lineX",
        brushMode: "single",
        outOfBrush: {
          colorAlpha: 0.3
        },
        brushStyle: {
          borderWidth: 1,
          color: "rgba(120,140,180,0.3)",
          borderColor: "rgba(120,140,180,0.8)"
        }
      },
      tooltip: {
        trigger: "axis",
        showContent: !1,
        axisPointer: { type: "shadow" }
      },
      backgroundColor: "transparent",
      toolbox: { show: !1 },
      ...w ? { legend: { show: !1 } } : {},
      xAxis: {
        name: a,
        nameLocation: "middle",
        nameGap: 30,
        type: "time",
        splitLine: {
          show: !1
        },
        axisLine: { show: !1 },
        splitNumber: s ?? mt,
        ...h && {
          axisLabel: {
            formatter: (_) => h(_)
          }
        }
      },
      yAxis: {
        name: u,
        nameLocation: "middle",
        nameGap: 40,
        type: "value",
        axisTick: { show: !0 },
        axisLabel: {
          margin: 15,
          ...p && {
            formatter: (_) => p(_)
          }
        },
        splitLine: {
          show: !0,
          lineStyle: { type: "dashed", width: 1 }
        },
        splitNumber: c,
        ...J && {
          min: (_) => Math.min(_.min, J.min),
          max: (_) => Math.max(_.max, J.max)
        }
      },
      grid: {
        left: u ? 30 : 24,
        right: 24,
        top: 24,
        bottom: a ? 30 : 24
      },
      series: O
    };
  }, [
    e,
    a,
    s,
    h,
    p,
    u,
    c,
    tn,
    W,
    r,
    M,
    w,
    t,
    b,
    o,
    l,
    ln,
    rn
  ]), Sn = en(() => ({
    updateaxispointer: (O) => {
      if (R.current) return;
      const D = O?.axesInfo?.[0]?.value;
      if (D == null) return;
      const X = zt(
        f.current,
        D,
        g.current
      );
      let J, hn = 0;
      if (F.current === "single") {
        const _ = B.current, vn = _ ? _.convertFromPixel("grid", [0, Y.current.y])?.[1] : null;
        vn != null && X.length > 0 ? J = [X.reduce(
          (Fn, Nn) => Math.abs(Nn.value - vn) < Math.abs(Fn.value - vn) ? Nn : Fn
        )] : J = X.slice(0, 1);
      } else
        ({ rows: J, hiddenCount: hn } = Dt(
          X,
          K.current
        ));
      const wn = {
        type: "series",
        ts: D,
        rows: J,
        hiddenCount: hn
      };
      V((_) => Ne(_, wn) ? _ : wn);
    },
    mouseover: (O) => {
      const D = dt(O);
      if (!D) return;
      const X = `${D.timestamp}-${D.label ?? ""}`;
      if (k.current === X) return;
      k.current = X, R.current = !0, B.current?.dispatchAction({ type: "hideTip" }), B.current?.dispatchAction({
        type: "updateAxisPointer",
        currTrigger: "leave"
      });
      const { rows: J, hiddenCount: hn } = be(
        f.current,
        D.timestamp,
        g.current,
        K.current
      );
      V({
        type: "marker",
        ts: D.timestamp,
        color: D.color ?? ln,
        markers: D.markers,
        rows: J,
        hiddenCount: hn
      });
    },
    mouseout: (O) => {
      dt(O) && (k.current = null, R.current = !1, V(null));
    },
    globalout: () => {
      k.current = null, R.current = !1, V(null);
    },
    // Keep the tooltip in sync with legend selection. Each action fires a
    // different event — `legendToggleSelect` → `legendselectchanged`,
    // `legendSelect` → `legendselected`, `legendUnSelect` → `legendunselected`
    // — and all three carry the full `selected` map, so we listen to all of
    // them (params type inferred from `ChartEvents`).
    legendselectchanged: (O) => {
      g.current = O.selected;
    },
    legendselected: (O) => {
      g.current = O.selected;
    },
    legendunselected: (O) => {
      g.current = O.selected;
    },
    ...d && {
      brushend: (O) => {
        const D = O.areas[0].coordRange;
        d(D[0], D[1]), B.current?.dispatchAction({ type: "brush", areas: [] });
      }
    }
  }), [d, ln]), xn = !!d;
  pn(() => {
    const O = B.current;
    if (O && xn)
      return O.dispatchAction({
        type: "takeGlobalCursor",
        key: "brush",
        brushOption: {
          brushType: "lineX",
          brushMode: "single"
        }
      }), () => {
        O.dispatchAction({
          type: "takeGlobalCursor",
          key: "brush",
          brushOption: {
            brushType: !1
          }
        });
      };
  }, [B, xn, E]);
  const j = m ?? i, an = Q !== null;
  return /* @__PURE__ */ un(
    ee,
    {
      open: an,
      trackCursorAxis: $,
      children: [
        /* @__PURE__ */ un(
          re,
          {
            render: /* @__PURE__ */ P(
              "div",
              {
                ref: I,
                className: "relative w-full",
                style: { height: S }
              }
            ),
            children: [
              E && /* @__PURE__ */ P(Ae, { height: S, isDarkMode: y }),
              !E && /* @__PURE__ */ P(
                Ln,
                {
                  echarts: t,
                  ref: T,
                  options: on,
                  height: S,
                  isDarkMode: y,
                  onEvents: Sn,
                  optionUpdateBehavior: C
                }
              )
            ]
          }
        ),
        an && /* @__PURE__ */ P(oe, { children: /* @__PURE__ */ P(
          ie,
          {
            side: "right",
            align: "start",
            sideOffset: 12,
            collisionAvoidance: { side: "flip", align: "shift" },
            collisionBoundary: N,
            collisionPadding: 8,
            children: /* @__PURE__ */ P(
              le,
              {
                "data-mode": y ? "dark" : "light",
                className: "bg-kumo-base rounded-lg shadow-lg shadow-kumo-tip-shadow outline outline-1 outline-kumo-fill p-2 min-w-[150px] max-w-xs",
                children: /* @__PURE__ */ P(
                  he,
                  {
                    state: Q,
                    formatValue: j,
                    formatTimestamp: Re
                  }
                )
              }
            )
          }
        ) })
      ]
    }
  );
});
we.displayName = "TimeseriesChart";
function Ee(n, t) {
  if (n.length === 0) return null;
  let r = 0, e = n.length - 1;
  for (; r < e; ) {
    const o = r + e >> 1;
    n[o][0] < t ? r = o + 1 : e = o;
  }
  return r > 0 && Math.abs(n[r - 1][0] - t) < Math.abs(n[r][0] - t) && r--, n[r][1];
}
function Me(n, t) {
  return [
    ...n.flatMap((r) => r.data.map(([e]) => e)),
    ...t?.map((r) => r.timestamp) ?? []
  ];
}
function zt(n, t, r) {
  const e = /* @__PURE__ */ new Set(), o = [];
  for (const l of n) {
    if (e.has(l.name) || r && r[l.name] === !1) continue;
    e.add(l.name);
    const a = Ee(l.data, t);
    a != null && o.push({ name: l.name, value: a, color: l.color });
  }
  return o.sort((l, a) => a.value - l.value);
}
function Dt(n, t) {
  return {
    rows: n.slice(0, t),
    hiddenCount: Math.max(0, n.length - t)
  };
}
function be(n, t, r, e) {
  return Dt(
    zt(n, t, r),
    e
  );
}
function Ce(n, t) {
  return n.ts === t.ts && n.color === t.color && n.hiddenCount === t.hiddenCount && n.rows.length === t.rows.length && _t(n.rows, t.rows) && n.markers.length === t.markers.length && n.markers.every((r, e) => {
    const o = t.markers[e];
    return r.timestamp === o.timestamp && r.label === o.label && r.description === o.description && r.color === o.color && r.lineStyle === o.lineStyle;
  });
}
function Ne(n, t) {
  return !n || n.type !== t.type ? !1 : n.type === "marker" && t.type === "marker" ? Ce(n, t) : n.type !== "series" || t.type !== "series" || n.ts !== t.ts || n.hiddenCount !== t.hiddenCount || n.rows.length !== t.rows.length ? !1 : _t(n.rows, t.rows);
}
function _t(n, t) {
  return n.every((r, e) => {
    const o = t[e];
    return r.name === o.name && r.value === o.value && r.color === o.color;
  });
}
function Ae({
  height: n,
  isDarkMode: t
}) {
  const r = n / 2, e = Math.min(n * 0.12, 28), o = 400, l = 120, a = [];
  for (let p = 0; p <= l; p++) {
    const i = -o + p / l * o * 3, u = r + Math.sin(p / l * 2 * Math.PI * 3) * e;
    a.push(`${p === 0 ? "M" : "L"}${i.toFixed(2)},${u.toFixed(2)}`);
  }
  const s = a.join(" "), h = t ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.2)";
  return /* @__PURE__ */ P(
    "div",
    {
      "aria-hidden": "true",
      className: "absolute inset-0 overflow-hidden",
      style: { height: n },
      children: /* @__PURE__ */ P(
        "svg",
        {
          width: "100%",
          height: n,
          viewBox: `0 0 ${o} ${n}`,
          preserveAspectRatio: "none",
          className: "w-full animate-pulse",
          children: /* @__PURE__ */ P(
            "path",
            {
              d: s,
              fill: "none",
              stroke: h,
              strokeWidth: "2",
              style: {
                animation: "kumo-chart-wave 2.4s linear infinite",
                transformOrigin: "0 0"
              }
            }
          )
        }
      )
    }
  );
}
function ht(n, t) {
  const r = Math.max(0, Math.min(1, t)), e = n.match(
    /rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
  );
  if (e)
    return `rgba(${e[1]}, ${e[2]}, ${e[3]}, ${r})`;
  let o = n.replace(/^#/, "");
  o.length === 3 && (o = o[0] + o[0] + o[1] + o[1] + o[2] + o[2]), o.length === 8 && (o = o.slice(0, 6));
  const l = parseInt(o.slice(0, 2), 16), a = parseInt(o.slice(2, 4), 16), s = parseInt(o.slice(4, 6), 16);
  return `rgba(${l}, ${a}, ${s}, ${r})`;
}
const Te = new Intl.DateTimeFormat(void 0, {
  month: "short",
  day: "numeric",
  hour: "2-digit",
  minute: "2-digit",
  second: "2-digit",
  hour12: !1
});
function Re(n) {
  return Te.format(new Date(n));
}
const Gt = (n) => {
  n.key !== "Enter" && n.key !== " " || (n.preventDefault(), n.currentTarget.click());
};
function $e({
  color: n,
  value: t,
  name: r,
  unit: e,
  inactive: o,
  onPointerEnter: l,
  onPointerLeave: a,
  onClick: s,
  className: h
}) {
  return /* @__PURE__ */ un(
    "div",
    {
      role: "button",
      tabIndex: s ? 0 : -1,
      className: dn(
        "inline-flex flex-col gap-2 min-w-42 py-2",
        { "cursor-pointer": !!s },
        h
      ),
      onPointerEnter: l,
      onPointerLeave: a,
      onClick: s,
      onKeyDown: s ? Gt : void 0,
      children: [
        /* @__PURE__ */ un("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ P(
            "span",
            {
              className: dn("size-2 rounded-full inline-block", {
                "opacity-50": o
              }),
              style: { backgroundColor: n }
            }
          ),
          /* @__PURE__ */ P("span", { className: dn("text-xs", { "opacity-50": o }), children: r })
        ] }),
        /* @__PURE__ */ un("div", { className: "flex items-baseline gap-0.5", children: [
          /* @__PURE__ */ P(
            "span",
            {
              className: dn("text-lg font-medium leading-none", {
                "opacity-50": o
              }),
              children: t
            }
          ),
          e && /* @__PURE__ */ P(
            "span",
            {
              className: dn("text-xs text-kumo-subtle leading-none", {
                "opacity-50": o
              }),
              children: e
            }
          )
        ] })
      ]
    }
  );
}
function Ie({
  color: n,
  value: t,
  name: r,
  inactive: e,
  onPointerEnter: o,
  onPointerLeave: l,
  onClick: a,
  className: s
}) {
  return /* @__PURE__ */ un(
    "div",
    {
      role: "button",
      tabIndex: a ? 0 : -1,
      className: dn(
        "inline-flex items-center gap-2",
        { "cursor-pointer": !!a },
        s
      ),
      onPointerEnter: o,
      onPointerLeave: l,
      onClick: a,
      onKeyDown: a ? Gt : void 0,
      children: [
        /* @__PURE__ */ P(
          "span",
          {
            className: dn("size-2 rounded-full inline-block", {
              "opacity-50": e
            }),
            style: { backgroundColor: n }
          }
        ),
        /* @__PURE__ */ P("span", { className: dn("text-xs", { "opacity-50": e }), children: r }),
        /* @__PURE__ */ P("span", { className: dn("text-xs font-medium", { "opacity-50": e }), children: t })
      ]
    }
  );
}
const Cr = {
  SmallItem: Ie,
  LargeItem: $e
}, at = (n) => n.toLocaleString(), yn = (n) => n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
function ke(n) {
  return typeof n == "object" && n !== null;
}
const gt = (n) => n.replace(/[{}|]/g, (t) => `\\${t}`), Vn = (n) => {
  const t = "#666";
  return !n || typeof n != "string" ? t : /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(n) || /^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
    n
  ) || /^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
    n
  ) || /^[a-z]{3,20}$/i.test(n) ? n : t;
};
function Le({
  echarts: n,
  nodes: t,
  links: r,
  height: e = 400,
  nodeWidth: o = 8,
  nodePadding: l = 10,
  showTooltip: a = !0,
  showNodeValues: s,
  nodeLabelLayout: h = "stacked",
  formatValue: p = at,
  tooltipFormatter: i,
  defaultNodeColor: u,
  left: c,
  right: m,
  linkColor: d = "gradient",
  linkOpacity: S = 0.5,
  className: v,
  isDarkMode: w,
  onNodeClick: y,
  onLinkClick: M
}) {
  const E = t.some((N) => N.value !== void 0), b = s ?? E, C = h === "inline", L = en(() => {
    const N = gn.text("primary", w), x = gn.text("secondary", w), B = t.map(
      (g, R) => g.color ?? u ?? gn.categorical(R, w)
    ), I = new Map(
      t.map((g, R) => [g.name, { ...g, computedColor: B[R] }])
    ), T = t.map((g, R) => ({
      name: g.name,
      value: g.value,
      itemStyle: {
        color: B[R]
      }
    })), f = r.map((g) => ({
      source: t[g.source]?.name ?? "",
      target: t[g.target]?.name ?? "",
      value: g.value
    }));
    return {
      backgroundColor: "transparent",
      animation: !0,
      animationDuration: 500,
      animationDurationUpdate: 300,
      animationEasingUpdate: "cubicInOut",
      tooltip: a ? {
        trigger: "item",
        triggerOn: "mousemove",
        dangerousHtmlFormatter: (g) => {
          if (!ke(g)) return "";
          if (g.dataType === "node" && g.name) {
            const R = I.get(g.name), k = Vn(
              R?.computedColor ?? g.color ?? "#666"
            );
            if (i)
              return i({
                type: "node",
                name: g.name,
                node: R,
                color: k
              });
            const F = yn(g.name);
            return `<div style="display:flex;align-items:center;gap:6px;"><span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${k}"></span><strong>${F}</strong></div>`;
          }
          if (g.dataType === "edge" && g.data) {
            const { source: R, target: k, value: F } = g.data;
            if (i)
              return i({
                type: "link",
                name: `${R} → ${k}`,
                link: {
                  source: R ?? "",
                  target: k ?? "",
                  value: F ?? 0
                }
              });
            const K = I.get(R ?? ""), Q = I.get(k ?? ""), V = Vn(
              K?.computedColor ?? "#666"
            ), Y = Vn(
              Q?.computedColor ?? "#666"
            ), tn = yn(R ?? ""), W = yn(k ?? "");
            return `<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
                  <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${V}"></span>
                  <strong>${tn}</strong>
                  <span style="color:${x}">→</span>
                  <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${Y}"></span>
                  <strong>${W}</strong>
                </div>
                <strong>${F !== void 0 ? yn(p(F)) : ""}</strong>`;
          }
          return "";
        }
      } : void 0,
      series: [
        {
          type: "sankey",
          ...c !== void 0 && { left: c },
          ...m !== void 0 && { right: m },
          data: T,
          links: f,
          draggable: !1,
          emphasis: {
            focus: "adjacency"
          },
          nodeWidth: o,
          nodeGap: l,
          lineStyle: {
            color: d === "gradient" ? "source" : "#d1d5db",
            opacity: d === "gradient" ? S : 0.4,
            curveness: 0.5
          },
          label: {
            show: !0,
            color: N,
            fontSize: 12,
            formatter: b ? (g) => {
              const R = g.name ?? "", k = I.get(R), F = gt(R);
              if (k?.value !== void 0) {
                const K = gt(
                  p(k.value)
                );
                return C ? `{name|${F}} {value|${K}}` : `{value|${K}}
{name|${F}}`;
              }
              return F;
            } : void 0,
            rich: b ? {
              value: {
                fontSize: 11,
                color: N,
                lineHeight: C ? void 0 : 16
              },
              name: {
                fontSize: 12,
                color: N,
                fontWeight: 700
              }
            } : void 0
          }
        }
      ]
    };
  }, [
    t,
    r,
    a,
    o,
    l,
    u,
    c,
    m,
    w,
    d,
    S,
    b,
    C,
    p,
    i
  ]), A = mn(
    (N) => {
      if (N.dataType === "node" && y && N.name) {
        const x = t.findIndex((T) => T.name === N.name), I = {
          ...x >= 0 ? t[x] : null,
          name: N.name
        };
        y(I);
      } else if (N.dataType === "edge" && M && N.data) {
        const x = N.data, B = typeof x == "object" && x !== null && "source" in x ? String(x.source) : "", I = typeof x == "object" && x !== null && "target" in x ? String(x.target) : "", T = t.findIndex((F) => F.name === B), f = t.findIndex((F) => F.name === I);
        if (T === -1 || f === -1) return;
        const g = N.value, R = typeof g == "number" ? g : Array.isArray(g) && typeof g[0] == "number" ? g[0] : 0, k = r.find(
          (F) => F.source === T && F.target === f
        );
        M({
          ...k,
          source: T,
          target: f,
          value: R
        });
      }
    },
    [t, r, y, M]
  ), $ = en(
    () => ({
      click: A
    }),
    [A]
  );
  return /* @__PURE__ */ P(
    Ln,
    {
      echarts: n,
      options: L,
      className: v,
      isDarkMode: w,
      height: e,
      onEvents: $
    }
  );
}
Le.displayName = "SankeyChart";
class Fe {
  constructor() {
    this._partials = new Float64Array(32), this._n = 0;
  }
  add(t) {
    const r = this._partials;
    let e = 0;
    for (let o = 0; o < this._n && o < 32; o++) {
      const l = r[o], a = t + l, s = Math.abs(t) < Math.abs(l) ? t - (a - l) : l - (a - t);
      s && (r[e++] = s), t = a;
    }
    return r[e] = t, this._n = e + 1, this;
  }
  valueOf() {
    const t = this._partials;
    let r = this._n, e, o, l, a = 0;
    if (r > 0) {
      for (a = t[--r]; r > 0 && (e = a, o = t[--r], a = e + o, l = o - (a - e), !l); )
        ;
      r > 0 && (l < 0 && t[r - 1] < 0 || l > 0 && t[r - 1] > 0) && (o = l * 2, e = a + o, o == e - a && (a = e));
    }
    return a;
  }
}
function* Oe(n) {
  for (const t of n)
    yield* t;
}
function Wt(n) {
  return Array.from(Oe(n));
}
var G = 1e-6, z = Math.PI, sn = z / 2, vt = z / 4, fn = z * 2, cn = 180 / z, Z = z / 180, q = Math.abs, Xt = Math.atan, $n = Math.atan2, U = Math.cos, Be = Math.exp, Pe = Math.log, H = Math.sin, ze = Math.sign || function(n) {
  return n > 0 ? 1 : n < 0 ? -1 : 0;
}, Hn = Math.sqrt, De = Math.tan;
function _e(n) {
  return n > 1 ? 0 : n < -1 ? z : Math.acos(n);
}
function In(n) {
  return n > 1 ? sn : n < -1 ? -sn : Math.asin(n);
}
function An() {
}
function _n(n, t) {
  n && St.hasOwnProperty(n.type) && St[n.type](n, t);
}
var yt = {
  Feature: function(n, t) {
    _n(n.geometry, t);
  },
  FeatureCollection: function(n, t) {
    for (var r = n.features, e = -1, o = r.length; ++e < o; ) _n(r[e].geometry, t);
  }
}, St = {
  Sphere: function(n, t) {
    t.sphere();
  },
  Point: function(n, t) {
    n = n.coordinates, t.point(n[0], n[1], n[2]);
  },
  MultiPoint: function(n, t) {
    for (var r = n.coordinates, e = -1, o = r.length; ++e < o; ) n = r[e], t.point(n[0], n[1], n[2]);
  },
  LineString: function(n, t) {
    nt(n.coordinates, t, 0);
  },
  MultiLineString: function(n, t) {
    for (var r = n.coordinates, e = -1, o = r.length; ++e < o; ) nt(r[e], t, 0);
  },
  Polygon: function(n, t) {
    xt(n.coordinates, t);
  },
  MultiPolygon: function(n, t) {
    for (var r = n.coordinates, e = -1, o = r.length; ++e < o; ) xt(r[e], t);
  },
  GeometryCollection: function(n, t) {
    for (var r = n.geometries, e = -1, o = r.length; ++e < o; ) _n(r[e], t);
  }
};
function nt(n, t, r) {
  var e = -1, o = n.length - r, l;
  for (t.lineStart(); ++e < o; ) l = n[e], t.point(l[0], l[1], l[2]);
  t.lineEnd();
}
function xt(n, t) {
  var r = -1, e = n.length;
  for (t.polygonStart(); ++r < e; ) nt(n[r], t, 1);
  t.polygonEnd();
}
function Ge(n, t) {
  n && yt.hasOwnProperty(n.type) ? yt[n.type](n, t) : _n(n, t);
}
function tt(n) {
  return [$n(n[1], n[0]), In(n[2])];
}
function Mn(n) {
  var t = n[0], r = n[1], e = U(r);
  return [e * U(t), e * H(t), H(r)];
}
function On(n, t) {
  return n[0] * t[0] + n[1] * t[1] + n[2] * t[2];
}
function Gn(n, t) {
  return [n[1] * t[2] - n[2] * t[1], n[2] * t[0] - n[0] * t[2], n[0] * t[1] - n[1] * t[0]];
}
function Yn(n, t) {
  n[0] += t[0], n[1] += t[1], n[2] += t[2];
}
function Bn(n, t) {
  return [n[0] * t, n[1] * t, n[2] * t];
}
function et(n) {
  var t = Hn(n[0] * n[0] + n[1] * n[1] + n[2] * n[2]);
  n[0] /= t, n[1] /= t, n[2] /= t;
}
function rt(n, t) {
  function r(e, o) {
    return e = n(e, o), t(e[0], e[1]);
  }
  return n.invert && t.invert && (r.invert = function(e, o) {
    return e = t.invert(e, o), e && n.invert(e[0], e[1]);
  }), r;
}
function ot(n, t) {
  return q(n) > z && (n -= Math.round(n / fn) * fn), [n, t];
}
ot.invert = ot;
function qt(n, t, r) {
  return (n %= fn) ? t || r ? rt(Et(n), Mt(t, r)) : Et(n) : t || r ? Mt(t, r) : ot;
}
function wt(n) {
  return function(t, r) {
    return t += n, q(t) > z && (t -= Math.round(t / fn) * fn), [t, r];
  };
}
function Et(n) {
  var t = wt(n);
  return t.invert = wt(-n), t;
}
function Mt(n, t) {
  var r = U(n), e = H(n), o = U(t), l = H(t);
  function a(s, h) {
    var p = U(h), i = U(s) * p, u = H(s) * p, c = H(h), m = c * r + i * e;
    return [
      $n(u * o - m * l, i * r - c * e),
      In(m * o + u * l)
    ];
  }
  return a.invert = function(s, h) {
    var p = U(h), i = U(s) * p, u = H(s) * p, c = H(h), m = c * o - u * l;
    return [
      $n(u * o + c * l, i * r + m * e),
      In(m * r - i * e)
    ];
  }, a;
}
function We(n) {
  n = qt(n[0] * Z, n[1] * Z, n.length > 2 ? n[2] * Z : 0);
  function t(r) {
    return r = n(r[0] * Z, r[1] * Z), r[0] *= cn, r[1] *= cn, r;
  }
  return t.invert = function(r) {
    return r = n.invert(r[0] * Z, r[1] * Z), r[0] *= cn, r[1] *= cn, r;
  }, t;
}
function Xe(n, t, r, e, o, l) {
  if (r) {
    var a = U(t), s = H(t), h = e * r;
    o == null ? (o = t + e * fn, l = t - h / 2) : (o = bt(a, o), l = bt(a, l), (e > 0 ? o < l : o > l) && (o += e * fn));
    for (var p, i = o; e > 0 ? i > l : i < l; i -= h)
      p = tt([a, -s * U(i), -s * H(i)]), n.point(p[0], p[1]);
  }
}
function bt(n, t) {
  t = Mn(t), t[0] -= n, et(t);
  var r = _e(-t[1]);
  return ((-t[2] < 0 ? -r : r) + fn - G) % fn;
}
function Ut() {
  var n = [], t;
  return {
    point: function(r, e, o) {
      t.push([r, e, o]);
    },
    lineStart: function() {
      n.push(t = []);
    },
    lineEnd: An,
    rejoin: function() {
      n.length > 1 && n.push(n.pop().concat(n.shift()));
    },
    result: function() {
      var r = n;
      return n = [], t = null, r;
    }
  };
}
function Dn(n, t) {
  return q(n[0] - t[0]) < G && q(n[1] - t[1]) < G;
}
function Pn(n, t, r, e) {
  this.x = n, this.z = t, this.o = r, this.e = e, this.v = !1, this.n = this.p = null;
}
function Ht(n, t, r, e, o) {
  var l = [], a = [], s, h;
  if (n.forEach(function(d) {
    if (!((S = d.length - 1) <= 0)) {
      var S, v = d[0], w = d[S], y;
      if (Dn(v, w)) {
        if (!v[2] && !w[2]) {
          for (o.lineStart(), s = 0; s < S; ++s) o.point((v = d[s])[0], v[1]);
          o.lineEnd();
          return;
        }
        w[0] += 2 * G;
      }
      l.push(y = new Pn(v, d, null, !0)), a.push(y.o = new Pn(v, null, y, !1)), l.push(y = new Pn(w, d, null, !1)), a.push(y.o = new Pn(w, null, y, !0));
    }
  }), !!l.length) {
    for (a.sort(t), Ct(l), Ct(a), s = 0, h = a.length; s < h; ++s)
      a[s].e = r = !r;
    for (var p = l[0], i, u; ; ) {
      for (var c = p, m = !0; c.v; ) if ((c = c.n) === p) return;
      i = c.z, o.lineStart();
      do {
        if (c.v = c.o.v = !0, c.e) {
          if (m)
            for (s = 0, h = i.length; s < h; ++s) o.point((u = i[s])[0], u[1]);
          else
            e(c.x, c.n.x, 1, o);
          c = c.n;
        } else {
          if (m)
            for (i = c.p.z, s = i.length - 1; s >= 0; --s) o.point((u = i[s])[0], u[1]);
          else
            e(c.x, c.p.x, -1, o);
          c = c.p;
        }
        c = c.o, i = c.z, m = !m;
      } while (!c.v);
      o.lineEnd();
    }
  }
}
function Ct(n) {
  if (t = n.length) {
    for (var t, r = 0, e = n[0], o; ++r < t; )
      e.n = o = n[r], o.p = e, e = o;
    e.n = o = n[0], o.p = e;
  }
}
function Zn(n) {
  return q(n[0]) <= z ? n[0] : ze(n[0]) * ((q(n[0]) + z) % fn - z);
}
function qe(n, t) {
  var r = Zn(t), e = t[1], o = H(e), l = [H(r), -U(r), 0], a = 0, s = 0, h = new Fe();
  o === 1 ? e = sn + G : o === -1 && (e = -sn - G);
  for (var p = 0, i = n.length; p < i; ++p)
    if (c = (u = n[p]).length)
      for (var u, c, m = u[c - 1], d = Zn(m), S = m[1] / 2 + vt, v = H(S), w = U(S), y = 0; y < c; ++y, d = E, v = C, w = L, m = M) {
        var M = u[y], E = Zn(M), b = M[1] / 2 + vt, C = H(b), L = U(b), A = E - d, $ = A >= 0 ? 1 : -1, N = $ * A, x = N > z, B = v * C;
        if (h.add($n(B * $ * H(N), w * L + B * U(N))), a += x ? A + $ * fn : A, x ^ d >= r ^ E >= r) {
          var I = Gn(Mn(m), Mn(M));
          et(I);
          var T = Gn(l, I);
          et(T);
          var f = (x ^ A >= 0 ? -1 : 1) * In(T[2]);
          (e > f || e === f && (I[0] || I[1])) && (s += x ^ A >= 0 ? 1 : -1);
        }
      }
  return (a < -G || a < G && h < -1e-12) ^ s & 1;
}
function Kt(n, t, r, e) {
  return function(o) {
    var l = t(o), a = Ut(), s = t(a), h = !1, p, i, u, c = {
      point: m,
      lineStart: S,
      lineEnd: v,
      polygonStart: function() {
        c.point = w, c.lineStart = y, c.lineEnd = M, i = [], p = [];
      },
      polygonEnd: function() {
        c.point = m, c.lineStart = S, c.lineEnd = v, i = Wt(i);
        var E = qe(p, e);
        i.length ? (h || (o.polygonStart(), h = !0), Ht(i, He, E, r, o)) : E && (h || (o.polygonStart(), h = !0), o.lineStart(), r(null, null, 1, o), o.lineEnd()), h && (o.polygonEnd(), h = !1), i = p = null;
      },
      sphere: function() {
        o.polygonStart(), o.lineStart(), r(null, null, 1, o), o.lineEnd(), o.polygonEnd();
      }
    };
    function m(E, b) {
      n(E, b) && o.point(E, b);
    }
    function d(E, b) {
      l.point(E, b);
    }
    function S() {
      c.point = d, l.lineStart();
    }
    function v() {
      c.point = m, l.lineEnd();
    }
    function w(E, b) {
      u.push([E, b]), s.point(E, b);
    }
    function y() {
      s.lineStart(), u = [];
    }
    function M() {
      w(u[0][0], u[0][1]), s.lineEnd();
      var E = s.clean(), b = a.result(), C, L = b.length, A, $, N;
      if (u.pop(), p.push(u), u = null, !!L) {
        if (E & 1) {
          if ($ = b[0], (A = $.length - 1) > 0) {
            for (h || (o.polygonStart(), h = !0), o.lineStart(), C = 0; C < A; ++C) o.point((N = $[C])[0], N[1]);
            o.lineEnd();
          }
          return;
        }
        L > 1 && E & 2 && b.push(b.pop().concat(b.shift())), i.push(b.filter(Ue));
      }
    }
    return c;
  };
}
function Ue(n) {
  return n.length > 1;
}
function He(n, t) {
  return ((n = n.x)[0] < 0 ? n[1] - sn - G : sn - n[1]) - ((t = t.x)[0] < 0 ? t[1] - sn - G : sn - t[1]);
}
const Nt = Kt(
  function() {
    return !0;
  },
  Ke,
  Ye,
  [-z, -sn]
);
function Ke(n) {
  var t = NaN, r = NaN, e = NaN, o;
  return {
    lineStart: function() {
      n.lineStart(), o = 1;
    },
    point: function(l, a) {
      var s = l > 0 ? z : -z, h = q(l - t);
      q(h - z) < G ? (n.point(t, r = (r + a) / 2 > 0 ? sn : -sn), n.point(e, r), n.lineEnd(), n.lineStart(), n.point(s, r), n.point(l, r), o = 0) : e !== s && h >= z && (q(t - e) < G && (t -= e * G), q(l - s) < G && (l -= s * G), r = Ve(t, r, l, a), n.point(e, r), n.lineEnd(), n.lineStart(), n.point(s, r), o = 0), n.point(t = l, r = a), e = s;
    },
    lineEnd: function() {
      n.lineEnd(), t = r = NaN;
    },
    clean: function() {
      return 2 - o;
    }
  };
}
function Ve(n, t, r, e) {
  var o, l, a = H(n - r);
  return q(a) > G ? Xt((H(t) * (l = U(e)) * H(r) - H(e) * (o = U(t)) * H(n)) / (o * l * a)) : (t + e) / 2;
}
function Ye(n, t, r, e) {
  var o;
  if (n == null)
    o = r * sn, e.point(-z, o), e.point(0, o), e.point(z, o), e.point(z, 0), e.point(z, -o), e.point(0, -o), e.point(-z, -o), e.point(-z, 0), e.point(-z, o);
  else if (q(n[0] - t[0]) > G) {
    var l = n[0] < t[0] ? z : -z;
    o = r * l / 2, e.point(-l, o), e.point(0, o), e.point(l, o);
  } else
    e.point(t[0], t[1]);
}
function Ze(n) {
  var t = U(n), r = 2 * Z, e = t > 0, o = q(t) > G;
  function l(i, u, c, m) {
    Xe(m, n, r, c, i, u);
  }
  function a(i, u) {
    return U(i) * U(u) > t;
  }
  function s(i) {
    var u, c, m, d, S;
    return {
      lineStart: function() {
        d = m = !1, S = 1;
      },
      point: function(v, w) {
        var y = [v, w], M, E = a(v, w), b = e ? E ? 0 : p(v, w) : E ? p(v + (v < 0 ? z : -z), w) : 0;
        if (!u && (d = m = E) && i.lineStart(), E !== m && (M = h(u, y), (!M || Dn(u, M) || Dn(y, M)) && (y[2] = 1)), E !== m)
          S = 0, E ? (i.lineStart(), M = h(y, u), i.point(M[0], M[1])) : (M = h(u, y), i.point(M[0], M[1], 2), i.lineEnd()), u = M;
        else if (o && u && e ^ E) {
          var C;
          !(b & c) && (C = h(y, u, !0)) && (S = 0, e ? (i.lineStart(), i.point(C[0][0], C[0][1]), i.point(C[1][0], C[1][1]), i.lineEnd()) : (i.point(C[1][0], C[1][1]), i.lineEnd(), i.lineStart(), i.point(C[0][0], C[0][1], 3)));
        }
        E && (!u || !Dn(u, y)) && i.point(y[0], y[1]), u = y, m = E, c = b;
      },
      lineEnd: function() {
        m && i.lineEnd(), u = null;
      },
      // Rejoin first and last segments if there were intersections and the first
      // and last points were visible.
      clean: function() {
        return S | (d && m) << 1;
      }
    };
  }
  function h(i, u, c) {
    var m = Mn(i), d = Mn(u), S = [1, 0, 0], v = Gn(m, d), w = On(v, v), y = v[0], M = w - y * y;
    if (!M) return !c && i;
    var E = t * w / M, b = -t * y / M, C = Gn(S, v), L = Bn(S, E), A = Bn(v, b);
    Yn(L, A);
    var $ = C, N = On(L, $), x = On($, $), B = N * N - x * (On(L, L) - 1);
    if (!(B < 0)) {
      var I = Hn(B), T = Bn($, (-N - I) / x);
      if (Yn(T, L), T = tt(T), !c) return T;
      var f = i[0], g = u[0], R = i[1], k = u[1], F;
      g < f && (F = f, f = g, g = F);
      var K = g - f, Q = q(K - z) < G, V = Q || K < G;
      if (!Q && k < R && (F = R, R = k, k = F), V ? Q ? R + k > 0 ^ T[1] < (q(T[0] - f) < G ? R : k) : R <= T[1] && T[1] <= k : K > z ^ (f <= T[0] && T[0] <= g)) {
        var Y = Bn($, (-N + I) / x);
        return Yn(Y, L), [T, tt(Y)];
      }
    }
  }
  function p(i, u) {
    var c = e ? n : z - n, m = 0;
    return i < -c ? m |= 1 : i > c && (m |= 2), u < -c ? m |= 4 : u > c && (m |= 8), m;
  }
  return Kt(a, s, l, e ? [0, -n] : [-z, n - z]);
}
function Qe(n, t, r, e, o, l) {
  var a = n[0], s = n[1], h = t[0], p = t[1], i = 0, u = 1, c = h - a, m = p - s, d;
  if (d = r - a, !(!c && d > 0)) {
    if (d /= c, c < 0) {
      if (d < i) return;
      d < u && (u = d);
    } else if (c > 0) {
      if (d > u) return;
      d > i && (i = d);
    }
    if (d = o - a, !(!c && d < 0)) {
      if (d /= c, c < 0) {
        if (d > u) return;
        d > i && (i = d);
      } else if (c > 0) {
        if (d < i) return;
        d < u && (u = d);
      }
      if (d = e - s, !(!m && d > 0)) {
        if (d /= m, m < 0) {
          if (d < i) return;
          d < u && (u = d);
        } else if (m > 0) {
          if (d > u) return;
          d > i && (i = d);
        }
        if (d = l - s, !(!m && d < 0)) {
          if (d /= m, m < 0) {
            if (d > u) return;
            d > i && (i = d);
          } else if (m > 0) {
            if (d < i) return;
            d < u && (u = d);
          }
          return i > 0 && (n[0] = a + i * c, n[1] = s + i * m), u < 1 && (t[0] = a + u * c, t[1] = s + u * m), !0;
        }
      }
    }
  }
}
var Tn = 1e9, zn = -Tn;
function je(n, t, r, e) {
  function o(p, i) {
    return n <= p && p <= r && t <= i && i <= e;
  }
  function l(p, i, u, c) {
    var m = 0, d = 0;
    if (p == null || (m = a(p, u)) !== (d = a(i, u)) || h(p, i) < 0 ^ u > 0)
      do
        c.point(m === 0 || m === 3 ? n : r, m > 1 ? e : t);
      while ((m = (m + u + 4) % 4) !== d);
    else
      c.point(i[0], i[1]);
  }
  function a(p, i) {
    return q(p[0] - n) < G ? i > 0 ? 0 : 3 : q(p[0] - r) < G ? i > 0 ? 2 : 1 : q(p[1] - t) < G ? i > 0 ? 1 : 0 : i > 0 ? 3 : 2;
  }
  function s(p, i) {
    return h(p.x, i.x);
  }
  function h(p, i) {
    var u = a(p, 1), c = a(i, 1);
    return u !== c ? u - c : u === 0 ? i[1] - p[1] : u === 1 ? p[0] - i[0] : u === 2 ? p[1] - i[1] : i[0] - p[0];
  }
  return function(p) {
    var i = p, u = Ut(), c, m, d, S, v, w, y, M, E, b, C, L = {
      point: A,
      lineStart: B,
      lineEnd: I,
      polygonStart: N,
      polygonEnd: x
    };
    function A(f, g) {
      o(f, g) && i.point(f, g);
    }
    function $() {
      for (var f = 0, g = 0, R = m.length; g < R; ++g)
        for (var k = m[g], F = 1, K = k.length, Q = k[0], V, Y, tn = Q[0], W = Q[1]; F < K; ++F)
          V = tn, Y = W, Q = k[F], tn = Q[0], W = Q[1], Y <= e ? W > e && (tn - V) * (e - Y) > (W - Y) * (n - V) && ++f : W <= e && (tn - V) * (e - Y) < (W - Y) * (n - V) && --f;
      return f;
    }
    function N() {
      i = u, c = [], m = [], C = !0;
    }
    function x() {
      var f = $(), g = C && f, R = (c = Wt(c)).length;
      (g || R) && (p.polygonStart(), g && (p.lineStart(), l(null, null, 1, p), p.lineEnd()), R && Ht(c, s, f, l, p), p.polygonEnd()), i = p, c = m = d = null;
    }
    function B() {
      L.point = T, m && m.push(d = []), b = !0, E = !1, y = M = NaN;
    }
    function I() {
      c && (T(S, v), w && E && u.rejoin(), c.push(u.result())), L.point = A, E && i.lineEnd();
    }
    function T(f, g) {
      var R = o(f, g);
      if (m && d.push([f, g]), b)
        S = f, v = g, w = R, b = !1, R && (i.lineStart(), i.point(f, g));
      else if (R && E) i.point(f, g);
      else {
        var k = [y = Math.max(zn, Math.min(Tn, y)), M = Math.max(zn, Math.min(Tn, M))], F = [f = Math.max(zn, Math.min(Tn, f)), g = Math.max(zn, Math.min(Tn, g))];
        Qe(k, F, n, t, r, e) ? (E || (i.lineStart(), i.point(k[0], k[1])), i.point(F[0], F[1]), R || i.lineEnd(), C = !1) : R && (i.lineStart(), i.point(f, g), C = !1);
      }
      y = f, M = g, E = R;
    }
    return L;
  };
}
const At = (n) => n;
var bn = 1 / 0, Wn = bn, kn = -bn, Xn = kn, Tt = {
  point: Je,
  lineStart: An,
  lineEnd: An,
  polygonStart: An,
  polygonEnd: An,
  result: function() {
    var n = [[bn, Wn], [kn, Xn]];
    return kn = Xn = -(Wn = bn = 1 / 0), n;
  }
};
function Je(n, t) {
  n < bn && (bn = n), n > kn && (kn = n), t < Wn && (Wn = t), t > Xn && (Xn = t);
}
function ut(n) {
  return function(t) {
    var r = new it();
    for (var e in n) r[e] = n[e];
    return r.stream = t, r;
  };
}
function it() {
}
it.prototype = {
  constructor: it,
  point: function(n, t) {
    this.stream.point(n, t);
  },
  sphere: function() {
    this.stream.sphere();
  },
  lineStart: function() {
    this.stream.lineStart();
  },
  lineEnd: function() {
    this.stream.lineEnd();
  },
  polygonStart: function() {
    this.stream.polygonStart();
  },
  polygonEnd: function() {
    this.stream.polygonEnd();
  }
};
function st(n, t, r) {
  var e = n.clipExtent && n.clipExtent();
  return n.scale(150).translate([0, 0]), e != null && n.clipExtent(null), Ge(r, n.stream(Tt)), t(Tt.result()), e != null && n.clipExtent(e), n;
}
function Vt(n, t, r) {
  return st(n, function(e) {
    var o = t[1][0] - t[0][0], l = t[1][1] - t[0][1], a = Math.min(o / (e[1][0] - e[0][0]), l / (e[1][1] - e[0][1])), s = +t[0][0] + (o - a * (e[1][0] + e[0][0])) / 2, h = +t[0][1] + (l - a * (e[1][1] + e[0][1])) / 2;
    n.scale(150 * a).translate([s, h]);
  }, r);
}
function nr(n, t, r) {
  return Vt(n, [[0, 0], t], r);
}
function tr(n, t, r) {
  return st(n, function(e) {
    var o = +t, l = o / (e[1][0] - e[0][0]), a = (o - l * (e[1][0] + e[0][0])) / 2, s = -l * e[0][1];
    n.scale(150 * l).translate([a, s]);
  }, r);
}
function er(n, t, r) {
  return st(n, function(e) {
    var o = +t, l = o / (e[1][1] - e[0][1]), a = -l * e[0][0], s = (o - l * (e[1][1] + e[0][1])) / 2;
    n.scale(150 * l).translate([a, s]);
  }, r);
}
var Rt = 16, rr = U(30 * Z);
function $t(n, t) {
  return +t ? ir(n, t) : or(n);
}
function or(n) {
  return ut({
    point: function(t, r) {
      t = n(t, r), this.stream.point(t[0], t[1]);
    }
  });
}
function ir(n, t) {
  function r(e, o, l, a, s, h, p, i, u, c, m, d, S, v) {
    var w = p - e, y = i - o, M = w * w + y * y;
    if (M > 4 * t && S--) {
      var E = a + c, b = s + m, C = h + d, L = Hn(E * E + b * b + C * C), A = In(C /= L), $ = q(q(C) - 1) < G || q(l - u) < G ? (l + u) / 2 : $n(b, E), N = n($, A), x = N[0], B = N[1], I = x - e, T = B - o, f = y * I - w * T;
      (f * f / M > t || q((w * I + y * T) / M - 0.5) > 0.3 || a * c + s * m + h * d < rr) && (r(e, o, l, a, s, h, x, B, $, E /= L, b /= L, C, S, v), v.point(x, B), r(x, B, $, E, b, C, p, i, u, c, m, d, S, v));
    }
  }
  return function(e) {
    var o, l, a, s, h, p, i, u, c, m, d, S, v = {
      point: w,
      lineStart: y,
      lineEnd: E,
      polygonStart: function() {
        e.polygonStart(), v.lineStart = b;
      },
      polygonEnd: function() {
        e.polygonEnd(), v.lineStart = y;
      }
    };
    function w(A, $) {
      A = n(A, $), e.point(A[0], A[1]);
    }
    function y() {
      u = NaN, v.point = M, e.lineStart();
    }
    function M(A, $) {
      var N = Mn([A, $]), x = n(A, $);
      r(u, c, i, m, d, S, u = x[0], c = x[1], i = A, m = N[0], d = N[1], S = N[2], Rt, e), e.point(u, c);
    }
    function E() {
      v.point = w, e.lineEnd();
    }
    function b() {
      y(), v.point = C, v.lineEnd = L;
    }
    function C(A, $) {
      M(o = A, $), l = u, a = c, s = m, h = d, p = S, v.point = M;
    }
    function L() {
      r(u, c, i, m, d, S, l, a, o, s, h, p, Rt, e), v.lineEnd = E, E();
    }
    return v;
  };
}
var lr = ut({
  point: function(n, t) {
    this.stream.point(n * Z, t * Z);
  }
});
function ar(n) {
  return ut({
    point: function(t, r) {
      var e = n(t, r);
      return this.stream.point(e[0], e[1]);
    }
  });
}
function ur(n, t, r, e, o) {
  function l(a, s) {
    return a *= e, s *= o, [t + n * a, r - n * s];
  }
  return l.invert = function(a, s) {
    return [(a - t) / n * e, (r - s) / n * o];
  }, l;
}
function It(n, t, r, e, o, l) {
  if (!l) return ur(n, t, r, e, o);
  var a = U(l), s = H(l), h = a * n, p = s * n, i = a / n, u = s / n, c = (s * r - a * t) / n, m = (s * t + a * r) / n;
  function d(S, v) {
    return S *= e, v *= o, [h * S - p * v + t, r - p * S - h * v];
  }
  return d.invert = function(S, v) {
    return [e * (i * S - u * v + c), o * (m - u * S - i * v)];
  }, d;
}
function sr(n) {
  return cr(function() {
    return n;
  })();
}
function cr(n) {
  var t, r = 150, e = 480, o = 250, l = 0, a = 0, s = 0, h = 0, p = 0, i, u = 0, c = 1, m = 1, d = null, S = Nt, v = null, w, y, M, E = At, b = 0.5, C, L, A, $, N;
  function x(f) {
    return A(f[0] * Z, f[1] * Z);
  }
  function B(f) {
    return f = A.invert(f[0], f[1]), f && [f[0] * cn, f[1] * cn];
  }
  x.stream = function(f) {
    return $ && N === f ? $ : $ = lr(ar(i)(S(C(E(N = f)))));
  }, x.preclip = function(f) {
    return arguments.length ? (S = f, d = void 0, T()) : S;
  }, x.postclip = function(f) {
    return arguments.length ? (E = f, v = w = y = M = null, T()) : E;
  }, x.clipAngle = function(f) {
    return arguments.length ? (S = +f ? Ze(d = f * Z) : (d = null, Nt), T()) : d * cn;
  }, x.clipExtent = function(f) {
    return arguments.length ? (E = f == null ? (v = w = y = M = null, At) : je(v = +f[0][0], w = +f[0][1], y = +f[1][0], M = +f[1][1]), T()) : v == null ? null : [[v, w], [y, M]];
  }, x.scale = function(f) {
    return arguments.length ? (r = +f, I()) : r;
  }, x.translate = function(f) {
    return arguments.length ? (e = +f[0], o = +f[1], I()) : [e, o];
  }, x.center = function(f) {
    return arguments.length ? (l = f[0] % 360 * Z, a = f[1] % 360 * Z, I()) : [l * cn, a * cn];
  }, x.rotate = function(f) {
    return arguments.length ? (s = f[0] % 360 * Z, h = f[1] % 360 * Z, p = f.length > 2 ? f[2] % 360 * Z : 0, I()) : [s * cn, h * cn, p * cn];
  }, x.angle = function(f) {
    return arguments.length ? (u = f % 360 * Z, I()) : u * cn;
  }, x.reflectX = function(f) {
    return arguments.length ? (c = f ? -1 : 1, I()) : c < 0;
  }, x.reflectY = function(f) {
    return arguments.length ? (m = f ? -1 : 1, I()) : m < 0;
  }, x.precision = function(f) {
    return arguments.length ? (C = $t(L, b = f * f), T()) : Hn(b);
  }, x.fitExtent = function(f, g) {
    return Vt(x, f, g);
  }, x.fitSize = function(f, g) {
    return nr(x, f, g);
  }, x.fitWidth = function(f, g) {
    return tr(x, f, g);
  }, x.fitHeight = function(f, g) {
    return er(x, f, g);
  };
  function I() {
    var f = It(r, 0, 0, c, m, u).apply(null, t(l, a)), g = It(r, e - f[0], o - f[1], c, m, u);
    return i = qt(s, h, p), L = rt(t, g), A = rt(i, L), C = $t(L, b), T();
  }
  function T() {
    return $ = N = null, x;
  }
  return function() {
    return t = n.apply(this, arguments), x.invert = t.invert && B, I();
  };
}
function ct(n, t) {
  return [n, Pe(De((sn + t) / 2))];
}
ct.invert = function(n, t) {
  return [n, 2 * Xt(Be(t)) - sn];
};
function fr() {
  return pr(ct).scale(961 / fn);
}
function pr(n) {
  var t = sr(n), r = t.center, e = t.scale, o = t.translate, l = t.clipExtent, a = null, s, h, p;
  t.scale = function(u) {
    return arguments.length ? (e(u), i()) : e();
  }, t.translate = function(u) {
    return arguments.length ? (o(u), i()) : o();
  }, t.center = function(u) {
    return arguments.length ? (r(u), i()) : r();
  }, t.clipExtent = function(u) {
    return arguments.length ? (u == null ? a = s = h = p = null : (a = +u[0][0], s = +u[0][1], h = +u[1][0], p = +u[1][1]), i()) : a == null ? null : [[a, s], [h, p]];
  };
  function i() {
    var u = z * e(), c = t(We(t.rotate()).invert([0, 0]));
    return l(a == null ? [[c[0] - u, c[1] - u], [c[0] + u, c[1] + u]] : n === ct ? [[Math.max(c[0] - u, a), s], [Math.min(c[0] + u, h), p]] : [[a, Math.max(c[1] - u, s)], [h, Math.min(c[1] + u, p)]]);
  }
  return i();
}
function En(n, t) {
  return typeof t == "function" ? t(n) : n[t];
}
function Qn(n, t) {
  return typeof t == "function" ? t(n) : t;
}
const kt = 85.0511, Lt = fr(), dr = {
  project: (n) => {
    const t = Math.max(
      -kt,
      Math.min(kt, n[1])
    );
    return Lt([n[0], t]) ?? [0, 0];
  },
  unproject: (n) => Lt.invert?.(n) ?? [0, 0]
}, qn = [
  [-180, 80],
  [180, -58]
];
function Rn(n) {
  if (n !== null)
    return n ?? dr;
}
function Yt(n, [[t, r], [e, o]]) {
  const l = n ? n.project : (p) => p, a = Math.min(r, Math.max(o, 0)), s = Math.abs(l([e, a])[0] - l([t, a])[0]), h = Math.abs(l([0, r])[1] - l([0, o])[1]);
  return s > 0 && h > 0 ? s / h : 16 / 9;
}
const Zt = 8, Ft = /* @__PURE__ */ new WeakMap();
function mr(n) {
  return n.replace(/[^a-zA-Z0-9_-]/g, "-");
}
function hr(n) {
  let t = 0;
  for (let r = 0; r < n.length; r++)
    t = Math.imul(31, t) + n.charCodeAt(r);
  return (t >>> 0).toString(36);
}
function Qt(n, t) {
  if (t) return mr(t);
  const r = Ft.get(n);
  if (r) return r;
  const e = `kumo-map-${hr(JSON.stringify(n))}`;
  return Ft.set(n, e), e;
}
function gr(n) {
  return {
    map: n.mapName,
    nameProperty: "name",
    roam: n.roam,
    // Prevent zooming far out into empty space while still allowing users to
    // zoom back to the lesser of ECharts' base scale and the configured zoom.
    ...n.roam ? {
      scaleLimit: {
        min: Math.min(1, n.zoom),
        max: n.zoom * Zt
      }
    } : {},
    center: n.center,
    zoom: n.zoom,
    // Crop empty poles / Antarctica so land fills the container.
    boundingCoords: qn,
    ...n.projection ? { projection: n.projection } : { aspectScale: 1 },
    silent: !0,
    itemStyle: {
      areaColor: n.areaColor,
      borderColor: n.areaColor,
      borderWidth: 0.5
    },
    emphasis: { disabled: !0 }
  };
}
function vr({
  echarts: n,
  geoJson: t,
  mapName: r,
  data: e,
  lng: o,
  lat: l,
  value: a,
  name: s,
  minRadius: h = 6,
  maxRadius: p = 26,
  bubbleSize: i,
  bubbleColor: u,
  bubbleBorderColor: c = "transparent",
  bubbleBorderWidth: m = 0,
  center: d,
  zoom: S = 1.25,
  roam: v = !1,
  projection: w,
  showTooltip: y = !0,
  valueFormat: M = at,
  tooltipFormatter: E,
  onBubbleHover: b,
  onBubbleClick: C,
  aspectRatio: L,
  height: A,
  className: $,
  isDarkMode: N
}, x) {
  const B = en(
    () => Qt(t, r),
    [t, r]
  );
  jt(n, B, t);
  const I = en(
    () => gn.mapColors(N),
    [N]
  ), T = d?.[0], f = d?.[1], g = en(
    () => gr({
      mapName: B,
      areaColor: I.area,
      center: T !== void 0 && f !== void 0 ? [T, f] : void 0,
      zoom: S,
      roam: v,
      projection: Rn(w)
    }),
    [B, t, I, T, f, S, v, w]
  ), R = en(() => {
    if (A === void 0)
      return L ?? Yt(Rn(w), qn);
  }, [L, A, w]), k = nn(void 0), F = k.current !== g;
  pn(() => {
    k.current = g;
  }, [g]);
  const K = nn(b);
  K.current = b;
  const Q = mn(
    (rn) => {
      typeof x == "function" ? x(rn) : x && (x.current = rn);
    },
    [x]
  ), V = en(() => {
    const rn = e.map((j) => En(j, a)), on = rn.length ? Math.max(...rn) : 1, Sn = (j) => {
      if (i) return i(j);
      if (on <= 0) return h;
      const an = Math.sqrt(Math.max(0, j) / on);
      return h + an * (p - h);
    }, xn = e.map((j) => {
      const an = En(j, a);
      return {
        name: s ? En(j, s) : void 0,
        value: [En(j, o), En(j, l), an],
        symbolSize: Sn(an),
        itemStyle: {
          color: u ? Qn(j, u) : I.bubble,
          borderColor: Qn(j, c),
          borderWidth: Qn(j, m)
        },
        datum: j
      };
    });
    return {
      backgroundColor: "transparent",
      animation: !0,
      animationDuration: 500,
      animationDurationUpdate: 0,
      ...F ? { geo: g } : {},
      tooltip: y ? {
        trigger: "item",
        triggerOn: "mousemove",
        backgroundColor: "var(--color-kumo-base)",
        borderColor: "var(--color-kumo-line)",
        borderWidth: 1,
        padding: 8,
        textStyle: {
          color: "var(--text-color-kumo-default)",
          fontSize: 13
        },
        extraCssText: "border-radius: 0.5rem;",
        dangerousHtmlFormatter: (j) => {
          const an = j, O = an.data?.datum;
          if (E && O !== void 0)
            return E(O);
          const D = an.value?.[2], X = an.name ? `<strong>${yn(an.name)}</strong>` : "", J = D !== void 0 ? `<span style="color:var(--text-color-kumo-subtle)">${yn(M(D))}</span>` : "";
          return `<div style="display:flex;flex-direction:column;gap:2px;">${X}${J}</div>`;
        }
      } : void 0,
      series: [
        {
          id: "bubbles",
          type: "scatter",
          coordinateSystem: "geo",
          data: xn,
          itemStyle: { opacity: 0.8 },
          emphasis: { scale: 1.2, itemStyle: { opacity: 1 } },
          z: 3
        }
      ]
    };
  }, [
    I,
    g,
    F,
    e,
    o,
    l,
    a,
    s,
    h,
    p,
    i,
    u,
    c,
    m,
    y,
    E,
    M
  ]), Y = mn(
    (rn) => {
      const on = rn.data?.datum;
      on !== void 0 && K.current?.(on);
    },
    []
  ), tn = mn(() => {
    K.current?.(void 0);
  }, []), W = mn(
    (rn) => {
      const on = rn.data?.datum;
      on !== void 0 && C?.(on);
    },
    [C]
  ), ln = en(
    () => ({
      ...b ? {
        mouseover: Y,
        mouseout: tn,
        globalout: tn
      } : {},
      ...C ? { click: W } : {}
    }),
    [
      b,
      Y,
      tn,
      W,
      C
    ]
  );
  return /* @__PURE__ */ P(
    Ln,
    {
      echarts: n,
      ref: Q,
      options: V,
      className: $,
      isDarkMode: N,
      height: A,
      aspectRatio: R,
      onEvents: ln
    }
  );
}
const yr = Un(vr);
yr.displayName = "BubbleMap";
function Sr({
  echarts: n,
  geoJson: t,
  mapName: r,
  data: e,
  name: o,
  value: l,
  nameProperty: a = "name",
  colorRange: s,
  min: h,
  max: p,
  noDataColor: i,
  showLegend: u = !1,
  showTooltip: c = !0,
  valueFormat: m = at,
  tooltipFormatter: d,
  onRegionHover: S,
  onRegionClick: v,
  center: w,
  zoom: y = 1.25,
  roam: M = !1,
  projection: E,
  aspectRatio: b,
  height: C,
  className: L,
  isDarkMode: A
}, $) {
  const N = en(
    () => Qt(t, r),
    [t, r]
  );
  jt(n, N, t);
  const x = en(
    () => gn.mapColors(A),
    [A]
  ), B = w?.[0], I = w?.[1], T = en(
    () => ({
      roam: M,
      ...M ? {
        scaleLimit: {
          min: Math.min(1, y),
          max: y * Zt
        }
      } : {},
      center: B !== void 0 && I !== void 0 ? [B, I] : void 0,
      zoom: y,
      // Crop empty poles / Antarctica so land fills the container.
      boundingCoords: qn,
      ...Rn(E) ? { projection: Rn(E) } : { aspectScale: 1 }
    }),
    [B, I, y, M, A, E]
  ), f = en(() => {
    if (C === void 0)
      return b ?? Yt(Rn(E), qn);
  }, [b, C, E]), g = nn(void 0), R = g.current !== T;
  pn(() => {
    g.current = T;
  }, [T]);
  const k = nn(S);
  k.current = S;
  const F = mn(
    (W) => {
      typeof $ == "function" ? $(W) : $ && ($.current = W);
    },
    [$]
  ), K = en(() => {
    const W = s ?? x.scale, ln = i ?? x.area, rn = e.map((D) => ({
      name: En(D, o),
      value: En(D, l),
      datum: D
    })), on = rn.map((D) => D.value), Sn = on.length ? Math.min(...on) : 0, xn = on.length ? Math.max(...on) : 1, j = h ?? Sn, an = p ?? (xn > Sn ? xn : Sn + 1);
    return {
      backgroundColor: "transparent",
      animation: !0,
      animationDuration: 500,
      animationDurationUpdate: 0,
      visualMap: {
        type: "continuous",
        show: u,
        min: j,
        max: an,
        calculable: !1,
        hoverLink: !1,
        inRange: { color: W },
        orient: "horizontal",
        text: ["High", "Low"],
        left: 0,
        bottom: 8,
        textStyle: {
          color: gn.text("primary", A),
          fontSize: 11
        }
      },
      tooltip: c ? {
        trigger: "item",
        triggerOn: "mousemove",
        backgroundColor: "var(--color-kumo-base)",
        borderColor: "var(--color-kumo-line)",
        borderWidth: 1,
        padding: 8,
        textStyle: {
          color: "var(--text-color-kumo-default)",
          fontSize: 13
        },
        extraCssText: "border-radius: 0.5rem;",
        dangerousHtmlFormatter: (D) => {
          const X = D, J = X.data?.datum;
          if (J === void 0) return "";
          if (d) return d(J);
          const hn = typeof X.value == "number" && !Number.isNaN(X.value) ? X.value : void 0, wn = X.name ? `<strong>${yn(X.name)}</strong>` : "", _ = hn !== void 0 ? `<span style="color:var(--text-color-kumo-subtle)">${yn(m(hn))}</span>` : "";
          return `<div style="display:flex;flex-direction:column;gap:2px;">${wn}${_}</div>`;
        }
      } : void 0,
      series: [
        {
          id: "regions",
          type: "map",
          map: N,
          nameProperty: a,
          ...R ? T : {},
          data: rn,
          itemStyle: {
            areaColor: ln,
            borderColor: "transparent",
            borderWidth: 0
          },
          label: { show: !1 },
          emphasis: {
            focus: "self",
            label: { show: !1 },
            itemStyle: {
              areaColor: "inherit"
            }
          },
          blur: {
            label: { show: !1 },
            itemStyle: { opacity: 0.45 }
          },
          select: { disabled: !0 },
          z: 1
        }
      ]
    };
  }, [
    A,
    x,
    t,
    N,
    T,
    R,
    e,
    o,
    l,
    a,
    s,
    h,
    p,
    i,
    u,
    c,
    d,
    m
  ]), Q = mn(
    (W) => {
      const ln = W.data?.datum;
      ln !== void 0 && k.current?.(ln);
    },
    []
  ), V = mn(() => {
    k.current?.(void 0);
  }, []), Y = mn(
    (W) => {
      const ln = W.data?.datum;
      ln !== void 0 && v?.(ln);
    },
    [v]
  ), tn = en(
    () => ({
      ...S ? {
        mouseover: Q,
        mouseout: V,
        globalout: V
      } : {},
      ...v ? { click: Y } : {}
    }),
    [
      S,
      Q,
      V,
      Y,
      v
    ]
  );
  return /* @__PURE__ */ P(
    Ln,
    {
      echarts: n,
      ref: F,
      options: K,
      className: L,
      isDarkMode: A,
      height: C,
      aspectRatio: f,
      onEvents: tn
    }
  );
}
const xr = Un(Sr);
xr.displayName = "ChoroplethMap";
function jt(n, t, r) {
  te(() => {
    n.registerMap(t, r);
  }, [n, t, r]);
}
export {
  yr as B,
  Ln as C,
  Le as S,
  we as T,
  Cr as a,
  xr as b,
  gn as c
};
//# sourceMappingURL=Maps-imwfwgb7do9lr3i5.js.map
