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, "playerID", this.props.config.playerId || `wistia-player-${(0, y.randomString)()}`), g(this, "onPlay", (...e) => this.props.onPlay(...e)), g(this, "onPause", (...e) => this.props.onPause(...e)), g(this, "onSeek", (...e) => this.props.onSeek(...e)), g(this, "onEnded", (...e) => this.props.onEnded(...e)), g(this, "onPlaybackRateChange", (...e) => this.props.onPlaybackRateChange(...e)), g(this, "mute", () => {
				this.callPlayer("mute");
			}), g(this, "unmute", () => {
				this.callPlayer("unmute");
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e) {
			let { playing: t, muted: n, controls: r, onReady: i, config: a, onError: o } = this.props;
			(0, y.getSDK)("https://fast.wistia.com/assets/external/E-v1.js", "Wistia").then((e) => {
				a.customControls && a.customControls.forEach((t) => e.defineControl(t)), window._wq = window._wq || [], window._wq.push({
					id: this.playerID,
					options: {
						autoPlay: t,
						silentAutoPlay: "allow",
						muted: n,
						controlsVisibleOnLoad: r,
						fullscreenButton: r,
						playbar: r,
						playbackRateControl: r,
						qualityControl: r,
						volumeControl: r,
						settingsControl: r,
						smallPlayButton: r,
						...a.options
					},
					onReady: (e) => {
						this.player = e, this.unbind(), this.player.bind("play", this.onPlay), this.player.bind("pause", this.onPause), this.player.bind("seek", this.onSeek), this.player.bind("end", this.onEnded), this.player.bind("playbackratechange", this.onPlaybackRateChange), i();
					}
				});
			}, o);
		}
		unbind() {
			this.player.unbind("play", this.onPlay), this.player.unbind("pause", this.onPause), this.player.unbind("seek", this.onSeek), this.player.unbind("end", this.onEnded), this.player.unbind("playbackratechange", this.onPlaybackRateChange);
		}
		play() {
			this.callPlayer("play");
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {
			this.unbind(), this.callPlayer("remove");
		}
		seekTo(e, t = !0) {
			this.callPlayer("time", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("volume", e);
		}
		setPlaybackRate(e) {
			this.callPlayer("playbackRate", e);
		}
		getDuration() {
			return this.callPlayer("duration");
		}
		getCurrentTime() {
			return this.callPlayer("time");
		}
		getSecondsLoaded() {
			return null;
		}
		render() {
			let { url: e } = this.props, t = e && e.match(b.MATCH_URL_WISTIA)[1], n = `wistia_embed wistia_async_${t}`, r = {
				width: "100%",
				height: "100%"
			};
			return /* @__PURE__ */ v.default.createElement("div", {
				id: this.playerID,
				key: t,
				className: n,
				style: r
			});
		}
	};
	g(x, "displayName", "Wistia"), g(x, "canPlay", b.canPlay.wistia), g(x, "loopOnEnded", !0);
}));
export default i();

//# sourceMappingURL=Wistia.BBV15ujo.js.map