import { b as e, e as t } from "./chunk.BlbRoQQ3.js";
import { b as n, c as r } from "./patterns.CVV2epWU.js";
import "./cjs.S1Glohke.js";
var i = /* @__PURE__ */ e(((exports, i) => {
	var a = Object.create, o = Object.defineProperty, s = Object.getOwnPropertyDescriptor, c = Object.getOwnPropertyNames, l = Object.getPrototypeOf, u = Object.prototype.hasOwnProperty, d = (e, t, n) => t in e ? o(e, t, {
		enumerable: !0,
		configurable: !0,
		writable: !0,
		value: n
	}) : e[t] = n, f = (e, t) => {
		for (var n in t) o(e, n, {
			get: t[n],
			enumerable: !0
		});
	}, p = (e, t, n, r) => {
		if (t && typeof t == "object" || typeof t == "function") for (let i of c(t)) !u.call(e, i) && i !== n && o(e, i, {
			get: () => t[i],
			enumerable: !(r = s(t, i)) || r.enumerable
		});
		return e;
	}, m = (e, t, n) => (n = e == null ? {} : a(l(e)), p(t || !e || !e.__esModule ? o(n, "default", {
		value: e,
		enumerable: !0
	}) : n, e)), h = (e) => p(o({}, "__esModule", { value: !0 }), e), g = (e, t, n) => (d(e, typeof t == "symbol" ? t : t + "", n), n), _ = {};
	f(_, { default: () => x }), i.exports = h(_);
	var v = m(t("react")), y = r(), b = n(), x = class extends v.Component {
		constructor() {
			super(...arguments), g(this, "callPlayer", y.callPlayer), g(this, "mute", () => {
				this.setVolume(0);
			}), g(this, "unmute", () => {
				this.props.volume !== null && this.setVolume(this.props.volume);
			}), g(this, "ref", (e) => {
				this.container = e;
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e) {
			let { playing: t, config: n, onError: r, onDuration: i } = this.props, a = e && e.match(b.MATCH_URL_VIDYARD)[1];
			this.player && this.stop(), (0, y.getSDK)("https://play.vidyard.com/embed/v4.js", "VidyardV4", "onVidyardAPI").then((e) => {
				this.container && (e.api.addReadyListener((e, t) => {
					this.player || (this.player = t, this.player.on("ready", this.props.onReady), this.player.on("play", this.props.onPlay), this.player.on("pause", this.props.onPause), this.player.on("seek", this.props.onSeek), this.player.on("playerComplete", this.props.onEnded));
				}, a), e.api.renderPlayer({
					uuid: a,
					container: this.container,
					autoplay: t ? 1 : 0,
					...n.options
				}), e.api.getPlayerMetadata(a).then((e) => {
					this.duration = e.length_in_seconds, i(e.length_in_seconds);
				}));
			}, r);
		}
		play() {
			this.callPlayer("play");
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {
			window.VidyardV4.api.destroyPlayer(this.player);
		}
		seekTo(e, t = !0) {
			this.callPlayer("seek", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("setVolume", e);
		}
		setPlaybackRate(e) {
			this.callPlayer("setPlaybackSpeed", e);
		}
		getDuration() {
			return this.duration;
		}
		getCurrentTime() {
			return this.callPlayer("currentTime");
		}
		getSecondsLoaded() {
			return null;
		}
		render() {
			let { display: e } = this.props, t = {
				width: "100%",
				height: "100%",
				display: e
			};
			return /* @__PURE__ */ v.default.createElement("div", { style: t }, /* @__PURE__ */ v.default.createElement("div", { ref: this.ref }));
		}
	};
	g(x, "displayName", "Vidyard"), g(x, "canPlay", b.canPlay.vidyard);
}));
export default i();

//# sourceMappingURL=Vidyard.CgSgkhL5.js.map