import { defineComponent as a, ref as m, createElementBlock as c, openBlock as f } from "vue";
import { isArray as p } from "lodash";
const d = ["src"], u = a({ name: "zv-media-iframe" }), w = /* @__PURE__ */ a({
  ...u,
  props: {
    basicOption: {},
    sceneOption: {},
    useEvents: {}
  },
  emits: ["on-iframe-event-listener"],
  setup(o, { expose: i, emit: r }) {
    const n = m(), s = o, l = r;
    return window.addEventListener("message", (e) => {
      l("on-iframe-event-listener", e.data), s.useEvents && p(s.useEvents) && window.SHJParseEvent(s.useEvents, "on-iframe-event-listener", e.data);
    }, !1), i({
      sendChildrenMessages: (e, t) => {
        e[0].dataType === "params" ? n.value.contentWindow.postMessage(t, s.basicOption.url) : n.value.contentWindow.postMessage(e[0].data, s.basicOption.url);
      }
    }), (e, t) => (f(), c("iframe", {
      ref_key: "iframeRef",
      ref: n,
      src: e.basicOption.url,
      class: "iframe",
      sandbox: "allow-scripts allow-same-origin allow-forms"
    }, null, 8, d));
  }
});
export {
  w as default
};
