@arc-ui/community-components 3.2.0 → 3.4.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 (158) hide show
  1. package/.turbo/turbo-build.log +133 -13
  2. package/CHANGELOG.md +31 -0
  3. package/lib/Accordion/Accordion.cjs +2 -3
  4. package/lib/Accordion/Accordion.mjs +2 -3
  5. package/lib/ActionTile/ActionTile.cjs +4 -5
  6. package/lib/ActionTile/ActionTile.mjs +10 -11
  7. package/lib/ActionTile/styles.css +1 -1
  8. package/lib/ArticleSidebar/ArticleSidebar.cjs +9 -10
  9. package/lib/ArticleSidebar/ArticleSidebar.mjs +46 -47
  10. package/lib/Author/Author.cjs +2 -3
  11. package/lib/Author/Author.mjs +2 -3
  12. package/lib/BannerWithTabs/BannerWithTabs.cjs +4 -5
  13. package/lib/BannerWithTabs/BannerWithTabs.mjs +8 -9
  14. package/lib/ContentInfoWidget/ContentInfoWidget.cjs +3 -2
  15. package/lib/ContentInfoWidget/ContentInfoWidget.mjs +8 -7
  16. package/lib/CopyLead/CopyLead.cjs +32 -23
  17. package/lib/CopyLead/CopyLead.mjs +60 -51
  18. package/lib/DownloadList/DownloadList.cjs +6 -8
  19. package/lib/DownloadList/DownloadList.mjs +11 -13
  20. package/lib/FAQs/FAQs.cjs +5 -6
  21. package/lib/FAQs/FAQs.mjs +22 -23
  22. package/lib/FeaturePost/FeaturePost.cjs +14 -15
  23. package/lib/FeaturePost/FeaturePost.mjs +54 -55
  24. package/lib/Highlights/Highlights.cjs +11 -12
  25. package/lib/Highlights/Highlights.mjs +24 -25
  26. package/lib/InlineLinkGroup/InlineLinkGroup.cjs +25 -0
  27. package/lib/InlineLinkGroup/InlineLinkGroup.mjs +23 -0
  28. package/lib/InlineLinkGroup/styles.css +1 -0
  29. package/lib/LinkTile/LinkTile.cjs +6 -6
  30. package/lib/LinkTile/LinkTile.mjs +7 -7
  31. package/lib/LinkTile/styles.css +1 -1
  32. package/lib/ProductNavigation/ProductNavigation.cjs +6 -7
  33. package/lib/ProductNavigation/ProductNavigation.mjs +18 -19
  34. package/lib/PromoListing/PromoListing.cjs +7 -8
  35. package/lib/PromoListing/PromoListing.mjs +17 -18
  36. package/lib/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.cjs +7 -8
  37. package/lib/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.mjs +9 -10
  38. package/lib/Quote/Quote.cjs +5 -6
  39. package/lib/Quote/Quote.mjs +9 -10
  40. package/lib/SectionHeading/SectionHeading.cjs +2 -3
  41. package/lib/SectionHeading/SectionHeading.mjs +2 -3
  42. package/lib/Statistics/Statistics.cjs +21 -19
  43. package/lib/Statistics/Statistics.mjs +35 -33
  44. package/lib/Statistics/styles.css +1 -1
  45. package/lib/Summary/Summary.cjs +4 -4
  46. package/lib/Summary/Summary.mjs +13 -13
  47. package/lib/ThumbnailSignpost/ThumbnailSignpost.cjs +2 -3
  48. package/lib/ThumbnailSignpost/ThumbnailSignpost.mjs +2 -3
  49. package/lib/VideoHeroCard/VideoHeroCard.cjs +76 -0
  50. package/lib/VideoHeroCard/VideoHeroCard.mjs +74 -0
  51. package/lib/VideoPortraitCard/VideoPortraitCard.cjs +22 -0
  52. package/lib/VideoPortraitCard/VideoPortraitCard.mjs +20 -0
  53. package/lib/_shared/cjs/{Accordion-DfNGOjTm.cjs → Accordion-QqDoB3pY.cjs} +8 -9
  54. package/lib/_shared/cjs/{Author-D4dKNQem.cjs → Author-aL8YXi7C.cjs} +4 -5
  55. package/lib/_shared/cjs/Preview-Dx1kCzJ1.cjs +102 -0
  56. package/lib/_shared/cjs/{SectionHeading-DeSFM0HV.cjs → SectionHeading-Dj-dJfv3.cjs} +4 -5
  57. package/lib/_shared/cjs/{ThumbnailSignpost-GkOiwt-Z.cjs → ThumbnailSignpost-SBnrGooA.cjs} +4 -5
  58. package/lib/_shared/cjs/VideoCardThumbnail-BqYgpk0u.cjs +440 -0
  59. package/lib/_shared/cjs/dash.all.min-BPXzla24.cjs +6 -0
  60. package/lib/_shared/cjs/{tslib.es6-BxB9I209.cjs → filter-attrs-C26zOt4_.cjs} +25 -0
  61. package/lib/_shared/cjs/hls-Ckhp5fVA.cjs +36628 -0
  62. package/lib/_shared/cjs/index-DjiIVIaV.cjs +96 -0
  63. package/lib/_shared/cjs/index-oGP6D6gL.cjs +14826 -0
  64. package/lib/_shared/cjs/{index.es-Dq8bYrbW.cjs → index.es-B0J3cvrY.cjs} +1 -1
  65. package/lib/_shared/cjs/mixin-BFwaXKGB.cjs +1027 -0
  66. package/lib/_shared/cjs/react-CEvhi3LL.cjs +737 -0
  67. package/lib/_shared/cjs/react-CqsEClV0.cjs +466 -0
  68. package/lib/_shared/cjs/react-DE6M3seI.cjs +496 -0
  69. package/lib/_shared/cjs/react-Dri2yjKm.cjs +554 -0
  70. package/lib/_shared/cjs/react-DxToimBj.cjs +4239 -0
  71. package/lib/_shared/cjs/react-JTfV8OSA.cjs +325 -0
  72. package/lib/_shared/cjs/react-caXJFZ8W.cjs +400 -0
  73. package/lib/_shared/cjs/react-fep2ei7j.cjs +727 -0
  74. package/lib/_shared/esm/{Accordion-cd1oYvBv.mjs → Accordion-DtU7jbCv.mjs} +16 -17
  75. package/lib/_shared/esm/Author-CJQFrQM9.mjs +27 -0
  76. package/lib/_shared/esm/Preview-CmbKOgEO.mjs +100 -0
  77. package/lib/_shared/esm/{SectionHeading-CpDLCndw.mjs → SectionHeading-BskdQ2Tt.mjs} +10 -11
  78. package/lib/_shared/esm/{ThumbnailSignpost-BeRiXbUp.mjs → ThumbnailSignpost-CBSdQiHw.mjs} +13 -14
  79. package/lib/_shared/esm/VideoCardThumbnail-VfOKmPCv.mjs +437 -0
  80. package/lib/_shared/esm/dash.all.min-CbWI_8dN.mjs +4 -0
  81. package/lib/_shared/esm/{tslib.es6-D6Wu-xwB.mjs → filter-attrs-D-1kWaCP.mjs} +25 -1
  82. package/lib/_shared/esm/hls-AFbJDS9D.mjs +36625 -0
  83. package/lib/_shared/esm/index-CrcIrdjn.mjs +14799 -0
  84. package/lib/_shared/esm/index-DYnuIO1L.mjs +94 -0
  85. package/lib/_shared/esm/{index.es-Bfdys5__.mjs → index.es-DraZ-qKh.mjs} +1 -1
  86. package/lib/_shared/esm/mixin-BGGG8VrM.mjs +1024 -0
  87. package/lib/_shared/esm/react-BGimq-TB.mjs +4237 -0
  88. package/lib/_shared/esm/react-BHT4t_eQ.mjs +494 -0
  89. package/lib/_shared/esm/react-BSd0sGcO.mjs +464 -0
  90. package/lib/_shared/esm/react-CSr43fZV.mjs +552 -0
  91. package/lib/_shared/esm/react-Ca6E7Fr-.mjs +398 -0
  92. package/lib/_shared/esm/react-DG070IvZ.mjs +725 -0
  93. package/lib/_shared/esm/react-DZyqy7W7.mjs +735 -0
  94. package/lib/_shared/esm/react-WW_9iHcl.mjs +323 -0
  95. package/lib/index.cjs +299 -181
  96. package/lib/index.cjs.map +1 -1
  97. package/lib/index.d.cts +77 -63
  98. package/lib/index.d.mts +77 -63
  99. package/lib/index.mjs +297 -181
  100. package/lib/index.mjs.map +1 -1
  101. package/lib/styles.css +1 -1
  102. package/package.json +15 -12
  103. package/rollup.config.js +1 -1
  104. package/src/components/ActionTile/ActionTile.module.css +56 -37
  105. package/src/components/ActionTile/ActionTile.tsx +1 -1
  106. package/src/components/ArticleSidebar/ArticleSidebar.tsx +4 -6
  107. package/src/components/Author/Author.tsx +0 -3
  108. package/src/components/BannerWithTabs/BannerWithTabs.tsx +4 -6
  109. package/src/components/ContentInfoWidget/ContentInfoWidget.tsx +3 -4
  110. package/src/components/CopyLead/components/MediaContent/MediaContent.tsx +7 -6
  111. package/src/components/CopyLead/templates/Content/Content.tsx +5 -3
  112. package/src/components/CopyLead/templates/Media/Media.tsx +5 -6
  113. package/src/components/DownloadList/DownloadList.tsx +8 -8
  114. package/src/components/FeaturePost/FeaturePost.tsx +3 -7
  115. package/src/components/Highlights/Highlights.tsx +3 -2
  116. package/src/components/Highlights/components/HighlightItem/HighlightItem.tsx +3 -2
  117. package/src/components/Highlights/components/HighlightList/HighlightList.tsx +5 -2
  118. package/src/components/InlineLinkGroup/InlineLinkGroup.module.css +81 -0
  119. package/src/components/InlineLinkGroup/InlineLinkGroup.tsx +67 -0
  120. package/src/components/InlineLinkGroup/index.ts +5 -0
  121. package/src/components/LinkTile/LinkTile.module.css +62 -26
  122. package/src/components/LinkTile/LinkTile.tsx +8 -1
  123. package/src/components/PromoListing/PromoListing.tsx +3 -11
  124. package/src/components/PromoListingThumbnailSignpost/PromoListingThumbnailSignpost.tsx +2 -0
  125. package/src/components/Quote/Quote.tsx +1 -7
  126. package/src/components/Statistics/Statistics.module.css +0 -10
  127. package/src/components/Statistics/Statistics.tsx +35 -32
  128. package/src/components/Summary/Summary.tsx +3 -1
  129. package/src/components/VideoHeroCard/VideoHeroCard.tsx +63 -0
  130. package/src/components/VideoHeroCard/components/VideoHeroCardContent/VideoHeroCardContent.module.css +32 -0
  131. package/src/components/VideoHeroCard/components/VideoHeroCardContent/VideoHeroCardContent.tsx +97 -0
  132. package/src/components/VideoHeroCard/components/VideoHeroCardContent/index.ts +4 -0
  133. package/src/components/VideoHeroCard/index.ts +1 -0
  134. package/src/components/VideoPortraitCard/VideoPortraitCard.tsx +54 -0
  135. package/src/components/VideoPortraitCard/index.ts +4 -0
  136. package/src/components/index.ts +3 -1
  137. package/src/internal/MultiLineText/MultiLineText.tsx +25 -0
  138. package/src/internal/MultiLineText/index.ts +1 -0
  139. package/src/internal/VideoCardPlayer/VideoCardPlayer.module.css +54 -0
  140. package/src/internal/VideoCardPlayer/VideoCardPlayer.tsx +62 -0
  141. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/VideoCardPlayIcon.module.css +41 -0
  142. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/VideoCardPlayIcon.tsx +28 -0
  143. package/src/internal/VideoCardPlayer/components/VideoCardPlayIcon/index.ts +1 -0
  144. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.module.css +58 -0
  145. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.tsx +38 -0
  146. package/src/internal/VideoCardPlayer/components/VideoCardThumbnail/index.ts +1 -0
  147. package/src/internal/VideoCardPlayer/index.ts +2 -0
  148. package/src/internal/VideoCardPlayer/types/player-props.ts +6 -0
  149. package/versions.json +1 -1
  150. package/lib/HeroLink/HeroLink.cjs +0 -35
  151. package/lib/HeroLink/HeroLink.mjs +0 -33
  152. package/lib/HeroLink/styles.css +0 -1
  153. package/lib/_shared/cjs/filter-attrs-BizjMsy0.cjs +0 -27
  154. package/lib/_shared/esm/Author-HnYsFTPT.mjs +0 -28
  155. package/lib/_shared/esm/filter-attrs-DZ7RCEZm.mjs +0 -25
  156. package/src/components/HeroLink/HeroLink.module.css +0 -44
  157. package/src/components/HeroLink/HeroLink.tsx +0 -136
  158. package/src/components/HeroLink/index.ts +0 -2
