import { H as D } from "./use-page-data.BYLN5MSa.js";
import M from "react";
import { r as S, a as T } from "./video.Ctm1aA2_.js";
function E(l, o) {
  for (var u = 0; u < o.length; u++) {
    const s = o[u];
    if (typeof s != "string" && !Array.isArray(s)) {
      for (const n in s)
        if (n !== "default" && !(n in l)) {
          const p = Object.getOwnPropertyDescriptor(s, n);
          p && Object.defineProperty(l, n, p.get ? p : {
            enumerable: !0,
            get: () => s[n]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(l, Symbol.toStringTag, { value: "Module" }));
}
var h, P;
function x() {
  if (P) return h;
  P = 1;
  var l = Object.create, o = Object.defineProperty, u = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, n = Object.getPrototypeOf, p = Object.prototype.hasOwnProperty, v = (t, e, r) => e in t ? o(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, b = (t, e) => {
    for (var r in e)
      o(t, r, { get: e[r], enumerable: !0 });
  }, f = (t, e, r, c) => {
    if (e && typeof e == "object" || typeof e == "function")
      for (let i of s(e))
        !p.call(t, i) && i !== r && o(t, i, { get: () => e[i], enumerable: !(c = u(e, i)) || c.enumerable });
    return t;
  }, O = (t, e, r) => (r = t != null ? l(n(t)) : {}, f(
    // If the importer is in node compatibility mode or this is not an ESM
    // file that has been converted to a CommonJS file using a Babel-
    // compatible transform (i.e. "__esModule" has not been set), then set
    // "default" to the CommonJS "module.exports" for node compatibility.
    !t || !t.__esModule ? o(r, "default", { value: t, enumerable: !0 }) : r,
    t
  )), w = (t) => f(o({}, "__esModule", { value: !0 }), t), a = (t, e, r) => (v(t, typeof e != "symbol" ? e + "" : e, r), r), y = {};
  b(y, {
    default: () => d
  }), h = w(y);
  var _ = O(M), m = /* @__PURE__ */ S(), K = /* @__PURE__ */ T();
  const j = "https://cdn.embed.ly/player-0.1.0.min.js", L = "playerjs";
  class d extends _.Component {
    constructor() {
      super(...arguments), a(this, "callPlayer", m.callPlayer), a(this, "duration", null), a(this, "currentTime", null), a(this, "secondsLoaded", null), a(this, "mute", () => {
        this.callPlayer("mute");
      }), a(this, "unmute", () => {
        this.callPlayer("unmute");
      }), a(this, "ref", (e) => {
        this.iframe = e;
      });
    }
    componentDidMount() {
      this.props.onMount && this.props.onMount(this);
    }
    load(e) {
      (0, m.getSDK)(j, L).then((r) => {
        this.iframe && (this.player = new r.Player(this.iframe), this.player.on("ready", () => {
          setTimeout(() => {
            this.player.isReady = !0, this.player.setLoop(this.props.loop), this.props.muted && this.player.mute(), this.addListeners(this.player, this.props), this.props.onReady();
          }, 500);
        }));
      }, this.props.onError);
    }
    addListeners(e, r) {
      e.on("play", r.onPlay), e.on("pause", r.onPause), e.on("ended", r.onEnded), e.on("error", r.onError), e.on("timeupdate", ({ duration: c, seconds: i }) => {
        this.duration = c, this.currentTime = i;
      });
    }
    play() {
      this.callPlayer("play");
    }
    pause() {
      this.callPlayer("pause");
    }
    stop() {
    }
    seekTo(e, r = !0) {
      this.callPlayer("setCurrentTime", e), r || this.pause();
    }
    setVolume(e) {
      this.callPlayer("setVolume", e);
    }
    setLoop(e) {
      this.callPlayer("setLoop", e);
    }
    getDuration() {
      return this.duration;
    }
    getCurrentTime() {
      return this.currentTime;
    }
    getSecondsLoaded() {
      return this.secondsLoaded;
    }
    render() {
      const e = {
        width: "100%",
        height: "100%"
      };
      return /* @__PURE__ */ _.default.createElement(
        "iframe",
        {
          ref: this.ref,
          src: this.props.url,
          frameBorder: "0",
          scrolling: "no",
          style: e,
          allow: "encrypted-media; autoplay; fullscreen;",
          referrerPolicy: "no-referrer-when-downgrade"
        }
      );
    }
  }
  return a(d, "displayName", "Kaltura"), a(d, "canPlay", K.canPlay.kaltura), h;
}
var g = /* @__PURE__ */ x();
const N = /* @__PURE__ */ D(g), A = /* @__PURE__ */ E({
  __proto__: null,
  default: N
}, [g]);
export {
  A as K
};
