import { at as e, a7 as s, aS as o } from "./index-9ceb1eb9.js";
import { openBlock as n, createElementBlock as a } from "vue";
import "lodash-es";
import "axios";
import "@vueuse/core";
import "vue-i18n";
const r = `.jitsi-meet-container{width:100%;height:100%;min-width:0;min-height:0}
`;
s("KapixJitsiMeet", r);
const d = {
  props: {
    domain: {
      type: String,
      default: "meet.jit.si"
    },
    options: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ["load"],
  data() {
    return {
      loaded: !1
    };
  },
  async mounted() {
    if (await o(`https://${this.domain}/external_api.js`), !window.JitsiMeetExternalAPI)
      throw new Error("Jitsi Meet API not loaded");
    this.embedJitsiWidget();
  },
  beforeUnmount() {
    this.removeJitsiWidget();
  },
  methods: {
    embedJitsiWidget() {
      const t = {
        ...this.options,
        parentNode: this.$refs.jitsiContainer,
        onload: this.onLoad
      };
      this.jitsiApi = new window.JitsiMeetExternalAPI(this.domain, t);
    },
    onLoad() {
      this.loaded = !0, setTimeout(() => {
        this.$emit("load", this.jitsiApi);
      }, 500);
    },
    executeCommand(t, ...i) {
      this.jitsiApi.executeCommand(t, ...i);
    },
    addEventListener(t, i) {
      this.jitsiApi.on(t, i);
    },
    removeJitsiWidget() {
      this.jitsiApi && this.jitsiApi.dispose();
    }
  }
}, p = {
  ref: "jitsiContainer",
  class: "jitsi-meet-container"
};
function m(t, i, h, c, l, f) {
  return n(), a("div", p, null, 512);
}
const A = /* @__PURE__ */ e(d, [["render", m]]);
export {
  A as default
};
