import { defineComponent as t, openBlock as f, createElementBlock as m, ref as u, onMounted as d, onBeforeUnmount as l } from "vue";
const p = ["src"], w = t({ name: "zv-scene-unity-webgl" }), I = /* @__PURE__ */ t({
  ...w,
  props: {
    basicOption: {},
    sources: {},
    useEvents: {},
    uuid: {},
    isPreview: { type: Boolean },
    disableDrag: { type: Boolean }
  },
  emits: [
    "on-message"
  ],
  setup(s, { emit: o }) {
    const a = s, r = o, i = () => {
      const e = u();
      return d(() => {
        window.SHJSceneUnityIframeInstance = e.value;
      }), l(() => {
        window.SHJSceneUnityIframeInstance && (window.SHJSceneUnityIframeInstance = null);
      }), window.addEventListener("message", (n) => {
        r("on-message", n.data), window.SHJParseEvent(a.useEvents, "on-message", n.data);
      }, !1), { unityIframeRef: e };
    }, { unityIframeRef: c } = i();
    return (e, n) => (f(), m("iframe", {
      ref_key: "unityIframeRef",
      ref: c,
      class: "unity-wrap",
      src: `${e.basicOption.url}/index.html`,
      frameborder: "0"
    }, null, 8, p));
  }
});
export {
  I as default
};
