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