@ix_waterford/lib 1.0.6 → 1.0.8
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.
- package/dist/index.html +1 -1
- package/dist/index.js +122379 -0
- package/dist/index.js.map +1 -0
- package/package.json +5 -5
- package/dist/static/js/async/reactPlayerDash.js +0 -351
- package/dist/static/js/async/reactPlayerDash.js.map +0 -1
- package/dist/static/js/async/reactPlayerHls.js +0 -430
- package/dist/static/js/async/reactPlayerHls.js.map +0 -1
- package/dist/static/js/async/reactPlayerMux.js +0 -16076
- package/dist/static/js/async/reactPlayerMux.js.map +0 -1
- package/dist/static/js/async/reactPlayerPreview.js +0 -112
- package/dist/static/js/async/reactPlayerPreview.js.map +0 -1
- package/dist/static/js/async/reactPlayerSpotify.js +0 -519
- package/dist/static/js/async/reactPlayerSpotify.js.map +0 -1
- package/dist/static/js/async/reactPlayerTiktok.js +0 -489
- package/dist/static/js/async/reactPlayerTiktok.js.map +0 -1
- package/dist/static/js/async/reactPlayerTwitch.js +0 -587
- package/dist/static/js/async/reactPlayerTwitch.js.map +0 -1
- package/dist/static/js/async/reactPlayerVimeo.js +0 -4265
- package/dist/static/js/async/reactPlayerVimeo.js.map +0 -1
- package/dist/static/js/async/reactPlayerWistia.js +0 -768
- package/dist/static/js/async/reactPlayerWistia.js.map +0 -1
- package/dist/static/js/async/reactPlayerYouTube.js +0 -739
- package/dist/static/js/async/reactPlayerYouTube.js.map +0 -1
- package/dist/static/js/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js +0 -1254
- package/dist/static/js/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js.map +0 -1
- package/dist/static/js/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js +0 -22
- package/dist/static/js/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +0 -1
- package/dist/static/js/async/vendors-node_modules_hls_js_dist_hls_mjs.js +0 -36692
- package/dist/static/js/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +0 -1
- package/dist/static/js/index.js +0 -6362
- package/dist/static/js/index.js.map +0 -1
- package/dist/static/js/lib-react.js +0 -3235
- package/dist/static/js/lib-react.js.map +0 -1
- package/dist/static/js/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-897cfa.js +0 -113737
- package/dist/static/js/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-897cfa.js.map +0 -1
|
@@ -1,587 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(self["webpackChunk_ix_waterford_lib"] = self["webpackChunk_ix_waterford_lib"] || []).push([["reactPlayerTwitch"], {
|
|
3
|
-
"./node_modules/twitch-video-element/dist/react.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
4
|
-
__webpack_require__.r(__webpack_exports__);
|
|
5
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
6
|
-
"default": () => (react_default)
|
|
7
|
-
});
|
|
8
|
-
/* import */var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/react/index.js");
|
|
9
|
-
/* import */var _twitch_video_element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/twitch-video-element/dist/twitch-video-element.js");
|
|
10
|
-
"use client";
|
|
11
|
-
|
|
12
|
-
// dist/react.ts
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// ../../node_modules/ce-la-react/dist/ce-la-react.js
|
|
17
|
-
var reservedReactProps = /* @__PURE__ */ new Set([
|
|
18
|
-
"style",
|
|
19
|
-
"children",
|
|
20
|
-
"ref",
|
|
21
|
-
"key",
|
|
22
|
-
"suppressContentEditableWarning",
|
|
23
|
-
"suppressHydrationWarning",
|
|
24
|
-
"dangerouslySetInnerHTML"
|
|
25
|
-
]);
|
|
26
|
-
var reactPropToAttrNameMap = {
|
|
27
|
-
className: "class",
|
|
28
|
-
htmlFor: "for"
|
|
29
|
-
};
|
|
30
|
-
function defaultToAttributeName(propName) {
|
|
31
|
-
return propName.toLowerCase();
|
|
32
|
-
}
|
|
33
|
-
function defaultToAttributeValue(propValue) {
|
|
34
|
-
if (typeof propValue === "boolean") return propValue ? "" : void 0;
|
|
35
|
-
if (typeof propValue === "function") return void 0;
|
|
36
|
-
if (typeof propValue === "object" && propValue !== null) return void 0;
|
|
37
|
-
return propValue;
|
|
38
|
-
}
|
|
39
|
-
function createComponent({
|
|
40
|
-
react: React2,
|
|
41
|
-
tagName,
|
|
42
|
-
elementClass,
|
|
43
|
-
events,
|
|
44
|
-
displayName,
|
|
45
|
-
defaultProps,
|
|
46
|
-
toAttributeName = defaultToAttributeName,
|
|
47
|
-
toAttributeValue = defaultToAttributeValue
|
|
48
|
-
}) {
|
|
49
|
-
const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;
|
|
50
|
-
const ReactComponent = React2.forwardRef((props, ref) => {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
const elementRef = React2.useRef(null);
|
|
53
|
-
const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());
|
|
54
|
-
const eventProps = {};
|
|
55
|
-
const attrs = {};
|
|
56
|
-
const reactProps = {};
|
|
57
|
-
const elementProps = {};
|
|
58
|
-
for (const [k, v] of Object.entries(props)) {
|
|
59
|
-
if (reservedReactProps.has(k)) {
|
|
60
|
-
reactProps[k] = v;
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);
|
|
64
|
-
if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {
|
|
65
|
-
elementProps[k] = v;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (k.startsWith("on")) {
|
|
69
|
-
eventProps[k] = v;
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
const attrValue = toAttributeValue(v);
|
|
73
|
-
if (attrName && attrValue != null) {
|
|
74
|
-
attrs[attrName] = String(attrValue);
|
|
75
|
-
if (!IS_REACT_19_OR_NEWER) {
|
|
76
|
-
reactProps[attrName] = attrValue;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (attrName && IS_REACT_19_OR_NEWER) {
|
|
80
|
-
const attrValueFromDefault = defaultToAttributeValue(v);
|
|
81
|
-
if (attrValue !== attrValueFromDefault) {
|
|
82
|
-
reactProps[attrName] = attrValue;
|
|
83
|
-
} else {
|
|
84
|
-
reactProps[attrName] = v;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if (typeof window !== "undefined") {
|
|
89
|
-
for (const propName in eventProps) {
|
|
90
|
-
const callback = eventProps[propName];
|
|
91
|
-
const useCapture = propName.endsWith("Capture");
|
|
92
|
-
const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(
|
|
93
|
-
0,
|
|
94
|
-
useCapture ? -7 : void 0
|
|
95
|
-
);
|
|
96
|
-
React2.useLayoutEffect(() => {
|
|
97
|
-
const eventTarget = elementRef == null ? void 0 : elementRef.current;
|
|
98
|
-
if (!eventTarget || typeof callback !== "function") return;
|
|
99
|
-
eventTarget.addEventListener(eventName, callback, useCapture);
|
|
100
|
-
return () => {
|
|
101
|
-
eventTarget.removeEventListener(eventName, callback, useCapture);
|
|
102
|
-
};
|
|
103
|
-
}, [elementRef == null ? void 0 : elementRef.current, callback]);
|
|
104
|
-
}
|
|
105
|
-
React2.useLayoutEffect(() => {
|
|
106
|
-
if (elementRef.current === null) return;
|
|
107
|
-
const newElemProps = /* @__PURE__ */ new Map();
|
|
108
|
-
for (const key in elementProps) {
|
|
109
|
-
setProperty(elementRef.current, key, elementProps[key]);
|
|
110
|
-
prevElemPropsRef.current.delete(key);
|
|
111
|
-
newElemProps.set(key, elementProps[key]);
|
|
112
|
-
}
|
|
113
|
-
for (const [key, _value] of prevElemPropsRef.current) {
|
|
114
|
-
setProperty(elementRef.current, key, void 0);
|
|
115
|
-
}
|
|
116
|
-
prevElemPropsRef.current = newElemProps;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
if (typeof window === "undefined" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {
|
|
120
|
-
const { mode, delegatesFocus } = elementClass.shadowRootOptions;
|
|
121
|
-
const templateShadowRoot = React2.createElement("template", {
|
|
122
|
-
shadowrootmode: mode,
|
|
123
|
-
shadowrootdelegatesfocus: delegatesFocus,
|
|
124
|
-
dangerouslySetInnerHTML: {
|
|
125
|
-
__html: elementClass.getTemplateHTML(attrs, props)
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
reactProps.children = [templateShadowRoot, reactProps.children];
|
|
129
|
-
}
|
|
130
|
-
return React2.createElement(tagName, {
|
|
131
|
-
...defaultProps,
|
|
132
|
-
...reactProps,
|
|
133
|
-
ref: React2.useCallback(
|
|
134
|
-
(node) => {
|
|
135
|
-
elementRef.current = node;
|
|
136
|
-
if (typeof ref === "function") {
|
|
137
|
-
ref(node);
|
|
138
|
-
} else if (ref !== null) {
|
|
139
|
-
ref.current = node;
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
[ref]
|
|
143
|
-
)
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
ReactComponent.displayName = displayName ?? elementClass.name;
|
|
147
|
-
return ReactComponent;
|
|
148
|
-
}
|
|
149
|
-
function setProperty(node, name, value) {
|
|
150
|
-
var _a;
|
|
151
|
-
node[name] = value;
|
|
152
|
-
if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {
|
|
153
|
-
node.removeAttribute(name);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// dist/react.ts
|
|
158
|
-
var react_default = createComponent({
|
|
159
|
-
react: react__WEBPACK_IMPORTED_MODULE_0__,
|
|
160
|
-
tagName: "twitch-video",
|
|
161
|
-
elementClass: _twitch_video_element_js__WEBPACK_IMPORTED_MODULE_1__["default"],
|
|
162
|
-
toAttributeName(propName) {
|
|
163
|
-
if (propName === "muted") return "";
|
|
164
|
-
if (propName === "defaultMuted") return "muted";
|
|
165
|
-
return defaultToAttributeName(propName);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
/*! Bundled license information:
|
|
170
|
-
|
|
171
|
-
ce-la-react/dist/ce-la-react.js:
|
|
172
|
-
(**
|
|
173
|
-
* @license
|
|
174
|
-
* Copyright 2018 Google LLC
|
|
175
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
176
|
-
*
|
|
177
|
-
* Modified version of `@lit/react` for vanilla custom elements with support for SSR.
|
|
178
|
-
*)
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}),
|
|
183
|
-
"./node_modules/twitch-video-element/dist/twitch-video-element.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
184
|
-
__webpack_require__.r(__webpack_exports__);
|
|
185
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
186
|
-
"default": () => (twitch_video_element_default)
|
|
187
|
-
});
|
|
188
|
-
const EMBED_BASE = "https://player.twitch.tv";
|
|
189
|
-
const MATCH_VIDEO = /(?:www\.|go\.)?twitch\.tv\/(?:videos?\/|\?video=)(\d+)($|\?)/;
|
|
190
|
-
const MATCH_CHANNEL = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+)($|\?)/;
|
|
191
|
-
const PlaybackState = {
|
|
192
|
-
IDLE: "Idle",
|
|
193
|
-
READY: "Ready",
|
|
194
|
-
BUFFERING: "Buffering",
|
|
195
|
-
PLAYING: "Playing",
|
|
196
|
-
ENDED: "Ended"
|
|
197
|
-
};
|
|
198
|
-
const PlayerCommands = {
|
|
199
|
-
DISABLE_CAPTIONS: 0,
|
|
200
|
-
ENABLE_CAPTIONS: 1,
|
|
201
|
-
PAUSE: 2,
|
|
202
|
-
PLAY: 3,
|
|
203
|
-
SEEK: 4,
|
|
204
|
-
SET_CHANNEL: 5,
|
|
205
|
-
SET_CHANNEL_ID: 6,
|
|
206
|
-
SET_COLLECTION: 7,
|
|
207
|
-
SET_QUALITY: 8,
|
|
208
|
-
SET_VIDEO: 9,
|
|
209
|
-
SET_MUTED: 10,
|
|
210
|
-
SET_VOLUME: 11
|
|
211
|
-
};
|
|
212
|
-
function getTemplateHTML(attrs, props = {}) {
|
|
213
|
-
const iframeAttrs = {
|
|
214
|
-
src: serializeIframeUrl(attrs, props),
|
|
215
|
-
frameborder: "0",
|
|
216
|
-
width: "100%",
|
|
217
|
-
height: "100%",
|
|
218
|
-
allow: "accelerometer; fullscreen; autoplay; encrypted-media; picture-in-picture;",
|
|
219
|
-
sandbox: "allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
|
|
220
|
-
scrolling: "no"
|
|
221
|
-
};
|
|
222
|
-
if (props.config) {
|
|
223
|
-
iframeAttrs["data-config"] = JSON.stringify(props.config);
|
|
224
|
-
}
|
|
225
|
-
return (
|
|
226
|
-
/*html*/
|
|
227
|
-
`
|
|
228
|
-
<style>
|
|
229
|
-
:host {
|
|
230
|
-
display: inline-block;
|
|
231
|
-
min-width: 300px;
|
|
232
|
-
min-height: 150px;
|
|
233
|
-
position: relative;
|
|
234
|
-
}
|
|
235
|
-
iframe {
|
|
236
|
-
position: absolute;
|
|
237
|
-
top: 0;
|
|
238
|
-
left: 0;
|
|
239
|
-
width: 100%;
|
|
240
|
-
height: 100%;
|
|
241
|
-
}
|
|
242
|
-
:host(:not([controls])) {
|
|
243
|
-
pointer-events: none;
|
|
244
|
-
}
|
|
245
|
-
</style>
|
|
246
|
-
<iframe${serializeAttributes(iframeAttrs)}></iframe>
|
|
247
|
-
`
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
function serializeIframeUrl(attrs, props) {
|
|
251
|
-
var _a;
|
|
252
|
-
if (!attrs.src) return;
|
|
253
|
-
const videoMatch = attrs.src.match(MATCH_VIDEO);
|
|
254
|
-
const channelMatch = attrs.src.match(MATCH_CHANNEL);
|
|
255
|
-
const params = {
|
|
256
|
-
parent: (_a = globalThis.location) == null ? void 0 : _a.hostname,
|
|
257
|
-
// ?controls=true is enabled by default in the iframe
|
|
258
|
-
controls: attrs.controls === "" ? null : false,
|
|
259
|
-
autoplay: attrs.autoplay === "" ? null : false,
|
|
260
|
-
muted: attrs.muted,
|
|
261
|
-
preload: attrs.preload,
|
|
262
|
-
...props.config
|
|
263
|
-
};
|
|
264
|
-
if (videoMatch) {
|
|
265
|
-
const videoId = videoMatch[1];
|
|
266
|
-
return `${EMBED_BASE}/?video=v${videoId}&${serialize(params)}`;
|
|
267
|
-
} else if (channelMatch) {
|
|
268
|
-
const channel = channelMatch[1];
|
|
269
|
-
return `${EMBED_BASE}/?channel=${channel}&${serialize(params)}`;
|
|
270
|
-
}
|
|
271
|
-
return "";
|
|
272
|
-
}
|
|
273
|
-
class TwitchVideoElement extends (globalThis.HTMLElement ?? class {
|
|
274
|
-
}) {
|
|
275
|
-
static getTemplateHTML = getTemplateHTML;
|
|
276
|
-
static shadowRootOptions = { mode: "open" };
|
|
277
|
-
static observedAttributes = ["autoplay", "controls", "loop", "muted", "playsinline", "preload", "src"];
|
|
278
|
-
loadComplete = new PublicPromise();
|
|
279
|
-
#loadRequested;
|
|
280
|
-
#hasLoaded;
|
|
281
|
-
#iframe;
|
|
282
|
-
#playerState = {};
|
|
283
|
-
#currentTime = 0;
|
|
284
|
-
#muted = false;
|
|
285
|
-
#volume = 1;
|
|
286
|
-
#paused = !this.autoplay;
|
|
287
|
-
#seeking = false;
|
|
288
|
-
#readyState = 0;
|
|
289
|
-
#config = null;
|
|
290
|
-
constructor() {
|
|
291
|
-
super();
|
|
292
|
-
this.#upgradeProperty("config");
|
|
293
|
-
}
|
|
294
|
-
get config() {
|
|
295
|
-
return this.#config;
|
|
296
|
-
}
|
|
297
|
-
set config(value) {
|
|
298
|
-
this.#config = value;
|
|
299
|
-
}
|
|
300
|
-
async load() {
|
|
301
|
-
if (this.#loadRequested) return;
|
|
302
|
-
if (!this.shadowRoot) {
|
|
303
|
-
this.attachShadow({ mode: "open" });
|
|
304
|
-
}
|
|
305
|
-
const isFirstLoad = !this.#hasLoaded;
|
|
306
|
-
if (this.#hasLoaded) {
|
|
307
|
-
this.loadComplete = new PublicPromise();
|
|
308
|
-
}
|
|
309
|
-
this.#hasLoaded = true;
|
|
310
|
-
await (this.#loadRequested = Promise.resolve());
|
|
311
|
-
this.#loadRequested = null;
|
|
312
|
-
this.#readyState = 0;
|
|
313
|
-
this.dispatchEvent(new Event("emptied"));
|
|
314
|
-
if (!this.src) {
|
|
315
|
-
this.shadowRoot.innerHTML = "";
|
|
316
|
-
globalThis.removeEventListener("message", this.#onMessage);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
this.dispatchEvent(new Event("loadstart"));
|
|
320
|
-
let iframe = this.shadowRoot.querySelector("iframe");
|
|
321
|
-
const attrs = namedNodeMapToObject(this.attributes);
|
|
322
|
-
if (isFirstLoad && iframe) {
|
|
323
|
-
this.#config = JSON.parse(iframe.getAttribute("data-config") || "{}");
|
|
324
|
-
}
|
|
325
|
-
if (!(iframe == null ? void 0 : iframe.src) || iframe.src !== serializeIframeUrl(attrs, this)) {
|
|
326
|
-
this.shadowRoot.innerHTML = getTemplateHTML(attrs, this);
|
|
327
|
-
iframe = this.shadowRoot.querySelector("iframe");
|
|
328
|
-
}
|
|
329
|
-
this.#iframe = iframe;
|
|
330
|
-
globalThis.addEventListener("message", this.#onMessage);
|
|
331
|
-
}
|
|
332
|
-
attributeChangedCallback(attrName, oldValue, newValue) {
|
|
333
|
-
if (oldValue === newValue) return;
|
|
334
|
-
switch (attrName) {
|
|
335
|
-
case "src":
|
|
336
|
-
case "controls": {
|
|
337
|
-
this.load();
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
getVideoPlaybackQuality() {
|
|
343
|
-
return this.#playerState.stats.videoStats;
|
|
344
|
-
}
|
|
345
|
-
get src() {
|
|
346
|
-
return this.getAttribute("src");
|
|
347
|
-
}
|
|
348
|
-
set src(value) {
|
|
349
|
-
this.setAttribute("src", value);
|
|
350
|
-
}
|
|
351
|
-
get readyState() {
|
|
352
|
-
return this.#readyState;
|
|
353
|
-
}
|
|
354
|
-
get seeking() {
|
|
355
|
-
return this.#seeking;
|
|
356
|
-
}
|
|
357
|
-
get buffered() {
|
|
358
|
-
var _a, _b;
|
|
359
|
-
return createTimeRanges(0, ((_b = (_a = this.#playerState.stats) == null ? void 0 : _a.videoStats) == null ? void 0 : _b.bufferSize) ?? 0);
|
|
360
|
-
}
|
|
361
|
-
get paused() {
|
|
362
|
-
if (!this.#playerState.playback) return this.#paused;
|
|
363
|
-
return this.#playerState.playback === PlaybackState.IDLE;
|
|
364
|
-
}
|
|
365
|
-
get ended() {
|
|
366
|
-
if (!this.#playerState.playback) return false;
|
|
367
|
-
return this.#playerState.playback === PlaybackState.ENDED;
|
|
368
|
-
}
|
|
369
|
-
get duration() {
|
|
370
|
-
return this.#playerState.duration ?? NaN;
|
|
371
|
-
}
|
|
372
|
-
get autoplay() {
|
|
373
|
-
return this.hasAttribute("autoplay");
|
|
374
|
-
}
|
|
375
|
-
set autoplay(val) {
|
|
376
|
-
if (this.autoplay == val) return;
|
|
377
|
-
this.toggleAttribute("autoplay", Boolean(val));
|
|
378
|
-
}
|
|
379
|
-
get controls() {
|
|
380
|
-
return this.hasAttribute("controls");
|
|
381
|
-
}
|
|
382
|
-
set controls(val) {
|
|
383
|
-
if (this.controls == val) return;
|
|
384
|
-
this.toggleAttribute("controls", Boolean(val));
|
|
385
|
-
}
|
|
386
|
-
get currentTime() {
|
|
387
|
-
if (!this.#playerState.currentTime) return this.#currentTime;
|
|
388
|
-
return this.#playerState.currentTime;
|
|
389
|
-
}
|
|
390
|
-
set currentTime(val) {
|
|
391
|
-
this.#currentTime = val;
|
|
392
|
-
this.loadComplete.then(() => {
|
|
393
|
-
this.#sendCommand(PlayerCommands.SEEK, val);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
get defaultMuted() {
|
|
397
|
-
return this.hasAttribute("muted");
|
|
398
|
-
}
|
|
399
|
-
set defaultMuted(val) {
|
|
400
|
-
this.toggleAttribute("muted", Boolean(val));
|
|
401
|
-
}
|
|
402
|
-
get loop() {
|
|
403
|
-
return this.hasAttribute("loop");
|
|
404
|
-
}
|
|
405
|
-
set loop(val) {
|
|
406
|
-
this.toggleAttribute("loop", Boolean(val));
|
|
407
|
-
}
|
|
408
|
-
get muted() {
|
|
409
|
-
return this.#muted;
|
|
410
|
-
}
|
|
411
|
-
set muted(val) {
|
|
412
|
-
this.#muted = val;
|
|
413
|
-
this.loadComplete.then(() => {
|
|
414
|
-
this.#sendCommand(PlayerCommands.SET_MUTED, val);
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
get volume() {
|
|
418
|
-
return this.#volume;
|
|
419
|
-
}
|
|
420
|
-
set volume(val) {
|
|
421
|
-
this.#volume = val;
|
|
422
|
-
this.loadComplete.then(() => {
|
|
423
|
-
this.#sendCommand(PlayerCommands.SET_VOLUME, val);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
get playsInline() {
|
|
427
|
-
return this.hasAttribute("playsinline");
|
|
428
|
-
}
|
|
429
|
-
set playsInline(val) {
|
|
430
|
-
this.toggleAttribute("playsinline", Boolean(val));
|
|
431
|
-
}
|
|
432
|
-
play() {
|
|
433
|
-
this.#paused = false;
|
|
434
|
-
this.#sendCommand(PlayerCommands.PLAY);
|
|
435
|
-
}
|
|
436
|
-
pause() {
|
|
437
|
-
this.#paused = true;
|
|
438
|
-
this.#sendCommand(PlayerCommands.PAUSE);
|
|
439
|
-
}
|
|
440
|
-
#onMessage = async (event) => {
|
|
441
|
-
var _a, _b, _c, _d;
|
|
442
|
-
if (!this.#iframe.contentWindow) return;
|
|
443
|
-
const { data, source } = event;
|
|
444
|
-
const isFromEmbedWindow = source === this.#iframe.contentWindow;
|
|
445
|
-
if (!isFromEmbedWindow) return;
|
|
446
|
-
if (data.namespace === "twitch-embed") {
|
|
447
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
448
|
-
if (data.eventName === "ready") {
|
|
449
|
-
this.dispatchEvent(new Event("loadcomplete"));
|
|
450
|
-
this.loadComplete.resolve();
|
|
451
|
-
this.#readyState = 1;
|
|
452
|
-
this.dispatchEvent(new Event("loadedmetadata"));
|
|
453
|
-
} else if (data.eventName === "seek") {
|
|
454
|
-
this.#seeking = true;
|
|
455
|
-
this.dispatchEvent(new Event("seeking"));
|
|
456
|
-
} else if (data.eventName === "playing") {
|
|
457
|
-
if (this.#seeking) {
|
|
458
|
-
this.#seeking = false;
|
|
459
|
-
this.dispatchEvent(new Event("seeked"));
|
|
460
|
-
}
|
|
461
|
-
this.#readyState = 3;
|
|
462
|
-
this.dispatchEvent(new Event("playing"));
|
|
463
|
-
} else {
|
|
464
|
-
this.dispatchEvent(new Event(data.eventName));
|
|
465
|
-
}
|
|
466
|
-
} else if (data.namespace === "twitch-embed-player-proxy" && data.eventName === "UPDATE_STATE") {
|
|
467
|
-
const oldDuration = this.#playerState.duration;
|
|
468
|
-
const oldCurrentTime = this.#playerState.currentTime;
|
|
469
|
-
const oldVolume = this.#playerState.volume;
|
|
470
|
-
const oldMuted = this.#playerState.muted;
|
|
471
|
-
const oldBuffered = (_b = (_a = this.#playerState.stats) == null ? void 0 : _a.videoStats) == null ? void 0 : _b.bufferSize;
|
|
472
|
-
this.#playerState = { ...this.#playerState, ...data.params };
|
|
473
|
-
if (oldDuration !== this.#playerState.duration) {
|
|
474
|
-
this.dispatchEvent(new Event("durationchange"));
|
|
475
|
-
}
|
|
476
|
-
if (oldCurrentTime !== this.#playerState.currentTime) {
|
|
477
|
-
this.dispatchEvent(new Event("timeupdate"));
|
|
478
|
-
}
|
|
479
|
-
if (oldVolume !== this.#playerState.volume || oldMuted !== this.#playerState.muted) {
|
|
480
|
-
if (this.#playerState.volume !== void 0) {
|
|
481
|
-
this.#volume = this.#playerState.volume;
|
|
482
|
-
}
|
|
483
|
-
if (this.#playerState.muted !== void 0) {
|
|
484
|
-
this.#muted = this.#playerState.muted;
|
|
485
|
-
}
|
|
486
|
-
this.dispatchEvent(new Event("volumechange"));
|
|
487
|
-
}
|
|
488
|
-
if (oldBuffered !== ((_d = (_c = this.#playerState.stats) == null ? void 0 : _c.videoStats) == null ? void 0 : _d.bufferSize)) {
|
|
489
|
-
this.dispatchEvent(new Event("progress"));
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
#sendCommand(command, params) {
|
|
494
|
-
if (!this.#iframe.contentWindow) return;
|
|
495
|
-
const message = {
|
|
496
|
-
eventName: command,
|
|
497
|
-
params,
|
|
498
|
-
namespace: "twitch-embed-player-proxy"
|
|
499
|
-
};
|
|
500
|
-
this.#iframe.contentWindow.postMessage(message, EMBED_BASE);
|
|
501
|
-
}
|
|
502
|
-
// This is a pattern to update property values that are set before
|
|
503
|
-
// the custom element is upgraded.
|
|
504
|
-
// https://web.dev/custom-elements-best-practices/#make-properties-lazy
|
|
505
|
-
#upgradeProperty(prop) {
|
|
506
|
-
if (Object.prototype.hasOwnProperty.call(this, prop)) {
|
|
507
|
-
const value = this[prop];
|
|
508
|
-
delete this[prop];
|
|
509
|
-
this[prop] = value;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
function namedNodeMapToObject(namedNodeMap) {
|
|
514
|
-
let obj = {};
|
|
515
|
-
for (let attr of namedNodeMap) {
|
|
516
|
-
obj[attr.name] = attr.value;
|
|
517
|
-
}
|
|
518
|
-
return obj;
|
|
519
|
-
}
|
|
520
|
-
function serializeAttributes(attrs) {
|
|
521
|
-
let html = "";
|
|
522
|
-
for (const key in attrs) {
|
|
523
|
-
const value = attrs[key];
|
|
524
|
-
if (value === "") html += ` ${escapeHtml(key)}`;
|
|
525
|
-
else html += ` ${escapeHtml(key)}="${escapeHtml(`${value}`)}"`;
|
|
526
|
-
}
|
|
527
|
-
return html;
|
|
528
|
-
}
|
|
529
|
-
function escapeHtml(str) {
|
|
530
|
-
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/`/g, "`");
|
|
531
|
-
}
|
|
532
|
-
function serialize(props) {
|
|
533
|
-
return String(new URLSearchParams(filterParams(props)));
|
|
534
|
-
}
|
|
535
|
-
function filterParams(props) {
|
|
536
|
-
let p = {};
|
|
537
|
-
for (let key in props) {
|
|
538
|
-
let val = props[key];
|
|
539
|
-
if (val === true || val === "") p[key] = true;
|
|
540
|
-
else if (val === false) p[key] = false;
|
|
541
|
-
else if (val != null) p[key] = val;
|
|
542
|
-
}
|
|
543
|
-
return p;
|
|
544
|
-
}
|
|
545
|
-
class PublicPromise extends Promise {
|
|
546
|
-
constructor(executor = () => {
|
|
547
|
-
}) {
|
|
548
|
-
let res, rej;
|
|
549
|
-
super((resolve, reject) => {
|
|
550
|
-
executor(resolve, reject);
|
|
551
|
-
res = resolve;
|
|
552
|
-
rej = reject;
|
|
553
|
-
});
|
|
554
|
-
this.resolve = res;
|
|
555
|
-
this.reject = rej;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
function createTimeRanges(start, end) {
|
|
559
|
-
if (Array.isArray(start)) {
|
|
560
|
-
return createTimeRangesObj(start);
|
|
561
|
-
} else if (start == null || end == null || start === 0 && end === 0) {
|
|
562
|
-
return createTimeRangesObj([[0, 0]]);
|
|
563
|
-
}
|
|
564
|
-
return createTimeRangesObj([[start, end]]);
|
|
565
|
-
}
|
|
566
|
-
function createTimeRangesObj(ranges) {
|
|
567
|
-
Object.defineProperties(ranges, {
|
|
568
|
-
start: {
|
|
569
|
-
value: (i) => ranges[i][0]
|
|
570
|
-
},
|
|
571
|
-
end: {
|
|
572
|
-
value: (i) => ranges[i][1]
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
return ranges;
|
|
576
|
-
}
|
|
577
|
-
if (globalThis.customElements && !globalThis.customElements.get("twitch-video")) {
|
|
578
|
-
globalThis.customElements.define("twitch-video", TwitchVideoElement);
|
|
579
|
-
}
|
|
580
|
-
var twitch_video_element_default = TwitchVideoElement;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}),
|
|
585
|
-
|
|
586
|
-
}]);
|
|
587
|
-
//# sourceMappingURL=reactPlayerTwitch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"static/js/async/reactPlayerTwitch.js","sources":["/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/twitch-video-element/dist/react.js","/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/twitch-video-element/dist/twitch-video-element.js"],"sourcesContent":["\"use client\";\n\n// dist/react.ts\nimport React from \"react\";\nimport CustomMediaElement from \"./twitch-video-element.js\";\n\n// ../../node_modules/ce-la-react/dist/ce-la-react.js\nvar reservedReactProps = /* @__PURE__ */ new Set([\n \"style\",\n \"children\",\n \"ref\",\n \"key\",\n \"suppressContentEditableWarning\",\n \"suppressHydrationWarning\",\n \"dangerouslySetInnerHTML\"\n]);\nvar reactPropToAttrNameMap = {\n className: \"class\",\n htmlFor: \"for\"\n};\nfunction defaultToAttributeName(propName) {\n return propName.toLowerCase();\n}\nfunction defaultToAttributeValue(propValue) {\n if (typeof propValue === \"boolean\") return propValue ? \"\" : void 0;\n if (typeof propValue === \"function\") return void 0;\n if (typeof propValue === \"object\" && propValue !== null) return void 0;\n return propValue;\n}\nfunction createComponent({\n react: React2,\n tagName,\n elementClass,\n events,\n displayName,\n defaultProps,\n toAttributeName = defaultToAttributeName,\n toAttributeValue = defaultToAttributeValue\n}) {\n const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;\n const ReactComponent = React2.forwardRef((props, ref) => {\n var _a, _b;\n const elementRef = React2.useRef(null);\n const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());\n const eventProps = {};\n const attrs = {};\n const reactProps = {};\n const elementProps = {};\n for (const [k, v] of Object.entries(props)) {\n if (reservedReactProps.has(k)) {\n reactProps[k] = v;\n continue;\n }\n const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);\n if (elementClass.prototype && k in elementClass.prototype && !(k in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) && !((_b = elementClass.observedAttributes) == null ? void 0 : _b.some((attr) => attr === attrName))) {\n elementProps[k] = v;\n continue;\n }\n if (k.startsWith(\"on\")) {\n eventProps[k] = v;\n continue;\n }\n const attrValue = toAttributeValue(v);\n if (attrName && attrValue != null) {\n attrs[attrName] = String(attrValue);\n if (!IS_REACT_19_OR_NEWER) {\n reactProps[attrName] = attrValue;\n }\n }\n if (attrName && IS_REACT_19_OR_NEWER) {\n const attrValueFromDefault = defaultToAttributeValue(v);\n if (attrValue !== attrValueFromDefault) {\n reactProps[attrName] = attrValue;\n } else {\n reactProps[attrName] = v;\n }\n }\n }\n if (typeof window !== \"undefined\") {\n for (const propName in eventProps) {\n const callback = eventProps[propName];\n const useCapture = propName.endsWith(\"Capture\");\n const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(\n 0,\n useCapture ? -7 : void 0\n );\n React2.useLayoutEffect(() => {\n const eventTarget = elementRef == null ? void 0 : elementRef.current;\n if (!eventTarget || typeof callback !== \"function\") return;\n eventTarget.addEventListener(eventName, callback, useCapture);\n return () => {\n eventTarget.removeEventListener(eventName, callback, useCapture);\n };\n }, [elementRef == null ? void 0 : elementRef.current, callback]);\n }\n React2.useLayoutEffect(() => {\n if (elementRef.current === null) return;\n const newElemProps = /* @__PURE__ */ new Map();\n for (const key in elementProps) {\n setProperty(elementRef.current, key, elementProps[key]);\n prevElemPropsRef.current.delete(key);\n newElemProps.set(key, elementProps[key]);\n }\n for (const [key, _value] of prevElemPropsRef.current) {\n setProperty(elementRef.current, key, void 0);\n }\n prevElemPropsRef.current = newElemProps;\n });\n }\n if (typeof window === \"undefined\" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {\n const { mode, delegatesFocus } = elementClass.shadowRootOptions;\n const templateShadowRoot = React2.createElement(\"template\", {\n shadowrootmode: mode,\n shadowrootdelegatesfocus: delegatesFocus,\n dangerouslySetInnerHTML: {\n __html: elementClass.getTemplateHTML(attrs, props)\n }\n });\n reactProps.children = [templateShadowRoot, reactProps.children];\n }\n return React2.createElement(tagName, {\n ...defaultProps,\n ...reactProps,\n ref: React2.useCallback(\n (node) => {\n elementRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref !== null) {\n ref.current = node;\n }\n },\n [ref]\n )\n });\n });\n ReactComponent.displayName = displayName ?? elementClass.name;\n return ReactComponent;\n}\nfunction setProperty(node, name, value) {\n var _a;\n node[name] = value;\n if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {\n node.removeAttribute(name);\n }\n}\n\n// dist/react.ts\nvar react_default = createComponent({\n react: React,\n tagName: \"twitch-video\",\n elementClass: CustomMediaElement,\n toAttributeName(propName) {\n if (propName === \"muted\") return \"\";\n if (propName === \"defaultMuted\") return \"muted\";\n return defaultToAttributeName(propName);\n }\n});\nexport {\n react_default as default\n};\n/*! Bundled license information:\n\nce-la-react/dist/ce-la-react.js:\n (**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n *\n * Modified version of `@lit/react` for vanilla custom elements with support for SSR.\n *)\n*/\n","const EMBED_BASE = \"https://player.twitch.tv\";\nconst MATCH_VIDEO = /(?:www\\.|go\\.)?twitch\\.tv\\/(?:videos?\\/|\\?video=)(\\d+)($|\\?)/;\nconst MATCH_CHANNEL = /(?:www\\.|go\\.)?twitch\\.tv\\/([a-zA-Z0-9_]+)($|\\?)/;\nconst PlaybackState = {\n IDLE: \"Idle\",\n READY: \"Ready\",\n BUFFERING: \"Buffering\",\n PLAYING: \"Playing\",\n ENDED: \"Ended\"\n};\nconst PlayerCommands = {\n DISABLE_CAPTIONS: 0,\n ENABLE_CAPTIONS: 1,\n PAUSE: 2,\n PLAY: 3,\n SEEK: 4,\n SET_CHANNEL: 5,\n SET_CHANNEL_ID: 6,\n SET_COLLECTION: 7,\n SET_QUALITY: 8,\n SET_VIDEO: 9,\n SET_MUTED: 10,\n SET_VOLUME: 11\n};\nfunction getTemplateHTML(attrs, props = {}) {\n const iframeAttrs = {\n src: serializeIframeUrl(attrs, props),\n frameborder: \"0\",\n width: \"100%\",\n height: \"100%\",\n allow: \"accelerometer; fullscreen; autoplay; encrypted-media; picture-in-picture;\",\n sandbox: \"allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox\",\n scrolling: \"no\"\n };\n if (props.config) {\n iframeAttrs[\"data-config\"] = JSON.stringify(props.config);\n }\n return (\n /*html*/\n `\n <style>\n :host {\n display: inline-block;\n min-width: 300px;\n min-height: 150px;\n position: relative;\n }\n iframe {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n :host(:not([controls])) {\n pointer-events: none;\n }\n </style>\n <iframe${serializeAttributes(iframeAttrs)}></iframe>\n `\n );\n}\nfunction serializeIframeUrl(attrs, props) {\n var _a;\n if (!attrs.src) return;\n const videoMatch = attrs.src.match(MATCH_VIDEO);\n const channelMatch = attrs.src.match(MATCH_CHANNEL);\n const params = {\n parent: (_a = globalThis.location) == null ? void 0 : _a.hostname,\n // ?controls=true is enabled by default in the iframe\n controls: attrs.controls === \"\" ? null : false,\n autoplay: attrs.autoplay === \"\" ? null : false,\n muted: attrs.muted,\n preload: attrs.preload,\n ...props.config\n };\n if (videoMatch) {\n const videoId = videoMatch[1];\n return `${EMBED_BASE}/?video=v${videoId}&${serialize(params)}`;\n } else if (channelMatch) {\n const channel = channelMatch[1];\n return `${EMBED_BASE}/?channel=${channel}&${serialize(params)}`;\n }\n return \"\";\n}\nclass TwitchVideoElement extends (globalThis.HTMLElement ?? class {\n}) {\n static getTemplateHTML = getTemplateHTML;\n static shadowRootOptions = { mode: \"open\" };\n static observedAttributes = [\"autoplay\", \"controls\", \"loop\", \"muted\", \"playsinline\", \"preload\", \"src\"];\n loadComplete = new PublicPromise();\n #loadRequested;\n #hasLoaded;\n #iframe;\n #playerState = {};\n #currentTime = 0;\n #muted = false;\n #volume = 1;\n #paused = !this.autoplay;\n #seeking = false;\n #readyState = 0;\n #config = null;\n constructor() {\n super();\n this.#upgradeProperty(\"config\");\n }\n get config() {\n return this.#config;\n }\n set config(value) {\n this.#config = value;\n }\n async load() {\n if (this.#loadRequested) return;\n if (!this.shadowRoot) {\n this.attachShadow({ mode: \"open\" });\n }\n const isFirstLoad = !this.#hasLoaded;\n if (this.#hasLoaded) {\n this.loadComplete = new PublicPromise();\n }\n this.#hasLoaded = true;\n await (this.#loadRequested = Promise.resolve());\n this.#loadRequested = null;\n this.#readyState = 0;\n this.dispatchEvent(new Event(\"emptied\"));\n if (!this.src) {\n this.shadowRoot.innerHTML = \"\";\n globalThis.removeEventListener(\"message\", this.#onMessage);\n return;\n }\n this.dispatchEvent(new Event(\"loadstart\"));\n let iframe = this.shadowRoot.querySelector(\"iframe\");\n const attrs = namedNodeMapToObject(this.attributes);\n if (isFirstLoad && iframe) {\n this.#config = JSON.parse(iframe.getAttribute(\"data-config\") || \"{}\");\n }\n if (!(iframe == null ? void 0 : iframe.src) || iframe.src !== serializeIframeUrl(attrs, this)) {\n this.shadowRoot.innerHTML = getTemplateHTML(attrs, this);\n iframe = this.shadowRoot.querySelector(\"iframe\");\n }\n this.#iframe = iframe;\n globalThis.addEventListener(\"message\", this.#onMessage);\n }\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (oldValue === newValue) return;\n switch (attrName) {\n case \"src\":\n case \"controls\": {\n this.load();\n break;\n }\n }\n }\n getVideoPlaybackQuality() {\n return this.#playerState.stats.videoStats;\n }\n get src() {\n return this.getAttribute(\"src\");\n }\n set src(value) {\n this.setAttribute(\"src\", value);\n }\n get readyState() {\n return this.#readyState;\n }\n get seeking() {\n return this.#seeking;\n }\n get buffered() {\n var _a, _b;\n return createTimeRanges(0, ((_b = (_a = this.#playerState.stats) == null ? void 0 : _a.videoStats) == null ? void 0 : _b.bufferSize) ?? 0);\n }\n get paused() {\n if (!this.#playerState.playback) return this.#paused;\n return this.#playerState.playback === PlaybackState.IDLE;\n }\n get ended() {\n if (!this.#playerState.playback) return false;\n return this.#playerState.playback === PlaybackState.ENDED;\n }\n get duration() {\n return this.#playerState.duration ?? NaN;\n }\n get autoplay() {\n return this.hasAttribute(\"autoplay\");\n }\n set autoplay(val) {\n if (this.autoplay == val) return;\n this.toggleAttribute(\"autoplay\", Boolean(val));\n }\n get controls() {\n return this.hasAttribute(\"controls\");\n }\n set controls(val) {\n if (this.controls == val) return;\n this.toggleAttribute(\"controls\", Boolean(val));\n }\n get currentTime() {\n if (!this.#playerState.currentTime) return this.#currentTime;\n return this.#playerState.currentTime;\n }\n set currentTime(val) {\n this.#currentTime = val;\n this.loadComplete.then(() => {\n this.#sendCommand(PlayerCommands.SEEK, val);\n });\n }\n get defaultMuted() {\n return this.hasAttribute(\"muted\");\n }\n set defaultMuted(val) {\n this.toggleAttribute(\"muted\", Boolean(val));\n }\n get loop() {\n return this.hasAttribute(\"loop\");\n }\n set loop(val) {\n this.toggleAttribute(\"loop\", Boolean(val));\n }\n get muted() {\n return this.#muted;\n }\n set muted(val) {\n this.#muted = val;\n this.loadComplete.then(() => {\n this.#sendCommand(PlayerCommands.SET_MUTED, val);\n });\n }\n get volume() {\n return this.#volume;\n }\n set volume(val) {\n this.#volume = val;\n this.loadComplete.then(() => {\n this.#sendCommand(PlayerCommands.SET_VOLUME, val);\n });\n }\n get playsInline() {\n return this.hasAttribute(\"playsinline\");\n }\n set playsInline(val) {\n this.toggleAttribute(\"playsinline\", Boolean(val));\n }\n play() {\n this.#paused = false;\n this.#sendCommand(PlayerCommands.PLAY);\n }\n pause() {\n this.#paused = true;\n this.#sendCommand(PlayerCommands.PAUSE);\n }\n #onMessage = async (event) => {\n var _a, _b, _c, _d;\n if (!this.#iframe.contentWindow) return;\n const { data, source } = event;\n const isFromEmbedWindow = source === this.#iframe.contentWindow;\n if (!isFromEmbedWindow) return;\n if (data.namespace === \"twitch-embed\") {\n await new Promise((resolve) => setTimeout(resolve, 10));\n if (data.eventName === \"ready\") {\n this.dispatchEvent(new Event(\"loadcomplete\"));\n this.loadComplete.resolve();\n this.#readyState = 1;\n this.dispatchEvent(new Event(\"loadedmetadata\"));\n } else if (data.eventName === \"seek\") {\n this.#seeking = true;\n this.dispatchEvent(new Event(\"seeking\"));\n } else if (data.eventName === \"playing\") {\n if (this.#seeking) {\n this.#seeking = false;\n this.dispatchEvent(new Event(\"seeked\"));\n }\n this.#readyState = 3;\n this.dispatchEvent(new Event(\"playing\"));\n } else {\n this.dispatchEvent(new Event(data.eventName));\n }\n } else if (data.namespace === \"twitch-embed-player-proxy\" && data.eventName === \"UPDATE_STATE\") {\n const oldDuration = this.#playerState.duration;\n const oldCurrentTime = this.#playerState.currentTime;\n const oldVolume = this.#playerState.volume;\n const oldMuted = this.#playerState.muted;\n const oldBuffered = (_b = (_a = this.#playerState.stats) == null ? void 0 : _a.videoStats) == null ? void 0 : _b.bufferSize;\n this.#playerState = { ...this.#playerState, ...data.params };\n if (oldDuration !== this.#playerState.duration) {\n this.dispatchEvent(new Event(\"durationchange\"));\n }\n if (oldCurrentTime !== this.#playerState.currentTime) {\n this.dispatchEvent(new Event(\"timeupdate\"));\n }\n if (oldVolume !== this.#playerState.volume || oldMuted !== this.#playerState.muted) {\n if (this.#playerState.volume !== void 0) {\n this.#volume = this.#playerState.volume;\n }\n if (this.#playerState.muted !== void 0) {\n this.#muted = this.#playerState.muted;\n }\n this.dispatchEvent(new Event(\"volumechange\"));\n }\n if (oldBuffered !== ((_d = (_c = this.#playerState.stats) == null ? void 0 : _c.videoStats) == null ? void 0 : _d.bufferSize)) {\n this.dispatchEvent(new Event(\"progress\"));\n }\n }\n };\n #sendCommand(command, params) {\n if (!this.#iframe.contentWindow) return;\n const message = {\n eventName: command,\n params,\n namespace: \"twitch-embed-player-proxy\"\n };\n this.#iframe.contentWindow.postMessage(message, EMBED_BASE);\n }\n // This is a pattern to update property values that are set before\n // the custom element is upgraded.\n // https://web.dev/custom-elements-best-practices/#make-properties-lazy\n #upgradeProperty(prop) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n const value = this[prop];\n delete this[prop];\n this[prop] = value;\n }\n }\n}\nfunction namedNodeMapToObject(namedNodeMap) {\n let obj = {};\n for (let attr of namedNodeMap) {\n obj[attr.name] = attr.value;\n }\n return obj;\n}\nfunction serializeAttributes(attrs) {\n let html = \"\";\n for (const key in attrs) {\n const value = attrs[key];\n if (value === \"\") html += ` ${escapeHtml(key)}`;\n else html += ` ${escapeHtml(key)}=\"${escapeHtml(`${value}`)}\"`;\n }\n return html;\n}\nfunction escapeHtml(str) {\n return str.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\").replace(/`/g, \"`\");\n}\nfunction serialize(props) {\n return String(new URLSearchParams(filterParams(props)));\n}\nfunction filterParams(props) {\n let p = {};\n for (let key in props) {\n let val = props[key];\n if (val === true || val === \"\") p[key] = true;\n else if (val === false) p[key] = false;\n else if (val != null) p[key] = val;\n }\n return p;\n}\nclass PublicPromise extends Promise {\n constructor(executor = () => {\n }) {\n let res, rej;\n super((resolve, reject) => {\n executor(resolve, reject);\n res = resolve;\n rej = reject;\n });\n this.resolve = res;\n this.reject = rej;\n }\n}\nfunction createTimeRanges(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start == null || end == null || start === 0 && end === 0) {\n return createTimeRangesObj([[0, 0]]);\n }\n return createTimeRangesObj([[start, end]]);\n}\nfunction createTimeRangesObj(ranges) {\n Object.defineProperties(ranges, {\n start: {\n value: (i) => ranges[i][0]\n },\n end: {\n value: (i) => ranges[i][1]\n }\n });\n return ranges;\n}\nif (globalThis.customElements && !globalThis.customElements.get(\"twitch-video\")) {\n globalThis.customElements.define(\"twitch-video\", TwitchVideoElement);\n}\nvar twitch_video_element_default = TwitchVideoElement;\nexport {\n twitch_video_element_default as default\n};\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AC3KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA"}
|