@ix_waterford/lib 1.0.7 → 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.
Files changed (34) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/index.js +121113 -5092
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/dist/async/reactPlayerDash.js +0 -350
  6. package/dist/async/reactPlayerDash.js.map +0 -1
  7. package/dist/async/reactPlayerHls.js +0 -429
  8. package/dist/async/reactPlayerHls.js.map +0 -1
  9. package/dist/async/reactPlayerMux.js +0 -16075
  10. package/dist/async/reactPlayerMux.js.map +0 -1
  11. package/dist/async/reactPlayerPreview.js +0 -111
  12. package/dist/async/reactPlayerPreview.js.map +0 -1
  13. package/dist/async/reactPlayerSpotify.js +0 -518
  14. package/dist/async/reactPlayerSpotify.js.map +0 -1
  15. package/dist/async/reactPlayerTiktok.js +0 -488
  16. package/dist/async/reactPlayerTiktok.js.map +0 -1
  17. package/dist/async/reactPlayerTwitch.js +0 -586
  18. package/dist/async/reactPlayerTwitch.js.map +0 -1
  19. package/dist/async/reactPlayerVimeo.js +0 -4264
  20. package/dist/async/reactPlayerVimeo.js.map +0 -1
  21. package/dist/async/reactPlayerWistia.js +0 -767
  22. package/dist/async/reactPlayerWistia.js.map +0 -1
  23. package/dist/async/reactPlayerYouTube.js +0 -738
  24. package/dist/async/reactPlayerYouTube.js.map +0 -1
  25. package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js +0 -1253
  26. package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js.map +0 -1
  27. package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js +0 -21
  28. package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +0 -1
  29. package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js +0 -36691
  30. package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +0 -1
  31. package/dist/lib-react.js +0 -1462
  32. package/dist/lib-react.js.map +0 -1
  33. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js +0 -53062
  34. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js.map +0 -1
