@ix_waterford/lib 1.0.6 → 1.0.7

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 (52) hide show
  1. package/dist/{static/js/async → async}/reactPlayerDash.js +3 -4
  2. package/dist/async/reactPlayerDash.js.map +1 -0
  3. package/dist/{static/js/async → async}/reactPlayerHls.js +3 -4
  4. package/dist/async/reactPlayerHls.js.map +1 -0
  5. package/dist/{static/js/async → async}/reactPlayerMux.js +3 -4
  6. package/dist/async/reactPlayerMux.js.map +1 -0
  7. package/dist/{static/js/async → async}/reactPlayerPreview.js +6 -7
  8. package/dist/async/reactPlayerPreview.js.map +1 -0
  9. package/dist/{static/js/async → async}/reactPlayerSpotify.js +3 -4
  10. package/dist/async/reactPlayerSpotify.js.map +1 -0
  11. package/dist/{static/js/async → async}/reactPlayerTiktok.js +3 -4
  12. package/dist/async/reactPlayerTiktok.js.map +1 -0
  13. package/dist/{static/js/async → async}/reactPlayerTwitch.js +3 -4
  14. package/dist/async/reactPlayerTwitch.js.map +1 -0
  15. package/dist/{static/js/async → async}/reactPlayerVimeo.js +3 -4
  16. package/dist/async/reactPlayerVimeo.js.map +1 -0
  17. package/dist/{static/js/async → async}/reactPlayerWistia.js +3 -4
  18. package/dist/async/reactPlayerWistia.js.map +1 -0
  19. package/dist/{static/js/async → async}/reactPlayerYouTube.js +3 -4
  20. package/dist/async/reactPlayerYouTube.js.map +1 -0
  21. package/dist/{static/js/async → async}/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js +1 -2
  22. package/dist/async/vendors-node_modules_custom-media-element_dist_custom-media-element_js-node_modules_media-tra-835023.js.map +1 -0
  23. package/dist/{static/js/async → async}/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js +1 -2
  24. package/dist/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +1 -0
  25. package/dist/{static/js/async → async}/vendors-node_modules_hls_js_dist_hls_mjs.js +1 -2
  26. package/dist/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +1 -0
  27. package/dist/index.html +1 -1
  28. package/dist/{static/js/index.js → index.js} +360 -364
  29. package/dist/index.js.map +1 -0
  30. package/dist/lib-react.js +1462 -0
  31. package/dist/lib-react.js.map +1 -0
  32. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js +53062 -0
  33. package/dist/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-5eb95d.js.map +1 -0
  34. package/package.json +5 -5
  35. package/dist/static/js/async/reactPlayerDash.js.map +0 -1
  36. package/dist/static/js/async/reactPlayerHls.js.map +0 -1
  37. package/dist/static/js/async/reactPlayerMux.js.map +0 -1
  38. package/dist/static/js/async/reactPlayerPreview.js.map +0 -1
  39. package/dist/static/js/async/reactPlayerSpotify.js.map +0 -1
  40. package/dist/static/js/async/reactPlayerTiktok.js.map +0 -1
  41. package/dist/static/js/async/reactPlayerTwitch.js.map +0 -1
  42. package/dist/static/js/async/reactPlayerVimeo.js.map +0 -1
  43. package/dist/static/js/async/reactPlayerWistia.js.map +0 -1
  44. package/dist/static/js/async/reactPlayerYouTube.js.map +0 -1
  45. 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
  46. package/dist/static/js/async/vendors-node_modules_dashjs_dist_modern_esm_dash_all_min_js.js.map +0 -1
  47. package/dist/static/js/async/vendors-node_modules_hls_js_dist_hls_mjs.js.map +0 -1
  48. package/dist/static/js/index.js.map +0 -1
  49. package/dist/static/js/lib-react.js +0 -3235
  50. package/dist/static/js/lib-react.js.map +0 -1
  51. package/dist/static/js/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-897cfa.js +0 -113737
  52. package/dist/static/js/vendors-node_modules_rspack_core_dist_cssExtractHmr_js-node_modules_dayjs_plugin_utc_js-node_-897cfa.js.map +0 -1
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ix_waterford/lib",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
- "main": "./dist/static/js/index.js",
6
- "module": "./dist/static/js/index.js",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
7
  "types": "./dist/types/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/types/index.d.ts",
