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