import { defineComponent as i, watch as n, openBlock as f, createElementBlock as v, createElementVNode as _, unref as b } from "vue";
import { cloneDeep as r, isEqual as w } from "lodash";
import { useChart as E } from "../../core/useChart.mjs";
const O = { class: "zerov-widget" }, g = ["id"], k = i({ name: "zv-chart-other-treemap" }), J = /* @__PURE__ */ i({
  ...k,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {}
  },
  emits: [
    "chart-click",
    "chart-dblclick",
    "chart-mousedown",
    "chart-mouseover",
    "chart-mouseout",
    "chart-contextmenu"
  ],
  setup(u, { expose: d, emit: h }) {
    const e = u, l = h, {
      id: p,
      setOption: o,
      chart: m,
      renderChart: c,
      renderData: a
    } = E({
      basicOption: r(e.basicOption),
      useEvents: r(e.useEvents),
      customRenderData: (t) => {
        t = r(t), window.SHJDatasourceV2({
          tId: e.uuid,
          sources: e.sources,
          callback: ({ data: s }) => {
            try {
              window.SHJParseEvent(e.useEvents, "dataListener", s), t.series[0].data = r(s[0].data), o(t);
            } catch {
              window.SHJParseEvent(e.useEvents, "dataListener", null), o(t);
            }
          }
        });
      },
      emit: l
    });
    return n(() => e.sources, () => {
      a(e.basicOption);
    }, {
      deep: !0
    }), n(() => r(e.basicOption), (t, s) => {
      w(t, s) || c(t);
    }, {
      deep: !0
    }), d({
      getEchartsInstance: () => m.value,
      refresh: () => {
        e.sources && e.sources.length > 0 && c(e.basicOption), a(e.basicOption);
      },
      refreshView: () => {
        e.sources && e.sources.length > 0 && c(e.basicOption);
      },
      refreshData: () => {
        a(e.basicOption);
      }
    }), (t, s) => (f(), v("div", O, [
      _("div", {
        id: b(p),
        class: "widget"
      }, null, 8, g)
    ]));
  }
});
export {
  J as default
};