11
- "import": "./dist/static/js/index.js",
12
- "require": "./dist/static/js/index.js"
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
13
  }
14
14
  },
15
15
  "sideEffects": false,
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/js/async/reactPlayerDash.js","sources":["/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/dash-video-element/dist/dash-video-element.js","/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/dash-video-element/dist/react.js"],"sourcesContent":["import { CustomVideoElement } from \"custom-media-element\";\nimport { MediaTracksMixin } from \"media-tracks\";\nclass DashVideoElement extends MediaTracksMixin(CustomVideoElement) {\n static shadowRootOptions = { ...CustomVideoElement.shadowRootOptions };\n static getTemplateHTML = (attrs) => {\n const { src, ...rest } = attrs;\n return CustomVideoElement.getTemplateHTML(rest);\n };\n #apiInit;\n attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName !== \"src\") {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n if (attrName === \"src\" && oldValue != newValue) {\n this.load();\n }\n }\n async _initThumbnails(representation) {\n const generateAllCues = async (totalThumbnails2, thumbnailDuration2) => {\n const promises = [];\n const timescale = representation.timescale || 1;\n const startNumber = representation.startNumber || 1;\n const pto = representation.presentationTimeOffset ? representation.presentationTimeOffset / timescale : 0;\n const tduration = representation.segmentDuration;\n for (let thIndex = 0; thIndex < totalThumbnails2; thIndex++) {\n const startTime = calculateThumbnailStartTime({\n thIndex,\n thduration: thumbnailDuration2,\n ttiles: totalThumbnails2,\n tduration,\n startNumber,\n pto\n });\n const endTime = startTime + thumbnailDuration2;\n const promise = new Promise((resolve, reject) => {\n this.api.provideThumbnail(startTime, ({ url, width, height, x, y }) => {\n try {\n const cue = new VTTCue(\n startTime,\n endTime,\n `${url}#xywh=${x},${y},${width},${height}`\n );\n resolve(cue);\n } catch (err) {\n reject(err);\n }\n });\n });\n promises.push(promise);\n }\n return await Promise.all(promises).catch((e) => console.error(\"Error processing thumbnails\", e));\n };\n const { totalThumbnails, thumbnailDuration } = calculateThumbnailTimes(representation);\n const cues = await generateAllCues(totalThumbnails, thumbnailDuration);\n let track = this.nativeEl.querySelector('track[label=\"thumbnails\"]');\n if (!track) {\n track = createThumbnailTrack();\n this.nativeEl.appendChild(track);\n const vttUrl = cuesToVttBlobUrl(cues);\n track.src = vttUrl;\n track.dispatchEvent(new Event(\"change\"));\n }\n }\n async load() {\n if (this.#apiInit) {\n this.api.attachSource(this.src);\n return;\n }\n this.#apiInit = true;\n const Dash = await import(\"dashjs\");\n this.api = Dash.MediaPlayer().create();\n this.api.initialize(this.nativeEl, this.src, this.autoplay);\n this.api.on(Dash.MediaPlayer.events.STREAM_INITIALIZED, () => {\n const bitrateList = this.api.getRepresentationsByType(\"video\");\n let videoTrack = this.videoTracks.getTrackById(\"main\");\n if (!videoTrack) {\n videoTrack = this.addVideoTrack(\"main\");\n videoTrack.id = \"main\";\n videoTrack.selected = true;\n }\n bitrateList.forEach((rep) => {\n const bitrate = rep.bandwidth ?? rep.bitrate ?? (Number.isFinite(rep.bitrateInKbit) ? rep.bitrateInKbit * 1e3 : void 0);\n const rendition = videoTrack.addRendition(rep.id, rep.width, rep.height, rep.mimeType ?? rep.codec, bitrate);\n rendition.id = rep.id;\n });\n this.videoRenditions.addEventListener(\"change\", () => {\n const selected = this.videoRenditions[this.videoRenditions.selectedIndex];\n if (selected == null ? void 0 : selected.id) {\n this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: false } } } });\n this.api.setRepresentationForTypeById(\"video\", selected.id, true);\n } else {\n this.api.updateSettings({ streaming: { abr: { autoSwitchBitrate: { video: true } } } });\n }\n });\n if (!this.api.isDynamic()) {\n const imageReps = this.api.getRepresentationsByType(\"image\");\n imageReps.forEach(async (rep, idx) => {\n if (idx > 0) return;\n this._initThumbnails(rep);\n });\n }\n });\n }\n}\nfunction calculateThumbnailTimes(representation) {\n var _a, _b;\n const essentialProp = representation.essentialProperties[0];\n const [htiles, vtiles] = essentialProp.value.split(\"x\").map(Number);\n const ttiles = htiles * vtiles;\n const periodDuration = ((_b = (_a = representation.adaptation) == null ? void 0 : _a.period) == null ? void 0 : _b.duration) || null;\n const tileDuration = representation.segmentDuration;\n const timescale = representation.timescale || 1;\n const tduration = tileDuration / timescale;\n const thduration = tduration / ttiles;\n const totalThumbnails = periodDuration != null ? Math.ceil(periodDuration / thduration) : Math.ceil(tileDuration / thduration);\n return { totalThumbnails, thumbnailDuration: thduration };\n}\nfunction calculateThumbnailStartTime({ thIndex, tduration, thduration, ttiles, startNumber, pto }) {\n const tnumber = Math.floor(thIndex / ttiles) + startNumber;\n const thnumber = thIndex % ttiles + 1;\n const tileStartTime = (tnumber - 1) * tduration - pto;\n const thumbnailStartTime = (thnumber - 1) * thduration;\n return tileStartTime + thumbnailStartTime;\n}\nfunction createThumbnailTrack() {\n const track = document.createElement(\"track\");\n track.kind = \"metadata\";\n track.label = \"thumbnails\";\n track.srclang = \"en\";\n track.mode = \"hidden\";\n track.default = true;\n return track;\n}\nfunction cuesToVttBlobUrl(cues) {\n let vtt = \"WEBVTT\\n\\n\";\n for (const cue of cues) {\n vtt += `${formatTime(cue.startTime)} --> ${formatTime(cue.endTime)}\n`;\n vtt += `${cue.text}\n\n`;\n }\n const blob = new Blob([vtt], { type: \"text/vtt\" });\n return URL.createObjectURL(blob);\n function formatTime(t) {\n const h = String(Math.floor(t / 3600)).padStart(2, \"0\");\n const m = String(Math.floor(t % 3600 / 60)).padStart(2, \"0\");\n const s = (t % 60).toFixed(3).padStart(6, \"0\");\n return `${h}:${m}:${s}`;\n }\n}\nif (globalThis.customElements && !globalThis.customElements.get(\"dash-video\")) {\n globalThis.customElements.define(\"dash-video\", DashVideoElement);\n}\nvar dash_video_element_default = DashVideoElement;\nexport {\n dash_video_element_default as default\n};\n","\"use client\";\n\n// dist/react.ts\nimport React from \"react\";\nimport CustomMediaElement from \"./dash-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: \"dash-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"],"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;AAGA;;;;;;;;;;;AC7JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"static/js/async/reactPlayerHls.js","sources":["/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/hls-video-element/dist/hls-video-element.js","/Users/kirubakaran.r/Documents/projects/hub/components/waterford_library/node_modules/hls-video-element/dist/react.js"],"sourcesContent":["import { CustomVideoElement } from \"custom-media-element\";\nimport { MediaTracksMixin } from \"media-tracks\";\nimport Hls from \"hls.js/dist/hls.mjs\";\nconst HlsVideoMixin = (superclass) => {\n return class HlsVideo extends superclass {\n static shadowRootOptions = { ...superclass.shadowRootOptions };\n static getTemplateHTML = (attrs, props = {}) => {\n const { src, ...rest } = attrs;\n return `\n <script type=\"application/json\" id=\"config\">\n ${JSON.stringify(props.config || {})}\n </script>\n ${superclass.getTemplateHTML(rest)}\n `;\n };\n #airplaySourceEl = null;\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 attributeChangedCallback(attrName, oldValue, newValue) {\n if (attrName !== \"src\") {\n super.attributeChangedCallback(attrName, oldValue, newValue);\n }\n if (attrName === \"src\" && oldValue != newValue) {\n this.load();\n }\n }\n #destroy() {\n var _a, _b;\n (_a = this.#airplaySourceEl) == null ? void 0 : _a.remove();\n (_b = this.nativeEl) == null ? void 0 : _b.removeEventListener(\n \"webkitcurrentplaybacktargetiswirelesschanged\",\n this.#toggleHlsLoad\n );\n if (this.api) {\n this.api.detachMedia();\n this.api.destroy();\n this.api = null;\n }\n }\n async load() {\n var _a, _b;\n const isFirstLoad = !this.api;\n this.#destroy();\n if (!this.src) {\n return;\n }\n if (isFirstLoad && !this.#config) {\n this.#config = JSON.parse(((_a = this.shadowRoot.getElementById(\"config\")) == null ? void 0 : _a.textContent) || \"{}\");\n }\n if (Hls.isSupported()) {\n await Promise.resolve();\n this.api = new Hls({\n // Mimic the media element with an Infinity duration for live streams.\n liveDurationInfinity: true,\n // Disable auto quality level/fragment loading.\n autoStartLoad: false,\n // Custom configuration for hls.js.\n ...this.config\n });\n this.api.loadSource(this.src);\n this.api.attachMedia(this.nativeEl);\n switch (this.nativeEl.preload) {\n case \"none\": {\n const loadSourceOnPlay = () => this.api.startLoad();\n this.nativeEl.addEventListener(\"play\", loadSourceOnPlay, {\n once: true\n });\n this.api.on(Hls.Events.DESTROYING, () => {\n this.nativeEl.removeEventListener(\"play\", loadSourceOnPlay);\n });\n break;\n }\n case \"metadata\": {\n const originalLength = this.api.config.maxBufferLength;\n const originalSize = this.api.config.maxBufferSize;\n this.api.config.maxBufferLength = 1;\n this.api.config.maxBufferSize = 1;\n const increaseBufferOnPlay = () => {\n this.api.config.maxBufferLength = originalLength;\n this.api.config.maxBufferSize = originalSize;\n };\n this.nativeEl.addEventListener(\"play\", increaseBufferOnPlay, {\n once: true\n });\n this.api.on(Hls.Events.DESTROYING, () => {\n this.nativeEl.removeEventListener(\"play\", increaseBufferOnPlay);\n });\n this.api.startLoad();\n break;\n }\n default:\n this.api.startLoad();\n }\n if (this.nativeEl.webkitCurrentPlaybackTargetIsWireless) {\n this.api.stopLoad();\n }\n this.nativeEl.addEventListener(\n \"webkitcurrentplaybacktargetiswirelesschanged\",\n this.#toggleHlsLoad\n );\n this.#airplaySourceEl = document.createElement(\"source\");\n this.#airplaySourceEl.setAttribute(\"type\", \"application/x-mpegURL\");\n this.#airplaySourceEl.setAttribute(\"src\", this.src);\n this.nativeEl.disableRemotePlayback = false;\n this.nativeEl.append(this.#airplaySourceEl);\n const levelIdMap = /* @__PURE__ */ new WeakMap();\n this.api.on(Hls.Events.MANIFEST_PARSED, (event, data) => {\n if (this.nativeEl.autoplay && this.nativeEl.paused) {\n this.nativeEl.play().catch((err) => {\n console.warn(\"Autoplay failed:\", err);\n });\n }\n removeAllMediaTracks();\n let videoTrack = this.videoTracks.getTrackById(\"main\");\n if (!videoTrack) {\n videoTrack = this.addVideoTrack(\"main\");\n videoTrack.id = \"main\";\n videoTrack.selected = true;\n }\n for (const [id, level] of data.levels.entries()) {\n const videoRendition = videoTrack.addRendition(\n level.url[0],\n level.width,\n level.height,\n level.videoCodec,\n level.bitrate\n );\n levelIdMap.set(level, `${id}`);\n videoRendition.id = `${id}`;\n }\n for (let [id, a] of data.audioTracks.entries()) {\n const kind = a.default ? \"main\" : \"alternative\";\n const audioTrack = this.addAudioTrack(kind, a.name, a.lang);\n audioTrack.id = `${id}`;\n if (a.default) {\n audioTrack.enabled = true;\n }\n }\n });\n this.audioTracks.addEventListener(\"change\", () => {\n var _a2;\n const audioTrackId = +((_a2 = [...this.audioTracks].find((t) => t.enabled)) == null ? void 0 : _a2.id);\n const availableIds = this.api.audioTracks.map((t) => t.id);\n if (audioTrackId != this.api.audioTrack && availableIds.includes(audioTrackId)) {\n this.api.audioTrack = audioTrackId;\n }\n });\n this.api.on(Hls.Events.LEVELS_UPDATED, (event, data) => {\n const videoTrack = this.videoTracks[this.videoTracks.selectedIndex ?? 0];\n if (!videoTrack) return;\n const levelIds = data.levels.map((l) => levelIdMap.get(l));\n for (const rendition of this.videoRenditions) {\n if (rendition.id && !levelIds.includes(rendition.id)) {\n videoTrack.removeRendition(rendition);\n }\n }\n });\n let lastFailedLevel = null;\n this.api.on(Hls.Events.ERROR, (event, data) => {\n if (data.type === Hls.ErrorTypes.NETWORK_ERROR && data.details === Hls.ErrorDetails.FRAG_LOAD_ERROR) {\n lastFailedLevel = data.frag.level;\n }\n });\n this.api.on(Hls.Events.LEVEL_SWITCHED, (event, data) => {\n const newLevel = data.level;\n if (lastFailedLevel !== null && newLevel < lastFailedLevel) {\n console.warn(\n `\\u26A0\\uFE0F hls.js downgraded quality from level ${lastFailedLevel} to ${newLevel} due to fragment load failure.`\n );\n this.videoRenditions.selectedIndex = newLevel;\n lastFailedLevel = null;\n }\n });\n const switchRendition = (event) => {\n const level = event.target.selectedIndex;\n if (level != this.api.nextLevel) {\n this.api.nextLevel = level;\n }\n };\n (_b = this.videoRenditions) == null ? void 0 : _b.addEventListener(\"change\", switchRendition);\n const removeAllMediaTracks = () => {\n for (const videoTrack of this.videoTracks) {\n this.removeVideoTrack(videoTrack);\n }\n for (const audioTrack of this.audioTracks) {\n this.removeAudioTrack(audioTrack);\n }\n };\n this.api.once(Hls.Events.DESTROYING, removeAllMediaTracks);\n return;\n }\n await Promise.resolve();\n if (this.nativeEl.canPlayType(\"application/vnd.apple.mpegurl\")) {\n this.nativeEl.src = this.src;\n }\n }\n #toggleHlsLoad = () => {\n var _a, _b, _c;\n if ((_a = this.nativeEl) == null ? void 0 : _a.webkitCurrentPlaybackTargetIsWireless) {\n (_b = this.api) == null ? void 0 : _b.stopLoad();\n } else {\n (_c = this.api) == null ? void 0 : _c.startLoad();\n }\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 };\n};\nconst HlsVideoElement = HlsVideoMixin(MediaTracksMixin(CustomVideoElement));\nif (globalThis.customElements && !globalThis.customElements.get(\"hls-video\")) {\n globalThis.customElements.define(\"hls-video\", HlsVideoElement);\n}\nvar hls_video_element_default = HlsVideoElement;\nexport {\n Hls,\n HlsVideoElement,\n HlsVideoMixin,\n hls_video_element_default as default\n};\n","\"use client\";\n\n// dist/react.ts\nimport React from \"react\";\nimport CustomMediaElement from \"./hls-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: \"hls-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"],"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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;;;;;;;;;;;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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"}