@@ -1,488 +0,0 @@
1
- (self["webpackChunk_ix_waterford_lib"] = self["webpackChunk_ix_waterford_lib"] || []).push([["reactPlayerTiktok"], {
2
- "./node_modules/tiktok-video-element/dist/react.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
3
- __webpack_require__.r(__webpack_exports__);
4
- __webpack_require__.d(__webpack_exports__, {
5
- "default": () => (react_default)
6
- });
7
- /* import */var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react");
8
- /* import */var _tiktok_video_element_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/tiktok-video-element/dist/tiktok-video-element.js");
9
- "use client";
10
-
11
- // dist/react.ts
12
-
13
-
14
-
15
- // ../../node_modules/ce-la-react/dist/ce-la-react.js
16
- var reservedReactProps = /* @__PURE__ */ new Set([
17
- "style",
18
- "children",
19
- "ref",
20
- "key",
21
- "suppressContentEditableWarning",
22
- "suppressHydrationWarning",
23
- "dangerouslySetInnerHTML"
24
- ]);
25
- var reactPropToAttrNameMap = {
26
- className: "class",
27
- htmlFor: "for"
28
- };
29
- function defaultToAttributeName(propName) {
30
- return propName.toLowerCase();
31
- }
32
- function defaultToAttributeValue(propValue) {
33
- if (typeof propValue === "boolean") return propValue ? "" : void 0;
34
- if (typeof propValue === "function") return void 0;
35
- if (typeof propValue === "object" && propValue !== null) return void 0;
36
- return propValue;
37
- }
38
- function createComponent({
39
- react: React2,
40
- tagName,
41
- elementClass,
42
- events,
43
- displayName,
44
- defaultProps,
45
- toAttributeName = defaultToAttributeName,
46
- toAttributeValue = defaultToAttributeValue
47
- }) {
48
- const IS_REACT_19_OR_NEWER = Number.parseInt(React2.version) >= 19;
49
- const ReactComponent = React2.forwardRef((props, ref) => {
50
- var _a, _b;
51
- const elementRef = React2.useRef(null);
52
- const prevElemPropsRef = React2.useRef(/* @__PURE__ */ new Map());
53
- const eventProps = {};
54
- const attrs = {};
55
- const reactProps = {};
56
- const elementProps = {};
57
- for (const [k, v] of Object.entries(props)) {
58
- if (reservedReactProps.has(k)) {
59
- reactProps[k] = v;
60
- continue;
61
- }
62
- const attrName = toAttributeName(reactPropToAttrNameMap[k] ?? k);
63
- 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))) {
64
- elementProps[k] = v;
65
- continue;
66
- }
67
- if (k.startsWith("on")) {
68
- eventProps[k] = v;
69
- continue;
70
- }
71
- const attrValue = toAttributeValue(v);
72
- if (attrName && attrValue != null) {
73
- attrs[attrName] = String(attrValue);
74
- if (!IS_REACT_19_OR_NEWER) {
75
- reactProps[attrName] = attrValue;
76
- }
77
- }
78
- if (attrName && IS_REACT_19_OR_NEWER) {
79
- const attrValueFromDefault = defaultToAttributeValue(v);
80
- if (attrValue !== attrValueFromDefault) {
81
- reactProps[attrName] = attrValue;
82
- } else {
83
- reactProps[attrName] = v;
84
- }
85
- }
86
- }
87
- if (typeof window !== "undefined") {
88
- for (const propName in eventProps) {
89
- const callback = eventProps[propName];
90
- const useCapture = propName.endsWith("Capture");
91
- const eventName = ((events == null ? void 0 : events[propName]) ?? propName.slice(2).toLowerCase()).slice(
92
- 0,
93
- useCapture ? -7 : void 0
94
- );
95
- React2.useLayoutEffect(() => {
96
- const eventTarget = elementRef == null ? void 0 : elementRef.current;
97
- if (!eventTarget || typeof callback !== "function") return;
98
- eventTarget.addEventListener(eventName, callback, useCapture);
99
- return () => {
100
- eventTarget.removeEventListener(eventName, callback, useCapture);
101
- };
102
- }, [elementRef == null ? void 0 : elementRef.current, callback]);
103
- }
104
- React2.useLayoutEffect(() => {
105
- if (elementRef.current === null) return;
106
- const newElemProps = /* @__PURE__ */ new Map();
107
- for (const key in elementProps) {
108
- setProperty(elementRef.current, key, elementProps[key]);
109
- prevElemPropsRef.current.delete(key);
110
- newElemProps.set(key, elementProps[key]);
111
- }
112
- for (const [key, _value] of prevElemPropsRef.current) {
113
- setProperty(elementRef.current, key, void 0);
114
- }
115
- prevElemPropsRef.current = newElemProps;
116
- });
117
- }
118
- if (typeof window === "undefined" && (elementClass == null ? void 0 : elementClass.getTemplateHTML) && (elementClass == null ? void 0 : elementClass.shadowRootOptions)) {
119
- const { mode, delegatesFocus } = elementClass.shadowRootOptions;
120
- const templateShadowRoot = React2.createElement("template", {
121
- shadowrootmode: mode,
122
- shadowrootdelegatesfocus: delegatesFocus,
123
- dangerouslySetInnerHTML: {
124
- __html: elementClass.getTemplateHTML(attrs, props)
125
- }
126
- });
127
- reactProps.children = [templateShadowRoot, reactProps.children];
128
- }
129
- return React2.createElement(tagName, {
130
- ...defaultProps,
131
- ...reactProps,
132
- ref: React2.useCallback(
133
- (node) => {
134
- elementRef.current = node;
135
- if (typeof ref === "function") {
136
- ref(node);
137
- } else if (ref !== null) {
138
- ref.current = node;
139
- }
140
- },
141
- [ref]
142
- )
143
- });
144
- });
145
- ReactComponent.displayName = displayName ?? elementClass.name;
146
- return ReactComponent;
147
- }
148
- function setProperty(node, name, value) {
149
- var _a;
150
- node[name] = value;
151
- if (value == null && name in (((_a = globalThis.HTMLElement) == null ? void 0 : _a.prototype) ?? {})) {
152
- node.removeAttribute(name);
153
- }
154
- }
155
-
156
- // dist/react.ts
157
- var react_default = createComponent({
158
- react: react__WEBPACK_IMPORTED_MODULE_0__["default"],
159
- tagName: "tiktok-video",
160
- elementClass: _tiktok_video_element_js__WEBPACK_IMPORTED_MODULE_1__["default"],
161
- toAttributeName(propName) {
162
- if (propName === "muted") return "";
163
- if (propName === "defaultMuted") return "muted";
164
- return defaultToAttributeName(propName);
165
- }
166
- });
167
-
168
- /*! Bundled license information:
169
-
170
- ce-la-react/dist/ce-la-react.js:
171
- (**
172
- * @license
173
- * Copyright 2018 Google LLC
174
- * SPDX-License-Identifier: BSD-3-Clause
175
- *
176
- * Modified version of `@lit/react` for vanilla custom elements with support for SSR.
177
- *)
178
- */
179
-
180
-
181
- }),
182
- "./node_modules/tiktok-video-element/dist/tiktok-video-element.js": (function (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
183
- __webpack_require__.r(__webpack_exports__);
184
- __webpack_require__.d(__webpack_exports__, {
185
- "default": () => (tiktok_video_element_default)
186
- });
187
- const EMBED_BASE = "https://www.tiktok.com/player/v1";
188
- const MATCH_SRC = /tiktok\.com\/(?:player\/v1\/|share\/video\/|@[^/]+\/video\/)([0-9]+)/;
189
- const PlayerState = { INIT: -1, ENDED: 0, PLAYING: 1, PAUSED: 2, BUFFERING: 3 };
190
- const EventMap = {
191
- [PlayerState.INIT]: "emptied",
192
- [PlayerState.PAUSED]: "pause",
193
- [PlayerState.ENDED]: "ended",
194
- [PlayerState.PLAYING]: "play",
195
- [PlayerState.BUFFERING]: "waiting"
196
- };
197
- function getTemplateHTML(attrs, props = {}) {
198
- const iframeAttrs = {
199
- src: serializeIframeUrl(attrs, props),
200
- frameborder: 0,
201
- width: "100%",
202
- height: "100%",
203
- allow: "accelerometer; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture"
204
- };
205
- if (props.config) {
206
- iframeAttrs["data-config"] = JSON.stringify(props.config);
207
- }
208
- return (
209
- /*html*/
210
- `
211
- <style>
212
- :host {
213
- display:inline-block;
214
- min-width: 300px;
215
- min-height: 150px;
216
- position: relative;
217
- }
218
- iframe {
219
- position:absolute;
220
- top:0;
221
- left:0;
222
- width:100%;
223
- height:100%;
224
- border:0;
225
- }
226
- </style>
227
- <iframe ${serializeAttributes(iframeAttrs)} title="TikTok video"></iframe>
228
- `
229
- );
230
- }
231
- function serializeIframeUrl(attrs, props = {}) {
232
- if (!attrs.src) return;
233
- const matches = attrs.src.match(MATCH_SRC);
234
- const srcId = matches && matches[1];
235
- const params = {
236
- controls: attrs.controls === "" ? null : 0,
237
- autoplay: attrs.autoplay,
238
- muted: attrs.muted,
239
- loop: attrs.loop,
240
- rel: 0,
241
- ...props.config
242
- };
243
- return `${EMBED_BASE}/${srcId}?${serialize(params)}`;
244
- }
245
- class TikTokVideoElement extends (globalThis.HTMLElement ?? class {
246
- }) {
247
- static getTemplateHTML = getTemplateHTML;
248
- static shadowRootOptions = { mode: "open" };
249
- static get observedAttributes() {
250
- return ["src", "controls", "loop", "autoplay", "muted"];
251
- }
252
- loadComplete = new PublicPromise();
253
- #loadRequested;
254
- #hasLoaded;
255
- #muted = false;
256
- #currentTime = 0;
257
- #paused = true;
258
- #config = null;
259
- #volume = 100;
260
- #duration = 0;
261
- #iframe;
262
- constructor() {
263
- super();
264
- this.#upgradeProperty("config");
265
- }
266
- async load() {
267
- if (this.#loadRequested) return;
268
- if (!this.shadowRoot) {
269
- this.attachShadow(TikTokVideoElement.shadowRootOptions);
270
- }
271
- const isFirstLoad = !this.#hasLoaded;
272
- if (this.#hasLoaded) {
273
- this.loadComplete = new PublicPromise();
274
- }
275
- this.#hasLoaded = true;
276
- await (this.#loadRequested = Promise.resolve());
277
- this.#loadRequested = null;
278
- this.#currentTime = 0;
279
- this.#muted = false;
280
- this.#paused = true;
281
- if (!this.src) {
282
- this.shadowRoot.innerHTML = "";
283
- globalThis.removeEventListener("message", this.#onMessage);
284
- return;
285
- }
286
- let iframe = this.shadowRoot.querySelector("iframe");
287
- const attrs = namedNodeMapToObject(this.attributes);
288
- if (isFirstLoad && iframe) {
289
- this.#config = JSON.parse(iframe.getAttribute("data-config") || "{}");
290
- }
291
- if (!(iframe == null ? void 0 : iframe.src) || iframe.src !== serializeIframeUrl(attrs, this)) {
292
- this.shadowRoot.innerHTML = getTemplateHTML(attrs, this);
293
- iframe = this.shadowRoot.querySelector("iframe");
294
- }
295
- this.#iframe = iframe;
296
- globalThis.addEventListener("message", this.#onMessage);
297
- }
298
- async attributeChangedCallback(attrName, oldValue, newValue) {
299
- if (oldValue === newValue) return;
300
- switch (attrName) {
301
- case "muted": {
302
- await this.loadComplete;
303
- this.muted = newValue != null;
304
- break;
305
- }
306
- case "autoplay":
307
- case "controls":
308
- case "loop":
309
- case "src": {
310
- this.load();
311
- return;
312
- }
313
- }
314
- }
315
- get config() {
316
- return this.#config;
317
- }
318
- set config(value) {
319
- this.#config = value;
320
- }
321
- #onMessage = (event) => {
322
- var _a;
323
- if (event.source !== ((_a = this.#iframe) == null ? void 0 : _a.contentWindow)) return;
324
- const msg = event.data;
325
- if (!(msg == null ? void 0 : msg["x-tiktok-player"])) return;
326
- switch (msg.type) {
327
- case "onPlayerReady":
328
- this.loadComplete.resolve();
329
- break;
330
- case "onStateChange": {
331
- this.#paused = [PlayerState.INIT, PlayerState.PAUSED, PlayerState.ENDED].includes(msg.value);
332
- const eventType = EventMap[msg.value];
333
- if (eventType) this.dispatchEvent(new Event(eventType));
334
- break;
335
- }
336
- case "onCurrentTime":
337
- this.#currentTime = msg.value.currentTime;
338
- this.#duration = msg.value.duration;
339
- this.dispatchEvent(new Event("durationchange"));
340
- this.dispatchEvent(new Event("timeupdate"));
341
- break;
342
- case "onVolumeChange":
343
- this.#volume = msg.value;
344
- this.dispatchEvent(new Event("volumechange"));
345
- break;
346
- case "onMute":
347
- this.#muted = msg.value ? true : false;
348
- this.#volume = msg.value ? 0 : this.#volume;
349
- this.dispatchEvent(new Event("volumechange"));
350
- break;
351
- case "onError":
352
- this.dispatchEvent(new Event("error"));
353
- break;
354
- default:
355
- console.warn("Unhandled TikTok player message:", msg);
356
- break;
357
- }
358
- };
359
- #post(type, value) {
360
- var _a;
361
- if (!((_a = this.#iframe) == null ? void 0 : _a.contentWindow)) return;
362
- const message = { "x-tiktok-player": true, type, ...value !== void 0 ? { value } : {} };
363
- this.#iframe.contentWindow.postMessage(message, "*");
364
- }
365
- async play() {
366
- await this.loadComplete;
367
- this.#post("play");
368
- }
369
- async pause() {
370
- await this.loadComplete;
371
- this.#post("pause");
372
- }
373
- async #seekTo(sec) {
374
- await this.loadComplete;
375
- this.#post("seekTo", Number(sec));
376
- }
377
- async #mute() {
378
- await this.loadComplete;
379
- this.#post("mute");
380
- }
381
- async #unMute() {
382
- await this.loadComplete;
383
- this.#post("unMute");
384
- }
385
- get volume() {
386
- return this.#volume / 100;
387
- }
388
- set volume(_val) {
389
- console.warn("Volume control is not supported for TikTok videos.");
390
- }
391
- get currentTime() {
392
- return this.#currentTime;
393
- }
394
- set currentTime(val) {
395
- this.#seekTo(val);
396
- }
397
- get muted() {
398
- return this.#muted;
399
- }
400
- set muted(val) {
401
- this.#muted = val;
402
- val ? this.#mute() : this.#unMute();
403
- }
404
- get defaultMuted() {
405
- return this.hasAttribute("muted");
406
- }
407
- set defaultMuted(val) {
408
- this.toggleAttribute("muted", !!val);
409
- }
410
- get paused() {
411
- return this.#paused;
412
- }
413
- get duration() {
414
- return this.#duration;
415
- }
416
- get src() {
417
- return this.getAttribute("src");
418
- }
419
- set src(val) {
420
- this.setAttribute("src", val ?? "");
421
- }
422
- // This is a pattern to update property values that are set before
423
- // the custom element is upgraded.
424
- // https://web.dev/custom-elements-best-practices/#make-properties-lazy
425
- #upgradeProperty(prop) {
426
- if (Object.prototype.hasOwnProperty.call(this, prop)) {
427
- const value = this[prop];
428
- delete this[prop];
429
- this[prop] = value;
430
- }
431
- }
432
- }
433
- class PublicPromise extends Promise {
434
- constructor(executor = () => {
435
- }) {
436
- let res, rej;
437
- super((resolve, reject) => {
438
- executor(resolve, reject);
439
- res = resolve;
440
- rej = reject;
441
- });
442
- this.resolve = res;
443
- this.reject = rej;
444
- }
445
- }
446
- function namedNodeMapToObject(namedNodeMap) {
447
- let obj = {};
448
- for (let attr of namedNodeMap) {
449
- obj[attr.name] = attr.value;
450
- }
451
- return obj;
452
- }
453
- function boolToBinary(props) {
454
- let p = {};
455
- for (let key in props) {
456
- let val = props[key];
457
- if (val === true || val === "") p[key] = 1;
458
- else if (val === false) p[key] = 0;
459
- else if (val != null) p[key] = val;
460
- }
461
- return p;
462
- }
463
- function serialize(props) {
464
- return String(new URLSearchParams(boolToBinary(props)));
465
- }
466
- function serializeAttributes(attrs) {
467
- let html = "";
468
- for (const key in attrs) {
469
- const value = attrs[key];
470
- if (value === "") html += ` ${escapeHtml(key)}`;
471
- else html += ` ${escapeHtml(key)}="${escapeHtml(`${value}`)}"`;
472
- }
473
- return html;
474
- }
475
- function escapeHtml(str) {
476
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/`/g, "&#x60;");
477
- }
478
- if (globalThis.customElements && !globalThis.customElements.get("tiktok-video")) {
479
- globalThis.customElements.define("tiktok-video", TikTokVideoElement);
480
- }
481
- var tiktok_video_element_default = TikTokVideoElement;
482
-
483
-
484
-
485
- }),
486
-
487
- }])
488
- //# sourceMappingURL=reactPlayerTiktok.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async/reactPlayerTiktok.js","sources":["/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/tiktok-video-element/dist/react.js","/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/tiktok-video-element/dist/tiktok-video-element.js"],"sourcesContent":["\"use client\";\n\n// dist/react.ts\nimport React from \"react\";\nimport CustomMediaElement from \"./tiktok-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: \"tiktok-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://www.tiktok.com/player/v1\";\nconst MATCH_SRC = /tiktok\\.com\\/(?:player\\/v1\\/|share\\/video\\/|@[^/]+\\/video\\/)([0-9]+)/;\nconst PlayerState = { INIT: -1, ENDED: 0, PLAYING: 1, PAUSED: 2, BUFFERING: 3 };\nconst EventMap = {\n [PlayerState.INIT]: \"emptied\",\n [PlayerState.PAUSED]: \"pause\",\n [PlayerState.ENDED]: \"ended\",\n [PlayerState.PLAYING]: \"play\",\n [PlayerState.BUFFERING]: \"waiting\"\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; autoplay; fullscreen; encrypted-media; gyroscope; picture-in-picture\"\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 border:0;\n }\n </style>\n <iframe ${serializeAttributes(iframeAttrs)} title=\"TikTok video\"></iframe>\n `\n );\n}\nfunction serializeIframeUrl(attrs, props = {}) {\n if (!attrs.src) return;\n const matches = attrs.src.match(MATCH_SRC);\n const srcId = matches && matches[1];\n const params = {\n controls: attrs.controls === \"\" ? null : 0,\n autoplay: attrs.autoplay,\n muted: attrs.muted,\n loop: attrs.loop,\n rel: 0,\n ...props.config\n };\n return `${EMBED_BASE}/${srcId}?${serialize(params)}`;\n}\nclass TikTokVideoElement extends (globalThis.HTMLElement ?? class {\n}) {\n static getTemplateHTML = getTemplateHTML;\n static shadowRootOptions = { mode: \"open\" };\n static get observedAttributes() {\n return [\"src\", \"controls\", \"loop\", \"autoplay\", \"muted\"];\n }\n loadComplete = new PublicPromise();\n #loadRequested;\n #hasLoaded;\n #muted = false;\n #currentTime = 0;\n #paused = true;\n #config = null;\n #volume = 100;\n #duration = 0;\n #iframe;\n constructor() {\n super();\n this.#upgradeProperty(\"config\");\n }\n async load() {\n if (this.#loadRequested) return;\n if (!this.shadowRoot) {\n this.attachShadow(TikTokVideoElement.shadowRootOptions);\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.#currentTime = 0;\n this.#muted = false;\n this.#paused = true;\n if (!this.src) {\n this.shadowRoot.innerHTML = \"\";\n globalThis.removeEventListener(\"message\", this.#onMessage);\n return;\n }\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 async attributeChangedCallback(attrName, oldValue, newValue) {\n if (oldValue === newValue) return;\n switch (attrName) {\n case \"muted\": {\n await this.loadComplete;\n this.muted = newValue != null;\n break;\n }\n case \"autoplay\":\n case \"controls\":\n case \"loop\":\n case \"src\": {\n this.load();\n return;\n }\n }\n }\n get config() {\n return this.#config;\n }\n set config(value) {\n this.#config = value;\n }\n #onMessage = (event) => {\n var _a;\n if (event.source !== ((_a = this.#iframe) == null ? void 0 : _a.contentWindow)) return;\n const msg = event.data;\n if (!(msg == null ? void 0 : msg[\"x-tiktok-player\"])) return;\n switch (msg.type) {\n case \"onPlayerReady\":\n this.loadComplete.resolve();\n break;\n case \"onStateChange\": {\n this.#paused = [PlayerState.INIT, PlayerState.PAUSED, PlayerState.ENDED].includes(msg.value);\n const eventType = EventMap[msg.value];\n if (eventType) this.dispatchEvent(new Event(eventType));\n break;\n }\n case \"onCurrentTime\":\n this.#currentTime = msg.value.currentTime;\n this.#duration = msg.value.duration;\n this.dispatchEvent(new Event(\"durationchange\"));\n this.dispatchEvent(new Event(\"timeupdate\"));\n break;\n case \"onVolumeChange\":\n this.#volume = msg.value;\n this.dispatchEvent(new Event(\"volumechange\"));\n break;\n case \"onMute\":\n this.#muted = msg.value ? true : false;\n this.#volume = msg.value ? 0 : this.#volume;\n this.dispatchEvent(new Event(\"volumechange\"));\n break;\n case \"onError\":\n this.dispatchEvent(new Event(\"error\"));\n break;\n default:\n console.warn(\"Unhandled TikTok player message:\", msg);\n break;\n }\n };\n #post(type, value) {\n var _a;\n if (!((_a = this.#iframe) == null ? void 0 : _a.contentWindow)) return;\n const message = { \"x-tiktok-player\": true, type, ...value !== void 0 ? { value } : {} };\n this.#iframe.contentWindow.postMessage(message, \"*\");\n }\n async play() {\n await this.loadComplete;\n this.#post(\"play\");\n }\n async pause() {\n await this.loadComplete;\n this.#post(\"pause\");\n }\n async #seekTo(sec) {\n await this.loadComplete;\n this.#post(\"seekTo\", Number(sec));\n }\n async #mute() {\n await this.loadComplete;\n this.#post(\"mute\");\n }\n async #unMute() {\n await this.loadComplete;\n this.#post(\"unMute\");\n }\n get volume() {\n return this.#volume / 100;\n }\n set volume(_val) {\n console.warn(\"Volume control is not supported for TikTok videos.\");\n }\n get currentTime() {\n return this.#currentTime;\n }\n set currentTime(val) {\n this.#seekTo(val);\n }\n get muted() {\n return this.#muted;\n }\n set muted(val) {\n this.#muted = val;\n val ? this.#mute() : this.#unMute();\n }\n get defaultMuted() {\n return this.hasAttribute(\"muted\");\n }\n set defaultMuted(val) {\n this.toggleAttribute(\"muted\", !!val);\n }\n get paused() {\n return this.#paused;\n }\n get duration() {\n return this.#duration;\n }\n get src() {\n return this.getAttribute(\"src\");\n }\n set src(val) {\n this.setAttribute(\"src\", val ?? \"\");\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}\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 namedNodeMapToObject(namedNodeMap) {\n let obj = {};\n for (let attr of namedNodeMap) {\n obj[attr.name] = attr.value;\n }\n return obj;\n}\nfunction boolToBinary(props) {\n let p = {};\n for (let key in props) {\n let val = props[key];\n if (val === true || val === \"\") p[key] = 1;\n else if (val === false) p[key] = 0;\n else if (val != null) p[key] = val;\n }\n return p;\n}\nfunction serialize(props) {\n return String(new URLSearchParams(boolToBinary(props)));\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, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\").replace(/\"/g, \"&quot;\").replace(/'/g, \"&apos;\").replace(/`/g, \"&#x60;\");\n}\nif (globalThis.customElements && !globalThis.customElements.get(\"tiktok-video\")) {\n globalThis.customElements.define(\"tiktok-video\", TikTokVideoElement);\n}\nvar tiktok_video_element_default = TikTokVideoElement;\nexport {\n tiktok_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;AAGA"}