@@ -0,0 +1,1027 @@
1
+ 'use strict';
2
+
3
+ const Events = [
4
+ "abort",
5
+ "canplay",
6
+ "canplaythrough",
7
+ "durationchange",
8
+ "emptied",
9
+ "encrypted",
10
+ "ended",
11
+ "error",
12
+ "loadeddata",
13
+ "loadedmetadata",
14
+ "loadstart",
15
+ "pause",
16
+ "play",
17
+ "playing",
18
+ "progress",
19
+ "ratechange",
20
+ "seeked",
21
+ "seeking",
22
+ "stalled",
23
+ "suspend",
24
+ "timeupdate",
25
+ "volumechange",
26
+ "waiting",
27
+ "waitingforkey",
28
+ "resize",
29
+ "enterpictureinpicture",
30
+ "leavepictureinpicture",
31
+ "webkitbeginfullscreen",
32
+ "webkitendfullscreen",
33
+ "webkitpresentationmodechanged"
34
+ ];
35
+ const Attributes = [
36
+ "autopictureinpicture",
37
+ "disablepictureinpicture",
38
+ "disableremoteplayback",
39
+ "autoplay",
40
+ "controls",
41
+ "controlslist",
42
+ "crossorigin",
43
+ "loop",
44
+ "muted",
45
+ "playsinline",
46
+ "poster",
47
+ "preload",
48
+ "src"
49
+ ];
50
+ function getAudioTemplateHTML(attrs) {
51
+ return (
52
+ /*html*/
53
+ `
54
+ <style>
55
+ :host {
56
+ display: inline-flex;
57
+ line-height: 0;
58
+ flex-direction: column;
59
+ justify-content: end;
60
+ }
61
+
62
+ audio {
63
+ width: 100%;
64
+ }
65
+ </style>
66
+ <slot name="media">
67
+ <audio${serializeAttributes(attrs)}></audio>
68
+ </slot>
69
+ <slot></slot>
70
+ `
71
+ );
72
+ }
73
+ function getVideoTemplateHTML(attrs) {
74
+ return (
75
+ /*html*/
76
+ `
77
+ <style>
78
+ :host {
79
+ display: inline-block;
80
+ line-height: 0;
81
+ }
82
+
83
+ video {
84
+ max-width: 100%;
85
+ max-height: 100%;
86
+ min-width: 100%;
87
+ min-height: 100%;
88
+ object-fit: var(--media-object-fit, contain);
89
+ object-position: var(--media-object-position, 50% 50%);
90
+ }
91
+
92
+ video::-webkit-media-text-track-container {
93
+ transform: var(--media-webkit-text-track-transform);
94
+ transition: var(--media-webkit-text-track-transition);
95
+ }
96
+ </style>
97
+ <slot name="media">
98
+ <video${serializeAttributes(attrs)}></video>
99
+ </slot>
100
+ <slot></slot>
101
+ `
102
+ );
103
+ }
104
+ function CustomMediaMixin(superclass, { tag, is }) {
105
+ const nativeElTest = globalThis.document?.createElement?.(tag, { is });
106
+ const nativeElProps = nativeElTest ? getNativeElProps(nativeElTest) : [];
107
+ return class CustomMedia extends superclass {
108
+ static getTemplateHTML = tag.endsWith("audio") ? getAudioTemplateHTML : getVideoTemplateHTML;
109
+ static shadowRootOptions = { mode: "open" };
110
+ static Events = Events;
111
+ static #isDefined = false;
112
+ static get observedAttributes() {
113
+ CustomMedia.#define();
114
+ const natAttrs = nativeElTest?.constructor?.observedAttributes ?? [];
115
+ return [
116
+ ...natAttrs,
117
+ ...Attributes
118
+ ];
119
+ }
120
+ static #define() {
121
+ if (this.#isDefined) return;
122
+ this.#isDefined = true;
123
+ const propsToAttrs = new Set(this.observedAttributes);
124
+ propsToAttrs.delete("muted");
125
+ for (const prop of nativeElProps) {
126
+ if (prop in this.prototype) continue;
127
+ if (typeof nativeElTest[prop] === "function") {
128
+ this.prototype[prop] = function(...args) {
129
+ this.#init();
130
+ const fn = () => {
131
+ if (this.call) return this.call(prop, ...args);
132
+ const nativeFn = this.nativeEl?.[prop];
133
+ return nativeFn?.apply(this.nativeEl, args);
134
+ };
135
+ return fn();
136
+ };
137
+ } else {
138
+ const config = {
139
+ get() {
140
+ this.#init();
141
+ const attr = prop.toLowerCase();
142
+ if (propsToAttrs.has(attr)) {
143
+ const val = this.getAttribute(attr);
144
+ return val === null ? false : val === "" ? true : val;
145
+ }
146
+ return this.get?.(prop) ?? this.nativeEl?.[prop];
147
+ }
148
+ };
149
+ if (prop !== prop.toUpperCase()) {
150
+ config.set = function(val) {
151
+ this.#init();
152
+ const attr = prop.toLowerCase();
153
+ if (propsToAttrs.has(attr)) {
154
+ if (val === true || val === false || val == null) {
155
+ this.toggleAttribute(attr, Boolean(val));
156
+ } else {
157
+ this.setAttribute(attr, val);
158
+ }
159
+ return;
160
+ }
161
+ if (this.set) {
162
+ this.set(prop, val);
163
+ return;
164
+ }
165
+ if (this.nativeEl) {
166
+ this.nativeEl[prop] = val;
167
+ }
168
+ };
169
+ }
170
+ Object.defineProperty(this.prototype, prop, config);
171
+ }
172
+ }
173
+ }
174
+ // Private fields
175
+ #isInit = false;
176
+ #nativeEl = null;
177
+ #childMap = /* @__PURE__ */ new Map();
178
+ #childObserver;
179
+ get;
180
+ set;
181
+ call;
182
+ // If the custom element is defined before the custom element's HTML is parsed
183
+ // no attributes will be available in the constructor (construction process).
184
+ // Wait until initializing in the attributeChangedCallback or
185
+ // connectedCallback or accessing any properties.
186
+ get nativeEl() {
187
+ this.#init();
188
+ return this.#nativeEl ?? this.querySelector(":scope > [slot=media]") ?? this.querySelector(tag) ?? this.shadowRoot?.querySelector(tag) ?? null;
189
+ }
190
+ set nativeEl(val) {
191
+ this.#nativeEl = val;
192
+ }
193
+ get defaultMuted() {
194
+ return this.hasAttribute("muted");
195
+ }
196
+ set defaultMuted(val) {
197
+ this.toggleAttribute("muted", val);
198
+ }
199
+ get src() {
200
+ return this.getAttribute("src");
201
+ }
202
+ set src(val) {
203
+ this.setAttribute("src", `${val}`);
204
+ }
205
+ get preload() {
206
+ return this.getAttribute("preload") ?? this.nativeEl?.preload;
207
+ }
208
+ set preload(val) {
209
+ this.setAttribute("preload", `${val}`);
210
+ }
211
+ #init() {
212
+ if (this.#isInit) return;
213
+ this.#isInit = true;
214
+ this.init();
215
+ }
216
+ init() {
217
+ if (!this.shadowRoot) {
218
+ this.attachShadow({ mode: "open" });
219
+ const attrs = namedNodeMapToObject(this.attributes);
220
+ if (is) attrs.is = is;
221
+ if (tag) attrs.part = tag;
222
+ this.shadowRoot.innerHTML = this.constructor.getTemplateHTML(attrs);
223
+ }
224
+ this.nativeEl.muted = this.hasAttribute("muted");
225
+ for (const prop of nativeElProps) {
226
+ this.#upgradeProperty(prop);
227
+ }
228
+ this.#childObserver = new MutationObserver(this.#syncMediaChildAttribute.bind(this));
229
+ this.shadowRoot.addEventListener("slotchange", () => this.#syncMediaChildren());
230
+ this.#syncMediaChildren();
231
+ for (const type of this.constructor.Events) {
232
+ this.shadowRoot.addEventListener(type, this, true);
233
+ }
234
+ }
235
+ handleEvent(event) {
236
+ if (event.target === this.nativeEl) {
237
+ this.dispatchEvent(new CustomEvent(event.type, { detail: event.detail }));
238
+ }
239
+ }
240
+ #syncMediaChildren() {
241
+ const removeNativeChildren = new Map(this.#childMap);
242
+ const defaultSlot = this.shadowRoot?.querySelector("slot:not([name])");
243
+ const mediaChildren = defaultSlot?.assignedElements({ flatten: true }).filter((el) => ["track", "source"].includes(el.localName));
244
+ mediaChildren.forEach((el) => {
245
+ removeNativeChildren.delete(el);
246
+ let clone = this.#childMap.get(el);
247
+ if (!clone) {
248
+ clone = el.cloneNode();
249
+ this.#childMap.set(el, clone);
250
+ this.#childObserver?.observe(el, { attributes: true });
251
+ }
252
+ this.nativeEl?.append(clone);
253
+ this.#enableDefaultTrack(clone);
254
+ });
255
+ removeNativeChildren.forEach((clone, el) => {
256
+ clone.remove();
257
+ this.#childMap.delete(el);
258
+ });
259
+ }
260
+ #syncMediaChildAttribute(mutations) {
261
+ for (const mutation of mutations) {
262
+ if (mutation.type === "attributes") {
263
+ const { target, attributeName } = mutation;
264
+ const clone = this.#childMap.get(target);
265
+ if (clone && attributeName) {
266
+ clone.setAttribute(attributeName, target.getAttribute(attributeName) ?? "");
267
+ this.#enableDefaultTrack(clone);
268
+ }
269
+ }
270
+ }
271
+ }
272
+ #enableDefaultTrack(trackEl) {
273
+ if (trackEl && trackEl.localName === "track" && trackEl.default && (trackEl.kind === "chapters" || trackEl.kind === "metadata") && trackEl.track.mode === "disabled") {
274
+ trackEl.track.mode = "hidden";
275
+ }
276
+ }
277
+ #upgradeProperty(prop) {
278
+ if (Object.prototype.hasOwnProperty.call(this, prop)) {
279
+ const value = this[prop];
280
+ delete this[prop];
281
+ this[prop] = value;
282
+ }
283
+ }
284
+ attributeChangedCallback(attrName, oldValue, newValue) {
285
+ this.#init();
286
+ this.#forwardAttribute(attrName, oldValue, newValue);
287
+ }
288
+ #forwardAttribute(attrName, _oldValue, newValue) {
289
+ if (["id", "class"].includes(attrName)) return;
290
+ if (!CustomMedia.observedAttributes.includes(attrName) && this.constructor.observedAttributes.includes(attrName)) {
291
+ return;
292
+ }
293
+ if (newValue === null) {
294
+ this.nativeEl?.removeAttribute(attrName);
295
+ } else if (this.nativeEl?.getAttribute(attrName) !== newValue) {
296
+ this.nativeEl?.setAttribute(attrName, newValue);
297
+ }
298
+ }
299
+ connectedCallback() {
300
+ this.#init();
301
+ }
302
+ };
303
+ }
304
+ function getNativeElProps(nativeElTest) {
305
+ const nativeElProps = [];
306
+ for (let proto = Object.getPrototypeOf(nativeElTest); proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {
307
+ const props = Object.getOwnPropertyNames(proto);
308
+ nativeElProps.push(...props);
309
+ }
310
+ return nativeElProps;
311
+ }
312
+ function serializeAttributes(attrs) {
313
+ let html = "";
314
+ for (const key in attrs) {
315
+ if (!Attributes.includes(key)) continue;
316
+ const value = attrs[key];
317
+ if (value === "") html += ` ${key}`;
318
+ else html += ` ${key}="${value}"`;
319
+ }
320
+ return html;
321
+ }
322
+ function namedNodeMapToObject(namedNodeMap) {
323
+ const obj = {};
324
+ for (const attr of namedNodeMap) {
325
+ obj[attr.name] = attr.value;
326
+ }
327
+ return obj;
328
+ }
329
+ const CustomVideoElement = CustomMediaMixin(globalThis.HTMLElement ?? class {
330
+ }, {
331
+ tag: "video"
332
+ });
333
+ CustomMediaMixin(globalThis.HTMLElement ?? class {
334
+ }, {
335
+ tag: "audio"
336
+ });
337
+
338
+ class TrackEvent extends Event {
339
+ track;
340
+ constructor(type, init) {
341
+ super(type);
342
+ this.track = init.track;
343
+ }
344
+ }
345
+
346
+ const privateProps = /* @__PURE__ */ new WeakMap();
347
+ function getPrivate(instance) {
348
+ return privateProps.get(instance) ?? setPrivate(instance, {});
349
+ }
350
+ function setPrivate(instance, props) {
351
+ let saved = privateProps.get(instance);
352
+ if (!saved) privateProps.set(instance, saved = {});
353
+ return Object.assign(saved, props);
354
+ }
355
+
356
+ function addVideoTrack(media, track) {
357
+ const trackList = media.videoTracks;
358
+ getPrivate(track).media = media;
359
+ if (!getPrivate(track).renditionSet) {
360
+ getPrivate(track).renditionSet = /* @__PURE__ */ new Set();
361
+ }
362
+ const trackSet = getPrivate(trackList).trackSet;
363
+ trackSet.add(track);
364
+ const index = trackSet.size - 1;
365
+ if (!(index in VideoTrackList.prototype)) {
366
+ Object.defineProperty(VideoTrackList.prototype, index, {
367
+ get() {
368
+ return [...getPrivate(this).trackSet][index];
369
+ }
370
+ });
371
+ }
372
+ queueMicrotask(() => {
373
+ trackList.dispatchEvent(new TrackEvent("addtrack", { track }));
374
+ });
375
+ }
376
+ function removeVideoTrack(track) {
377
+ const trackList = getPrivate(track).media?.videoTracks;
378
+ if (!trackList) return;
379
+ const trackSet = getPrivate(trackList).trackSet;
380
+ trackSet.delete(track);
381
+ queueMicrotask(() => {
382
+ trackList.dispatchEvent(new TrackEvent("removetrack", { track }));
383
+ });
384
+ }
385
+ function selectedChanged$2(selected) {
386
+ const trackList = getPrivate(selected).media.videoTracks ?? [];
387
+ let hasUnselected = false;
388
+ for (const track of trackList) {
389
+ if (track === selected) continue;
390
+ track.selected = false;
391
+ hasUnselected = true;
392
+ }
393
+ if (hasUnselected) {
394
+ if (getPrivate(trackList).changeRequested) return;
395
+ getPrivate(trackList).changeRequested = true;
396
+ queueMicrotask(() => {
397
+ delete getPrivate(trackList).changeRequested;
398
+ trackList.dispatchEvent(new Event("change"));
399
+ });
400
+ }
401
+ }
402
+ class VideoTrackList extends EventTarget {
403
+ #addTrackCallback;
404
+ #removeTrackCallback;
405
+ #changeCallback;
406
+ constructor() {
407
+ super();
408
+ getPrivate(this).trackSet = /* @__PURE__ */ new Set();
409
+ }
410
+ get #tracks() {
411
+ return getPrivate(this).trackSet;
412
+ }
413
+ [Symbol.iterator]() {
414
+ return this.#tracks.values();
415
+ }
416
+ get length() {
417
+ return this.#tracks.size;
418
+ }
419
+ getTrackById(id) {
420
+ return [...this.#tracks].find((track) => track.id === id) ?? null;
421
+ }
422
+ get selectedIndex() {
423
+ return [...this.#tracks].findIndex((track) => track.selected);
424
+ }
425
+ get onaddtrack() {
426
+ return this.#addTrackCallback;
427
+ }
428
+ set onaddtrack(callback) {
429
+ if (this.#addTrackCallback) {
430
+ this.removeEventListener("addtrack", this.#addTrackCallback);
431
+ this.#addTrackCallback = void 0;
432
+ }
433
+ if (typeof callback == "function") {
434
+ this.#addTrackCallback = callback;
435
+ this.addEventListener("addtrack", callback);
436
+ }
437
+ }
438
+ get onremovetrack() {
439
+ return this.#removeTrackCallback;
440
+ }
441
+ set onremovetrack(callback) {
442
+ if (this.#removeTrackCallback) {
443
+ this.removeEventListener("removetrack", this.#removeTrackCallback);
444
+ this.#removeTrackCallback = void 0;
445
+ }
446
+ if (typeof callback == "function") {
447
+ this.#removeTrackCallback = callback;
448
+ this.addEventListener("removetrack", callback);
449
+ }
450
+ }
451
+ get onchange() {
452
+ return this.#changeCallback;
453
+ }
454
+ set onchange(callback) {
455
+ if (this.#changeCallback) {
456
+ this.removeEventListener("change", this.#changeCallback);
457
+ this.#changeCallback = void 0;
458
+ }
459
+ if (typeof callback == "function") {
460
+ this.#changeCallback = callback;
461
+ this.addEventListener("change", callback);
462
+ }
463
+ }
464
+ }
465
+
466
+ class RenditionEvent extends Event {
467
+ rendition;
468
+ constructor(type, init) {
469
+ super(type);
470
+ this.rendition = init.rendition;
471
+ }
472
+ }
473
+
474
+ function addRendition$1(track, rendition) {
475
+ const renditionList = getPrivate(track).media.videoRenditions;
476
+ getPrivate(rendition).media = getPrivate(track).media;
477
+ getPrivate(rendition).track = track;
478
+ const renditionSet = getPrivate(track).renditionSet;
479
+ renditionSet.add(rendition);
480
+ const index = renditionSet.size - 1;
481
+ if (!(index in VideoRenditionList.prototype)) {
482
+ Object.defineProperty(VideoRenditionList.prototype, index, {
483
+ get() {
484
+ return getCurrentRenditions$1(this)[index];
485
+ }
486
+ });
487
+ }
488
+ queueMicrotask(() => {
489
+ if (!track.selected) return;
490
+ renditionList.dispatchEvent(new RenditionEvent("addrendition", { rendition }));
491
+ });
492
+ }
493
+ function removeRendition$1(rendition) {
494
+ const renditionList = getPrivate(rendition).media.videoRenditions;
495
+ const track = getPrivate(rendition).track;
496
+ const renditionSet = getPrivate(track).renditionSet;
497
+ renditionSet.delete(rendition);
498
+ queueMicrotask(() => {
499
+ const track2 = getPrivate(rendition).track;
500
+ if (!track2.selected) return;
501
+ renditionList.dispatchEvent(new RenditionEvent("removerendition", { rendition }));
502
+ });
503
+ }
504
+ function selectedChanged$1(rendition) {
505
+ const renditionList = getPrivate(rendition).media.videoRenditions;
506
+ if (!renditionList || getPrivate(renditionList).changeRequested) return;
507
+ getPrivate(renditionList).changeRequested = true;
508
+ queueMicrotask(() => {
509
+ delete getPrivate(renditionList).changeRequested;
510
+ const track = getPrivate(rendition).track;
511
+ if (!track.selected) return;
512
+ renditionList.dispatchEvent(new Event("change"));
513
+ });
514
+ }
515
+ function getCurrentRenditions$1(renditionList) {
516
+ const media = getPrivate(renditionList).media;
517
+ return [...media.videoTracks].filter((track) => track.selected).flatMap((track) => [...getPrivate(track).renditionSet]);
518
+ }
519
+ class VideoRenditionList extends EventTarget {
520
+ #addRenditionCallback;
521
+ #removeRenditionCallback;
522
+ #changeCallback;
523
+ [Symbol.iterator]() {
524
+ return getCurrentRenditions$1(this).values();
525
+ }
526
+ get length() {
527
+ return getCurrentRenditions$1(this).length;
528
+ }
529
+ getRenditionById(id) {
530
+ return getCurrentRenditions$1(this).find((rendition) => `${rendition.id}` === `${id}`) ?? null;
531
+ }
532
+ get selectedIndex() {
533
+ return getCurrentRenditions$1(this).findIndex((rendition) => rendition.selected);
534
+ }
535
+ set selectedIndex(index) {
536
+ for (const [i, rendition] of getCurrentRenditions$1(this).entries()) {
537
+ rendition.selected = i === index;
538
+ }
539
+ }
540
+ get onaddrendition() {
541
+ return this.#addRenditionCallback;
542
+ }
543
+ set onaddrendition(callback) {
544
+ if (this.#addRenditionCallback) {
545
+ this.removeEventListener("addrendition", this.#addRenditionCallback);
546
+ this.#addRenditionCallback = void 0;
547
+ }
548
+ if (typeof callback == "function") {
549
+ this.#addRenditionCallback = callback;
550
+ this.addEventListener("addrendition", callback);
551
+ }
552
+ }
553
+ get onremoverendition() {
554
+ return this.#removeRenditionCallback;
555
+ }
556
+ set onremoverendition(callback) {
557
+ if (this.#removeRenditionCallback) {
558
+ this.removeEventListener("removerendition", this.#removeRenditionCallback);
559
+ this.#removeRenditionCallback = void 0;
560
+ }
561
+ if (typeof callback == "function") {
562
+ this.#removeRenditionCallback = callback;
563
+ this.addEventListener("removerendition", callback);
564
+ }
565
+ }
566
+ get onchange() {
567
+ return this.#changeCallback;
568
+ }
569
+ set onchange(callback) {
570
+ if (this.#changeCallback) {
571
+ this.removeEventListener("change", this.#changeCallback);
572
+ this.#changeCallback = void 0;
573
+ }
574
+ if (typeof callback == "function") {
575
+ this.#changeCallback = callback;
576
+ this.addEventListener("change", callback);
577
+ }
578
+ }
579
+ }
580
+
581
+ class VideoRendition {
582
+ src;
583
+ id;
584
+ width;
585
+ height;
586
+ bitrate;
587
+ frameRate;
588
+ codec;
589
+ #selected = false;
590
+ get selected() {
591
+ return this.#selected;
592
+ }
593
+ set selected(val) {
594
+ if (this.#selected === val) return;
595
+ this.#selected = val;
596
+ selectedChanged$1(this);
597
+ }
598
+ }
599
+
600
+ class VideoTrack {
601
+ id;
602
+ kind;
603
+ label = "";
604
+ language = "";
605
+ sourceBuffer;
606
+ #selected = false;
607
+ addRendition(src, width, height, codec, bitrate, frameRate) {
608
+ const rendition = new VideoRendition();
609
+ rendition.src = src;
610
+ rendition.width = width;
611
+ rendition.height = height;
612
+ rendition.frameRate = frameRate;
613
+ rendition.bitrate = bitrate;
614
+ rendition.codec = codec;
615
+ addRendition$1(this, rendition);
616
+ return rendition;
617
+ }
618
+ removeRendition(rendition) {
619
+ removeRendition$1(rendition);
620
+ }
621
+ get selected() {
622
+ return this.#selected;
623
+ }
624
+ set selected(val) {
625
+ if (this.#selected === val) return;
626
+ this.#selected = val;
627
+ if (val !== true) return;
628
+ selectedChanged$2(this);
629
+ }
630
+ }
631
+
632
+ function addRendition(track, rendition) {
633
+ const renditionList = getPrivate(track).media.audioRenditions;
634
+ getPrivate(rendition).media = getPrivate(track).media;
635
+ getPrivate(rendition).track = track;
636
+ const renditionSet = getPrivate(track).renditionSet;
637
+ renditionSet.add(rendition);
638
+ const index = renditionSet.size - 1;
639
+ if (!(index in AudioRenditionList.prototype)) {
640
+ Object.defineProperty(AudioRenditionList.prototype, index, {
641
+ get() {
642
+ return getCurrentRenditions(this)[index];
643
+ }
644
+ });
645
+ }
646
+ queueMicrotask(() => {
647
+ if (!track.enabled) return;
648
+ renditionList.dispatchEvent(new RenditionEvent("addrendition", { rendition }));
649
+ });
650
+ }
651
+ function removeRendition(rendition) {
652
+ const renditionList = getPrivate(rendition).media.audioRenditions;
653
+ const track = getPrivate(rendition).track;
654
+ const renditionSet = getPrivate(track).renditionSet;
655
+ renditionSet.delete(rendition);
656
+ queueMicrotask(() => {
657
+ const track2 = getPrivate(rendition).track;
658
+ if (!track2.enabled) return;
659
+ renditionList.dispatchEvent(new RenditionEvent("removerendition", { rendition }));
660
+ });
661
+ }
662
+ function selectedChanged(rendition) {
663
+ const renditionList = getPrivate(rendition).media.audioRenditions;
664
+ if (!renditionList || getPrivate(renditionList).changeRequested) return;
665
+ getPrivate(renditionList).changeRequested = true;
666
+ queueMicrotask(() => {
667
+ delete getPrivate(renditionList).changeRequested;
668
+ const track = getPrivate(rendition).track;
669
+ if (!track.enabled) return;
670
+ renditionList.dispatchEvent(new Event("change"));
671
+ });
672
+ }
673
+ function getCurrentRenditions(renditionList) {
674
+ const media = getPrivate(renditionList).media;
675
+ return [...media.audioTracks].filter((track) => track.enabled).flatMap((track) => [...getPrivate(track).renditionSet]);
676
+ }
677
+ class AudioRenditionList extends EventTarget {
678
+ #addRenditionCallback;
679
+ #removeRenditionCallback;
680
+ #changeCallback;
681
+ [Symbol.iterator]() {
682
+ return getCurrentRenditions(this).values();
683
+ }
684
+ get length() {
685
+ return getCurrentRenditions(this).length;
686
+ }
687
+ getRenditionById(id) {
688
+ return getCurrentRenditions(this).find((rendition) => `${rendition.id}` === `${id}`) ?? null;
689
+ }
690
+ get selectedIndex() {
691
+ return getCurrentRenditions(this).findIndex((rendition) => rendition.selected);
692
+ }
693
+ set selectedIndex(index) {
694
+ for (const [i, rendition] of getCurrentRenditions(this).entries()) {
695
+ rendition.selected = i === index;
696
+ }
697
+ }
698
+ get onaddrendition() {
699
+ return this.#addRenditionCallback;
700
+ }
701
+ set onaddrendition(callback) {
702
+ if (this.#addRenditionCallback) {
703
+ this.removeEventListener("addrendition", this.#addRenditionCallback);
704
+ this.#addRenditionCallback = void 0;
705
+ }
706
+ if (typeof callback == "function") {
707
+ this.#addRenditionCallback = callback;
708
+ this.addEventListener("addrendition", callback);
709
+ }
710
+ }
711
+ get onremoverendition() {
712
+ return this.#removeRenditionCallback;
713
+ }
714
+ set onremoverendition(callback) {
715
+ if (this.#removeRenditionCallback) {
716
+ this.removeEventListener("removerendition", this.#removeRenditionCallback);
717
+ this.#removeRenditionCallback = void 0;
718
+ }
719
+ if (typeof callback == "function") {
720
+ this.#removeRenditionCallback = callback;
721
+ this.addEventListener("removerendition", callback);
722
+ }
723
+ }
724
+ get onchange() {
725
+ return this.#changeCallback;
726
+ }
727
+ set onchange(callback) {
728
+ if (this.#changeCallback) {
729
+ this.removeEventListener("change", this.#changeCallback);
730
+ this.#changeCallback = void 0;
731
+ }
732
+ if (typeof callback == "function") {
733
+ this.#changeCallback = callback;
734
+ this.addEventListener("change", callback);
735
+ }
736
+ }
737
+ }
738
+
739
+ class AudioRendition {
740
+ src;
741
+ id;
742
+ bitrate;
743
+ codec;
744
+ #selected = false;
745
+ get selected() {
746
+ return this.#selected;
747
+ }
748
+ set selected(val) {
749
+ if (this.#selected === val) return;
750
+ this.#selected = val;
751
+ selectedChanged(this);
752
+ }
753
+ }
754
+
755
+ function addAudioTrack(media, track) {
756
+ const trackList = media.audioTracks;
757
+ getPrivate(track).media = media;
758
+ if (!getPrivate(track).renditionSet) {
759
+ getPrivate(track).renditionSet = /* @__PURE__ */ new Set();
760
+ }
761
+ const trackSet = getPrivate(trackList).trackSet;
762
+ trackSet.add(track);
763
+ const index = trackSet.size - 1;
764
+ if (!(index in AudioTrackList.prototype)) {
765
+ Object.defineProperty(AudioTrackList.prototype, index, {
766
+ get() {
767
+ return [...getPrivate(this).trackSet][index];
768
+ }
769
+ });
770
+ }
771
+ queueMicrotask(() => {
772
+ trackList.dispatchEvent(new TrackEvent("addtrack", { track }));
773
+ });
774
+ }
775
+ function removeAudioTrack(track) {
776
+ const trackList = getPrivate(track).media?.audioTracks;
777
+ if (!trackList) return;
778
+ const trackSet = getPrivate(trackList).trackSet;
779
+ trackSet.delete(track);
780
+ queueMicrotask(() => {
781
+ trackList.dispatchEvent(new TrackEvent("removetrack", { track }));
782
+ });
783
+ }
784
+ function enabledChanged(track) {
785
+ const trackList = getPrivate(track).media.audioTracks;
786
+ if (!trackList || getPrivate(trackList).changeRequested) return;
787
+ getPrivate(trackList).changeRequested = true;
788
+ queueMicrotask(() => {
789
+ delete getPrivate(trackList).changeRequested;
790
+ trackList.dispatchEvent(new Event("change"));
791
+ });
792
+ }
793
+ class AudioTrackList extends EventTarget {
794
+ #addTrackCallback;
795
+ #removeTrackCallback;
796
+ #changeCallback;
797
+ constructor() {
798
+ super();
799
+ getPrivate(this).trackSet = /* @__PURE__ */ new Set();
800
+ }
801
+ get #tracks() {
802
+ return getPrivate(this).trackSet;
803
+ }
804
+ [Symbol.iterator]() {
805
+ return this.#tracks.values();
806
+ }
807
+ get length() {
808
+ return this.#tracks.size;
809
+ }
810
+ getTrackById(id) {
811
+ return [...this.#tracks].find((track) => track.id === id) ?? null;
812
+ }
813
+ get onaddtrack() {
814
+ return this.#addTrackCallback;
815
+ }
816
+ set onaddtrack(callback) {
817
+ if (this.#addTrackCallback) {
818
+ this.removeEventListener("addtrack", this.#addTrackCallback);
819
+ this.#addTrackCallback = void 0;
820
+ }
821
+ if (typeof callback == "function") {
822
+ this.#addTrackCallback = callback;
823
+ this.addEventListener("addtrack", callback);
824
+ }
825
+ }
826
+ get onremovetrack() {
827
+ return this.#removeTrackCallback;
828
+ }
829
+ set onremovetrack(callback) {
830
+ if (this.#removeTrackCallback) {
831
+ this.removeEventListener("removetrack", this.#removeTrackCallback);
832
+ this.#removeTrackCallback = void 0;
833
+ }
834
+ if (typeof callback == "function") {
835
+ this.#removeTrackCallback = callback;
836
+ this.addEventListener("removetrack", callback);
837
+ }
838
+ }
839
+ get onchange() {
840
+ return this.#changeCallback;
841
+ }
842
+ set onchange(callback) {
843
+ if (this.#changeCallback) {
844
+ this.removeEventListener("change", this.#changeCallback);
845
+ this.#changeCallback = void 0;
846
+ }
847
+ if (typeof callback == "function") {
848
+ this.#changeCallback = callback;
849
+ this.addEventListener("change", callback);
850
+ }
851
+ }
852
+ }
853
+
854
+ class AudioTrack {
855
+ id;
856
+ kind;
857
+ label = "";
858
+ language = "";
859
+ sourceBuffer;
860
+ #enabled = false;
861
+ addRendition(src, codec, bitrate) {
862
+ const rendition = new AudioRendition();
863
+ rendition.src = src;
864
+ rendition.codec = codec;
865
+ rendition.bitrate = bitrate;
866
+ addRendition(this, rendition);
867
+ return rendition;
868
+ }
869
+ removeRendition(rendition) {
870
+ removeRendition(rendition);
871
+ }
872
+ get enabled() {
873
+ return this.#enabled;
874
+ }
875
+ set enabled(val) {
876
+ if (this.#enabled === val) return;
877
+ this.#enabled = val;
878
+ enabledChanged(this);
879
+ }
880
+ }
881
+
882
+ const nativeVideoTracksFn = getBaseMediaTracksFn(globalThis.HTMLMediaElement, "video");
883
+ const nativeAudioTracksFn = getBaseMediaTracksFn(globalThis.HTMLMediaElement, "audio");
884
+ function MediaTracksMixin(MediaElementClass) {
885
+ if (!MediaElementClass?.prototype) return MediaElementClass;
886
+ const videoTracksFn = getBaseMediaTracksFn(MediaElementClass, "video");
887
+ if (!videoTracksFn || `${videoTracksFn}`.includes("[native code]")) {
888
+ Object.defineProperty(MediaElementClass.prototype, "videoTracks", {
889
+ get() {
890
+ return getVideoTracks(this);
891
+ }
892
+ });
893
+ }
894
+ const audioTracksFn = getBaseMediaTracksFn(MediaElementClass, "audio");
895
+ if (!audioTracksFn || `${audioTracksFn}`.includes("[native code]")) {
896
+ Object.defineProperty(MediaElementClass.prototype, "audioTracks", {
897
+ get() {
898
+ return getAudioTracks(this);
899
+ }
900
+ });
901
+ }
902
+ if (!("addVideoTrack" in MediaElementClass.prototype)) {
903
+ MediaElementClass.prototype.addVideoTrack = function(kind, label = "", language = "") {
904
+ const track = new VideoTrack();
905
+ track.kind = kind;
906
+ track.label = label;
907
+ track.language = language;
908
+ addVideoTrack(this, track);
909
+ return track;
910
+ };
911
+ }
912
+ if (!("removeVideoTrack" in MediaElementClass.prototype)) {
913
+ MediaElementClass.prototype.removeVideoTrack = removeVideoTrack;
914
+ }
915
+ if (!("addAudioTrack" in MediaElementClass.prototype)) {
916
+ MediaElementClass.prototype.addAudioTrack = function(kind, label = "", language = "") {
917
+ const track = new AudioTrack();
918
+ track.kind = kind;
919
+ track.label = label;
920
+ track.language = language;
921
+ addAudioTrack(this, track);
922
+ return track;
923
+ };
924
+ }
925
+ if (!("removeAudioTrack" in MediaElementClass.prototype)) {
926
+ MediaElementClass.prototype.removeAudioTrack = removeAudioTrack;
927
+ }
928
+ if (!("videoRenditions" in MediaElementClass.prototype)) {
929
+ Object.defineProperty(MediaElementClass.prototype, "videoRenditions", {
930
+ get() {
931
+ return initVideoRenditions(this);
932
+ }
933
+ });
934
+ }
935
+ const initVideoRenditions = (media) => {
936
+ let renditions = getPrivate(media).videoRenditions;
937
+ if (!renditions) {
938
+ renditions = new VideoRenditionList();
939
+ getPrivate(renditions).media = media;
940
+ getPrivate(media).videoRenditions = renditions;
941
+ }
942
+ return renditions;
943
+ };
944
+ if (!("audioRenditions" in MediaElementClass.prototype)) {
945
+ Object.defineProperty(MediaElementClass.prototype, "audioRenditions", {
946
+ get() {
947
+ return initAudioRenditions(this);
948
+ }
949
+ });
950
+ }
951
+ const initAudioRenditions = (media) => {
952
+ let renditions = getPrivate(media).audioRenditions;
953
+ if (!renditions) {
954
+ renditions = new AudioRenditionList();
955
+ getPrivate(renditions).media = media;
956
+ getPrivate(media).audioRenditions = renditions;
957
+ }
958
+ return renditions;
959
+ };
960
+ return MediaElementClass;
961
+ }
962
+ function getBaseMediaTracksFn(MediaElementClass, type) {
963
+ if (MediaElementClass?.prototype) {
964
+ return Object.getOwnPropertyDescriptor(MediaElementClass.prototype, `${type}Tracks`)?.get;
965
+ }
966
+ }
967
+ function getVideoTracks(media) {
968
+ let tracks = getPrivate(media).videoTracks;
969
+ if (!tracks) {
970
+ tracks = new VideoTrackList();
971
+ getPrivate(media).videoTracks = tracks;
972
+ if (nativeVideoTracksFn) {
973
+ const nativeTracks = nativeVideoTracksFn.call(media.nativeEl ?? media);
974
+ for (const nativeTrack of nativeTracks) {
975
+ addVideoTrack(media, nativeTrack);
976
+ }
977
+ nativeTracks.addEventListener("change", () => {
978
+ tracks.dispatchEvent(new Event("change"));
979
+ });
980
+ nativeTracks.addEventListener("addtrack", (event) => {
981
+ if ([...tracks].some((t) => t instanceof VideoTrack)) {
982
+ for (const nativeTrack of nativeTracks) {
983
+ removeVideoTrack(nativeTrack);
984
+ }
985
+ return;
986
+ }
987
+ addVideoTrack(media, event.track);
988
+ });
989
+ nativeTracks.addEventListener("removetrack", (event) => {
990
+ removeVideoTrack(event.track);
991
+ });
992
+ }
993
+ }
994
+ return tracks;
995
+ }
996
+ function getAudioTracks(media) {
997
+ let tracks = getPrivate(media).audioTracks;
998
+ if (!tracks) {
999
+ tracks = new AudioTrackList();
1000
+ getPrivate(media).audioTracks = tracks;
1001
+ if (nativeAudioTracksFn) {
1002
+ const nativeTracks = nativeAudioTracksFn.call(media.nativeEl ?? media);
1003
+ for (const nativeTrack of nativeTracks) {
1004
+ addAudioTrack(media, nativeTrack);
1005
+ }
1006
+ nativeTracks.addEventListener("change", () => {
1007
+ tracks.dispatchEvent(new Event("change"));
1008
+ });
1009
+ nativeTracks.addEventListener("addtrack", (event) => {
1010
+ if ([...tracks].some((t) => t instanceof AudioTrack)) {
1011
+ for (const nativeTrack of nativeTracks) {
1012
+ removeAudioTrack(nativeTrack);
1013
+ }
1014
+ return;
1015
+ }
1016
+ addAudioTrack(media, event.track);
1017
+ });
1018
+ nativeTracks.addEventListener("removetrack", (event) => {
1019
+ removeAudioTrack(event.track);
1020
+ });
1021
+ }
1022
+ }
1023
+ return tracks;
1024
+ }
1025
+
1026
+ exports.CustomVideoElement = CustomVideoElement;
1027
+ exports.MediaTracksMixin = MediaTracksMixin;