@dskripchenko/ui 1.15.1 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -0
  2. package/dist/{UidIcon-DUeT_lN-.cjs → UidIcon-BCwosbz1.cjs} +1 -0
  3. package/dist/{UidIcon-5947kXOj.js → UidIcon-wihsnq_U.js} +1 -0
  4. package/dist/components/Board/UidBoard.vue.d.ts +86 -0
  5. package/dist/components/Board/index.d.ts +2 -0
  6. package/dist/components/Media/index.d.ts +1 -1
  7. package/dist/components/Media/mediaUtils.d.ts +5 -0
  8. package/dist/components/Video/UidVideo.vue.d.ts +7 -1
  9. package/dist/composables/useLocale.d.ts +4 -2
  10. package/dist/fonts/InterDisplay-Bold.woff2 +0 -0
  11. package/dist/fonts/InterDisplay-SemiBold.woff2 +0 -0
  12. package/dist/fonts/InterVariable-Italic.woff2 +0 -0
  13. package/dist/fonts/InterVariable.woff2 +0 -0
  14. package/dist/fonts/LICENSE-IBMPlexMono.txt +93 -0
  15. package/dist/fonts/LICENSE-Inter.txt +93 -0
  16. package/dist/fonts/ibm-plex-mono-cyrillic-400-normal.woff2 +0 -0
  17. package/dist/fonts/ibm-plex-mono-cyrillic-500-normal.woff2 +0 -0
  18. package/dist/fonts/ibm-plex-mono-cyrillic-600-normal.woff2 +0 -0
  19. package/dist/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  20. package/dist/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  21. package/dist/fonts/ibm-plex-mono-latin-600-normal.woff2 +0 -0
  22. package/dist/hls/index.cjs +1 -0
  23. package/dist/hls/index.mjs +1 -0
  24. package/dist/icons/index.cjs +2 -1
  25. package/dist/icons/index.mjs +2 -1
  26. package/dist/index.cjs +28 -11
  27. package/dist/index.d.ts +5 -2
  28. package/dist/index.mjs +4071 -3353
  29. package/dist/locales/types.d.ts +5 -0
  30. package/dist/styles/all.css +3 -1
  31. package/dist/styles/fonts.css +84 -0
  32. package/dist/styles/index.css +1 -1
  33. package/dist/styles/tokens.css +2 -0
  34. package/package.json +4 -2
package/README.md CHANGED
@@ -53,6 +53,7 @@ import '@dskripchenko/ui/styles/tokens.css' // primitives (colors, spacing, ra
53
53
  import '@dskripchenko/ui/styles/themes.css' // :root[data-theme="light|dark"] + semantic aliases
54
54
  import '@dskripchenko/ui/styles/reset.css' // optional: minimal HTML reset
55
55
  import '@dskripchenko/ui/styles/global.css' // optional: :root font-family + base typography
56
+ import '@dskripchenko/ui/styles/fonts.css' // optional: the Inter, Inter Display and IBM Plex Mono files
56
57
  import '@dskripchenko/ui/styles/index.css' // component styles
