import { H as M } from "./use-page-data.BYLN5MSa.js";
import D from "react";
import { r as E, a as T } from "./video.Ctm1aA2_.js";
function x(p, s) {
  for (var u = 0; u < s.length; u++) {
    const o = s[u];
    if (typeof o != "string" && !Array.isArray(o)) {
      for (const i in o)
        if (i !== "default" && !(i in p)) {
          const c = Object.getOwnPropertyDescriptor(o, i);
          c && Object.defineProperty(p, i, c.get ? c : {
            enumerable: !0,
            get: () => o[i]
          });
        }
    }
  }
  return Object.freeze(Object.defineProperty(p, Symbol.toStringTag, { value: "Module" }));
}
var m, P;
function A() {
  if (P) return m;
  P = 1;
  var p = Object.create, s = Object.defineProperty, u = Object.getOwnPropertyDescriptor, o = Object.getOwnPropertyNames, i = Object.getPrototypeOf, c = Object.prototype.hasOwnProperty, v = (t, e, r) => e in t ? s(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, O = (t, e) => {
    for (var r in e)
      s(t, r, { get: e[r], enumerable: !0 });
  }, d = (t, e, r, n) => {
    if (e && typeof e == "object" || typeof e == "function")
      for (let l of o(e))
        !c.call(t, l) && l !== r && s(t, l, { get: () => e[l], enumerable: !(n = u(e, l)) || n.enumerable });
    return t;
  }, S = (t, e, r) => (r = t != null ? p(i(t)) : {}, d(
    // 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 ? s(r, "default", { value: t, enumerable: !0 }) : r,
    t
  )), j = (t) => d(s({}, "__esModule", { value: !0 }), t), a = (t, e, r) => (v(t, typeof e != "symbol" ? e + "" : e, r), r), y = {};
  O(y, {
    default: () => h
  }), m = j(y);
  var f = S(D), _ = /* @__PURE__ */ E(), b = /* @__PURE__ */ T();
  const L = "https://cdn.embed.ly/player-0.1.0.min.js", w = "playerjs";
  class h extends f.Component {
    constructor() {
      super(...arguments), a(this, "callPlayer", _.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, _.getSDK)(L, w).then((r) => {
        this.iframe && (this.player = new r.Player(this.iframe), this.player.setLoop(this.props.loop), this.player.on("ready", this.props.onReady), this.player.on("play", this.props.onPlay), this.player.on("pause", this.props.onPause), this.player.on("seeked", this.props.onSeek), this.player.on("ended", this.props.onEnded), this.player.on("error", this.props.onError), this.player.on("timeupdate", ({ duration: n, seconds: l }) => {
          this.duration = n, this.currentTime = l;
        }), this.player.on("buffered", ({ percent: n }) => {
          this.duration && (this.secondsLoaded = this.duration * n);
        }), this.props.muted && this.player.mute());
      }, this.props.onError);
    }
    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 * 100);
    }
    setLoop(e) {
      this.callPlayer("setLoop", e);
    }
    getDuration() {
      return this.duration;
    }
    getCurrentTime() {
      return this.currentTime;
    }
    getSecondsLoaded() {
      return this.secondsLoaded;
    }
    render() {
      const e = this.props.url.match(b.MATCH_URL_STREAMABLE)[1], r = {
        width: "100%",
        height: "100%"
      };
      return /* @__PURE__ */ f.default.createElement(
        "iframe",
        {
          ref: this.ref,
          src: `https://streamable.com/o/${e}`,
          frameBorder: "0",
          scrolling: "no",
          style: r,
          allow: "encrypted-media; autoplay; fullscreen;"
        }
      );
    }
  }
  return a(h, "displayName", "Streamable"), a(h, "canPlay", b.canPlay.streamable), m;
}
var g = /* @__PURE__ */ A();
const C = /* @__PURE__ */ M(g), B = /* @__PURE__ */ x({
  __proto__: null,
  default: C
}, [g]);
export {
  B as S
};
