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