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