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: () => S }), i.exports = h(_);
	var v = m(t("react")), y = r(), b = n();
	let x = (e) => e.replace("/manage/videos", "");
	var S = class extends v.Component {
		constructor() {
			super(...arguments), g(this, "callPlayer", y.callPlayer), g(this, "duration", null), g(this, "currentTime", null), g(this, "secondsLoaded", null), g(this, "mute", () => {
				this.setMuted(!0);
			}), g(this, "unmute", () => {
				this.setMuted(!1);
			}), g(this, "ref", (e) => {
				this.container = e;
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e) {
			this.duration = null, (0, y.getSDK)("https://player.vimeo.com/api/player.js", "Vimeo").then((t) => {
				if (!this.container) return;
				let { playerOptions: n, title: r } = this.props.config;
				this.player = new t.Player(this.container, {
					url: x(e),
					autoplay: this.props.playing,
					muted: this.props.muted,
					loop: this.props.loop,
					playsinline: this.props.playsinline,
					controls: this.props.controls,
					...n
				}), this.player.ready().then(() => {
					let e = this.container.querySelector("iframe");
					e.style.width = "100%", e.style.height = "100%", r && (e.title = r);
				}).catch(this.props.onError), this.player.on("loaded", () => {
					this.props.onReady(), this.refreshDuration();
				}), this.player.on("play", () => {
					this.props.onPlay(), this.refreshDuration();
				}), this.player.on("pause", this.props.onPause), this.player.on("seeked", (e) => this.props.onSeek(e.seconds)), this.player.on("ended", this.props.onEnded), this.player.on("error", this.props.onError), this.player.on("timeupdate", ({ seconds: e }) => {
					this.currentTime = e;
				}), this.player.on("progress", ({ seconds: e }) => {
					this.secondsLoaded = e;
				}), this.player.on("bufferstart", this.props.onBuffer), this.player.on("bufferend", this.props.onBufferEnd), this.player.on("playbackratechange", (e) => this.props.onPlaybackRateChange(e.playbackRate));
			}, this.props.onError);
		}
		refreshDuration() {
			this.player.getDuration().then((e) => {
				this.duration = e;
			});
		}
		play() {
			let e = this.callPlayer("play");
			e && e.catch(this.props.onError);
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {
			this.callPlayer("unload");
		}
		seekTo(e, t = !0) {
			this.callPlayer("setCurrentTime", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("setVolume", e);
		}
		setMuted(e) {
			this.callPlayer("setMuted", e);
		}
		setLoop(e) {
			this.callPlayer("setLoop", e);
		}
		setPlaybackRate(e) {
			this.callPlayer("setPlaybackRate", e);
		}
		getDuration() {
			return this.duration;
		}
		getCurrentTime() {
			return this.currentTime;
		}
		getSecondsLoaded() {
			return this.secondsLoaded;
		}
		render() {
			let { display: e } = this.props, t = {
				width: "100%",
				height: "100%",
				overflow: "hidden",
				display: e
			};
			return /* @__PURE__ */ v.default.createElement("div", {
				key: this.props.url,
				ref: this.ref,
				style: t
			});
		}
	};
	g(S, "displayName", "Vimeo"), g(S, "canPlay", b.canPlay.vimeo), g(S, "forceLoad", !0);
}));
export default i();

//# sourceMappingURL=Vimeo.CBTVCnbi.js.map