Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@videojs/vhs-utils

Package Overview
Dependencies
Maintainers
19
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@videojs/vhs-utils - npm Package Compare versions

Comparing version 3.0.5 to 4.0.0

13

CHANGELOG.md

@@ -0,1 +1,14 @@

<a name="4.0.0"></a>
# [4.0.0](https://github.com/videojs/vhs-utils/compare/v3.0.5...v4.0.0) (2022-08-19)
### Chores
* do not run es-check on publish ([#35](https://github.com/videojs/vhs-utils/issues/35)) ([964080e](https://github.com/videojs/vhs-utils/commit/964080e))
* remove IE11 support ([#34](https://github.com/videojs/vhs-utils/issues/34)) ([6d979a2](https://github.com/videojs/vhs-utils/commit/6d979a2))
### BREAKING CHANGES
* Internet Explorer is no longer supported.
<a name="3.0.5"></a>

@@ -2,0 +15,0 @@ ## [3.0.5](https://github.com/videojs/vhs-utils/compare/v3.0.4...v3.0.5) (2022-03-16)

656

dist/vhs-utils.js

@@ -1,2 +0,2 @@

/*! @name @videojs/vhs-utils @version 3.0.5 @license MIT */
/*! @name @videojs/vhs-utils @version 4.0.0 @license MIT */
(function (global, factory) {

@@ -6,5 +6,5 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vhsUtils = factory());
}(this, (function () { 'use strict';
})(this, (function () { 'use strict';
var regexs = {
const regexs = {
// to determine mime types

@@ -26,4 +26,4 @@ mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,

};
var mediaTypes = ['video', 'audio', 'text'];
var upperMediaTypes = ['Video', 'Audio', 'Text'];
const mediaTypes = ['video', 'audio', 'text'];
const upperMediaTypes = ['Video', 'Audio', 'Text'];
/**

@@ -39,3 +39,3 @@ * Replace the old apple-style `avc1.<dd>.<dd>` codec string with the standard

var translateLegacyCodec = function translateLegacyCodec(codec) {
const translateLegacyCodec = function (codec) {
if (!codec) {

@@ -46,4 +46,4 @@ return codec;

return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avcLevel) {
var profileHex = ('00' + Number(profile).toString(16)).slice(-2);
var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2);
const profileHex = ('00' + Number(profile).toString(16)).slice(-2);
const avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2);
return 'avc1.' + profileHex + '00' + avcLevelHex;

@@ -62,3 +62,3 @@ });

var translateLegacyCodecs = function translateLegacyCodecs(codecs) {
const translateLegacyCodecs = function (codecs) {
return codecs.map(translateLegacyCodec);

@@ -78,4 +78,4 @@ };

var mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) {
return codecString.replace(/avc1\.(\d+)\.(\d+)/i, function (match) {
const mapLegacyAvcCodecs = function (codecString) {
return codecString.replace(/avc1\.(\d+)\.(\d+)/i, match => {
return translateLegacyCodecs([match])[0];

@@ -106,14 +106,10 @@ });

var parseCodecs = function parseCodecs(codecString) {
if (codecString === void 0) {
codecString = '';
}
var codecs = codecString.split(',');
var result = [];
const parseCodecs = function (codecString = '') {
const codecs = codecString.split(',');
const result = [];
codecs.forEach(function (codec) {
codec = codec.trim();
var codecType;
let codecType;
mediaTypes.forEach(function (name) {
var match = regexs[name].exec(codec.toLowerCase());
const match = regexs[name].exec(codec.toLowerCase());

@@ -126,7 +122,7 @@ if (!match || match.length <= 1) {

var type = codec.substring(0, match[1].length);
var details = codec.replace(type, '');
const type = codec.substring(0, match[1].length);
const details = codec.replace(type, '');
result.push({
type: type,
details: details,
type,
details,
mediaType: name

@@ -158,3 +154,3 @@ });

var codecsFromDefault = function codecsFromDefault(master, audioGroupId) {
const codecsFromDefault = (master, audioGroupId) => {
if (!master.mediaGroups.AUDIO || !audioGroupId) {

@@ -164,3 +160,3 @@ return null;

var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
const audioGroup = master.mediaGroups.AUDIO[audioGroupId];

@@ -171,4 +167,4 @@ if (!audioGroup) {

for (var name in audioGroup) {
var audioType = audioGroup[name];
for (const name in audioGroup) {
const audioType = audioGroup[name];

@@ -183,24 +179,6 @@ if (audioType.default && audioType.playlists) {

};
var isVideoCodec = function isVideoCodec(codec) {
if (codec === void 0) {
codec = '';
}
return regexs.video.test(codec.trim().toLowerCase());
};
var isAudioCodec = function isAudioCodec(codec) {
if (codec === void 0) {
codec = '';
}
return regexs.audio.test(codec.trim().toLowerCase());
};
var isTextCodec = function isTextCodec(codec) {
if (codec === void 0) {
codec = '';
}
return regexs.text.test(codec.trim().toLowerCase());
};
var getMimeForCodec = function getMimeForCodec(codecString) {
const isVideoCodec = (codec = '') => regexs.video.test(codec.trim().toLowerCase());
const isAudioCodec = (codec = '') => regexs.audio.test(codec.trim().toLowerCase());
const isTextCodec = (codec = '') => regexs.text.test(codec.trim().toLowerCase());
const getMimeForCodec = codecString => {
if (!codecString || typeof codecString !== 'string') {

@@ -210,7 +188,5 @@ return;

var codecs = codecString.toLowerCase().split(',').map(function (c) {
return translateLegacyCodec(c.trim());
}); // default to video type
const codecs = codecString.toLowerCase().split(',').map(c => translateLegacyCodec(c.trim())); // default to video type
var type = 'video'; // only change to audio type if the only codec we have is
let type = 'video'; // only change to audio type if the only codec we have is
// audio

@@ -226,49 +202,31 @@

var container = 'mp4'; // every codec must be able to go into the container
let container = 'mp4'; // every codec must be able to go into the container
// for that container to be the correct one
if (codecs.every(function (c) {
return regexs.mp4.test(c);
})) {
if (codecs.every(c => regexs.mp4.test(c))) {
container = 'mp4';
} else if (codecs.every(function (c) {
return regexs.webm.test(c);
})) {
} else if (codecs.every(c => regexs.webm.test(c))) {
container = 'webm';
} else if (codecs.every(function (c) {
return regexs.ogg.test(c);
})) {
} else if (codecs.every(c => regexs.ogg.test(c))) {
container = 'ogg';
}
return type + "/" + container + ";codecs=\"" + codecString + "\"";
return `${type}/${container};codecs="${codecString}"`;
};
var browserSupportsCodec = function browserSupportsCodec(codecString) {
if (codecString === void 0) {
codecString = '';
}
const browserSupportsCodec = (codecString = '') => window.MediaSource && window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false;
const muxerSupportsCodec = (codecString = '') => codecString.toLowerCase().split(',').every(codec => {
codec = codec.trim(); // any match is supported.
return window.MediaSource && window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false;
};
var muxerSupportsCodec = function muxerSupportsCodec(codecString) {
if (codecString === void 0) {
codecString = '';
}
for (let i = 0; i < upperMediaTypes.length; i++) {
const type = upperMediaTypes[i];
return codecString.toLowerCase().split(',').every(function (codec) {
codec = codec.trim(); // any match is supported.
for (var i = 0; i < upperMediaTypes.length; i++) {
var type = upperMediaTypes[i];
if (regexs["muxer" + type].test(codec)) {
return true;
}
if (regexs[`muxer${type}`].test(codec)) {
return true;
}
}
return false;
});
};
var DEFAULT_AUDIO_CODEC = 'mp4a.40.2';
var DEFAULT_VIDEO_CODEC = 'avc1.4d400d';
return false;
});
const DEFAULT_AUDIO_CODEC = 'mp4a.40.2';
const DEFAULT_VIDEO_CODEC = 'avc1.4d400d';

@@ -293,4 +251,4 @@ var codecs = /*#__PURE__*/Object.freeze({

// const log2 = Math.log2 ? Math.log2 : (x) => (Math.log(x) / Math.log(2));
var repeat = function repeat(str, len) {
var acc = '';
const repeat = function (str, len) {
let acc = '';

@@ -307,17 +265,7 @@ while (len--) {

var countBits = function countBits(x) {
return x.toString(2).length;
}; // count the number of whole bytes it would take to represent a number
const countBits = x => x.toString(2).length; // count the number of whole bytes it would take to represent a number
var countBytes = function countBytes(x) {
return Math.ceil(countBits(x) / 8);
};
var padStart = function padStart(b, len, str) {
if (str === void 0) {
str = ' ';
}
return (repeat(str, len) + b.toString()).slice(-len);
};
var isArrayBufferView = function isArrayBufferView(obj) {
const countBytes = x => Math.ceil(countBits(x) / 8);
const padStart = (b, len, str = ' ') => (repeat(str, len) + b.toString()).slice(-len);
const isArrayBufferView = obj => {
if (ArrayBuffer.isView === 'function') {

@@ -329,6 +277,4 @@ return ArrayBuffer.isView(obj);

};
var isTypedArray = function isTypedArray(obj) {
return isArrayBufferView(obj);
};
var toUint8 = function toUint8(bytes) {
const isTypedArray = obj => isArrayBufferView(obj);
const toUint8 = function (bytes) {
if (bytes instanceof Uint8Array) {

@@ -350,7 +296,7 @@ return bytes;

};
var toHexString = function toHexString(bytes) {
const toHexString = function (bytes) {
bytes = toUint8(bytes);
var str = '';
let str = '';
for (var i = 0; i < bytes.length; i++) {
for (let i = 0; i < bytes.length; i++) {
str += padStart(bytes[i].toString(16), 2, '0');

@@ -361,7 +307,7 @@ }

};
var toBinaryString = function toBinaryString(bytes) {
const toBinaryString = function (bytes) {
bytes = toUint8(bytes);
var str = '';
let str = '';
for (var i = 0; i < bytes.length; i++) {
for (let i = 0; i < bytes.length; i++) {
str += padStart(bytes[i].toString(2), 8, '0');

@@ -372,7 +318,7 @@ }

};
var BigInt = window.BigInt || Number;
var BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];
var ENDIANNESS = function () {
var a = new Uint16Array([0xFFCC]);
var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
const BigInt = window.BigInt || Number;
const BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];
const ENDIANNESS = function () {
const a = new Uint16Array([0xFFCC]);
const b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);

@@ -389,16 +335,13 @@ if (b[0] === 0xFF) {

}();
var IS_BIG_ENDIAN = ENDIANNESS === 'big';
var IS_LITTLE_ENDIAN = ENDIANNESS === 'little';
var bytesToNumber = function bytesToNumber(bytes, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$signed = _ref.signed,
signed = _ref$signed === void 0 ? false : _ref$signed,
_ref$le = _ref.le,
le = _ref$le === void 0 ? false : _ref$le;
const IS_BIG_ENDIAN = ENDIANNESS === 'big';
const IS_LITTLE_ENDIAN = ENDIANNESS === 'little';
const bytesToNumber = function (bytes, {
signed = false,
le = false
} = {}) {
bytes = toUint8(bytes);
var fn = le ? 'reduce' : 'reduceRight';
var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn];
var number = obj.call(bytes, function (total, byte, i) {
var exponent = le ? i : Math.abs(i + 1 - bytes.length);
const fn = le ? 'reduce' : 'reduceRight';
const obj = bytes[fn] ? bytes[fn] : Array.prototype[fn];
let number = obj.call(bytes, function (total, byte, i) {
const exponent = le ? i : Math.abs(i + 1 - bytes.length);
return total + BigInt(byte) * BYTE_TABLE[exponent];

@@ -408,3 +351,3 @@ }, BigInt(0));

if (signed) {
var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);
const max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);
number = BigInt(number);

@@ -421,7 +364,5 @@

};
var numberToBytes = function numberToBytes(number, _temp2) {
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$le = _ref2.le,
le = _ref2$le === void 0 ? false : _ref2$le;
const numberToBytes = function (number, {
le = false
} = {}) {
// eslint-disable-next-line

@@ -433,7 +374,7 @@ if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) {

number = BigInt(number);
var byteCount = countBytes(number);
var bytes = new Uint8Array(new ArrayBuffer(byteCount));
const byteCount = countBytes(number);
const bytes = new Uint8Array(new ArrayBuffer(byteCount));
for (var i = 0; i < byteCount; i++) {
var byteIndex = le ? i : Math.abs(i + 1 - bytes.length);
for (let i = 0; i < byteCount; i++) {
const byteIndex = le ? i : Math.abs(i + 1 - bytes.length);
bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF));

@@ -449,3 +390,3 @@

};
var bytesToString = function bytesToString(bytes) {
const bytesToString = bytes => {
if (!bytes) {

@@ -458,3 +399,3 @@ return '';

bytes = Array.prototype.slice.call(bytes);
var string = String.fromCharCode.apply(null, toUint8(bytes));
const string = String.fromCharCode.apply(null, toUint8(bytes));

@@ -469,3 +410,3 @@ try {

};
var stringToBytes = function stringToBytes(string, stringIsBytes) {
const stringToBytes = (string, stringIsBytes) => {
if (typeof string !== 'string' && string && typeof string.toString === 'function') {

@@ -486,5 +427,5 @@ string = string.toString();

var view = new Uint8Array(string.length);
const view = new Uint8Array(string.length);
for (var i = 0; i < string.length; i++) {
for (let i = 0; i < string.length; i++) {
view[i] = string.charCodeAt(i);

@@ -495,11 +436,5 @@ }

};
var concatTypedArrays = function concatTypedArrays() {
for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
buffers[_key] = arguments[_key];
}
const concatTypedArrays = (...buffers) => {
buffers = buffers.filter(b => b && (b.byteLength || b.length) && typeof b !== 'string');
buffers = buffers.filter(function (b) {
return b && (b.byteLength || b.length) && typeof b !== 'string';
});
if (buffers.length <= 1) {

@@ -511,7 +446,5 @@ // for 0 length we will return empty uint8

var totalLen = buffers.reduce(function (total, buf, i) {
return total + (buf.byteLength || buf.length);
}, 0);
var tempBuffer = new Uint8Array(totalLen);
var offset = 0;
const totalLen = buffers.reduce((total, buf, i) => total + (buf.byteLength || buf.length), 0);
const tempBuffer = new Uint8Array(totalLen);
let offset = 0;
buffers.forEach(function (buf) {

@@ -547,20 +480,17 @@ buf = toUint8(buf);

var bytesMatch = function bytesMatch(a, b, _temp3) {
var _ref3 = _temp3 === void 0 ? {} : _temp3,
_ref3$offset = _ref3.offset,
offset = _ref3$offset === void 0 ? 0 : _ref3$offset,
_ref3$mask = _ref3.mask,
mask = _ref3$mask === void 0 ? [] : _ref3$mask;
const bytesMatch = (a, b, {
offset = 0,
mask = []
} = {}) => {
a = toUint8(a);
b = toUint8(b); // ie 11 does not support uint8 every
var fn = b.every ? b.every : Array.prototype.every;
const fn = b.every ? b.every : Array.prototype.every;
return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8
fn.call(b, function (bByte, i) {
var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i];
fn.call(b, (bByte, i) => {
const aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i];
return bByte === aByte;
});
};
var sliceBytes = function sliceBytes(src, start, end) {
const sliceBytes = function (src, start, end) {
if (Uint8Array.prototype.slice) {

@@ -572,3 +502,3 @@ return Uint8Array.prototype.slice.call(src, start, end);

};
var reverseBytes = function reverseBytes(src) {
const reverseBytes = function (src) {
if (src.reverse) {

@@ -604,3 +534,3 @@ return src.reverse();

var normalizePath = function normalizePath(path) {
const normalizePath$1 = function (path) {
if (typeof path === 'string') {

@@ -617,10 +547,8 @@ return stringToBytes(path);

var normalizePaths = function normalizePaths(paths) {
const normalizePaths$1 = function (paths) {
if (!Array.isArray(paths)) {
return [normalizePath(paths)];
return [normalizePath$1(paths)];
}
return paths.map(function (p) {
return normalizePath(p);
});
return paths.map(p => normalizePath$1(p));
};

@@ -648,10 +576,6 @@ /**

var findBox = function findBox(bytes, paths, complete) {
if (complete === void 0) {
complete = false;
}
paths = normalizePaths(paths);
const findBox = function (bytes, paths, complete = false) {
paths = normalizePaths$1(paths);
bytes = toUint8(bytes);
var results = [];
const results = [];

@@ -663,7 +587,7 @@ if (!paths.length) {

var i = 0;
let i = 0;
while (i < bytes.length) {
var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0;
var type = bytes.subarray(i + 4, i + 8); // invalid box format.
const size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0;
const type = bytes.subarray(i + 4, i + 8); // invalid box format.

@@ -674,3 +598,3 @@ if (size === 0) {

var end = i + size;
let end = i + size;

@@ -687,3 +611,3 @@ if (end > bytes.length) {

var data = bytes.subarray(i + 8, end);
const data = bytes.subarray(i + 8, end);

@@ -712,3 +636,3 @@ if (bytesMatch(type, paths[0])) {

var EBML_TAGS = {
const EBML_TAGS = {
EBML: toUint8([0x1A, 0x45, 0xDF, 0xA3]),

@@ -748,8 +672,8 @@ DocType: toUint8([0x42, 0x82]),

var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];
const LENGTH_TABLE = [0b10000000, 0b01000000, 0b00100000, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000001];
var getLength = function getLength(byte) {
var len = 1;
const getLength = function (byte) {
let len = 1;
for (var i = 0; i < LENGTH_TABLE.length; i++) {
for (let i = 0; i < LENGTH_TABLE.length; i++) {
if (byte & LENGTH_TABLE[i]) {

@@ -770,13 +694,5 @@ break;

var getvint = function getvint(bytes, offset, removeLength, signed) {
if (removeLength === void 0) {
removeLength = true;
}
if (signed === void 0) {
signed = false;
}
var length = getLength(bytes[offset]);
var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes
const getvint = function (bytes, offset, removeLength = true, signed = false) {
const length = getLength(bytes[offset]);
let valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes
// as they will be modified below to remove the dataSizeLen bits and we do not

@@ -792,5 +708,5 @@ // want to modify the original data. normally we could just call slice on

return {
length: length,
length,
value: bytesToNumber(valueBytes, {
signed: signed
signed
}),

@@ -801,7 +717,5 @@ bytes: valueBytes

var normalizePath$1 = function normalizePath(path) {
const normalizePath = function (path) {
if (typeof path === 'string') {
return path.match(/.{1,2}/g).map(function (p) {
return normalizePath(p);
});
return path.match(/.{1,2}/g).map(p => normalizePath(p));
}

@@ -816,13 +730,11 @@

var normalizePaths$1 = function normalizePaths(paths) {
const normalizePaths = function (paths) {
if (!Array.isArray(paths)) {
return [normalizePath$1(paths)];
return [normalizePath(paths)];
}
return paths.map(function (p) {
return normalizePath$1(p);
});
return paths.map(p => normalizePath(p));
};
var getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) {
const getInfinityDataSize = (id, bytes, offset) => {
if (offset >= bytes.length) {

@@ -832,3 +744,3 @@ return bytes.length;

var innerid = getvint(bytes, offset, false);
const innerid = getvint(bytes, offset, false);

@@ -839,3 +751,3 @@ if (bytesMatch(id.bytes, innerid.bytes)) {

var dataHeader = getvint(bytes, offset + innerid.length);
const dataHeader = getvint(bytes, offset + innerid.length);
return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);

@@ -864,6 +776,6 @@ };

var findEbml = function findEbml(bytes, paths) {
paths = normalizePaths$1(paths);
const findEbml = function (bytes, paths) {
paths = normalizePaths(paths);
bytes = toUint8(bytes);
var results = [];
let results = [];

@@ -874,8 +786,8 @@ if (!paths.length) {

var i = 0;
let i = 0;
while (i < bytes.length) {
var id = getvint(bytes, i, false);
var dataHeader = getvint(bytes, i + id.length);
var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream
const id = getvint(bytes, i, false);
const dataHeader = getvint(bytes, i + id.length);
const dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream

@@ -890,4 +802,4 @@ if (dataHeader.value === 0x7f) {

var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
var data = bytes.subarray(dataStart, dataEnd);
const dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
const data = bytes.subarray(dataStart, dataEnd);

@@ -906,3 +818,3 @@ if (bytesMatch(paths[0], id.bytes)) {

var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it
const totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it

@@ -915,12 +827,8 @@ i += totalLength;

var ID3 = toUint8([0x49, 0x44, 0x33]);
var getId3Size = function getId3Size(bytes, offset) {
if (offset === void 0) {
offset = 0;
}
const ID3 = toUint8([0x49, 0x44, 0x33]);
const getId3Size = function (bytes, offset = 0) {
bytes = toUint8(bytes);
var flags = bytes[offset + 5];
var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
var footerPresent = (flags & 16) >> 4;
const flags = bytes[offset + 5];
const returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
const footerPresent = (flags & 16) >> 4;

@@ -933,11 +841,7 @@ if (footerPresent) {

};
var getId3Offset = function getId3Offset(bytes, offset) {
if (offset === void 0) {
offset = 0;
}
const getId3Offset = function (bytes, offset = 0) {
bytes = toUint8(bytes);
if (bytes.length - offset < 10 || !bytesMatch(bytes, ID3, {
offset: offset
offset
})) {

@@ -954,5 +858,5 @@ return offset;

var NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]);
var NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]);
var EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]);
const NAL_TYPE_ONE = toUint8([0x00, 0x00, 0x00, 0x01]);
const NAL_TYPE_TWO = toUint8([0x00, 0x00, 0x01]);
const EMULATION_PREVENTION = toUint8([0x00, 0x00, 0x03]);
/**

@@ -968,5 +872,5 @@ * Expunge any "Emulation Prevention" bytes from a "Raw Byte

var discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) {
var positions = [];
var i = 1; // Find all `Emulation Prevention Bytes`
const discardEmulationPreventionBytes = function (bytes) {
const positions = [];
let i = 1; // Find all `Emulation Prevention Bytes`

@@ -989,5 +893,5 @@ while (i < bytes.length - 2) {

var newLength = bytes.length - positions.length;
var newData = new Uint8Array(newLength);
var sourceIndex = 0;
const newLength = bytes.length - positions.length;
const newData = new Uint8Array(newLength);
let sourceIndex = 0;

@@ -1007,12 +911,8 @@ for (i = 0; i < newLength; sourceIndex++, i++) {

};
var findNal = function findNal(bytes, dataType, types, nalLimit) {
if (nalLimit === void 0) {
nalLimit = Infinity;
}
const findNal = function (bytes, dataType, types, nalLimit = Infinity) {
bytes = toUint8(bytes);
types = [].concat(types);
var i = 0;
var nalStart;
var nalsFound = 0; // keep searching until:
let i = 0;
let nalStart;
let nalsFound = 0; // keep searching until:
// we reach the end of bytes

@@ -1024,3 +924,3 @@ // we reach the maximum number of nals they want to seach

while (i < bytes.length && (nalsFound < nalLimit || nalStart)) {
var nalOffset = void 0;
let nalOffset;

@@ -1046,3 +946,3 @@ if (bytesMatch(bytes.subarray(i), NAL_TYPE_ONE)) {

var nalType = void 0;
let nalType;

@@ -1065,10 +965,6 @@ if (dataType === 'h264') {

};
var findH264Nal = function findH264Nal(bytes, type, nalLimit) {
return findNal(bytes, 'h264', type, nalLimit);
};
var findH265Nal = function findH265Nal(bytes, type, nalLimit) {
return findNal(bytes, 'h265', type, nalLimit);
};
const findH264Nal = (bytes, type, nalLimit) => findNal(bytes, 'h264', type, nalLimit);
const findH265Nal = (bytes, type, nalLimit) => findNal(bytes, 'h265', type, nalLimit);
var CONSTANTS = {
const CONSTANTS = {
// "webm" string literal in hex

@@ -1104,28 +1000,32 @@ 'webm': toUint8([0x77, 0x65, 0x62, 0x6d]),

};
var _isLikely = {
aac: function aac(bytes) {
var offset = getId3Offset(bytes);
const _isLikely = {
aac(bytes) {
const offset = getId3Offset(bytes);
return bytesMatch(bytes, [0xFF, 0x10], {
offset: offset,
offset,
mask: [0xFF, 0x16]
});
},
mp3: function mp3(bytes) {
var offset = getId3Offset(bytes);
mp3(bytes) {
const offset = getId3Offset(bytes);
return bytesMatch(bytes, [0xFF, 0x02], {
offset: offset,
offset,
mask: [0xFF, 0x06]
});
},
webm: function webm(bytes) {
var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm
webm(bytes) {
const docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm
return bytesMatch(docType, CONSTANTS.webm);
},
mkv: function mkv(bytes) {
var docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska
mkv(bytes) {
const docType = findEbml(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska
return bytesMatch(docType, CONSTANTS.matroska);
},
mp4: function mp4(bytes) {
mp4(bytes) {
// if this file is another base media file format, it is not mp4

@@ -1154,3 +1054,4 @@ if (_isLikely['3gp'](bytes) || _isLikely.mov(bytes)) {

},
mov: function mov(bytes) {
mov(bytes) {
return bytesMatch(bytes, CONSTANTS.mov, {

@@ -1160,3 +1061,4 @@ offset: 4

},
'3gp': function gp(bytes) {
'3gp'(bytes) {
return bytesMatch(bytes, CONSTANTS['3gp'], {

@@ -1166,9 +1068,11 @@ offset: 4

},
ac3: function ac3(bytes) {
var offset = getId3Offset(bytes);
ac3(bytes) {
const offset = getId3Offset(bytes);
return bytesMatch(bytes, CONSTANTS.ac3, {
offset: offset
offset
});
},
ts: function ts(bytes) {
ts(bytes) {
if (bytes.length < 189 && bytes.length >= 1) {

@@ -1178,3 +1082,3 @@ return bytes[0] === 0x47;

var i = 0; // check the first 376 bytes for two matching sync bytes
let i = 0; // check the first 376 bytes for two matching sync bytes

@@ -1191,12 +1095,15 @@ while (i + 188 < bytes.length && i < 188) {

},
flac: function flac(bytes) {
var offset = getId3Offset(bytes);
flac(bytes) {
const offset = getId3Offset(bytes);
return bytesMatch(bytes, CONSTANTS.flac, {
offset: offset
offset
});
},
ogg: function ogg(bytes) {
ogg(bytes) {
return bytesMatch(bytes, CONSTANTS.ogg);
},
avi: function avi(bytes) {
avi(bytes) {
return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.avi, {

@@ -1206,3 +1113,4 @@ offset: 8

},
wav: function wav(bytes) {
wav(bytes) {
return bytesMatch(bytes, CONSTANTS.riff) && bytesMatch(bytes, CONSTANTS.wav, {

@@ -1212,10 +1120,13 @@ offset: 8

},
'h264': function h264(bytes) {
'h264'(bytes) {
// find seq_parameter_set_rbsp
return findH264Nal(bytes, 7, 3).length;
},
'h265': function h265(bytes) {
'h265'(bytes) {
// find video_parameter_set_rbsp or seq_parameter_set_rbsp
return findH265Nal(bytes, [32, 33], 3).length;
}
}; // get all the isLikely functions

@@ -1225,24 +1136,20 @@ // but make sure 'ts' is above h264 and h265

var isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265
.filter(function (t) {
return t !== 'ts' && t !== 'h264' && t !== 'h265';
}) // add it back to the bottom
const isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265
.filter(t => t !== 'ts' && t !== 'h264' && t !== 'h265') // add it back to the bottom
.concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data.
isLikelyTypes.forEach(function (type) {
var isLikelyFn = _isLikely[type];
const isLikelyFn = _isLikely[type];
_isLikely[type] = function (bytes) {
return isLikelyFn(toUint8(bytes));
};
_isLikely[type] = bytes => isLikelyFn(toUint8(bytes));
}); // export after wrapping
var isLikely = _isLikely; // A useful list of file signatures can be found here
const isLikely = _isLikely; // A useful list of file signatures can be found here
// https://en.wikipedia.org/wiki/List_of_file_signatures
var detectContainerForBytes = function detectContainerForBytes(bytes) {
const detectContainerForBytes = bytes => {
bytes = toUint8(bytes);
for (var i = 0; i < isLikelyTypes.length; i++) {
var type = isLikelyTypes[i];
for (let i = 0; i < isLikelyTypes.length; i++) {
const type = isLikelyTypes[i];

@@ -1257,3 +1164,3 @@ if (isLikely[type](bytes)) {

var isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) {
const isLikelyFmp4MediaSegment = bytes => {
return findBox(bytes, ['moof']).length > 0;

@@ -1269,11 +1176,9 @@ };

var atob = function atob(s) {
return window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary');
};
const atob = s => window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary');
function decodeB64ToUint8Array(b64Text) {
var decodedString = atob(b64Text);
var array = new Uint8Array(decodedString.length);
const decodedString = atob(b64Text);
const array = new Uint8Array(decodedString.length);
for (var i = 0; i < decodedString.length; i++) {
for (let i = 0; i < decodedString.length; i++) {
array[i] = decodedString.charCodeAt(i);

@@ -1296,7 +1201,7 @@ }

*/
var forEachMediaGroup = function forEachMediaGroup(master, groups, callback) {
groups.forEach(function (mediaType) {
for (var groupKey in master.mediaGroups[mediaType]) {
for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
const forEachMediaGroup = (master, groups, callback) => {
groups.forEach(mediaType => {
for (const groupKey in master.mediaGroups[mediaType]) {
for (const labelKey in master.mediaGroups[mediaType][groupKey]) {
const mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
callback(mediaProperties, mediaType, groupKey, labelKey);

@@ -1313,17 +1218,5 @@ }

function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}
var urlToolkit = {exports: {}};
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var urlToolkit = createCommonjsModule(function (module, exports) {
(function (module, exports) {
// see https://tools.ietf.org/html/rfc1808

@@ -1342,3 +1235,3 @@ (function (root) {

// http://a.com/b/cd + /e/f/../g => http://a.com/e/g
buildAbsoluteURL: function buildAbsoluteURL(baseURL, relativeURL, opts) {
buildAbsoluteURL: function (baseURL, relativeURL, opts) {
opts = opts || {}; // remove any remaining space and CRLF

@@ -1455,3 +1348,3 @@

},
parseURL: function parseURL(url) {
parseURL: function (url) {
var parts = URL_REGEX.exec(url);

@@ -1472,3 +1365,3 @@

},
normalizePath: function normalizePath(path) {
normalizePath: function (path) {
// The following operations are

@@ -1493,3 +1386,3 @@ // then applied, in order, to the new path:

},
buildURLFromParts: function buildURLFromParts(parts) {
buildURLFromParts: function (parts) {
return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;

@@ -1500,7 +1393,9 @@ }

})();
});
})(urlToolkit);
var DEFAULT_LOCATION = 'http://example.com';
var URLToolkit = urlToolkit.exports;
var resolveUrl = function resolveUrl(baseUrl, relativeUrl) {
const DEFAULT_LOCATION = 'http://example.com';
const resolveUrl = (baseUrl, relativeUrl) => {
// return early if we don't need to resolve

@@ -1518,7 +1413,7 @@ if (/^[a-z]+:/i.test(relativeUrl)) {

var nativeURL = typeof window.URL === 'function';
var protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node)
const nativeURL = typeof window.URL === 'function';
const protocolLess = /^\/\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node)
// and if baseUrl isn't an absolute url
var removeLocation = !window.location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location
const removeLocation = !window.location && !/\/\//i.test(baseUrl); // if the base URL is relative then combine with the current location

@@ -1528,7 +1423,7 @@ if (nativeURL) {

} else if (!/\/\//i.test(baseUrl)) {
baseUrl = urlToolkit.buildAbsoluteURL(window.location && window.location.href || '', baseUrl);
baseUrl = URLToolkit.buildAbsoluteURL(window.location && window.location.href || '', baseUrl);
}
if (nativeURL) {
var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol
const newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol
// and if we're location-less, remove the location

@@ -1546,3 +1441,3 @@ // otherwise, return the url unmodified

return urlToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
};

@@ -1559,4 +1454,4 @@

*/
var Stream = /*#__PURE__*/function () {
function Stream() {
class Stream {
constructor() {
this.listeners = {};

@@ -1573,5 +1468,3 @@ }

var _proto = Stream.prototype;
_proto.on = function on(type, listener) {
on(type, listener) {
if (!this.listeners[type]) {

@@ -1591,5 +1484,5 @@ this.listeners[type] = [];

*/
;
_proto.off = function off(type, listener) {
off(type, listener) {
if (!this.listeners[type]) {

@@ -1599,3 +1492,3 @@ return false;

var index = this.listeners[type].indexOf(listener); // TODO: which is better?
const index = this.listeners[type].indexOf(listener); // TODO: which is better?
// In Video.js we slice listener functions

@@ -1619,7 +1512,7 @@ // on trigger so that it does not mess up the order

*/
;
_proto.trigger = function trigger(type) {
var callbacks = this.listeners[type];
trigger(type) {
const callbacks = this.listeners[type];
if (!callbacks) {

@@ -1634,13 +1527,13 @@ return;

if (arguments.length === 2) {
var length = callbacks.length;
const length = callbacks.length;
for (var i = 0; i < length; ++i) {
for (let i = 0; i < length; ++i) {
callbacks[i].call(this, arguments[1]);
}
} else {
var args = Array.prototype.slice.call(arguments, 1);
var _length = callbacks.length;
const args = Array.prototype.slice.call(arguments, 1);
const length = callbacks.length;
for (var _i = 0; _i < _length; ++_i) {
callbacks[_i].apply(this, args);
for (let i = 0; i < length; ++i) {
callbacks[i].apply(this, args);
}

@@ -1652,5 +1545,5 @@ }

*/
;
_proto.dispose = function dispose() {
dispose() {
this.listeners = {};

@@ -1666,21 +1559,20 @@ }

*/
;
_proto.pipe = function pipe(destination) {
pipe(destination) {
this.on('data', function (data) {
destination.push(data);
});
};
}
return Stream;
}();
}
var index = {
codecs: codecs,
byteHelpers: byteHelpers,
containers: containers,
decodeB64ToUint8Array: decodeB64ToUint8Array,
mediaGroups: mediaGroups,
resolveUrl: resolveUrl,
Stream: Stream
codecs,
byteHelpers,
containers,
decodeB64ToUint8Array,
mediaGroups,
resolveUrl,
Stream
};

@@ -1690,2 +1582,2 @@

})));
}));

@@ -1,2 +0,2 @@

/*! @name @videojs/vhs-utils @version 3.0.5 @license MIT */
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).vhsUtils=e()}(this,(function(){"use strict";var r,e,t={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},n=["video","audio","text"],o=["Video","Audio","Text"],i=function(r){return r?r.replace(/avc1\.(\d+)\.(\d+)/i,(function(r,e,t){return"avc1."+("00"+Number(e).toString(16)).slice(-2)+"00"+("00"+Number(t).toString(16)).slice(-2)})):r},a=function(r){return r.map(i)},u=function(r){void 0===r&&(r="");var e=r.split(","),o=[];return e.forEach((function(r){var e;r=r.trim(),n.forEach((function(n){var i=t[n].exec(r.toLowerCase());if(i&&!(i.length<=1)){e=n;var a=r.substring(0,i[1].length),u=r.replace(a,"");o.push({type:a,details:u,mediaType:n})}})),e||o.push({type:r,details:"",mediaType:"unknown"})})),o},f=function(r){return void 0===r&&(r=""),t.audio.test(r.trim().toLowerCase())},s=function(r){return void 0===r&&(r=""),t.text.test(r.trim().toLowerCase())},c=function(r){if(r&&"string"==typeof r){var e=r.toLowerCase().split(",").map((function(r){return i(r.trim())})),n="video";1===e.length&&f(e[0])?n="audio":1===e.length&&s(e[0])&&(n="application");var o="mp4";return e.every((function(r){return t.mp4.test(r)}))?o="mp4":e.every((function(r){return t.webm.test(r)}))?o="webm":e.every((function(r){return t.ogg.test(r)}))&&(o="ogg"),n+"/"+o+';codecs="'+r+'"'}},l=Object.freeze({__proto__:null,translateLegacyCodec:i,translateLegacyCodecs:a,mapLegacyAvcCodecs:function(r){return r.replace(/avc1\.(\d+)\.(\d+)/i,(function(r){return a([r])[0]}))},parseCodecs:u,codecsFromDefault:function(r,e){if(!r.mediaGroups.AUDIO||!e)return null;var t=r.mediaGroups.AUDIO[e];if(!t)return null;for(var n in t){var o=t[n];if(o.default&&o.playlists)return u(o.playlists[0].attributes.CODECS)}return null},isVideoCodec:function(r){return void 0===r&&(r=""),t.video.test(r.trim().toLowerCase())},isAudioCodec:f,isTextCodec:s,getMimeForCodec:c,browserSupportsCodec:function(r){return void 0===r&&(r=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(c(r))||!1},muxerSupportsCodec:function(r){return void 0===r&&(r=""),r.toLowerCase().split(",").every((function(r){r=r.trim();for(var e=0;e<o.length;e++){if(t["muxer"+o[e]].test(r))return!0}return!1}))},DEFAULT_AUDIO_CODEC:"mp4a.40.2",DEFAULT_VIDEO_CODEC:"avc1.4d400d"}),p=function(r){return r.toString(2).length},h=function(r){return Math.ceil(p(r)/8)},v=function(r,e,t){return void 0===t&&(t=" "),(function(r,e){for(var t="";e--;)t+=r;return t}(t,e)+r.toString()).slice(-e)},y=function(r){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer},g=function(r){return y(r)},m=function(r){return r instanceof Uint8Array?r:(Array.isArray(r)||g(r)||r instanceof ArrayBuffer||(r="number"!=typeof r||"number"==typeof r&&r!=r?0:[r]),new Uint8Array(r&&r.buffer||r,r&&r.byteOffset||0,r&&r.byteLength||0))},d=window.BigInt||Number,b=[d("0x1"),d("0x100"),d("0x10000"),d("0x1000000"),d("0x100000000"),d("0x10000000000"),d("0x1000000000000"),d("0x100000000000000"),d("0x10000000000000000")],w=(r=new Uint16Array([65484]),255===(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))[0]?"big":204===e[0]?"little":"unknown"),A="big"===w,L="little"===w,U=function(r,e){var t=void 0===e?{}:e,n=t.signed,o=void 0!==n&&n,i=t.le,a=void 0!==i&&i;r=m(r);var u=a?"reduce":"reduceRight",f=(r[u]?r[u]:Array.prototype[u]).call(r,(function(e,t,n){var o=a?n:Math.abs(n+1-r.length);return e+d(t)*b[o]}),d(0));if(o){var s=b[r.length]/d(2)-d(1);(f=d(f))>s&&(f-=s,f-=s,f-=d(2))}return Number(f)},x=function(r,e){var t=(void 0===e?{}:e).le,n=void 0!==t&&t;("bigint"!=typeof r&&"number"!=typeof r||"number"==typeof r&&r!=r)&&(r=0),r=d(r);for(var o=h(r),i=new Uint8Array(new ArrayBuffer(o)),a=0;a<o;a++){var u=n?a:Math.abs(a+1-i.length);i[u]=Number(r/b[a]&d(255)),r<0&&(i[u]=Math.abs(~i[u]),i[u]-=0===a?1:2)}return i},T=function(r,e){if("string"!=typeof r&&r&&"function"==typeof r.toString&&(r=r.toString()),"string"!=typeof r)return new Uint8Array;e||(r=unescape(encodeURIComponent(r)));for(var t=new Uint8Array(r.length),n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t},C=function(r,e,t){var n=void 0===t?{}:t,o=n.offset,i=void 0===o?0:o,a=n.mask,u=void 0===a?[]:a;r=m(r);var f=(e=m(e)).every?e.every:Array.prototype.every;return e.length&&r.length-i>=e.length&&f.call(e,(function(e,t){return e===(u[t]?u[t]&r[i+t]:r[i+t])}))},S=Object.freeze({__proto__:null,countBits:p,countBytes:h,padStart:v,isArrayBufferView:y,isTypedArray:g,toUint8:m,toHexString:function(r){r=m(r);for(var e="",t=0;t<r.length;t++)e+=v(r[t].toString(16),2,"0");return e},toBinaryString:function(r){r=m(r);for(var e="",t=0;t<r.length;t++)e+=v(r[t].toString(2),8,"0");return e},ENDIANNESS:w,IS_BIG_ENDIAN:A,IS_LITTLE_ENDIAN:L,bytesToNumber:U,numberToBytes:x,bytesToString:function(r){if(!r)return"";r=Array.prototype.slice.call(r);var e=String.fromCharCode.apply(null,m(r));try{return decodeURIComponent(escape(e))}catch(r){}return e},stringToBytes:T,concatTypedArrays:function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];if(e=e.filter((function(r){return r&&(r.byteLength||r.length)&&"string"!=typeof r})),e.length<=1)return m(e[0]);var n=e.reduce((function(r,e,t){return r+(e.byteLength||e.length)}),0),o=new Uint8Array(n),i=0;return e.forEach((function(r){r=m(r),o.set(r,i),i+=r.byteLength})),o},bytesMatch:C,sliceBytes:function(r,e,t){return Uint8Array.prototype.slice?Uint8Array.prototype.slice.call(r,e,t):new Uint8Array(Array.prototype.slice.call(r,e,t))},reverseBytes:function(r){return r.reverse?r.reverse():Array.prototype.reverse.call(r)}}),E=function(r){return"string"==typeof r?T(r):r},B=function r(e,t,n){void 0===n&&(n=!1),t=function(r){return Array.isArray(r)?r.map((function(r){return E(r)})):[E(r)]}(t),e=m(e);var o=[];if(!t.length)return o;for(var i=0;i<e.length;){var a=(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])>>>0,u=e.subarray(i+4,i+8);if(0===a)break;var f=i+a;if(f>e.length){if(n)break;f=e.length}var s=e.subarray(i+8,f);C(u,t[0])&&(1===t.length?o.push(s):o.push.apply(o,r(s,t.slice(1),n))),i=f}return o},k={EBML:m([26,69,223,163]),DocType:m([66,130]),Segment:m([24,83,128,103]),SegmentInfo:m([21,73,169,102]),Tracks:m([22,84,174,107]),Track:m([174]),TrackNumber:m([215]),DefaultDuration:m([35,227,131]),TrackEntry:m([174]),TrackType:m([131]),FlagDefault:m([136]),CodecID:m([134]),CodecPrivate:m([99,162]),VideoTrack:m([224]),AudioTrack:m([225]),Cluster:m([31,67,182,117]),Timestamp:m([231]),TimestampScale:m([42,215,177]),BlockGroup:m([160]),BlockDuration:m([155]),Block:m([161]),SimpleBlock:m([163])},_=[128,64,32,16,8,4,2,1],D=function(r,e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!1);var o=function(r){for(var e=1,t=0;t<_.length&&!(r&_[t]);t++)e++;return e}(r[e]),i=r.subarray(e,e+o);return t&&((i=Array.prototype.slice.call(r,e,e+o))[0]^=_[o-1]),{length:o,value:U(i,{signed:n}),bytes:i}},R=function r(e){return"string"==typeof e?e.match(/.{1,2}/g).map((function(e){return r(e)})):"number"==typeof e?x(e):e},I=function r(e,t,n){if(n>=t.length)return t.length;var o=D(t,n,!1);if(C(e.bytes,o.bytes))return n;var i=D(t,n+o.length);return r(e,t,n+i.length+i.value+o.length)},N=function r(e,t){t=function(r){return Array.isArray(r)?r.map((function(r){return R(r)})):[R(r)]}(t),e=m(e);var n=[];if(!t.length)return n;for(var o=0;o<e.length;){var i=D(e,o,!1),a=D(e,o+i.length),u=o+i.length+a.length;127===a.value&&(a.value=I(i,e,u),a.value!==e.length&&(a.value-=u));var f=u+a.value>e.length?e.length:u+a.value,s=e.subarray(u,f);C(t[0],i.bytes)&&(1===t.length?n.push(s):n=n.concat(r(s,t.slice(1)))),o+=i.length+a.length+s.length}return n},O=m([73,68,51]),z=function r(e,t){return void 0===t&&(t=0),(e=m(e)).length-t<10||!C(e,O,{offset:t})?t:(t+=function(r,e){void 0===e&&(e=0);var t=(r=m(r))[e+5],n=r[e+6]<<21|r[e+7]<<14|r[e+8]<<7|r[e+9];return(16&t)>>4?n+20:n+10}(e,t),r(e,t))},M=m([0,0,0,1]),F=m([0,0,1]),P=m([0,0,3]),j=function(r){for(var e=[],t=1;t<r.length-2;)C(r.subarray(t,t+3),P)&&(e.push(t+2),t++),t++;if(0===e.length)return r;var n=r.length-e.length,o=new Uint8Array(n),i=0;for(t=0;t<n;i++,t++)i===e[0]&&(i++,e.shift()),o[t]=r[i];return o},q=function(r,e,t,n){void 0===n&&(n=1/0),r=m(r),t=[].concat(t);for(var o,i=0,a=0;i<r.length&&(a<n||o);){var u=void 0;if(C(r.subarray(i),M)?u=4:C(r.subarray(i),F)&&(u=3),u){if(a++,o)return j(r.subarray(o,i));var f=void 0;"h264"===e?f=31&r[i+u]:"h265"===e&&(f=r[i+u]>>1&63),-1!==t.indexOf(f)&&(o=i+u),i+=u+("h264"===e?1:2)}else i++}return r.subarray(0,0)},G={webm:m([119,101,98,109]),matroska:m([109,97,116,114,111,115,107,97]),flac:m([102,76,97,67]),ogg:m([79,103,103,83]),ac3:m([11,119]),riff:m([82,73,70,70]),avi:m([65,86,73]),wav:m([87,65,86,69]),"3gp":m([102,116,121,112,51,103]),mp4:m([102,116,121,112]),fmp4:m([115,116,121,112]),mov:m([102,116,121,112,113,116]),moov:m([109,111,111,118]),moof:m([109,111,111,102])},V={aac:function(r){var e=z(r);return C(r,[255,16],{offset:e,mask:[255,22]})},mp3:function(r){var e=z(r);return C(r,[255,2],{offset:e,mask:[255,6]})},webm:function(r){var e=N(r,[k.EBML,k.DocType])[0];return C(e,G.webm)},mkv:function(r){var e=N(r,[k.EBML,k.DocType])[0];return C(e,G.matroska)},mp4:function(r){return!V["3gp"](r)&&!V.mov(r)&&(!(!C(r,G.mp4,{offset:4})&&!C(r,G.fmp4,{offset:4}))||(!(!C(r,G.moof,{offset:4})&&!C(r,G.moov,{offset:4}))||void 0))},mov:function(r){return C(r,G.mov,{offset:4})},"3gp":function(r){return C(r,G["3gp"],{offset:4})},ac3:function(r){var e=z(r);return C(r,G.ac3,{offset:e})},ts:function(r){if(r.length<189&&r.length>=1)return 71===r[0];for(var e=0;e+188<r.length&&e<188;){if(71===r[e]&&71===r[e+188])return!0;e+=1}return!1},flac:function(r){var e=z(r);return C(r,G.flac,{offset:e})},ogg:function(r){return C(r,G.ogg)},avi:function(r){return C(r,G.riff)&&C(r,G.avi,{offset:8})},wav:function(r){return C(r,G.riff)&&C(r,G.wav,{offset:8})},h264:function(r){return function(r,e,t){return q(r,"h264",e,t)}(r,7,3).length},h265:function(r){return function(r,e,t){return q(r,"h265",e,t)}(r,[32,33],3).length}},H=Object.keys(V).filter((function(r){return"ts"!==r&&"h264"!==r&&"h265"!==r})).concat(["ts","h264","h265"]);H.forEach((function(r){var e=V[r];V[r]=function(r){return e(m(r))}}));var $=V,Z=Object.freeze({__proto__:null,isLikely:$,detectContainerForBytes:function(r){r=m(r);for(var e=0;e<H.length;e++){var t=H[e];if($[t](r))return t}return""},isLikelyFmp4MediaSegment:function(r){return B(r,["moof"]).length>0}});var J=Object.freeze({__proto__:null,forEachMediaGroup:function(r,e,t){e.forEach((function(e){for(var n in r.mediaGroups[e])for(var o in r.mediaGroups[e][n]){var i=r.mediaGroups[e][n][o];t(i,e,n,o)}}))}});var K=function(r,e,t){return r(t={path:e,exports:{},require:function(r,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&t.path)}},t.exports),t.exports}((function(r,e){var t,n,o,i,a;t=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,o=/(?:\/|^)\.(?=\/)/g,i=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(r,e,t){if(t=t||{},r=r.trim(),!(e=e.trim())){if(!t.alwaysNormalize)return r;var o=a.parseURL(r);if(!o)throw new Error("Error trying to parse base URL.");return o.path=a.normalizePath(o.path),a.buildURLFromParts(o)}var i=a.parseURL(e);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return t.alwaysNormalize?(i.path=a.normalizePath(i.path),a.buildURLFromParts(i)):e;var u=a.parseURL(r);if(!u)throw new Error("Error trying to parse base URL.");if(!u.netLoc&&u.path&&"/"!==u.path[0]){var f=n.exec(u.path);u.netLoc=f[1],u.path=f[2]}u.netLoc&&!u.path&&(u.path="/");var s={scheme:u.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};if(!i.netLoc&&(s.netLoc=u.netLoc,"/"!==i.path[0]))if(i.path){var c=u.path,l=c.substring(0,c.lastIndexOf("/")+1)+i.path;s.path=a.normalizePath(l)}else s.path=u.path,i.params||(s.params=u.params,i.query||(s.query=u.query));return null===s.path&&(s.path=t.alwaysNormalize?a.normalizePath(i.path):i.path),a.buildURLFromParts(s)},parseURL:function(r){var e=t.exec(r);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(r){for(r=r.split("").reverse().join("").replace(o,"");r.length!==(r=r.replace(i,"")).length;);return r.split("").reverse().join("")},buildURLFromParts:function(r){return r.scheme+r.netLoc+r.path+r.params+r.query+r.fragment}},r.exports=a})),Q="http://example.com",W=function(){function r(){this.listeners={}}var e=r.prototype;return e.on=function(r,e){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(e)},e.off=function(r,e){if(!this.listeners[r])return!1;var t=this.listeners[r].indexOf(e);return this.listeners[r]=this.listeners[r].slice(0),this.listeners[r].splice(t,1),t>-1},e.trigger=function(r){var e=this.listeners[r];if(e)if(2===arguments.length)for(var t=e.length,n=0;n<t;++n)e[n].call(this,arguments[1]);else for(var o=Array.prototype.slice.call(arguments,1),i=e.length,a=0;a<i;++a)e[a].apply(this,o)},e.dispose=function(){this.listeners={}},e.pipe=function(r){this.on("data",(function(e){r.push(e)}))},r}();return{codecs:l,byteHelpers:S,containers:Z,decodeB64ToUint8Array:function(r){for(var e,t=(e=r,window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")),n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n},mediaGroups:J,resolveUrl:function(r,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(r)&&(r=window.location&&window.location.href||"");var t="function"==typeof window.URL,n=/^\/\//.test(r),o=!window.location&&!/\/\//i.test(r);if(t?r=new window.URL(r,window.location||Q):/\/\//i.test(r)||(r=K.buildAbsoluteURL(window.location&&window.location.href||"",r)),t){var i=new URL(e,r);return o?i.href.slice(Q.length):n?i.href.slice(i.protocol.length):i.href}return K.buildAbsoluteURL(r,e)},Stream:W}}));
/*! @name @videojs/vhs-utils @version 4.0.0 @license MIT */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).vhsUtils=t()}(this,(function(){"use strict";const e={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},t=["video","audio","text"],r=["Video","Audio","Text"],n=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,(function(e,t,r){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(r).toString(16)).slice(-2)})):e},o=function(e){return e.map(n)},a=function(r=""){const n=r.split(","),o=[];return n.forEach((function(r){let n;r=r.trim(),t.forEach((function(t){const a=e[t].exec(r.toLowerCase());if(!a||a.length<=1)return;n=t;const i=r.substring(0,a[1].length),s=r.replace(i,"");o.push({type:i,details:s,mediaType:t})})),n||o.push({type:r,details:"",mediaType:"unknown"})})),o},i=(t="")=>e.audio.test(t.trim().toLowerCase()),s=(t="")=>e.text.test(t.trim().toLowerCase()),l=t=>{if(!t||"string"!=typeof t)return;const r=t.toLowerCase().split(",").map((e=>n(e.trim())));let o="video";1===r.length&&i(r[0])?o="audio":1===r.length&&s(r[0])&&(o="application");let a="mp4";return r.every((t=>e.mp4.test(t)))?a="mp4":r.every((t=>e.webm.test(t)))?a="webm":r.every((t=>e.ogg.test(t)))&&(a="ogg"),`${o}/${a};codecs="${t}"`};var c=Object.freeze({__proto__:null,translateLegacyCodec:n,translateLegacyCodecs:o,mapLegacyAvcCodecs:function(e){return e.replace(/avc1\.(\d+)\.(\d+)/i,(e=>o([e])[0]))},parseCodecs:a,codecsFromDefault:(e,t)=>{if(!e.mediaGroups.AUDIO||!t)return null;const r=e.mediaGroups.AUDIO[t];if(!r)return null;for(const e in r){const t=r[e];if(t.default&&t.playlists)return a(t.playlists[0].attributes.CODECS)}return null},isVideoCodec:(t="")=>e.video.test(t.trim().toLowerCase()),isAudioCodec:i,isTextCodec:s,getMimeForCodec:l,browserSupportsCodec:(e="")=>window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(l(e))||!1,muxerSupportsCodec:(t="")=>t.toLowerCase().split(",").every((t=>{t=t.trim();for(let n=0;n<r.length;n++){if(e[`muxer${r[n]}`].test(t))return!0}return!1})),DEFAULT_AUDIO_CODEC:"mp4a.40.2",DEFAULT_VIDEO_CODEC:"avc1.4d400d"});const u=e=>e.toString(2).length,f=e=>Math.ceil(u(e)/8),p=(e,t,r=" ")=>(function(e,t){let r="";for(;t--;)r+=e;return r}(r,t)+e.toString()).slice(-t),h=e=>"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,y=e=>h(e),g=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||y(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},m=window.BigInt||Number,d=[m("0x1"),m("0x100"),m("0x10000"),m("0x1000000"),m("0x100000000"),m("0x10000000000"),m("0x1000000000000"),m("0x100000000000000"),m("0x10000000000000000")],b=function(){const e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return 255===t[0]?"big":204===t[0]?"little":"unknown"}(),v="big"===b,w="little"===b,A=function(e,{signed:t=!1,le:r=!1}={}){e=g(e);const n=r?"reduce":"reduceRight";let o=(e[n]?e[n]:Array.prototype[n]).call(e,(function(t,n,o){const a=r?o:Math.abs(o+1-e.length);return t+m(n)*d[a]}),m(0));if(t){const t=d[e.length]/m(2)-m(1);o=m(o),o>t&&(o-=t,o-=t,o-=m(2))}return Number(o)},L=function(e,{le:t=!1}={}){("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=m(e);const r=f(e),n=new Uint8Array(new ArrayBuffer(r));for(let o=0;o<r;o++){const r=t?o:Math.abs(o+1-n.length);n[r]=Number(e/d[o]&m(255)),e<0&&(n[r]=Math.abs(~n[r]),n[r]-=0===o?1:2)}return n},U=(e,t)=>{if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));const r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.charCodeAt(t);return r},x=(e,t,{offset:r=0,mask:n=[]}={})=>{e=g(e);const o=(t=g(t)).every?t.every:Array.prototype.every;return t.length&&e.length-r>=t.length&&o.call(t,((t,o)=>t===(n[o]?n[o]&e[r+o]:e[r+o])))};var T=Object.freeze({__proto__:null,countBits:u,countBytes:f,padStart:p,isArrayBufferView:h,isTypedArray:y,toUint8:g,toHexString:function(e){e=g(e);let t="";for(let r=0;r<e.length;r++)t+=p(e[r].toString(16),2,"0");return t},toBinaryString:function(e){e=g(e);let t="";for(let r=0;r<e.length;r++)t+=p(e[r].toString(2),8,"0");return t},ENDIANNESS:b,IS_BIG_ENDIAN:v,IS_LITTLE_ENDIAN:w,bytesToNumber:A,numberToBytes:L,bytesToString:e=>{if(!e)return"";e=Array.prototype.slice.call(e);const t=String.fromCharCode.apply(null,g(e));try{return decodeURIComponent(escape(t))}catch(e){}return t},stringToBytes:U,concatTypedArrays:(...e)=>{if((e=e.filter((e=>e&&(e.byteLength||e.length)&&"string"!=typeof e))).length<=1)return g(e[0]);const t=e.reduce(((e,t,r)=>e+(t.byteLength||t.length)),0),r=new Uint8Array(t);let n=0;return e.forEach((function(e){e=g(e),r.set(e,n),n+=e.byteLength})),r},bytesMatch:x,sliceBytes:function(e,t,r){return Uint8Array.prototype.slice?Uint8Array.prototype.slice.call(e,t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))},reverseBytes:function(e){return e.reverse?e.reverse():Array.prototype.reverse.call(e)}});const C=function(e){return"string"==typeof e?U(e):e},S=function(e,t,r=!1){t=function(e){return Array.isArray(e)?e.map((e=>C(e))):[C(e)]}(t),e=g(e);const n=[];if(!t.length)return n;let o=0;for(;o<e.length;){const a=(e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0,i=e.subarray(o+4,o+8);if(0===a)break;let s=o+a;if(s>e.length){if(r)break;s=e.length}const l=e.subarray(o+8,s);x(i,t[0])&&(1===t.length?n.push(l):n.push.apply(n,S(l,t.slice(1),r))),o=s}return n},E={EBML:g([26,69,223,163]),DocType:g([66,130]),Segment:g([24,83,128,103]),SegmentInfo:g([21,73,169,102]),Tracks:g([22,84,174,107]),Track:g([174]),TrackNumber:g([215]),DefaultDuration:g([35,227,131]),TrackEntry:g([174]),TrackType:g([131]),FlagDefault:g([136]),CodecID:g([134]),CodecPrivate:g([99,162]),VideoTrack:g([224]),AudioTrack:g([225]),Cluster:g([31,67,182,117]),Timestamp:g([231]),TimestampScale:g([42,215,177]),BlockGroup:g([160]),BlockDuration:g([155]),Block:g([161]),SimpleBlock:g([163])},B=[128,64,32,16,8,4,2,1],k=function(e,t,r=!0,n=!1){const o=function(e){let t=1;for(let r=0;r<B.length&&!(e&B[r]);r++)t++;return t}(e[t]);let a=e.subarray(t,t+o);return r&&(a=Array.prototype.slice.call(e,t,t+o),a[0]^=B[o-1]),{length:o,value:A(a,{signed:n}),bytes:a}},_=function(e){return"string"==typeof e?e.match(/.{1,2}/g).map((e=>_(e))):"number"==typeof e?L(e):e},D=(e,t,r)=>{if(r>=t.length)return t.length;const n=k(t,r,!1);if(x(e.bytes,n.bytes))return r;const o=k(t,r+n.length);return D(e,t,r+o.length+o.value+n.length)},R=function(e,t){t=function(e){return Array.isArray(e)?e.map((e=>_(e))):[_(e)]}(t),e=g(e);let r=[];if(!t.length)return r;let n=0;for(;n<e.length;){const o=k(e,n,!1),a=k(e,n+o.length),i=n+o.length+a.length;127===a.value&&(a.value=D(o,e,i),a.value!==e.length&&(a.value-=i));const s=i+a.value>e.length?e.length:i+a.value,l=e.subarray(i,s);x(t[0],o.bytes)&&(1===t.length?r.push(l):r=r.concat(R(l,t.slice(1))));n+=o.length+a.length+l.length}return r},I=g([73,68,51]),N=function(e,t=0){return(e=g(e)).length-t<10||!x(e,I,{offset:t})?t:(t+=function(e,t=0){const r=(e=g(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&r)>>4?n+20:n+10}(e,t),N(e,t))},O=g([0,0,0,1]),z=g([0,0,1]),M=g([0,0,3]),F=function(e){const t=[];let r=1;for(;r<e.length-2;)x(e.subarray(r,r+3),M)&&(t.push(r+2),r++),r++;if(0===t.length)return e;const n=e.length-t.length,o=new Uint8Array(n);let a=0;for(r=0;r<n;a++,r++)a===t[0]&&(a++,t.shift()),o[r]=e[a];return o},P=function(e,t,r,n=1/0){e=g(e),r=[].concat(r);let o,a=0,i=0;for(;a<e.length&&(i<n||o);){let n,s;if(x(e.subarray(a),O)?n=4:x(e.subarray(a),z)&&(n=3),n){if(i++,o)return F(e.subarray(o,a));"h264"===t?s=31&e[a+n]:"h265"===t&&(s=e[a+n]>>1&63),-1!==r.indexOf(s)&&(o=a+n),a+=n+("h264"===t?1:2)}else a++}return e.subarray(0,0)},G={webm:g([119,101,98,109]),matroska:g([109,97,116,114,111,115,107,97]),flac:g([102,76,97,67]),ogg:g([79,103,103,83]),ac3:g([11,119]),riff:g([82,73,70,70]),avi:g([65,86,73]),wav:g([87,65,86,69]),"3gp":g([102,116,121,112,51,103]),mp4:g([102,116,121,112]),fmp4:g([115,116,121,112]),mov:g([102,116,121,112,113,116]),moov:g([109,111,111,118]),moof:g([109,111,111,102])},j={aac(e){const t=N(e);return x(e,[255,16],{offset:t,mask:[255,22]})},mp3(e){const t=N(e);return x(e,[255,2],{offset:t,mask:[255,6]})},webm(e){const t=R(e,[E.EBML,E.DocType])[0];return x(t,G.webm)},mkv(e){const t=R(e,[E.EBML,E.DocType])[0];return x(t,G.matroska)},mp4:e=>!j["3gp"](e)&&!j.mov(e)&&(!(!x(e,G.mp4,{offset:4})&&!x(e,G.fmp4,{offset:4}))||(!(!x(e,G.moof,{offset:4})&&!x(e,G.moov,{offset:4}))||void 0)),mov:e=>x(e,G.mov,{offset:4}),"3gp":e=>x(e,G["3gp"],{offset:4}),ac3(e){const t=N(e);return x(e,G.ac3,{offset:t})},ts(e){if(e.length<189&&e.length>=1)return 71===e[0];let t=0;for(;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac(e){const t=N(e);return x(e,G.flac,{offset:t})},ogg:e=>x(e,G.ogg),avi:e=>x(e,G.riff)&&x(e,G.avi,{offset:8}),wav:e=>x(e,G.riff)&&x(e,G.wav,{offset:8}),h264:e=>((e,t,r)=>P(e,"h264",t,r))(e,7,3).length,h265:e=>((e,t,r)=>P(e,"h265",t,r))(e,[32,33],3).length},V=Object.keys(j).filter((e=>"ts"!==e&&"h264"!==e&&"h265"!==e)).concat(["ts","h264","h265"]);V.forEach((function(e){const t=j[e];j[e]=e=>t(g(e))}));const q=j;var $=Object.freeze({__proto__:null,isLikely:q,detectContainerForBytes:e=>{e=g(e);for(let t=0;t<V.length;t++){const r=V[t];if(q[r](e))return r}return""},isLikelyFmp4MediaSegment:e=>S(e,["moof"]).length>0});var H=Object.freeze({__proto__:null,forEachMediaGroup:(e,t,r)=>{t.forEach((t=>{for(const n in e.mediaGroups[t])for(const o in e.mediaGroups[t][n]){const a=e.mediaGroups[t][n][o];r(a,t,n,o)}}))}}),Z={exports:{}};!function(e,t){!function(t){var r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,o=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,i={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var o=i.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return o.path=i.normalizePath(o.path),i.buildURLFromParts(o)}var a=i.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return r.alwaysNormalize?(a.path=i.normalizePath(a.path),i.buildURLFromParts(a)):t;var s=i.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");if(!s.netLoc&&s.path&&"/"!==s.path[0]){var l=n.exec(s.path);s.netLoc=l[1],s.path=l[2]}s.netLoc&&!s.path&&(s.path="/");var c={scheme:s.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(c.netLoc=s.netLoc,"/"!==a.path[0]))if(a.path){var u=s.path,f=u.substring(0,u.lastIndexOf("/")+1)+a.path;c.path=i.normalizePath(f)}else c.path=s.path,a.params||(c.params=s.params,a.query||(c.query=s.query));return null===c.path&&(c.path=r.alwaysNormalize?i.normalizePath(a.path):a.path),i.buildURLFromParts(c)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(o,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=i}()}(Z);var J=Z.exports;const K="http://example.com";var Q={codecs:c,byteHelpers:T,containers:$,decodeB64ToUint8Array:function(e){const t=(r=e,window.atob?window.atob(r):Buffer.from(r,"base64").toString("binary"));var r;const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},mediaGroups:H,resolveUrl:(e,t)=>{if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=window.location&&window.location.href||"");const r="function"==typeof window.URL,n=/^\/\//.test(e),o=!window.location&&!/\/\//i.test(e);if(r?e=new window.URL(e,window.location||K):/\/\//i.test(e)||(e=J.buildAbsoluteURL(window.location&&window.location.href||"",e)),r){const r=new URL(t,e);return o?r.href.slice(K.length):n?r.href.slice(r.protocol.length):r.href}return J.buildAbsoluteURL(e,t)},Stream:class{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){if(!this.listeners[e])return!1;const r=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(r,1),r>-1}trigger(e){const t=this.listeners[e];if(t)if(2===arguments.length){const e=t.length;for(let r=0;r<e;++r)t[r].call(this,arguments[1])}else{const e=Array.prototype.slice.call(arguments,1),r=t.length;for(let n=0;n<r;++n)t[n].apply(this,e)}}dispose(){this.listeners={}}pipe(e){this.on("data",(function(t){e.push(t)}))}}};return Q}));
{
"name": "@videojs/vhs-utils",
"version": "3.0.5",
"version": "4.0.0",
"description": "Objects and functions shared throughtout @videojs/http-streaming code",

@@ -12,6 +12,2 @@ "repository": {

},
"browserslist": [
"defaults",
"ie 11"
],
"main": "./cjs/index.js",

@@ -41,3 +37,3 @@ "module": "./es/index.js",

"watch:es": "npm run build:es -- -w",
"prepublishOnly": "npm-run-all build-prod && vjsverify --verbose"
"prepublishOnly": "npm-run-all build-prod && vjsverify --verbose --skip-es-check"
},

@@ -94,5 +90,5 @@ "engines": {

"karma": "^5.2.3",
"rollup": "^2.28.2",
"videojs-generate-karma-config": "~7.0.0",
"videojs-generate-rollup-config": "^6.2.2",
"rollup": "^2.38.0",
"videojs-generate-karma-config": "^8.0.1",
"videojs-generate-rollup-config": "~7.0.0",
"videojs-generator-verify": "~3.0.3",

@@ -99,0 +95,0 @@ "videojs-standard": "^8.0.4"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc