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, "onDurationChange", () => {
				let e = this.getDuration();
				this.props.onDuration(e);
			}), g(this, "mute", () => {
				this.callPlayer("setMuted", !0);
			}), g(this, "unmute", () => {
				this.callPlayer("setMuted", !1);
			}), g(this, "ref", (e) => {
				this.container = e;
			});
		}
		componentDidMount() {
			this.props.onMount && this.props.onMount(this);
		}
		load(e) {
			let { controls: t, config: n, onError: r, playing: i } = this.props, [, a] = e.match(b.MATCH_URL_DAILYMOTION);
			if (this.player) {
				this.player.load(a, {
					start: (0, y.parseStartTime)(e),
					autoplay: i
				});
				return;
			}
			(0, y.getSDK)("https://api.dmcdn.net/all.js", "DM", "dmAsyncInit", (e) => e.player).then((i) => {
				if (!this.container) return;
				let o = i.player;
				this.player = new o(this.container, {
					width: "100%",
					height: "100%",
					video: a,
					params: {
						controls: t,
						autoplay: this.props.playing,
						mute: this.props.muted,
						start: (0, y.parseStartTime)(e),
						origin: window.location.origin,
						...n.params
					},
					events: {
						apiready: this.props.onReady,
						seeked: () => this.props.onSeek(this.player.currentTime),
						video_end: this.props.onEnded,
						durationchange: this.onDurationChange,
						pause: this.props.onPause,
						playing: this.props.onPlay,
						waiting: this.props.onBuffer,
						error: (e) => r(e)
					}
				});
			}, r);
		}
		play() {
			this.callPlayer("play");
		}
		pause() {
			this.callPlayer("pause");
		}
		stop() {}
		seekTo(e, t = !0) {
			this.callPlayer("seek", e), t || this.pause();
		}
		setVolume(e) {
			this.callPlayer("setVolume", e);
		}
		getDuration() {
			return this.player.duration || null;
		}
		getCurrentTime() {
			return this.player.currentTime;
		}
		getSecondsLoaded() {
			return this.player.bufferedTime;
		}
		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", "DailyMotion"), g(x, "canPlay", b.canPlay.dailymotion), g(x, "loopOnEnded", !0);
}));
export default i();

//# sourceMappingURL=DailyMotion.J8G993qw.js.map