import { computed as w, ref as f, watch as ot, onMounted as lt, onBeforeUnmount as at, openBlock as g, createElementBlock as C, normalizeClass as Fe, normalizeStyle as R, unref as m, createBlock as E, createCommentVNode as O, createSlots as nt, withCtx as x, renderSlot as $, normalizeProps as G, guardReactiveProps as X, createVNode as Ie, Fragment as Le, renderList as Re, createElementVNode as S, toDisplayString as Y, createTextVNode as De, nextTick as st, pushScopeId as rt, popScopeId as ut } from "vue";
import { u as it, c as Me, t as ct, a as dt, p as T, b as vt, o as ht, e as ft, d as ae, i as ne, f as K, X as pt, l as Ve, G as Be, x as Ue, y as gt, q as yt, r as mt } from "./index-BbPeL8Gp.js";
import { _ as bt } from "./Title-aSAft5dl.js";
import { u as kt, U as wt } from "./usePrinter-DaybDVqP.js";
import { _ as Ct } from "./Tooltip-smutPF--.js";
import { L as $t } from "./Legend-BLaZxMge.js";
import xt from "./vue-ui-skeleton-Bniq21d9.js";
import { D as Tt } from "./DataTable-DGf6RrOJ.js";
import _t from "./vue-ui-accordion-5d5iVpr7.js";
import { t as Ot, u as St } from "./useResponsive-CoxXLe23.js";
import { u as We } from "./useNestedProp-BN8claGG.js";
import { _ as Nt } from "./PackageVersion-CxJghxYD.js";
import { P as zt } from "./PenAndPaper-ZdZEumki.js";
import { u as Pt } from "./useUserOptionState-BIvW1Kz7.js";
import { _ as At } from "./_plugin-vue_export-helper-CHgC5LLL.js";
function He(a, i) {
  const s = a.length;
  if (s === 0)
    throw new Error(`Max aspect ratio cannot be computed: ${a} is an empty array`);
  {
    let n = 1 / 0, u = -1 / 0, c = 0;
    for (let h = 0; h < s; h += 1) {
      const v = a[h].normalizedValue;
      v < n && (n = v), v > u && (u = v), c += v;
    }
    return Math.max(
      i ** 2 * u / c ** 2,
      c ** 2 / (i ** 2 * n)
    );
  }
}
function Ee(a) {
  const { xOffset: i, yOffset: s, width: n, height: u } = a;
  return {
    x0: i,
    y0: s,
    x1: i + n,
    y1: s + u
  };
}
function Ft(a, i, s) {
  if (a.length === 0)
    return !0;
  {
    const n = a.concat(i), u = He(
      a,
      s
    ), c = He(n, s);
    return u >= c;
  }
}
function It(a) {
  const i = [], s = a.length;
  for (let n = 0; n < s; n += 1) {
    const u = a[n], c = u.length;
    for (let d = 0; d < c; d += 1)
      i.push(u[d]);
  }
  return i;
}
function Lt(a, i) {
  const s = {
    ...i,
    children: a
  };
  return Xe(s);
}
function Rt(a) {
  return (a.x1 - a.x0) * (a.y1 - a.y0);
}
function Ge(a, i) {
  const { width: s, height: n, xOffset: u, yOffset: c } = ce(i), d = a.length, h = a.map((p) => p.normalizedValue || 0).reduce((p, _) => p + _, 0), v = h / n, N = h / s;
  let k = u, z = c;
  const y = [];
  if (s >= n) {
    for (let p = 0; p < d; p += 1) {
      const _ = a[p], P = z + _.normalizedValue / v, D = {
        x0: k,
        y0: z,
        x1: k + v,
        y1: P
      }, A = Object.assign({}, _, D);
      z = P, y.push(A);
    }
    return y;
  } else {
    for (let p = 0; p < d; p += 1) {
      const _ = a[p], P = k + _.normalizedValue / N, D = {
        x0: k,
        y0: z,
        x1: P,
        y1: z + N
      }, A = Object.assign({}, _, D);
      k = P, y.push(A);
    }
    return y;
  }
}
function Dt(a) {
  const i = ce(a), s = i.width, n = i.height;
  return Math.min(s, n);
}
function Mt(a, i) {
  const s = a.length, n = a.map((v) => v.value ?? 0).reduce((v, N) => v + N, 0), u = i / n, c = [];
  let d, h;
  for (let v = 0; v < s; v += 1)
    h = a[v], d = Object.assign({}, h, {
      normalizedValue: h.value * (u || 0)
    }), c.push(d);
  return c;
}
function ce(a) {
  const { x0: i, y0: s, x1: n, y1: u } = a;
  return {
    xOffset: i,
    yOffset: s,
    width: n - i,
    height: u - s
  };
}
function Vt(a, i, s, n) {
  let u = a, c = i, d = s, h = n;
  for (; ; ) {
    const v = u.length;
    if (v === 0) {
      const y = Ge(c, d);
      return h.concat(y);
    }
    const N = Dt(d), k = u[0], z = u.slice(1, v);
    if (Ft(c, k, N)) {
      const y = c.concat(k);
      u = z, c = y, d = d, h = h;
    } else {
      const y = c.length;
      let p = 0;
      for (let A = 0; A < y; A += 1)
        p += c[A].normalizedValue;
      const _ = Bt(d, p), P = Ge(c, d), D = h.concat(P);
      u = u, c = [], d = _, h = D;
    }
  }
}
function Xe(a) {
  if (typeof a.children > "u" || !a.children.length)
    return [a];
  {
    const i = Mt(
      a.children,
      Rt(a)
    ), s = Vt(i, [], a, []), n = s.length, u = [];
    for (let d = 0; d < n; d += 1)
      u.push(Xe(s[d]));
    return It(u);
  }
}
function Bt(a, i) {
  const { width: s, height: n, xOffset: u, yOffset: c } = ce(a);
  if (s >= n) {
    const d = i / n, h = s - d, v = {
      xOffset: u + d,
      yOffset: c,
      width: h,
      height: n
    };
    return Ee(v);
  } else {
    const d = i / s, h = n - d, v = {
      xOffset: u,
      yOffset: c + d,
      width: s,
      height: h
    };
    return Ee(v);
  }
}
const Ut = (a) => (rt("data-v-6f68fbde"), a = a(), ut(), a), Wt = ["id"], Ht = ["xmlns", "viewBox"], Et = { key: 0 }, Gt = ["id"], Xt = ["stop-color"], qt = ["stop-color"], jt = ["x", "y", "height", "width", "fill", "rx", "stroke", "stroke-width", "onClick", "onMouseenter"], Yt = ["x", "y", "height", "width"], Zt = {
  style: { width: "100%", height: "100%" },
  class: "vue-ui-treemap-cell"
}, Jt = /* @__PURE__ */ Ut(() => /* @__PURE__ */ S("br", null, null, -1)), Kt = {
  key: 5,
  class: "vue-data-ui-watermark"
}, Qt = ["onClick"], eo = { key: 0 }, to = { key: 1 }, oo = ["innerHTML"], lo = {
  __name: "vue-ui-treemap",
  props: {
    config: {
      type: Object,
      default() {
        return {};
      }
    },
    dataset: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  emits: ["selectLegend", "selectDatapoint"],
  setup(a, { expose: i, emit: s }) {
    const n = a, { vue_ui_treemap: u } = it(), c = w(() => !!n.dataset && n.dataset.length), d = w(() => /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), h = f(Me()), v = f(!1), N = f(""), k = f(!1), z = f(0), y = f([]), p = f(null), _ = f(null), P = f(null), D = f(null), A = f(null), de = f(0), ve = f(0), he = f(0), e = w({
      get: () => ye(),
      set: (t) => t
    }), { userOptionsVisible: fe, setUserOptionsVisibility: pe, keepUserOptionState: ge } = Pt({ config: e.value });
    function ye() {
      const t = We({
        userConfig: n.config,
        defaultConfig: u
      });
      return t.theme ? {
        ...We({
          userConfig: ct.vue_ui_treemap[t.theme] || n.config,
          defaultConfig: t
        }),
        customPalette: dt[t.theme] || T
      } : t;
    }
    ot(() => n.config, (t) => {
      e.value = ye(), de.value += 1, ve.value += 1, he.value += 1;
    }, { deep: !0 });
    const { isPrinting: me, isImaging: be, generatePdf: ke, generateImage: we } = kt({
      elementId: `treemap_${h.value}`,
      fileName: e.value.style.chart.title.text || "vue-ui-treemap"
    }), qe = w(() => e.value.userOptions.show && !e.value.style.chart.title.text), Q = w(() => vt(e.value.customPalette)), M = f({
      showTable: e.value.table.show,
      showTooltip: e.value.style.chart.tooltip.show
    }), V = f({
      height: e.value.style.chart.height,
      width: e.value.style.chart.width
    }), U = w(() => ({
      bottom: V.value.height - e.value.style.chart.padding.bottom,
      height: V.value.height - e.value.style.chart.padding.top - e.value.style.chart.padding.bottom,
      left: e.value.style.chart.padding.left,
      right: V.value.width - e.value.style.chart.padding.right,
      top: e.value.style.chart.padding.top,
      vbHeight: V.value.height,
      vbWidth: V.value.width,
      width: V.value.width - e.value.style.chart.padding.left - e.value.style.chart.padding.right
    }));
    function Ce(t) {
      t.forEach((l, o) => {
        l.id = Me(), l.color = ae(l.color) || Q.value[o] || T[o] || T[o % T.length], l.children && (l.children.forEach((r) => {
          r.parentId = l.id, r.color = l.color;
        }), Ce(l.children));
      });
    }
    const W = f(n.dataset), ee = f(null);
    lt(() => {
      je();
    });
    function je() {
      if (ht(n.dataset) && ft({
        componentName: "VueUiTreemap",
        type: "dataset"
      }), Ce(W.value), e.value.responsive) {
        const t = Ot(() => {
          const { width: l, height: o } = St({
            chart: p.value,
            title: e.value.style.chart.title.text ? _.value : null,
            legend: e.value.style.chart.legend.show ? P.value : null,
            source: D.value,
            noTitle: A.value
          });
          V.value.width = l, V.value.height = o;
        });
        ee.value = new ResizeObserver(t), ee.value.observe(p.value.parentNode);
      }
    }
    at(() => {
      ee.value && ee.value.disconnect();
    });
    const se = f(W.value), Z = w(() => se.value.map((t, l) => ({
      ...t,
      color: ae(t.color) || Q.value[l] || T[l] || T[l % T.length]
    })).filter((t) => !y.value.includes(t.id))), q = w(() => W.value.filter((t) => !y.value.includes(t.id)).map((t) => t.value || 0).reduce((t, l) => t + l, 0)), $e = w({
      get() {
        let t = [...Z.value];
        return e.value.style.chart.layout.sorted && (t = [...Z.value].sort((l, o) => o.value - l.value)), t.map((l) => ({
          ...l
        }));
      },
      set(t) {
        return t;
      }
    });
    function xe(t, l) {
      return t.value / l;
    }
    function Ye(t, l, o) {
      const r = e.value.style.chart.layout.rects.colorRatio - xe(l, o);
      return Ve(t, r < 0 ? 0 : r);
    }
    function Te(t, l, o, r) {
      return t.map((b, B) => {
        const le = Ye(ae(l) || Q.value[B] || T[B] || T[B % T.length], b, r), tt = xe(b, r);
        return {
          ...b,
          color: le,
          proportion: tt,
          parentName: o,
          children: b.children ? Te(b.children, le, b.name, r) : void 0
        };
      });
    }
    const J = w(() => Lt(
      $e.value.map((t, l) => {
        const o = t.children ? t.children.reduce((r, b) => r + b.value, 0) : t.value;
        return {
          value: t.value,
          id: t.id,
          children: t.children ? Te(t.children.sort((r, b) => b.value - r.value), t.color, t.name, o) : void 0,
          color: t.color,
          name: t.name
        };
      }),
      { x0: U.value.left * 2, y0: U.value.top, x1: U.value.width, y1: U.value.height }
    ));
    function _e({ y0: t, y1: l }) {
      return l - t <= 0 ? 1e-4 : l - t;
    }
    function Oe({ x0: t, x1: l }) {
      return l - t <= 0 ? 1e-4 : l - t;
    }
    function H(t) {
      const l = e.value.style.chart.layout.labels.fontSize * (t.proportion * 2 > 1 ? 1 : t.proportion * 2);
      return l < e.value.style.chart.layout.labels.minFontSize ? e.value.style.chart.layout.labels.minFontSize : l;
    }
    function Ze(t) {
      k.value = t, z.value += 1;
    }
    const j = w(() => ({
      startX: 0,
      startY: 0,
      width: U.value.vbWidth,
      height: U.value.vbHeight
    })), F = f(!1);
    function re(t, l = W.value) {
      for (const o of l) {
        if (o.id === t)
          return o;
        if (o.children) {
          const r = re(t, o.children);
          if (r)
            return r;
        }
      }
      return null;
    }
    function Je(t) {
      if (F.value)
        s("selectDatapoint", void 0), se.value = W.value;
      else {
        if (s("selectDatapoint", t), !re(t.parentId))
          return;
        se.value = [re(t.parentId)];
      }
      F.value = !F.value;
    }
    const I = f(null), Se = w(() => W.value.map((t, l) => ({
      ...t,
      color: ae(t.color) || Q.value[l] || T[l] || T[l % T.length],
      shape: "square"
    })).sort((t, l) => l.value - t.value).map((t, l) => ({
      ...t,
      proportion: t.value / W.value.map((o) => o.value).reduce((o, r) => o + r, 0),
      opacity: y.value.includes(t.id) ? 0.5 : 1
    }))), Ke = w(() => ({
      cy: "treemap-div-legend",
      backgroundColor: e.value.style.chart.legend.backgroundColor,
      color: e.value.style.chart.legend.color,
      fontSize: e.value.style.chart.legend.fontSize,
      paddingBottom: 12,
      fontWeight: e.value.style.chart.legend.bold ? "bold" : ""
    }));
    function Ne(t) {
      F.value = !1, I.value = null, y.value.includes(t.id) ? y.value = y.value.filter((l) => l !== t.id) : y.value.length < n.dataset.length - 1 && y.value.push(t.id), s("selectLegend", $e.value);
    }
    const ue = f(null);
    function Qe({ datapoint: t, seriesIndex: l }) {
      I.value = t, ue.value = { datapoint: t, seriesIndex: l, config: e.value, series: Z.value };
      const o = e.value.style.chart.tooltip.customFormat;
      if (Ue(o) && gt(() => o({
        seriesIndex: l,
        datapoint: t,
        series: Z.value,
        config: e.value
      })))
        N.value = o({
          seriesIndex: l,
          datapoint: t,
          series: Z.value,
          config: e.value
        });
      else {
        let r = "";
        r += `<div style="width:100%;text-align:center;border-bottom:1px solid ${e.value.style.chart.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${t.name}</div>`, r += `<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><rect x="0" y="0" height="12" width="12" stroke="none" fill="${t.color}"/></svg>`, r += `<b>${ne(
          e.value.style.chart.layout.labels.formatter,
          t.value,
          K({
            p: e.value.style.chart.layout.labels.prefix,
            v: t.value,
            s: e.value.style.chart.layout.labels.suffix,
            r: e.value.style.chart.tooltip.roundingValue
          }),
          { datapoint: t, seriesIndex: l }
        )}</b>`, N.value = `<div>${r}</div>`;
      }
      v.value = !0;
    }
    const L = w(() => {
      const t = J.value.map((o) => ({
        name: o.name,
        color: o.color
      })), l = J.value.map((o) => o.value);
      return { head: t, body: l };
    });
    function ze() {
      st(() => {
        const t = L.value.head.map((r, b) => [[
          r.name
        ], [L.value.body[b]], [isNaN(L.value.body[b] / q.value) ? "-" : L.value.body[b] / q.value * 100]]), l = [[e.value.style.chart.title.text], [e.value.style.chart.title.subtitle.text], [[""], ["val"], ["%"]]].concat(t), o = yt(l);
        mt({ csvContent: o, title: e.value.style.chart.title.text || "vue-ui-treemap" });
      });
    }
    const te = w(() => {
      const t = [
        e.value.table.columnNames.series,
        e.value.table.columnNames.value,
        e.value.table.columnNames.percentage
      ], l = L.value.head.map((b, B) => {
        const le = ne(
          e.value.style.chart.layout.labels.formatter,
          L.value.body[B],
          K({
            p: e.value.style.chart.layout.labels.prefix,
            v: L.value.body[B],
            s: e.value.style.chart.layout.labels.suffix,
            r: e.value.table.td.roundingValue
          })
        );
        return [
          {
            color: b.color,
            name: b.name,
            shape: "square"
          },
          le,
          isNaN(L.value.body[B] / q.value) ? "-" : K({
            v: L.value.body[B] / q.value * 100,
            s: "%",
            r: e.value.table.td.roundingPercentage
          })
        ];
      }), o = {
        th: {
          backgroundColor: e.value.table.th.backgroundColor,
          color: e.value.table.th.color,
          outline: e.value.table.th.outline
        },
        td: {
          backgroundColor: e.value.table.td.backgroundColor,
          color: e.value.table.td.color,
          outline: e.value.table.td.outline
        },
        breakpoint: e.value.table.responsiveBreakpoint
      };
      return {
        colNames: [
          e.value.table.columnNames.series,
          e.value.table.columnNames.value
        ],
        head: t,
        body: l,
        config: o
      };
    });
    function et() {
      return J.value;
    }
    function Pe() {
      M.value.showTable = !M.value.showTable;
    }
    function Ae() {
      M.value.showTooltip = !M.value.showTooltip;
    }
    const oe = f(!1);
    function ie() {
      oe.value = !oe.value;
    }
    return i({
      getData: et,
      generateCsv: ze,
      generateImage: we,
      generatePdf: ke,
      toggleTable: Pe,
      toggleTooltip: Ae,
      toggleAnnotator: ie
    }), (t, l) => (g(), C("div", {
      ref_key: "treemapChart",
      ref: p,
      class: Fe(`vue-ui-treemap ${k.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${e.value.useCssAnimation ? "" : "vue-ui-dna"}`),
      style: R(`font-family:${e.value.style.fontFamily};width:100%; ${e.value.responsive ? "height: 100%;" : ""} text-align:center;background:${e.value.style.chart.backgroundColor}`),
      id: `treemap_${h.value}`,
      onMouseenter: l[3] || (l[3] = () => m(pe)(!0)),
      onMouseleave: l[4] || (l[4] = () => m(pe)(!1))
    }, [
      e.value.userOptions.buttons.annotator ? (g(), E(zt, {
        key: 0,
        parent: p.value,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        active: oe.value,
        onClose: ie
      }, null, 8, ["parent", "backgroundColor", "color", "active"])) : O("", !0),
      qe.value ? (g(), C("div", {
        key: 1,
        ref_key: "noTitle",
        ref: A,
        class: "vue-data-ui-no-title-space",
        style: "height:36px; width: 100%;background:transparent"
      }, null, 512)) : O("", !0),
      e.value.style.chart.title.text ? (g(), C("div", {
        key: 2,
        ref_key: "chartTitle",
        ref: _,
        style: R(`width:100%;background:${e.value.style.chart.backgroundColor};padding-bottom:6px`)
      }, [
        (g(), E(bt, {
          key: `title_${de.value}`,
          config: {
            title: {
              cy: "treemap-div-title",
              ...e.value.style.chart.title
            },
            subtitle: {
              cy: "treemap-div-subtitle",
              ...e.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 4)) : O("", !0),
      e.value.userOptions.show && c.value && (m(ge) || m(fe)) ? (g(), E(wt, {
        ref: "details",
        key: `user_option_${z.value}`,
        backgroundColor: e.value.style.chart.backgroundColor,
        color: e.value.style.chart.color,
        isPrinting: m(me),
        isImaging: m(be),
        uid: h.value,
        hasTooltip: e.value.userOptions.buttons.tooltip && e.value.style.chart.tooltip.show,
        hasPdf: e.value.userOptions.buttons.pdf,
        hasXls: e.value.userOptions.buttons.csv,
        hasImg: e.value.userOptions.buttons.img,
        hasTable: e.value.userOptions.buttons.table,
        hasFullscreen: e.value.userOptions.buttons.fullscreen,
        isFullscreen: k.value,
        isTooltip: M.value.showTooltip,
        titles: { ...e.value.userOptions.buttonTitles },
        chartElement: p.value,
        position: e.value.userOptions.position,
        hasAnnotator: e.value.userOptions.buttons.annotator,
        isAnnotation: oe.value,
        onToggleFullscreen: Ze,
        onGeneratePdf: m(ke),
        onGenerateCsv: ze,
        onGenerateImage: m(we),
        onToggleTable: Pe,
        onToggleTooltip: Ae,
        onToggleAnnotator: ie,
        style: R({
          visibility: m(ge) ? m(fe) ? "visible" : "hidden" : "visible"
        })
      }, nt({ _: 2 }, [
        t.$slots.optionTooltip ? {
          name: "optionTooltip",
          fn: x(() => [
            $(t.$slots, "optionTooltip", {}, void 0, !0)
          ]),
          key: "0"
        } : void 0,
        t.$slots.optionPdf ? {
          name: "optionPdf",
          fn: x(() => [
            $(t.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        t.$slots.optionCsv ? {
          name: "optionCsv",
          fn: x(() => [
            $(t.$slots, "optionCsv", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        t.$slots.optionImg ? {
          name: "optionImg",
          fn: x(() => [
            $(t.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        t.$slots.optionTable ? {
          name: "optionTable",
          fn: x(() => [
            $(t.$slots, "optionTable", {}, void 0, !0)
          ]),
          key: "4"
        } : void 0,
        t.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: x(({ toggleFullscreen: o, isFullscreen: r }) => [
            $(t.$slots, "optionFullscreen", G(X({ toggleFullscreen: o, isFullscreen: r })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        t.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: x(({ toggleAnnotator: o, isAnnotator: r }) => [
            $(t.$slots, "optionAnnotator", G(X({ toggleAnnotator: o, isAnnotator: r })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasXls", "hasImg", "hasTable", "hasFullscreen", "isFullscreen", "isTooltip", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : O("", !0),
      c.value ? (g(), C("svg", {
        key: 4,
        xmlns: m(pt),
        class: Fe({ "vue-data-ui-fullscreen--on": k.value, "vue-data-ui-fulscreen--off": !k.value, "vue-data-ui-zoom-plus": !F.value, "vue-data-ui-zoom-minus": F.value }),
        viewBox: `${j.value.startX} ${j.value.startY} ${j.value.width <= 0 ? 10 : j.value.width} ${j.value.height <= 0 ? 10 : j.value.height}`,
        style: R(`max-width:100%; overflow: hidden; background:transparent;color:${e.value.style.chart.color}`)
      }, [
        Ie(Nt),
        (g(!0), C(Le, null, Re(J.value, (o, r) => (g(), C("g", null, [
          e.value.style.chart.layout.rects.gradient.show ? (g(), C("defs", Et, [
            S("radialGradient", {
              id: `tgrad_${o.id}`,
              gradientTransform: "translate(-1, -1.000001) scale(2, 2)"
            }, [
              S("stop", {
                offset: "18%",
                "stop-color": o.color
              }, null, 8, Xt),
              S("stop", {
                offset: "100%",
                "stop-color": m(Ve)(o.color, e.value.style.chart.layout.rects.gradient.intensity / 100)
              }, null, 8, qt)
            ], 8, Gt)
          ])) : O("", !0)
        ]))), 256)),
        (g(!0), C(Le, null, Re(J.value, (o, r) => (g(), C("g", null, [
          S("rect", {
            x: o.x0,
            y: o.y0,
            height: _e(o),
            width: Oe(o),
            fill: d.value ? o.color : e.value.style.chart.layout.rects.gradient.show ? `url(#tgrad_${o.id})` : o.color,
            rx: e.value.style.chart.layout.rects.borderRadius,
            stroke: I.value && I.value.id === o.id ? e.value.style.chart.layout.rects.selected.stroke : e.value.style.chart.layout.rects.stroke,
            "stroke-width": I.value && I.value.id === o.id ? e.value.style.chart.layout.rects.selected.strokeWidth : e.value.style.chart.layout.rects.strokeWidth,
            onClick: (b) => Je(o),
            onMouseenter: () => Qe({
              datapoint: o,
              seriesIndex: r
            }),
            onMouseleave: l[0] || (l[0] = (b) => {
              I.value = null, v.value = !1;
            }),
            style: R(`opacity:${I.value ? I.value.id === o.id ? 1 : e.value.style.chart.layout.rects.selected.unselectedOpacity : 1}`),
            class: "vue-ui-treemap-rect"
          }, null, 44, jt),
          (g(), C("foreignObject", {
            x: o.x0,
            y: o.y0,
            height: _e(o),
            width: Oe(o),
            class: "vue-ui-treemap-cell-foreignObject"
          }, [
            S("div", Zt, [
              e.value.style.chart.layout.labels.showDefaultLabels && (o.proportion > e.value.style.chart.layout.labels.hideUnderProportion || F.value) ? (g(), C("div", {
                key: 0,
                class: "vue-ui-treemap-cell-default",
                style: R(`width:calc(100% - ${H(o) / 1.5}px);text-align:left;line-height:${H(o) < 14 ? 14 : H(o)}px;padding:${H(o) / 3}px; color:${m(Be)(o.color)}`)
              }, [
                S("span", {
                  style: R(`width:100%;font-size:${H(o)}px;`)
                }, Y(o.name), 5),
                Jt,
                S("span", {
                  style: R(`width:100%;font-size:${H(o)}px;`)
                }, Y(m(ne)(
                  e.value.style.chart.layout.labels.formatter,
                  o.value,
                  m(K)({
                    p: e.value.style.chart.layout.labels.prefix,
                    v: o.value,
                    s: e.value.style.chart.layout.labels.suffix,
                    r: e.value.style.chart.layout.labels.rounding
                  }),
                  { datapoint: o }
                )), 5)
              ], 4)) : O("", !0),
              $(t.$slots, "rect", G(X({
                rect: o,
                shouldShow: o.proportion > e.value.style.chart.layout.labels.hideUnderProportion || F.value,
                fontSize: H(o),
                isZoom: F.value,
                textColor: m(Be)(o.color)
              })), void 0, !0)
            ])
          ], 8, Yt))
        ]))), 256)),
        $(t.$slots, "svg", G(X({ svg: U.value, isZoom: F.value, rect: I.value, config: e.value })), void 0, !0)
      ], 14, Ht)) : O("", !0),
      t.$slots.watermark ? (g(), C("div", Kt, [
        $(t.$slots, "watermark", G(X({ isPrinting: m(me) || m(be) })), void 0, !0)
      ])) : O("", !0),
      c.value ? O("", !0) : (g(), E(xt, {
        key: 6,
        config: {
          type: "treemap",
          style: {
            backgroundColor: e.value.style.chart.backgroundColor,
            treemap: {
              color: "#CCCCCC"
            }
          }
        }
      }, null, 8, ["config"])),
      S("div", {
        ref_key: "chartLegend",
        ref: P
      }, [
        e.value.style.chart.legend.show ? (g(), E($t, {
          key: `legend_${he.value}`,
          legendSet: Se.value,
          config: Ke.value,
          id: `treemap_legend_${h.value}`,
          onClickMarker: l[1] || (l[1] = ({ legend: o }) => Ne(o))
        }, {
          item: x(({ legend: o, index: r }) => [
            S("div", {
              onClick: (b) => Ne(o),
              style: R(`opacity:${y.value.includes(o.id) ? 0.5 : 1}`)
            }, [
              De(Y(o.name) + ": " + Y(m(ne)(
                e.value.style.chart.layout.labels.formatter,
                o.value,
                m(K)({
                  p: e.value.style.chart.layout.labels.prefix,
                  v: o.value,
                  s: e.value.style.chart.layout.labels.suffix,
                  r: e.value.style.chart.legend.roundingValue
                }),
                { datapoint: o }
              )) + " ", 1),
              y.value.includes(o.id) ? (g(), C("span", to, " ( - % ) ")) : (g(), C("span", eo, " (" + Y(isNaN(o.value / q.value) ? "-" : (o.value / q.value * 100).toFixed(e.value.style.chart.legend.roundingPercentage)) + "%) ", 1))
            ], 12, Qt)
          ]),
          _: 1
        }, 8, ["legendSet", "config", "id"])) : $(t.$slots, "legend", {
          key: 1,
          legend: Se.value
        }, void 0, !0)
      ], 512),
      t.$slots.source ? (g(), C("div", {
        key: 7,
        ref_key: "source",
        ref: D,
        dir: "auto"
      }, [
        $(t.$slots, "source", {}, void 0, !0)
      ], 512)) : O("", !0),
      Ie(Ct, {
        show: M.value.showTooltip && v.value,
        backgroundColor: e.value.style.chart.tooltip.backgroundColor,
        color: e.value.style.chart.tooltip.color,
        fontSize: e.value.style.chart.tooltip.fontSize,
        borderRadius: e.value.style.chart.tooltip.borderRadius,
        borderColor: e.value.style.chart.tooltip.borderColor,
        borderWidth: e.value.style.chart.tooltip.borderWidth,
        backgroundOpacity: e.value.style.chart.tooltip.backgroundOpacity,
        position: e.value.style.chart.tooltip.position,
        offsetY: e.value.style.chart.tooltip.offsetY,
        parent: p.value,
        content: N.value,
        isFullscreen: k.value,
        isCustom: m(Ue)(e.value.style.chart.tooltip.customFormat)
      }, {
        "tooltip-before": x(() => [
          $(t.$slots, "tooltip-before", G(X({ ...ue.value })), void 0, !0)
        ]),
        "tooltip-after": x(() => [
          $(t.$slots, "tooltip-after", G(X({ ...ue.value })), void 0, !0)
        ]),
        _: 3
      }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "backgroundOpacity", "position", "offsetY", "parent", "content", "isFullscreen", "isCustom"]),
      c.value ? (g(), E(_t, {
        key: 8,
        hideDetails: "",
        config: {
          open: M.value.showTable,
          maxHeight: 1e4,
          body: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          },
          head: {
            backgroundColor: e.value.style.chart.backgroundColor,
            color: e.value.style.chart.color
          }
        }
      }, {
        content: x(() => [
          (g(), E(Tt, {
            key: `table_${ve.value}`,
            colNames: te.value.colNames,
            head: te.value.head,
            body: te.value.body,
            config: te.value.config,
            title: `${e.value.style.chart.title.text}${e.value.style.chart.title.subtitle.text ? ` : ${e.value.style.chart.title.subtitle.text}` : ""}`,
            onClose: l[2] || (l[2] = (o) => M.value.showTable = !1)
          }, {
            th: x(({ th: o }) => [
              S("div", {
                innerHTML: o,
                style: { display: "flex", "align-items": "center" }
              }, null, 8, oo)
            ]),
            td: x(({ td: o }) => [
              De(Y(o.name || o), 1)
            ]),
            _: 1
          }, 8, ["colNames", "head", "body", "config", "title"]))
        ]),
        _: 1
      }, 8, ["config"])) : O("", !0)
    ], 46, Wt));
  }
}, ko = /* @__PURE__ */ At(lo, [["__scopeId", "data-v-6f68fbde"]]);
export {
  ko as default
};
