@slashedcloud/player
Version:
A media player application utilizing Shaka Player for adaptive video streaming, capable of playing HLS, MPD and plain HTTP video streams.
15 lines (14 loc) • 930 B
JavaScript
/*!
* SlashedCloud v0.1.2 (https://github.com/SlashedCloud/player#readme)
* Copyright 2024-2024 rogerio.jardim@fedrax.pt
* Licensed under Apache (https://github.com/SlashedCloud/player/blob/develop/LICENSE)
*/
const n = "a-f\\d", $ = `#?[${n}]{3}[${n}]?`, a = `#?[${n}]{6}([${n}]{2})?`, g = new RegExp(`[^#${n}]`, "gi"), l = new RegExp(`^${$}$|^${a}$`, "i"), u = (t, r = 1) => {
t = t.replace(/^#/, ""), t.length === 8 && (r = Number.parseInt(t.slice(6, 8), 16) / 255, t = t.slice(0, 6)), t.length === 4 && (r = Number.parseInt(t.slice(3, 4).repeat(2), 16) / 255, t = t.slice(0, 3)), t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]);
const s = Number.parseInt(t, 16), e = s >> 16, c = s >> 8 & 255, i = s & 255, o = r === 1 ? "" : ` / ${Number((r * 100).toFixed(2))}%`;
return `rgb(${e} ${c} ${i}${o})`;
}, b = (t) => !(typeof t != "string" || g.test(t) || !l.test(t));
export {
u as h,
b as i
};