57
58
  ```
58
59
 
@@ -1 +1,2 @@
1
+
1
2
  let e=require(`vue`);var t=(0,e.defineComponent)({__name:`UidIcon`,props:{icon:{},size:{default:20},strokeWidth:{default:2},label:{}},setup(t){return(n,r)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.resolveDynamicComponent)(t.icon),{class:`uid-icon`,width:t.size,height:t.size,"stroke-width":t.strokeWidth,"aria-label":t.label,"aria-hidden":t.label?void 0:`true`,role:`img`},null,8,[`width`,`height`,`stroke-width`,`aria-label`,`aria-hidden`]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
@@ -1,3 +1,4 @@
1
+
1
2
  import { createBlock as e, defineComponent as t, openBlock as n, resolveDynamicComponent as r } from "vue";
2
3
  //#endregion
3
4
  //#region src/icons/UidIcon.vue
@@ -0,0 +1,86 @@
1
+ import { Tone } from '../../types/index.js';
2
+ export type BoardKey = string | number;
3
+ export interface BoardCardTag {
4
+ label: string;
5
+ tone?: Tone | 'default';
6
+ }
7
+ export interface BoardCard {
8
+ key: BoardKey;
9
+ title: string;
10
+ subtitle?: string;
11
+ tags?: BoardCardTag[];
12
+ /** The swimlane the card sits in, when the board has lanes. */
13
+ lane?: BoardKey;
14
+ /** Columns the card may move to; omitted — any column. */
15
+ targets?: BoardKey[];
16
+ }
17
+ export interface BoardColumn {
18
+ key: BoardKey;
19
+ title: string;
20
+ cards: BoardCard[];
21
+ /** Work-in-progress limit; the header warns when the column holds more. */
22
+ wip?: number | null;
23
+ }
24
+ export interface BoardLane {
25
+ key: BoardKey;
26
+ title: string;
27
+ }
28
+ export interface BoardMove {
29
+ card: BoardCard;
30
+ from: BoardKey;
31
+ to: BoardKey;
32
+ /** The neighbours at the drop point, for ranking: null at an end. */
33
+ beforeKey: BoardKey | null;
34
+ afterKey: BoardKey | null;
35
+ lane: BoardKey | null;
36
+ }
37
+ export interface UidBoardProps {
38
+ columns: BoardColumn[];
39
+ lanes?: BoardLane[];
40
+ /** Freeze the board while a move is being saved. */
41
+ busy?: boolean;
42
+ }
43
+ declare function __VLS_template(): {
44
+ attrs: Partial<{}>;
45
+ slots: Readonly<{
46
+ card?(props: {
47
+ card: BoardCard;
48
+ column: BoardColumn;
49
+ }): unknown;
50
+ 'column-header'?(props: {
51
+ column: BoardColumn;
52
+ count: number;
53
+ over: boolean;
54
+ }): unknown;
55
+ }> & {
56
+ card?(props: {
57
+ card: BoardCard;
58
+ column: BoardColumn;
59
+ }): unknown;
60
+ 'column-header'?(props: {
61
+ column: BoardColumn;
62
+ count: number;
63
+ over: boolean;
64
+ }): unknown;
65
+ };
66
+ refs: {};
67
+ rootEl: HTMLDivElement;
68
+ };
69
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
70
+ declare const __VLS_component: import('vue').DefineComponent<UidBoardProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
71
+ open: (card: BoardCard) => any;
72
+ move: (move: BoardMove) => any;
73
+ }, string, import('vue').PublicProps, Readonly<UidBoardProps> & Readonly<{
74
+ onOpen?: ((card: BoardCard) => any) | undefined;
75
+ onMove?: ((move: BoardMove) => any) | undefined;
76
+ }>, {
77
+ lanes: BoardLane[];
78
+ busy: boolean;
79
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
80
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
81
+ export default _default;
82
+ type __VLS_WithTemplateSlots<T, S> = T & {
83
+ new (): {
84
+ $slots: S;
85
+ };
86
+ };
@@ -0,0 +1,2 @@
1
+ export { default as UidBoard } from './UidBoard.vue';
2
+ export type { UidBoardProps, BoardCard, BoardCardTag, BoardColumn, BoardLane, BoardMove, BoardKey } from './UidBoard.vue';
@@ -1,6 +1,6 @@
1
1
  export { useMediaController } from './useMediaController.js';
2
2
  export type { UseMediaControllerOptions, UidMediaController, UidMediaState, UidMediaErrorInfo, UidMediaErrorKind, } from './useMediaController.js';
3
3
  export { formatTime, parseVtt, cueText, cueAt, parseThumbnail, isHlsSource, orderSources, PLAYBACK_RATES, } from './mediaUtils.js';
4
- export type { UidMediaSource, UidMediaTrack, UidMediaCue, UidMediaRange, UidMediaThumbnail, } from './mediaUtils.js';
4
+ export type { UidMediaSource, UidMediaTrack, UidMediaCue, UidMediaChapter, UidMediaRange, UidMediaThumbnail, } from './mediaUtils.js';
5
5
  export { computePeaks, resamplePeaks, normalizePeaks, peaksToPath, getWaveform, clearWaveformCache } from './waveform.js';
6
6
  export type { ComputePeaksOptions, WaveformOptions } from './waveform.js';
@@ -17,6 +17,11 @@ export interface UidMediaCue {
17
17
  end: number;
18
18
  text: string;
19
19
  }
20
+ export interface UidMediaChapter {
21
+ start: number;
22
+ end: number;
23
+ title: string;
24
+ }
20
25
  export type UidMediaRange = [number, number];
21
26
  export declare function formatTime(value: number, withHours?: boolean): string;
22
27
  export declare function toRanges(ranges: TimeRanges | null | undefined): UidMediaRange[];
@@ -1,5 +1,5 @@
1
1
  import { UidMediaErrorInfo } from '../Media/useMediaController.js';
2
- import { UidMediaSource, UidMediaTrack } from '../Media/mediaUtils.js';
2
+ import { UidMediaChapter, UidMediaSource, UidMediaTrack } from '../Media/mediaUtils.js';
3
3
  import { HlsOptions } from '../../hls/index.js';
4
4
  export type UidHlsModule = typeof import('../../hls/index.js');
5
5
  export interface UidVideoProps {
@@ -35,11 +35,15 @@ export interface UidVideoProps {
35
35
  /** Loads the HLS adapter; defaults to the lazily imported `@dskripchenko/ui/hls`. */
36
36
  hlsLoader?: () => Promise<UidHlsModule>;
37
37
  }
38
+ declare function seekToChapter(target: number | string): boolean;
38
39
  declare const _default: import('vue').DefineComponent<UidVideoProps, {
39
40
  play: () => Promise<void>;
40
41
  pause: () => void;
41
42
  toggle: () => void;
42
43
  seek: (time: number) => void;
44
+ seekToChapter: typeof seekToChapter;
45
+ chapters: import('vue').ComputedRef<UidMediaChapter[]>;
46
+ chapterIndex: import('vue').ComputedRef<number>;
43
47
  state: {
44
48
  playing: boolean;
45
49
  paused: boolean;
@@ -70,6 +74,7 @@ declare const _default: import('vue').DefineComponent<UidVideoProps, {
70
74
  ended: () => any;
71
75
  qualitychange: (label: string) => any;
72
76
  audiotrackchange: (label: string) => any;
77
+ chapterchange: (chapter: UidMediaChapter | null, index: number) => any;
73
78
  }, string, import('vue').PublicProps, Readonly<UidVideoProps> & Readonly<{
74
79
  onError?: ((error: UidMediaErrorInfo) => any) | undefined;
75
80
  onPlay?: (() => any) | undefined;
@@ -77,6 +82,7 @@ declare const _default: import('vue').DefineComponent<UidVideoProps, {
77
82
  onEnded?: (() => any) | undefined;
78
83
  onQualitychange?: ((label: string) => any) | undefined;
79
84
  onAudiotrackchange?: ((label: string) => any) | undefined;
85
+ onChapterchange?: ((chapter: UidMediaChapter | null, index: number) => any) | undefined;
80
86
  }>, {
81
87
  title: string;
82
88
  src: string;
@@ -1,5 +1,7 @@
1
- import { ComputedRef, InjectionKey } from 'vue';
1
+ import { App, ComputedRef, InjectionKey, MaybeRefOrGetter } from 'vue';
2
2
  import { UidLocale, UidPartialLocale } from '../locales/types.js';
3
3
  export declare const localeKey: InjectionKey<ComputedRef<UidLocale>>;
4
- export declare function provideLocale(source: ComputedRef<UidLocale | UidPartialLocale | undefined>): void;
4
+ export type UidLocaleSource = MaybeRefOrGetter<UidLocale | UidPartialLocale | undefined>;
5
+ export declare function provideLocale(source: UidLocaleSource): void;
6
+ export declare function provideAppLocale(app: App, source: UidLocaleSource): () => void;
5
7
  export declare function useLocale(): ComputedRef<UidLocale>;
Binary file
@@ -0,0 +1,93 @@
1
+ Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ThinItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLight.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-ExtraLightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Light.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-LightItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Regular.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Italic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Medium.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-MediumItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-SemiBoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-Bold.ttf: Copyright 2017 IBM Corp. All rights reserved. IBMPlexMono-BoldItalic.ttf: Copyright 2017 IBM Corp. All rights reserved.
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter) Inter-Italic[opsz,wght].ttf: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,3 +1,4 @@
1
+
1
2
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e=1e6,t=3,n=9,r=16e3){this.fastHalfLife=t,this.slowHalfLife=n,this.minBytes=r,this.fastWeight=0,this.slowWeight=0,this.defaultEstimate=e,this.fast=0,this.slow=0}sample({bytes:e,ms:t}){if(e<this.minBytes||t<=0)return;let n=e*8*1e3/t,r=Math.max(t/1e3,.05),i=Math.exp(Math.log(.5)/this.fastHalfLife*r),a=Math.exp(Math.log(.5)/this.slowHalfLife*r);this.fast=n*(1-i)+i*this.fast,this.fastWeight=1-i+i*this.fastWeight,this.slow=n*(1-a)+a*this.slow,this.slowWeight=1-a+a*this.slowWeight}get hasSamples(){return this.fastWeight>0}get estimate(){return this.fastWeight?Math.min(this.fast/this.fastWeight,this.slow/this.slowWeight):this.defaultEstimate}};function t(e,t,n={}){if(!e.length)return-1;let r=n.safety??.8;n.bufferAhead!==void 0&&n.bufferAhead<4&&(r*=.7);let i=t*r,a=0;for(let t=0;t<e.length;t++){let r=e[t],o=e[t-1];if(n.maxHeight&&o?.height&&o.height>=n.maxHeight)break;r.bandwidth<=i&&(a=t)}let o=n.current;return o!==void 0&&o>=0&&a>o+1&&(a=o+1),a}var n=class extends Error{constructor(e){super(e),this.name=`HlsParseError`}};function r(e){let t={},n=/([A-Z0-9-]+)=("[^"]*"|[^,]*)/g,r;for(;r=n.exec(e);){let e=r[2];e.startsWith(`"`)&&(e=e.slice(1,-1)),t[r[1]]=e}return t}function i(e,t){try{return new URL(e,t).href}catch{return e}}function a(e,t){let[n,r]=e.split(`@`);return{length:parseInt(n,10),offset:r===void 0?t:parseInt(r,10)}}function o(e){let t=e.replace(/^0x/i,``).padStart(32,`0`),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.substr(e*2,2),16);return n}function s(e,t){let r=e.replace(/\r\n?/g,`
2
3
  `).split(`
