import { defineComponent as i, watch as n, openBlock as f, createElementBlock as b, createElementVNode as v, unref as _ } 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-label-gauge" }), 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: l }) {
    const e = u, h = l, {
      id: p,
      setOption: a,
      chart: m,
      renderChart: c,
      renderData: o
    } = E({
      basicOption: r(e.basicOption),
      useEvents: r(e.useEvents),
      customRenderData: (s) => {
        s = r(s), window.SHJDatasourceV2({
          tId: e.uuid,
          sources: e.sources,
          callback: ({ data: t }) => {
            try {
              window.SHJParseEvent(e.useEvents, "dataListener", t), s.dataset = {
                dimensions: ["score"],
                source: r(t[0].data)
              }, a(s);
            } catch {
              window.SHJParseEvent(e.useEvents, "dataListener", null), a(s);
            }
          }
        });
      },
      emit: h
    });
    return n(() => e.sources, () => {
      e.sources && e.sources.length > 0 && o(e.basicOption);
    }, {
      deep: !0
    }), n(() => r(e.basicOption), (s, t) => {
      w(s, t) || c(s);
    }, {
      deep: !0
    }), d({
      getEchartsInstance: () => m.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);
      }
    }), (s, t) => (f(), b("div", O, [
      v("div", {
        id: _(p),
        class: "widget"
      }, null, 8, g)
    ]));
  }
});
export {
  J as default
};
