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