3
4
  `).map(e=>e.trim());if(r[0]?.replace(/^/,``)!==`#EXTM3U`)throw new n(`Not an M3U8 playlist`);return r.some(e=>e.startsWith(`#EXT-X-STREAM-INF`))?c(r,t):l(r,t)}function c(e,t){let a=[],o=[];for(let n=0;n<e.length;n++){let s=e[n];if(s.startsWith(`#EXT-X-STREAM-INF:`)){let o=r(s.slice(18)),c=``;for(;n+1<e.length;){let t=e[++n];if(t&&!t.startsWith(`#`)){c=t;break}}if(!c)continue;let l=o.RESOLUTION?.split(`x`).map(Number);a.push({uri:i(c,t),bandwidth:Number(o.BANDWIDTH)||0,averageBandwidth:o[`AVERAGE-BANDWIDTH`]?Number(o[`AVERAGE-BANDWIDTH`]):void 0,width:l?.[0]||void 0,height:l?.[1]||void 0,codecs:o.CODECS||void 0,frameRate:o[`FRAME-RATE`]?Number(o[`FRAME-RATE`]):void 0,name:o.NAME||void 0,audio:o.AUDIO||void 0})}else if(s.startsWith(`#EXT-X-MEDIA:`)){let e=r(s.slice(13));o.push({type:e.TYPE,groupId:e[`GROUP-ID`],name:e.NAME,language:e.LANGUAGE,uri:e.URI?i(e.URI,t):void 0,default:e.DEFAULT===`YES`,autoselect:e.AUTOSELECT===`YES`,channels:e.CHANNELS})}}if(!a.length)throw new n(`Master playlist without variants`);return{type:`master`,url:t,variants:a,media:o}}function l(e,t){let n={type:`media`,url:t,targetDuration:0,mediaSequence:0,discontinuitySequence:0,endList:!1,segments:[],totalDuration:0},s=0,c,l,u=0,d,f,p=!1,m=0,h=0;for(let g of e)if(g){if(g.startsWith(`#EXTINF:`)){let e=g.slice(8),t=e.indexOf(`,`);s=parseFloat(t===-1?e:e.slice(0,t)),c=t===-1?void 0:e.slice(t+1)||void 0}else if(g.startsWith(`#EXT-X-TARGETDURATION:`))n.targetDuration=parseFloat(g.slice(22));else if(g.startsWith(`#EXT-X-MEDIA-SEQUENCE:`))n.mediaSequence=parseInt(g.slice(22),10);else if(g.startsWith(`#EXT-X-DISCONTINUITY-SEQUENCE:`))n.discontinuitySequence=parseInt(g.slice(30),10),m=n.discontinuitySequence;else if(g===`#EXT-X-DISCONTINUITY`)p=!0;else if(g===`#EXT-X-ENDLIST`)n.endList=!0;else if(g.startsWith(`#EXT-X-PLAYLIST-TYPE:`))n.playlistType=g.slice(21);else if(g.startsWith(`#EXT-X-BYTERANGE:`))l=a(g.slice(17),u);else if(g.startsWith(`#EXT-X-KEY:`)){let e=r(g.slice(11));d=e.METHOD===`NONE`?void 0:{method:e.METHOD,uri:e.URI?i(e.URI,t):void 0,iv:e.IV?o(e.IV):void 0}}else if(g.startsWith(`#EXT-X-MAP:`)){let e=r(g.slice(11));f={uri:i(e.URI,t),byteRange:e.BYTERANGE?a(e.BYTERANGE,0):void 0,key:d}}else if(!g.startsWith(`#`)){p&&m++;let e={uri:i(g,t),duration:s,start:h,sn:n.mediaSequence+n.segments.length,cc:m,title:c,byteRange:l,key:d,map:f};n.segments.push(e),h+=s,l&&(u=l.offset+l.length),s=0,c=void 0,l=void 0,p=!1}}return n.totalDuration=h,!n.targetDuration&&n.segments.length&&(n.targetDuration=Math.ceil(Math.max(...n.segments.map(e=>e.duration)))),n}function u(e){let t=new Uint8Array(16),n=e;for(let e=15;e>=8&&n>0;e--)t[e]=n%256,n=Math.floor(n/256);return t}var d=new Map;function f(){return typeof crypto<`u`&&!!crypto.subtle}function p(e,t){let n=d.get(e);return n||(n=t(e).then(e=>{if(e.byteLength!==16)throw Error(`AES-128 key must be 16 bytes, got ${e.byteLength}`);return crypto.subtle.importKey(`raw`,e,{name:`AES-CBC`},!1,[`decrypt`])}),n.catch(()=>d.delete(e)),d.set(e,n)),n}async function m(e,t,n,r){if(!t.uri)throw Error(`EXT-X-KEY without URI`);let i=await p(t.uri,r),a=t.iv??u(n);return crypto.subtle.decrypt({name:`AES-CBC`,iv:a},i,e)}function h(e,t){return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]}function g(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function _(e,t=0,n=e.length){let r=[],i=t;for(;i+8<=n;){let t=h(e,i),a=g(e,i+4),o=8;if(t===1?(t=h(e,i+8)*4294967296+h(e,i+12),o=16):t===0&&(t=n-i),t<o||i+t>n)break;r.push({type:a,start:i,data:i+o,end:i+t}),i+=t}return r}function v(e,t,n=0,r=e.length){if(!t.length)return[];let[i,...a]=t,o=_(e,n,r).filter(e=>e.type===i);return a.length?o.flatMap(t=>v(e,a,t.data,t.end)):o}var ee=[`ftyp`,`styp`,`moof`,`sidx`,`moov`,`emsg`,`prft`,`free`];function y(e){return e.length>=8&&ee.includes(g(e,4))}function b(e){return e.length<188||e[0]!==71?!1:e.length<376||e[188]===71}function x(e){return e.toString(16).padStart(2,`0`)}function S(e,t){let n=e[t],r=0,i=t+1;for(let t=0;t<4;t++){let t=e[i++];if(r=r<<7|t&127,!(t&128))break}return{tag:n,data:i,end:i+r}}function te(e,t,n){let r=S(e,t);if(r.tag!==3||r.end>n)return;let i=e[r.data+2],a=r.data+3;i&128&&(a+=2),i&64&&(a+=e[a]+1),i&32&&(a+=2);let o=S(e,a);if(o.tag!==4||e[o.data]!==64)return;let s=S(e,o.data+13);if(s.tag!==5)return;let c=e[s.data]>>3;return c>0&&c<31?c:void 0}function ne(e,t){let n=t.type;if(n===`avc1`||n===`avc3`){let r=_(e,t.data+78,t.end).find(e=>e.type===`avcC`);return r?`${n}.${x(e[r.data+1])}${x(e[r.data+2])}${x(e[r.data+3])}`:`${n}.42e01e`}if(n===`mp4a`){let n=_(e,t.data+28,t.end).find(e=>e.type===`esds`),r=n?te(e,n.data+4,n.end):void 0;return r?`mp4a.40.${r}`:`mp4a.40.2`}if(n===`hvc1`||n===`hev1`)return`${n}.1.6.L93.B0`;if(n===`Opus`)return`opus`;if(n===`fLaC`)return`flac`;if(n===`vp09`)return`vp09.00.10.08`;if(n===`av01`)return`av01.0.04M.08`;if(n===`ac-3`)return`ac-3`;if(n===`ec-3`)return`ec-3`}function C(e){return v(e,[`moov`,`trak`]).map(t=>{let n=v(e,[`tkhd`],t.data,t.end)[0],r=v(e,[`mdia`,`mdhd`],t.data,t.end)[0],i=v(e,[`mdia`,`hdlr`],t.data,t.end)[0],a=v(e,[`mdia`,`minf`,`stbl`,`stsd`],t.data,t.end)[0],o=n?h(e,n.data+(e[n.data]===1?20:12)):0,s=r?h(e,r.data+(e[r.data]===1?20:12)):9e4,c=i?g(e,i.data+8):``,l=a?_(e,a.data+8,a.end)[0]:void 0;return{id:o,timescale:s,kind:c===`vide`?`video`:c===`soun`?`audio`:`other`,codec:l?ne(e,l):void 0}})}function w(e,t){let n=null;for(let r of v(e,[`moof`,`traf`])){let i=v(e,[`tfhd`],r.data,r.end)[0],a=v(e,[`tfdt`],r.data,r.end)[0];if(!i||!a)continue;let o=h(e,i.data+4),s=t.find(e=>e.id===o)?.timescale??9e4,c=(e[a.data]===1?h(e,a.data+4)*4294967296+h(e,a.data+8):h(e,a.data+4))/s;(n===null||c<n)&&(n=c)}return n}var T=class extends Error{constructor(e,t){super(e),this.code=t,this.name=`TransmuxError`}},re=`com.apple.streaming.transportStreamTimestamp`;function E(e,t){return(e[t]&127)<<21|(e[t+1]&127)<<14|(e[t+2]&127)<<7|e[t+3]&127}function D(e,t){return e.length>=t+10&&e[t]===73&&e[t+1]===68&&e[t+2]===51&&e[t+3]<255&&e[t+4]<255}function ie(e,t=0){return e.length>t+1&&e[t]===255&&(e[t+1]&246)==240}function O(e){return D(e,0)||ie(e,0)}function k(e){let t=0,n;for(;D(e,t);){let r=e[t+3],i=E(e,t+6),a=t+10+i,o=t+10;for(;o+10<=a;){let t=String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3]),i=r>=4?E(e,o+4):(e[o+4]<<24>>>0)+(e[o+5]<<16)+(e[o+6]<<8)+e[o+7];if(!t.trim()||i<=0)break;let a=o+10;if(t===`PRIV`){let t=a;for(;t<a+i&&e[t]!==0;)t++;if(String.fromCharCode(...e.subarray(a,t))===re&&t+9<=a+i){let r=t+1;n=(e[r+3]&1)*4294967296+(e[r+4]<<24>>>0)+(e[r+5]<<16)+(e[r+6]<<8)+e[r+7]}}o=a+i}t=a}return{pts:n,data:e.subarray(t)}}var ae=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function oe(e){let t=[],n,r=0;for(;r+7<=e.length;){if(e[r]!==255||(e[r+1]&246)!=240){r++;continue}let i=e[r+1]&1?7:9,a=(e[r+3]&3)<<11|e[r+4]<<3|e[r+5]>>5;if(a<i){r++;continue}if(r+a>e.length)break;if(!n){let t=e[r+2]>>2&15;n={objectType:(e[r+2]>>6)+1,rateIndex:t,sampleRate:ae[t]??44100,channels:(e[r+2]&1)<<2|e[r+3]>>6}}t.push(e.subarray(r+i,r+a)),r+=a}return{config:n,frames:t,rest:e.subarray(r)}}function se(e){return new Uint8Array([e.objectType<<3|e.rateIndex>>1,(e.rateIndex&1)<<7|e.channels<<3])}var ce=[3,4],le=[129,135];function A(e,t){return(e[t]&14)*536870912+e[t+1]*4194304+(e[t+2]&254)*16384+e[t+3]*128+(e[t+4]&254)/2}function ue(e){if(e.length<9||e[0]!==0||e[1]!==0||e[2]!==1)return null;let t=e[7],n=e[8],r,i;t&128&&(r=A(e,9),i=(t&192)==192?A(e,14):r);let a=9+n;return a>e.length?null:{pts:r,dts:i,data:e.subarray(a)}}function de(e){if(e.length===1)return e[0];let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function fe(e,t){let n=(e[t+1]&15)<<8|e[t+2],r=Math.min(e.length,t+3+n-4);for(let n=t+8;n+4<=r;n+=4)if(e[n]<<8|e[n+1])return(e[n+2]&31)<<8|e[n+3]}function pe(e,t,n){let r=(e[t+1]&15)<<8|e[t+2],i=Math.min(e.length,t+3+r-4),a=(e[t+10]&15)<<8|e[t+11],o=t+12+a;for(;o+5<=i;){let t=e[o],r=(e[o+1]&31)<<8|e[o+2],i=(e[o+3]&15)<<8|e[o+4],a=t===27||t===36,s=t===15||ce.includes(t)||le.includes(t);a&&n.videoPid===void 0?(n.videoPid=r,n.videoType=t):s&&n.audioPid===void 0&&(n.audioPid=r,n.audioType=t),o+=5+i}}function me(e,t={}){let n={...t},r=new Map,i=[],a=[],o=!1,s=e=>{let t=r.get(e);if(r.delete(e),!t?.length)return;let o=ue(de(t));o&&(e===n.videoPid?i.push(o):e===n.audioPid&&a.push(o))},c=0;for(;c<e.length&&e[c]!==71;)c++;for(let t=c;t+188<=e.length;t+=188){if(e[t]!==71)continue;let i=(e[t+1]&64)!=0,a=(e[t+1]&31)<<8|e[t+2],c=(e[t+3]&48)>>4,l=t+4;if(c===2||(c===3&&(l+=e[l]+1),l>=t+188))continue;if(a===0){i&&(l+=e[l]+1),n.pmtPid=fe(e,l);continue}if(a===n.pmtPid){o||=(i&&(l+=e[l]+1),n.videoPid=n.audioPid=n.videoType=n.audioType=void 0,pe(e,l,n),!0);continue}if(a!==n.videoPid&&a!==n.audioPid)continue;i&&s(a);let u=r.get(a);if(!u){if(!i)continue;u=[],r.set(a,u)}u.push(e.subarray(l,t+188))}for(let e of Array.from(r.keys()))s(e);return{...n,video:i,audio:a}}function he(e){let t=[],n=-1,r=0,i=e.length;for(;r+2<i;)e[r+2]>1?r+=3:e[r]===0&&e[r+1]===0&&e[r+2]===1?(n>=0&&t.push(ge(e.subarray(n,r))),r+=3,n=r):r++;return n>=0&&n<i&&t.push(e.subarray(n)),t.filter(e=>e.length>0)}function ge(e){let t=e.length;for(;t>0&&e[t-1]===0;)t--;return e.subarray(0,t)}function _e(e){return e[0]&31}function ve(e){let t=new Uint8Array(e.length),n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];if(r>=2&&a===3){r=0;continue}t[n++]=a,r=a===0?r+1:0}return t.subarray(0,n)}var ye=class{constructor(e){this.d=e,this.pos=0}bit(){let e=(this.d[this.pos>>3]??0)>>7-(this.pos&7)&1;return this.pos++,e}bits(e){let t=0;for(let n=0;n<e;n++)t=t*2+this.bit();return t}ue(){let e=0;for(;this.bit()===0&&e<32;)e++;return 2**e-1+this.bits(e)}se(){let e=this.ue();return e&1?(e+1)/2:-e/2}},be=[100,110,122,244,44,83,86,118,128,138,139,134,135];function xe(e,t){let n=8,r=8;for(let i=0;i<t;i++)r!==0&&(r=(n+e.se()+256)%256),n=r===0?n:r}function Se(e){let t=new ye(ve(e.subarray(1))),n=t.bits(8),r=t.bits(8),i=t.bits(8);t.ue();let a=1,o=1;if(be.includes(n)&&(a=t.ue(),a===3&&t.bit(),t.ue(),t.ue(),t.bit(),t.bit()))for(let e=0;e<(a===3?12:8);e++)t.bit()&&xe(t,e<6?16:64);t.ue();let s=t.ue();if(s===0)t.ue();else if(s===1){t.bit(),t.se(),t.se();let e=t.ue();for(let n=0;n<e;n++)t.se()}t.ue(),t.bit();let c=t.ue()+1,l=t.ue()+1;o=t.bit(),o||t.bit(),t.bit();let u=0,d=0,f=0,p=0;t.bit()&&(u=t.ue(),d=t.ue(),f=t.ue(),p=t.ue());let m=a===1||a===2?2:1,h=a===1?2:1,g=a===0?1:m,_=(a===0?1:h)*(2-o);return{profile:n,compatibility:r,level:i,width:c*16-(u+d)*g,height:(2-o)*l*16-(f+p)*_}}function Ce(e){let t=e=>e.toString(16).padStart(2,`0`);return`avc1.${t(e[1])}${t(e[2])}${t(e[3])}`}function we(e){let t=0;for(let n of e)t+=4+n.length;let n=new Uint8Array(t),r=0;for(let t of e){let e=t.length;n[r]=e>>>24&255,n[r+1]=e>>>16&255,n[r+2]=e>>>8&255,n[r+3]=e&255,n.set(t,r+4),r+=4+e}return n}function j(e){return[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]}function M(e){return[e>>>24&255,e>>>16&255,e>>>8&255,e&255]}function N(e){return[e>>>8&255,e&255]}function Te(e){let t=Math.floor(e/4294967296);return[...M(t),...M(e-t*4294967296)]}function P(e,...t){let n=8;for(let e of t)n+=e.length;let r=new Uint8Array(n);r.set(M(n),0),r.set(j(e),4);let i=8;for(let e of t)r.set(e,i),i+=e.length;return r}function F(e,t){return[e,t>>16&255,t>>8&255,t&255]}var I=[...M(65536),...M(0),...M(0),...M(0),...M(65536),...M(0),...M(0),...M(0),...M(1073741824)];function L(e){return Array(e).fill(0)}function Ee(e,t){return P(`mvhd`,F(0,0),M(0),M(0),M(e),M(0),M(65536),N(256),L(10),I,L(24),M(t))}function De(e){let t=e.kind===`video`?e.width:0,n=e.kind===`video`?e.height:0;return P(`tkhd`,F(0,3),M(0),M(0),M(e.id),M(0),M(0),L(8),N(0),N(0),N(e.kind===`audio`?256:0),N(0),I,M(t*65536),M(n*65536))}function Oe(e){return P(`mdhd`,F(0,0),M(0),M(0),M(e),M(0),N(21956),N(0))}function ke(e){let t=e===`video`?`VideoHandler`:`SoundHandler`;return P(`hdlr`,F(0,0),M(0),j(e===`video`?`vide`:`soun`),L(12),[...Array.from(t,e=>e.charCodeAt(0)),0])}function Ae(e){let t=P(`avcC`,[1,e.sps[1],e.sps[2],e.sps[3],255,225],N(e.sps.length),e.sps,[1],N(e.pps.length),e.pps);return P(`avc1`,L(6),N(1),N(0),N(0),L(12),N(e.width),N(e.height),M(4718592),M(4718592),M(0),N(1),L(32),N(24),N(65535),t)}function R(e){return[128|e>>21&127,128|e>>14&127,128|e>>7&127,e&127]}function je(e){let t=[5,...R(e.config.length),...e.config],n=[4,...R(13+t.length),64,21,0,0,0,...M(0),...M(0),...t],r=[6,...R(1),2],i=[3,...R(3+n.length+r.length),...N(e.id),0,...n,...r],a=P(`esds`,F(0,0),i);return P(`mp4a`,L(6),N(1),L(8),N(e.channels),N(16),N(0),N(0),M(Math.min(e.sampleRate,65535)*65536),a)}function Me(e){let t=e.kind===`video`?Ae(e):je(e);return P(`stbl`,P(`stsd`,F(0,0),M(1),t),P(`stts`,F(0,0),M(0)),P(`stsc`,F(0,0),M(0)),P(`stsz`,F(0,0),M(0),M(0)),P(`stco`,F(0,0),M(0)))}function Ne(e){let t=e.kind===`video`?P(`vmhd`,F(0,1),L(8)):P(`smhd`,F(0,0),L(4)),n=P(`dinf`,P(`dref`,F(0,0),M(1),P(`url `,F(0,1))));return P(`trak`,De(e),P(`mdia`,Oe(e.timescale),ke(e.kind),P(`minf`,t,n,Me(e))))}function Pe(e){let t=P(`ftyp`,j(`isom`),M(1),j(`isom`),j(`iso5`),j(`avc1`),j(`mp41`)),n=e.map(e=>P(`trex`,F(0,0),M(e.id),M(1),M(0),M(0),M(65537)));return B([t,P(`moov`,Ee(1e3,e.length+1),...e.map(Ne),P(`mvex`,...n))])}function z(e,t,n,r,i){let a=[];for(let e of r)a.push(...M(e.duration),...M(e.size),...M(e.key?33554432:16842752),...M(e.cts|0));let o=P(`trun`,F(1,3841),M(r.length),M(0),a),s=P(`traf`,P(`tfhd`,F(0,131072),M(t)),P(`tfdt`,F(1,0),Te(Math.max(0,Math.round(n)))),o),c=P(`moof`,P(`mfhd`,F(0,0),M(e)),s);return c.set(M(c.length+8),84),B([c,P(`mdat`,i)])}function B(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var V=1,H=2,U=8589934592,W=1024;function Fe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}var G=class{constructor(){this.demux={},this.initKey=``,this.seq=1,this.ref=null,this.nextVideoDts=null,this.nextAudioDts=null,this.videoDuration=3e3}canHandle(e){return b(e)||O(e)}reset(){this.demux={},this.initKey=``,this.ref=null,this.nextVideoDts=null,this.nextAudioDts=null}unwrap(e){for(this.ref===null&&(this.ref=e);e-this.ref>U/2;)e-=U;for(;this.ref-e>U/2;)e+=U;return this.ref=e,e}push(e,t){if(t.discontinuity&&(this.ref=null,this.nextVideoDts=null,this.nextAudioDts=null),!b(e))return this.pushPacked(e);let n=me(e,this.demux);if(this.demux=n,n.videoType!==void 0&&n.videoType!==27)throw new T(`Unsupported video stream type 0x${n.videoType.toString(16)}`,`codec`);if(n.audioType!==void 0&&n.audioType!==15)throw new T(`Unsupported audio stream type 0x${n.audioType.toString(16)}`,`codec`);if(n.videoPid===void 0&&n.audioPid===void 0)throw new T(`No program map in the transport stream`,`format`);let r=n.video.length?this.videoSamples(n.video):null,i=n.audio.length?this.audioSamples(n.audio):null;return this.output(r,i)}pushPacked(e){let t=k(e);if(t.pts===void 0&&this.nextAudioDts===null)throw new T(`Packed audio segment without an ID3 timestamp`,`format`);let n=t.pts??Math.round(this.nextAudioDts*9e4/(this.audio?.sampleRate??9e4)),r=this.audioSamples([{pts:n,dts:n,data:t.data}]);if(!r)throw new T(`No AAC frames in the packed audio segment`,`format`);return this.output(null,r)}output(e,t){let n=[],r=[],i=[];if(this.video&&(n.push({id:V,kind:`video`,timescale:9e4,...this.video}),r.push({id:V,kind:`video`,timescale:9e4,codec:this.video.codec}),i.push(this.video.codec)),this.audio){let e=se(this.audio);n.push({id:H,kind:`audio`,timescale:this.audio.sampleRate,channels:this.audio.channels,sampleRate:this.audio.sampleRate,config:e}),r.push({id:H,kind:`audio`,timescale:this.audio.sampleRate,codec:`mp4a.40.${this.audio.objectType}`}),i.push(`mp4a.40.${this.audio.objectType}`)}if(!n.length)throw new T(`No decodable samples in the segment`,`format`);let a=i.join(`,`)+(this.video?`|${this.video.width}x${this.video.height}|${this.video.sps.join(`.`)}`:``),o;a!==this.initKey&&(o=Pe(n),this.initKey=a);let s=[],c=[];return e&&this.video&&(s.push(z(this.seq++,V,e.base,e.samples,e.payload)),c.push(e.base/9e4)),t&&this.audio&&(s.push(z(this.seq++,H,t.base,t.samples,t.payload)),c.push(t.base/this.audio.sampleRate)),{init:o,data:B(s),mimeType:`${this.video?`video`:`audio`}/mp4; codecs="${i.join(`,`)}"`,tracks:r,startTime:c.length?Math.min(...c):0}}videoSamples(e){let t=[],n=null;for(let r of e){let e=he(r.data),i=[],a=!1;for(let t of e){let e=_e(t);if(e===7){let e=Se(t);(!this.video||!Fe(this.video.sps,t))&&(this.video={sps:t.slice(),pps:this.video?.pps??new Uint8Array,width:e.width,height:e.height,codec:Ce(t)})}else e===8?this.video&&(this.video.pps=t.slice()):e!==9&&(e===5&&(a=!0),i.push(t))}if(!i.length)continue;let o=r.dts===void 0?n===null?null:n+this.videoDuration:this.unwrap(r.dts);if(o===null)continue;let s=r.pts===void 0?o:this.unwrap(r.pts);t.push({dts:o,pts:s,key:a,data:we(i)}),n=o}if(!t.length||!this.video?.pps.length)return null;if(this.nextVideoDts!==null){let e=t[0].dts-this.nextVideoDts;Math.abs(e)<this.videoDuration*1.5&&e!==0&&(t[0].pts-=e,t[0].dts-=e)}let r=[];for(let e=0;e<t.length;e++){let n=t[e],i=e+1<t.length?t[e+1].dts-n.dts:this.videoDuration;i<=0?i=this.videoDuration:e+1<t.length&&(this.videoDuration=i),r.push({size:n.data.length,duration:i,cts:Math.max(0,n.pts-n.dts),key:n.key})}let i=t[t.length-1];return this.nextVideoDts=i.dts+r[r.length-1].duration,{base:t[0].dts,samples:r,payload:B(t.map(e=>e.data))}}audioSamples(e){let t=[],n=null,r=new Uint8Array;for(let i of e){let e=oe(r.length?B([r,i.data]):i.data);(e.config&&!this.audio||e.config&&this.audio&&(e.config.sampleRate!==this.audio.sampleRate||e.config.channels!==this.audio.channels))&&(this.audio=e.config),n===null&&i.pts!==void 0&&(n=this.unwrap(i.pts)),t.push(...e.frames),r=e.rest}if(!t.length||!this.audio||n===null)return null;let i=this.audio.sampleRate,a=Math.round(n*i/9e4);this.nextAudioDts!==null&&Math.abs(a-this.nextAudioDts)<W*2&&(a=this.nextAudioDts),this.nextAudioDts=a+t.length*W;let o=t.map(e=>({size:e.length,duration:W,cts:0,key:!0}));return{base:a,samples:o,payload:B(t)}}};function K(){return new G}var q=class extends Error{constructor(e,t){super(t),this.code=e,this.name=`HlsError`}};function J(){if(typeof window>`u`)return;let e=window;return e.MediaSource??e.ManagedMediaSource}function Y(e){return!!e.canPlayType(`application/vnd.apple.mpegurl`)||!!e.canPlayType(`application/x-mpegURL`)}function Ie(e){return!!J()||!!e&&Y(e)}function Le(e){return e.height?`${e.height}p`:e.name?e.name:`${Math.round(e.bandwidth/1e3)} kbps`}var Re=e=>e>=500||e===429||e===0;function ze(e,t){return new Promise((n,r)=>{let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(new DOMException(`Aborted`,`AbortError`))},{once:!0})})}function X(e){let t=[];if(!e)return t;for(let n=0;n<e.length;n++)t.push([e.start(n),e.end(n)]);return t}function Be(e,t){let n=t;for(let[t,r]of e)t-.3<=n&&r>n&&(n=r);return n}function Z(e){return e?.name===`AbortError`}function Q(e,t){if(!e.length)return-1;let n=e=>(e??``).toLowerCase(),r=(e,t)=>!!t&&(n(e)===t||n(e).startsWith(`${t}-`)||t.startsWith(`${n(e)}-`));if(t){let i=e.findIndex(e=>r(e.language,n(t)));if(i>=0)return i}let i=e.findIndex(e=>e.default);if(i>=0)return i;let a=typeof navigator<`u`?n(navigator.language):``,o=e.findIndex(e=>e.autoselect&&r(e.language,a));return o>=0?o:0}var Ve=class{constructor(e,t,n){this.engine=e,this.kind=t,this.sb=null,this.ended=!1,this.mime=``,this.queue=[],this.running=null,this.loading=!1,this.segmentAbort=null,this.last=null,this.appendedInit=``,this.tracks=[],this.transmuxer=null,this.reloadTimer=null,this.onUpdateEnd=()=>{let e=this.running;this.running=null,e?.resolve(),this.pump(),this.engine.maybeEndOfStream()},this.onBufferError=()=>{let e=this.running;this.running=null,e?.reject(new q(`codec`,`SourceBuffer error`))},this.source=n}get idle(){return!this.loading&&!this.running&&!this.queue.length&&!this.sb?.updating}buffered(){try{return X(this.sb?.buffered)}catch{return[]}}bufferedEnd(e){return Be(this.buffered(),e)}loadPlaylist(e=this.source,t=!1){return e.playlist&&!t?Promise.resolve(e.playlist):(e.loading||=this.engine.fetchText(e.uri).then(t=>{let r=s(t,e.uri);if(r.type!==`media`)throw new n(`Expected a media playlist`);let i=e.playlist??this.source.playlist;return i&&i!==r&&$(i,r),e.playlist=r,r}).finally(()=>{e.loading=void 0}),e.loading)}scheduleReload(e){this.engine.destroyed||(this.reloadTimer&&clearTimeout(this.reloadTimer),this.reloadTimer=setTimeout(async()=>{try{let e=this.source.playlist,t=await this.loadPlaylist(this.source,!0),n=e=>e?.segments[e.segments.length-1]?.sn;if(t.endList){this.kind===`main`&&(this.engine.live=!1);return}this.kind===`main`&&this.engine.updateSeekable(t),this.scheduleReload(n(e)===n(t)?t.targetDuration/2:t.targetDuration),this.tick()}catch(e){this.engine.fail(e)}},Math.max(1,e)*1e3))}switchSource(e,t){let n=this.source.playlist;if(this.source=e,this.segmentAbort?.abort(),this.last=null,this.ended=!1,t!==`none`&&this.sb){let e=this.engine.media.currentTime,n=t===`all`?0:e+1;(t===`all`||this.bufferedEnd(e)>n)&&this.enqueue({kind:`remove`,start:n,end:1/0}).catch(()=>{})}this.loadPlaylist(e).then(t=>{n&&n!==t&&this.kind===`audio`&&!e.playlist?.endList&&$(n,t),this.engine.live&&this.scheduleReload(t.targetDuration),this.tick()},e=>this.engine.fail(e))}ensureBuffer(e){let t=this.engine.ms;if(t){if(!this.sb){try{this.sb=t.addSourceBuffer(e)}catch(t){throw new q(`codec`,`${e}: ${t.message}`)}this.mime=e,this.sb.addEventListener(`updateend`,this.onUpdateEnd),this.sb.addEventListener(`error`,this.onBufferError),this.engine.bufferCreated();return}e!==this.mime&&(this.mime=e,typeof this.sb.changeType==`function`&&this.enqueue({kind:`changeType`,mime:e}).catch(()=>{}))}}enqueue(e){return new Promise((t,n)=>{this.queue.push({op:e,resolve:t,reject:n}),this.pump()})}async append(e){await this.engine.buffersReady(),await this.enqueue({kind:`append`,data:e})}pump(){let e=this.sb,t=this.engine.ms;if(!(!e||!t||this.running||e.updating))for(;this.queue.length;){let t=this.queue.shift(),{op:n}=t;try{if(n.kind===`append`){this.running=t,e.appendBuffer(n.data);return}if(n.kind===`remove`){if(this.buffered().some(([,e])=>e>n.start)){this.running=t,e.remove(n.start,n.end);return}t.resolve()}else n.kind===`offset`?(e.timestampOffset=n.value,t.resolve()):n.kind===`changeType`&&(e.changeType(n.mime),t.resolve())}catch(e){if(this.running=null,e?.name===`QuotaExceededError`&&n.kind===`append`){let e=this.engine.media.currentTime-5;if(e>0){this.queue.unshift({op:{kind:`remove`,start:0,end:e},resolve:()=>{},reject:()=>{}},t);continue}}t.reject(e)}}}onSeeking(e){this.bufferedEnd(e)-e>.1||(this.segmentAbort?.abort(),this.last=null,this.ended=!1)}nextSegment(e){let t=e.segments;if(!t.length)return;let n=this.last;if(n&&n.source===this.source.id){let e=t.find(e=>e.sn===n.sn+1);if(e)return e;if(t[t.length-1].sn<=n.sn)return}if(this.engine.live&&!this.engine.startPositioned&&!n&&this.kind===`main`)return t[Math.max(0,t.length-3)];let r=this.bufferedEnd(this.engine.targetTime());return r<t[0].start?t[0]:t.find(e=>r>=e.start-.05&&r<e.start+e.duration-.05)}tick(){let e=this.engine;if(e.destroyed||e.failed||this.loading||!e.ms||this.kind===`audio`&&e.live&&!e.startPositioned)return;let t=this.source.playlist;if(!t)return;let n=e.media.currentTime;if(this.evict(n),this.bufferedEnd(n)-n>=e.opts.maxBufferAhead)return;let r=this.nextSegment(t);if(!r){t.endList&&this.last&&(this.ended=!0),e.maybeEndOfStream();return}this.ended=!1,this.loading=!0;let i=this.source.id;this.loadSegment(r,i).catch(t=>{Z(t)||e.fail(t)}).finally(()=>{this.loading=!1,e.destroyed||setTimeout(()=>this.tick(),0)})}evict(e){let t=this.buffered();if(!t.length||!this.sb||this.queue.some(e=>e.op.kind===`remove`))return;let n=e-this.engine.opts.maxBufferBehind;t[0][0]<n-1&&this.enqueue({kind:`remove`,start:0,end:n}).catch(()=>{})}async loadInit(e,t){let n=`${this.source.id}|${e.uri}|${e.byteRange?.offset??``}`;if(n===this.appendedInit)return;let{data:r}=await this.engine.fetchBytes(e.uri,e.byteRange,t);e.key?.method===`AES-128`&&!y(r)&&(r=new Uint8Array(await m(r.slice().buffer,e.key,0,this.engine.loadKey))),this.tracks=C(r);let i=this.tracks.map(e=>e.codec).filter(Boolean).join(`,`)||this.source.codecs||``,a=this.tracks.some(e=>e.kind===`video`)?`video`:this.tracks.length||this.kind===`audio`?`audio`:`video`;this.ensureBuffer(`${a}/mp4; codecs="${i}"`),await this.append(r),this.appendedInit=n}async loadSegment(e,t){let n=this.engine,r=new AbortController;this.segmentAbort=r;let i=()=>r.abort();n.abort.signal.addEventListener(`abort`,i,{once:!0});try{if(e.key&&e.key.method!==`AES-128`)throw new q(`encrypted`,`${e.key.method} encryption is not supported`);if(e.key&&!f())throw new q(`encrypted`,`WebCrypto is not available`);e.map&&await this.loadInit(e.map,r.signal);let{data:i,ms:a}=await n.fetchBytes(e.uri,e.byteRange,r.signal);this.kind===`main`&&n.est.sample({bytes:i.length,ms:a});let o=i;if(e.key&&(o=new Uint8Array(await m(i.slice().buffer,e.key,e.sn,n.loadKey))),r.signal.aborted)return;let s=!!this.last&&this.last.source===t&&this.last.sn+1===e.sn&&this.last.cc===e.cc,c;if(b(o)||!y(o)&&O(o)){if(n.opts.transmuxer===null)throw new q(`codec`,`MPEG-TS segments need a transmuxer`);if(this.transmuxer??=(n.opts.transmuxer??K)(),!this.transmuxer.canHandle(o))throw new q(`codec`,`The transmuxer cannot read this segment`);let e=this.transmuxer.push(o,{discontinuity:!s});e.init&&(this.ensureBuffer(e.mimeType),await this.append(e.init),this.appendedInit=``),this.tracks=e.tracks,o=e.data,c=e.startTime}else if(y(o)){if(!this.sb)throw new q(`codec`,`fMP4 segment without an initialization section`);c=w(o,this.tracks)}else throw new q(`codec`,`Unknown segment container`);if(c!==null){let t=n.offsetFor(e,c);this.sb&&Math.abs(this.sb.timestampOffset-t)>.001&&await this.enqueue({kind:`offset`,value:t});let r=c+t-e.start;if(this.kind===`audio`&&Math.abs(r)>Math.max(.5,e.duration/2)&&this.source.playlist)for(let e of this.source.playlist.segments)e.start+=r}if(r.signal.aborted)return;await this.append(o),this.last={source:t,sn:e.sn,cc:e.cc},this.kind===`main`&&!n.startPositioned&&(n.startPositioned=!0,n.live&&(n.media.currentTime=e.start+.01,n.updateSeekable(this.source.playlist)),n.tickAll()),this.kind===`main`&&n.afterMainSegment()}finally{n.abort.signal.removeEventListener(`abort`,i),this.segmentAbort===r&&(this.segmentAbort=null)}}destroy(){this.segmentAbort?.abort(),this.reloadTimer&&clearTimeout(this.reloadTimer);for(let e of this.queue)e.reject(new DOMException(`Aborted`,`AbortError`));this.queue=[],this.sb=null}stopTimers(){this.reloadTimer&&clearTimeout(this.reloadTimer)}},He=class{constructor(t,n,r){this.media=t,this.url=n,this.native=!1,this.live=!1,this.levels=[],this.level=-1,this.autoLevel=!0,this.audioTracks=[],this.audioTrack=-1,this.abort=new AbortController,this.ms=null,this.destroyed=!1,this.failed=!1,this.startPositioned=!1,this.all=[],this.renditions=[],this.audioSources=[],this.streams=[],this.main=null,this.audio=null,this.objectUrl=``,this.offsets=new Map,this.timer=null,this.created=0,this.readyWaiters=[],this.stallPos=-1,this.stallSince=0,this.loadKey=async e=>{let{data:t}=await this.fetchBytes(e,void 0,this.abort.signal);return t.slice().buffer},this.onSeeking=()=>{let e=this.media.currentTime;for(let t of this.streams)t.onSeeking(e);setTimeout(()=>this.tickAll(),0)},this.opts={maxBufferAhead:30,maxBufferBehind:30,retries:3,...r},this.est=new e(r.initialBandwidth??1e6),this.fetchFn=r.fetch??((...e)=>fetch(...e)),this.media.addEventListener(`seeking`,this.onSeeking),this.start().catch(e=>this.fail(e))}get bandwidth(){return this.est.estimate}async start(){let e=J();if(!e)throw new q(`mse`,`MediaSource is not available`);let t=s(await this.fetchText(this.url),this.url);if(t.type===`master`){let n=t=>e.isTypeSupported(`video/mp4; codecs="${t}"`)||e.isTypeSupported(`audio/mp4; codecs="${t}"`),r=t.variants.filter(e=>!e.codecs||n(e.codecs)).sort((e,t)=>e.bandwidth-t.bandwidth);if(!r.length)throw new q(`codec`,`No variant has codecs this browser supports`);this.all=r.map((e,t)=>({id:t,uri:e.uri,codecs:e.codecs,variant:e,info:{index:t,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:e.codecs,label:Le(e)}})),this.renditions=t.media.filter(e=>e.type===`AUDIO`)}else{let e={uri:this.url,bandwidth:0};this.all=[{id:0,uri:this.url,variant:e,playlist:t,info:{index:0,bandwidth:0,label:`auto`}}]}this.levels=this.all.map(e=>e.info),this.opts.onLevels?.(this.levels);let n=this.opts.startLevel??-1;this.autoLevel=n<0,this.level=n>=0&&n<this.all.length?n:this.pickLevel(),this.buildAudioTracks(this.all[this.level].variant.audio);let r=new e;this.ms=r,`disableRemotePlayback`in this.media&&window.ManagedMediaSource===e&&(this.media.disableRemotePlayback=!0),this.objectUrl=URL.createObjectURL(r);let i=new Promise(e=>r.addEventListener(`sourceopen`,()=>e(),{once:!0}));if(this.media.src=this.objectUrl,await i,this.destroyed)return;this.main=new Ve(this,`main`,this.all[this.level]),this.streams=[this.main];let a=this.audioSources[this.audioTrack];a&&(this.audio=new Ve(this,`audio`,a),this.streams.push(this.audio));let[o]=await Promise.all(this.streams.map(e=>e.loadPlaylist()));if(this.live=!o.endList,this.live||(r.duration=o.totalDuration),this.opts.onLevelSwitched?.(this.level),this.audio&&this.opts.onAudioTrackSwitched?.(this.audioTrack),this.live)for(let e of this.streams)e.scheduleReload(e.source.playlist.targetDuration);this.timer=setInterval(()=>this.tickAll(),250),this.tickAll()}buildAudioTracks(e){let t=e?this.renditions.filter(t=>t.groupId===e&&t.uri):[];this.audioSources=t.map((e,t)=>({id:1e3+t,uri:e.uri,rendition:e,info:{index:t,label:e.name||e.language||`#${t+1}`,language:e.language,default:!!e.default}})),this.audioTracks=this.audioSources.map(e=>e.info);let n=this.audioTrack>=0?this.audioSources[this.audioTrack]?.rendition.language??this.opts.audioLanguage:this.opts.audioLanguage;this.audioTrack=Q(t,n),this.opts.onAudioTracks?.(this.audioTracks)}destroy(){if(!this.destroyed){this.destroyed=!0,this.abort.abort(),this.timer&&clearInterval(this.timer),this.media.removeEventListener(`seeking`,this.onSeeking);for(let e of this.streams)e.destroy();this.objectUrl&&(this.media.removeAttribute(`src`),this.media.load(),URL.revokeObjectURL(this.objectUrl)),this.ms=null}}fail(e){if(this.destroyed||Z(e)||this.failed)return;this.failed=!0;let t;t=e instanceof q?e:e instanceof n?new q(`manifest`,e.message):e instanceof T||e?.name===`NotSupportedError`?new q(`codec`,e.message):new q(`network`,e?.message??String(e)),this.timer&&clearInterval(this.timer);for(let e of this.streams)e.stopTimers();this.opts.onError?.(t)}bufferCreated(){this.created++,this.created>=this.streams.length&&this.readyWaiters.splice(0).forEach(e=>e())}buffersReady(){return this.created>=this.streams.length?Promise.resolve():new Promise(e=>this.readyWaiters.push(e))}offsetFor(e,t){let n=this.offsets.get(e.cc);return n===void 0&&(n=e.start-t,this.offsets.set(e.cc,n)),n}targetTime(){return this.media.currentTime}tickAll(){if(!(this.destroyed||this.failed)){this.jumpGap(this.media.currentTime);for(let e of this.streams)e.tick()}}maybeEndOfStream(){let e=this.ms;if(!(!e||e.readyState!==`open`||this.live)&&this.streams.length&&this.streams.every(e=>e.ended&&e.idle))try{e.endOfStream()}catch{}}async request(e,t,n){let r={};t&&(r.Range=`bytes=${t.offset}-${t.offset+t.length-1}`);let i=0;for(;;){try{let t=await this.fetchFn(e,{headers:r,signal:n});if(t.ok)return t;if(!Re(t.status)||i>=this.opts.retries)throw new q(`network`,`HTTP ${t.status} for ${e}`)}catch(e){if(Z(e)||e instanceof q||i>=this.opts.retries)throw e}await ze(500*2**i,n),i++}}async fetchText(e){return(await this.request(e,void 0,this.abort.signal)).text()}async fetchBytes(e,t,n){let r=performance.now(),i=await this.request(e,t,n),a=await i.arrayBuffer(),o=new Uint8Array(a);return t&&i.status===200&&o.length>t.length&&(o=o.subarray(t.offset,t.offset+t.length)),{data:o,ms:performance.now()-r}}updateSeekable(e){let t=this.ms;if(!t||t.readyState!==`open`||!e.segments.length)return;let n=e.segments[0],r=e.segments[e.segments.length-1];try{t.duration!==1/0&&!this.streams.some(e=>e.sb?.updating)&&(t.duration=1/0),t.setLiveSeekableRange?.(n.start,r.start+r.duration)}catch{}}pickLevel(){let e=this.all.map(e=>e.info),n=this.opts.capToPlayerSize===!1?void 0:Math.round((this.media.clientHeight||0)*(window.devicePixelRatio||1))||void 0,r=this.media.currentTime,i=this.main?this.main.bufferedEnd(r)-r:0;return t(e,this.est.estimate,{maxHeight:n,bufferAhead:this.est.hasSamples?i:void 0,current:this.level>=0?this.level:void 0})}afterMainSegment(){if(this.autoLevel&&this.all.length>1){let e=this.pickLevel();e!==this.level&&this.switchTo(e,!1)}}setLevel(e){if(e<0){this.autoLevel=!0;return}e>=this.all.length||(this.autoLevel=!1,e!==this.level&&this.switchTo(e,!0))}switchTo(e,t){let n=this.all[this.level]?.variant.audio;this.level=e,this.opts.onLevelSwitched?.(e),this.main?.switchSource(this.all[e],t?`ahead`:`none`);let r=this.all[e].variant.audio;if(r!==n&&this.audio){let e=this.audioSources[this.audioTrack]?.rendition;this.buildAudioTracks(r);let t=this.audioSources.findIndex(t=>t.rendition.language===e?.language&&t.rendition.name===e?.name);t>=0&&(this.audioTrack=t);let n=this.audioSources[this.audioTrack];n&&this.audio.switchSource(n,`all`),this.opts.onAudioTrackSwitched?.(this.audioTrack)}}stats(){return{buffered:{main:this.main?.buffered()??[],...this.audio?{audio:this.audio.buffered()}:{}},level:this.level,audioTrack:this.audioTrack,bandwidth:this.est.estimate}}setAudioTrack(e){let t=this.audioSources[e];!t||e===this.audioTrack||!this.audio||(this.audioTrack=e,this.audio.switchSource(t,`all`),this.opts.onAudioTrackSwitched?.(e))}jumpGap(e){let t=X(this.media.buffered);if(!t.length||this.media.seeking)return;let n=t.find(([t,n])=>e>=t&&e<n),r=t.find(([t])=>t>e);if(!n){r&&(r[0]-e<1||!this.startPositioned&&this.live)&&(this.media.currentTime=r[0]+.01);return}if(!(!this.media.paused&&this.media.readyState<3)){this.stallPos=-1;return}if(this.stallPos!==e){this.stallPos=e,this.stallSince=performance.now();return}performance.now()-this.stallSince<500||r&&n[1]-e<.5&&r[0]-n[1]<1&&(this.media.currentTime=r[0]+.01)}};function $(e,t){if(!e.segments.length||!t.segments.length)return;let n=new Map(e.segments.map(e=>[e.sn,e])),r=null;for(let e of t.segments){let t=n.get(e.sn);if(t){r=t.start-e.start;break}}if(r===null){let n=e.segments[e.segments.length-1],i=t.segments[0];if(i.sn<=n.sn)return;let a=(i.sn-n.sn-1)*(t.targetDuration||n.duration);r=n.start+n.duration+a-i.start}if(r)for(let e of t.segments)e.start+=r}function Ue(e,t,n){e.src=t;let r=e.audioTracks,i={native:!0,get live(){return e.duration===1/0},levels:[],level:-1,autoLevel:!0,audioTracks:[],audioTrack:-1,bandwidth:0,setLevel:()=>{},stats:()=>({buffered:{main:X(e.buffered)},level:-1,audioTrack:i.audioTrack,bandwidth:0}),setAudioTrack(e){if(!(!r||e<0||e>=r.length))for(let t=0;t<r.length;t++)r[t].enabled=t===e},destroy(){r?.removeEventListener(`addtrack`,a),r?.removeEventListener(`removetrack`,a),r?.removeEventListener(`change`,a),e.removeAttribute(`src`),e.load()}};function a(){if(!r)return;let e=[],t=-1;for(let n=0;n<r.length;n++){let i=r[n];e.push({index:n,label:i.label||i.language||`#${n+1}`,language:i.language||void 0,default:i.kind===`main`}),i.enabled&&(t=n)}let a=e.length!==i.audioTracks.length;i.audioTracks=e,a&&n.onAudioTracks?.(e),t!==i.audioTrack&&(i.audioTrack=t,n.onAudioTrackSwitched?.(t))}return r?.addEventListener(`addtrack`,a),r?.addEventListener(`removetrack`,a),r?.addEventListener(`change`,a),i}function We(e,t,n={}){if(n.preferNative!==!1&&Y(e))return Ue(e,t,n);if(!J()){let e=new q(`mse`,`MediaSource is not available`);return queueMicrotask(()=>n.onError?.(e)),{native:!1,live:!1,levels:[],level:-1,autoLevel:!0,audioTracks:[],audioTrack:-1,bandwidth:0,setLevel:()=>{},setAudioTrack:()=>{},destroy:()=>{},stats:()=>({buffered:{main:[]},level:-1,audioTrack:-1,bandwidth:0})}}return new He(e,typeof location<`u`?new URL(t,location.href).href:t,n)}exports.BandwidthEstimator=e,exports.HlsError=q,exports.HlsParseError=n,exports.TransmuxError=T,exports.TsTransmuxer=G,exports.alignTimes=$,exports.attachHls=We,exports.canPlayNativeHls=Y,exports.chooseLevel=t,exports.createTsTransmuxer=K,exports.fragmentStart=w,exports.getMediaSource=J,exports.isFmp4=y,exports.isHlsSupported=Ie,exports.isMpegTs=b,exports.isPackedAudio=O,exports.parseAttributes=r,exports.parseInit=C,exports.parsePackedAudio=k,exports.parsePlaylist=s,exports.pickAudioRendition=Q,exports.sequenceIv=u;
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/hls/abr.ts
2
3
  var e = class {
3
4
  constructor(e = 1e6, t = 3, n = 9, r = 16e3) {
@@ -1 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../UidIcon-DUeT_lN-.cjs`);exports.UidIcon=e.t;var t=require(`lucide-vue-next`);Object.keys(t).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
1
+
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../UidIcon-BCwosbz1.cjs`);exports.UidIcon=e.t;var t=require(`lucide-vue-next`);Object.keys(t).forEach(function(e){e!==`default`&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})});
@@ -1,3 +1,4 @@
1
- import { t as e } from "../UidIcon-5947kXOj.js";
1
+
2
+ import { t as e } from "../UidIcon-wihsnq_U.js";
2
3
  export * from "lucide-vue-next";
3
4
  export { e as UidIcon };