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