import { t as e } from "./wt-icon-y89gRcOs.js";
import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { l as n } from "./enums-De8CDKZ1.js";
import { t as r } from "./wt-button-dC4nOW56.js";
import { n as i, t as a } from "./useVidstackSrc-epUQZhkL.js";
import { t as o } from "./wt-popover-ChCN6b1o.js";
import { t as s } from "./wt-slider-BPzRTeYU.js";
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createVNode as m, defineComponent as h, normalizeClass as g, openBlock as _, ref as v, renderList as y, resolveComponent as b, toDisplayString as x, toRefs as S, unref as C, watch as w, withCtx as T } from "vue";
//#region src/components/_shared/settings-panel/components/speed-settings/speed-settings.vue?vue&type=script&setup=true&lang.ts
var E = { class: "speed-settings" }, D = { class: "speed-settings__controls" }, O = { class: "speed-settings__label" }, k = { class: "speed-settings__presets" }, A = .25, j = 3, M = .25, N = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "speed-settings",
	props: { modelValue: { default: 1 } },
	emits: ["update:modelValue"],
	setup(t, { emit: i }) {
		let a = t, o = i, u = [
			{
				speed: .5,
				icon: "playback-0.50"
			},
			{
				speed: .75,
				icon: "playback-0.75"
			},
			{
				speed: 1,
				icon: "playback-1.00"
			},
			{
				speed: 1.5,
				icon: "playback-1.50"
			},
			{
				speed: 1.75,
				icon: "playback-1.75"
			}
		], d = l(() => `${a.modelValue.toFixed(2)}x`);
		function h() {
			let e = parseFloat((a.modelValue - M).toFixed(2));
			o("update:modelValue", Math.max(A, e));
		}
		function g() {
			let e = parseFloat((a.modelValue + M).toFixed(2));
			o("update:modelValue", Math.min(j, e));
		}
		return (i, a) => (_(), f("div", E, [
			p("div", D, [
				m(r, {
					size: C(n).SM,
					disabled: t.modelValue <= A,
					class: "speed-settings__step-button",
					variant: "outlined",
					color: "secondary",
					onClick: h
				}, {
					default: T(() => [m(e, {
						icon: "minus",
						size: C(n).SM
					}, null, 8, ["size"])]),
					_: 1
				}, 8, ["size", "disabled"]),
				p("span", O, x(d.value), 1),
				m(r, {
					size: C(n).SM,
					disabled: t.modelValue >= j,
					class: "speed-settings__step-button",
					variant: "outlined",
					color: "secondary",
					onClick: g
				}, {
					default: T(() => [m(e, {
						icon: "plus",
						size: C(n).SM
					}, null, 8, ["size"])]),
					_: 1
				}, 8, ["size", "disabled"])
			]),
			m(s, {
				class: "speed-settings__slider",
				"model-value": t.modelValue,
				min: A,
				max: j,
				step: M,
				"onUpdate:modelValue": a[0] ||= (e) => i.$emit("update:modelValue", e)
			}, null, 8, ["model-value"]),
			p("div", k, [(_(), f(c, null, y(u, (t) => m(r, {
				key: t.speed,
				size: C(n).SM,
				variant: "outlined",
				class: "speed-settings__preset-button",
				color: "secondary",
				onClick: (e) => i.$emit("update:modelValue", t.speed)
			}, {
				default: T(() => [m(e, {
					icon: t.icon,
					size: C(n).SM
				}, null, 8, ["icon", "size"])]),
				_: 2
			}, 1032, ["size", "onClick"])), 64))])
		]));
	}
}), [["__scopeId", "data-v-8544c47d"]]), P = ["onClick"], F = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "settings-panel",
	props: { modelValue: { default: () => ({ playbackRate: 1 }) } },
	emits: ["update:modelValue"],
	setup(e, { emit: t }) {
		let r = e, i = t;
		function a(e) {
			i("update:modelValue", {
				...r.modelValue,
				playbackRate: e
			});
		}
		return (t, r) => {
			let i = b("wt-icon-btn");
			return _(), u(o, { class: "settings-panel" }, {
				activator: T(({ toggle: e }) => [p("media-button", {
					class: "settings-panel__button",
					onClick: e
				}, [m(i, {
					icon: "plyr-settings",
					size: C(n).SM
				}, null, 8, ["size"])], 8, P)]),
				default: T(() => [m(N, {
					"model-value": e.modelValue.playbackRate,
					"onUpdate:modelValue": a
				}, null, 8, ["model-value"])], void 0, !0),
				_: 1
			});
		};
	}
}), [["__scopeId", "data-v-d152dae2"]]), I = {}, L = { class: "mute-button" };
function R(e, t) {
	let n = b("wt-icon");
	return _(), f("media-mute-button", L, [m(n, {
		type: "mute",
		icon: "plyr-muted",
		class: "mute-icon",
		size: "sm"
	}), m(n, {
		type: "volume",
		icon: "plyr-volume",
		class: "volume-icon",
		size: "sm"
	})]);
}
var z = /*#__PURE__*/ t(I, [["render", R], ["__scopeId", "data-v-45e5719d"]]), B = { class: "play-button" }, V = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "play-button",
	setup(t) {
		return (t, n) => (_(), f("media-play-button", B, [m(e, {
			icon: "plyr-play",
			type: "play",
			class: "play-icon",
			size: "sm"
		}), m(e, {
			icon: "plyr-pause",
			type: "pause",
			class: "pause-icon",
			size: "sm"
		})]));
	}
}), [["__scopeId", "data-v-e6149485"]]), H = { class: "time-slider media-slider" }, U = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "time-slider",
	setup(e) {
		return (e, t) => (_(), f("media-time-slider", H, [m(s, { class: "time-slider__slider" })]));
	}
}), [["__scopeId", "data-v-e57a9871"]]), W = { class: "volume-slider media-slider" }, G = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "volume-slider",
	setup(e) {
		return (e, t) => (_(), f("media-volume-slider", W, [m(s, { class: "volume-slider__slider" })]));
	}
}), [["__scopeId", "data-v-b92a4daf"]]), K = [
	"src",
	"loop",
	"autoplay",
	"playback-rate"
], q = { class: "controls-group" }, J = /*#__PURE__*/ t(/* @__PURE__ */ h({
	__name: "wt-player",
	props: {
		src: {},
		id: {},
		fileName: {},
		autoplay: {
			type: Boolean,
			default: !0
		},
		loop: {
			type: Boolean,
			default: !1
		},
		download: {
			type: [
				String,
				Function,
				Boolean
			],
			default: () => (e) => e.replace("/stream", "/download")
		},
		resetOnEnd: {
			type: Boolean,
			default: !1
		},
		countdownTimeMode: { type: Boolean },
		hideVolumeSlider: {
			type: Boolean,
			default: !1
		},
		hideMuteButton: {
			type: Boolean,
			default: !1
		},
		hideSettings: {
			type: Boolean,
			default: !1
		},
		closable: {
			type: Boolean,
			default: !0
		},
		position: { default: "sticky" },
		invertTime: {
			type: Boolean,
			default: !0
		},
		resetVolume: {
			type: Boolean,
			default: !1
		}
	},
	emits: ["initialized", "close"],
	setup(e, { emit: t }) {
		let r = e, o = v({ playbackRate: 1 }), { src: s } = S(r), { normalizedSrcObject: c } = a({ src: s });
		function l() {
			let e = typeof r.src == "string" ? r.src : r.src?.src, t = typeof r.download == "function" ? r.download(e) : r.download, n = r.src?.type.split("/").pop(), i = r.fileName || r.id || "unknown", a = document.createElement("a");
			a.style.display = "none", a.href = t, a.download = `${i}.${n}`, document.body.appendChild(a), a.click(), document.body.removeChild(a);
		}
		function h(e) {
			if (!r.resetOnEnd) return;
			let t = e.target;
			t.currentTime = 0;
		}
		function y() {
			o.value.playbackRate = 1;
		}
		return w(() => r.src, () => {
			y();
		}), (t, a) => {
			let s = b("wt-icon-btn");
			return _(), f("media-player", {
				class: g(["wt-player", `wt-player--position-${r.position}`]),
				src: C(c),
				loop: r.loop,
				autoplay: e.autoplay,
				"playback-rate": o.value.playbackRate,
				onEnded: h
			}, [a[2] ||= p("media-provider", null, null, -1), p("media-controls-group", q, [
				m(V),
				m(U),
				m(i, { countdown: r.countdownTimeMode }, null, 8, ["countdown"]),
				r.hideMuteButton ? d("", !0) : (_(), u(z, { key: 0 })),
				r.hideVolumeSlider ? d("", !0) : (_(), u(G, { key: 1 })),
				r.hideSettings ? d("", !0) : (_(), u(F, {
					key: 2,
					"model-value": o.value,
					"onUpdate:modelValue": a[0] ||= (e) => o.value = e
				}, null, 8, ["model-value"])),
				r.download ? (_(), f("media-button", {
					key: 3,
					class: "download-button",
					onClick: l
				}, [m(s, {
					icon: "plyr-download",
					size: C(n).SM
				}, null, 8, ["size"])])) : d("", !0),
				r.closable ? (_(), f("media-button", {
					key: 4,
					class: "close-button",
					onClick: a[1] ||= (e) => t.$emit("close")
				}, [m(s, {
					icon: "close",
					size: C(n).SM
				}, null, 8, ["size"])])) : d("", !0)
			])], 42, K);
		};
	}
}), [["__scopeId", "data-v-b4642a75"]]);
//#endregion
export { J as default };
