import { defineComponent as t, computed as c, createElementBlock as n, openBlock as i } from "vue";
import { useEcharts as u } from "./utils/compileAndRunEcharts.mjs";
import { upgradeEcharts as f } from "./version.mjs";
import { useWatch as l } from "./hooks/useWatch.mjs";
const m = t({ name: "ShjEcharts" }), x = /* @__PURE__ */ t({
  ...m,
  props: {
    option: {},
    sources: {},
    useEvents: {}
  },
  setup(o, { expose: s }) {
    const e = c(() => f(o.option)), { iframeRef: a, initEcharts: r } = u(e.value, o.sources, o.useEvents);
    return l({ option: e.value, sources: o.sources }, r), s({
      refreshData: () => {
        r(e.value.code);
      },
      refreshView: () => {
        r(e.value.code);
      },
      refresh: () => {
        r(e.value.code);
      }
    }), (h, p) => (i(), n("iframe", {
      ref_key: "iframeRef",
      ref: a,
      style: { width: "100%", height: "100%", border: "0" },
      sandbox: "allow-scripts allow-same-origin"
    }, null, 512));
  }
});
export {
  x as default
};
