@obipascal/player 1.0.3 → 1.0.4

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.
@@ -1,10 +1,11 @@
1
- var at = Object.defineProperty;
2
- var lt = (c, t, e) => t in c ? at(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
- var o = (c, t, e) => lt(c, typeof t != "symbol" ? t + "" : t, e);
4
- import k from "hls.js";
5
- import * as nt from "react";
6
- import ct, { useRef as V, useEffect as Q, useState as W } from "react";
7
- class ut {
1
+ var V = Object.defineProperty;
2
+ var N = (l, t, e) => t in l ? V(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
+ var o = (l, t, e) => N(l, typeof t != "symbol" ? t + "" : t, e);
4
+ import p from "hls.js";
5
+ import { jsx as $ } from "react/jsx-runtime";
6
+ import * as F from "react";
7
+ import { useRef as w, useEffect as f, useState as b } from "react";
8
+ class j {
8
9
  constructor(t) {
9
10
  o(this, "config");
10
11
  o(this, "sessionId");
@@ -20,9 +21,9 @@ class ut {
20
21
  this.config = t, this.sessionId = (t == null ? void 0 : t.sessionId) || this.generateSessionId(), this.sessionStartTime = Date.now(), (e = this.config) != null && e.enabled && this.trackEvent("session_start", this.getSessionData());
21
22
  }
22
23
  trackEvent(t, e = {}) {
23
- var r;
24
- if (!((r = this.config) != null && r.enabled)) return;
25
- const s = {
24
+ var i;
25
+ if (!((i = this.config) != null && i.enabled)) return;
26
+ const n = {
26
27
  eventType: t,
27
28
  timestamp: Date.now(),
28
29
  sessionId: this.sessionId,
@@ -33,7 +34,7 @@ class ut {
33
34
  ...this.getQoEMetrics()
34
35
  }
35
36
  };
36
- this.events.push(s), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(s), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, s.data);
37
+ this.events.push(n), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(n), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, n.data);
37
38
  }
38
39
  updateMetrics(t, e) {
39
40
  switch (t) {
@@ -96,8 +97,8 @@ class ut {
96
97
  },
97
98
  body: JSON.stringify(t)
98
99
  });
99
- } catch (s) {
100
- console.error("Failed to send analytics event:", s);
100
+ } catch (n) {
101
+ console.error("Failed to send analytics event:", n);
101
102
  }
102
103
  }
103
104
  generateSessionId() {
@@ -118,7 +119,7 @@ class ut {
118
119
  (t = this.config) != null && t.enabled && this.trackEvent("session_end", this.getSessionData()), this.events = [];
119
120
  }
120
121
  }
121
- class dt {
122
+ class W {
122
123
  constructor(t, e) {
123
124
  o(this, "container");
124
125
  o(this, "player");
@@ -130,9 +131,6 @@ class dt {
130
131
  o(this, "skipForwardButton");
131
132
  o(this, "volumeButton");
132
133
  o(this, "fullscreenButton");
133
- o(this, "qualityButton");
134
- o(this, "subtitleButton");
135
- o(this, "speedButton");
136
134
  o(this, "settingsButton");
137
135
  // private timeDisplay: HTMLElement
138
136
  o(this, "volumeSlider");
@@ -140,24 +138,24 @@ class dt {
140
138
  // private controlsVisible = true
141
139
  o(this, "hideControlsTimeout", null);
142
140
  o(this, "stickyControls", !1);
143
- this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.qualityButton = this.controlsContainer.querySelector(".wontum-quality-btn"), this.subtitleButton = this.controlsContainer.querySelector(".wontum-subtitle-btn"), this.speedButton = this.controlsContainer.querySelector(".wontum-speed-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
141
+ this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
144
142
  }
145
143
  injectStyles() {
146
144
  const t = "wontum-player-styles";
147
145
  if (document.getElementById(t)) return;
148
- const e = this.player.config.theme || {}, s = e.primaryColor || "#3b82f6", r = e.accentColor || "#2563eb", i = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", l = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", u = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", g = e.progressHeight || "6px", y = e.borderRadius || "4px", f = document.createElement("style");
149
- f.id = t, f.textContent = `
146
+ const e = this.player.config.theme || {}, n = e.primaryColor || "#3b82f6", i = e.accentColor || "#2563eb", s = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", r = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", a = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", c = e.progressHeight || "6px", d = e.borderRadius || "4px", m = document.createElement("style");
147
+ m.id = t, m.textContent = `
150
148
  .wontum-player-container {
151
149
  position: relative;
152
150
  background: #000;
153
- font-family: ${i};
151
+ font-family: ${s};
154
152
  overflow: hidden;
155
- --primary-color: ${s};
156
- --accent-color: ${r};
157
- --controls-bg: ${l};
158
- --button-hover: ${u};
159
- --progress-height: ${g};
160
- --border-radius: ${y};
153
+ --primary-color: ${n};
154
+ --accent-color: ${i};
155
+ --controls-bg: ${r};
156
+ --button-hover: ${a};
157
+ --progress-height: ${c};
158
+ --border-radius: ${d};
161
159
  }
162
160
 
163
161
  .wontum-player-video {
@@ -426,21 +424,7 @@ class dt {
426
424
  }
427
425
 
428
426
  .wontum-quality-menu {
429
- position: absolute;
430
- bottom: 100%;
431
- right: 0;
432
- background: rgba(20, 20, 20, 0.95);
433
- backdrop-filter: blur(10px);
434
- border-radius: 6px;
435
427
  padding: 6px 0;
436
- margin-bottom: 8px;
437
- display: none;
438
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
439
- min-width: 120px;
440
- }
441
-
442
- .wontum-quality-menu.active {
443
- display: block;
444
428
  }
445
429
 
446
430
  .wontum-quality-option {
@@ -463,21 +447,7 @@ class dt {
463
447
  }
464
448
 
465
449
  .wontum-speed-menu {
466
- position: absolute;
467
- bottom: 100%;
468
- right: 0;
469
- background: rgba(20, 20, 20, 0.95);
470
- backdrop-filter: blur(10px);
471
- border-radius: 6px;
472
450
  padding: 6px 0;
473
- margin-bottom: 8px;
474
- display: none;
475
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
476
- min-width: 120px;
477
- }
478
-
479
- .wontum-speed-menu.active {
480
- display: block;
481
451
  }
482
452
 
483
453
  .wontum-speed-option {
@@ -499,24 +469,73 @@ class dt {
499
469
  background: rgba(255, 255, 255, 0.05);
500
470
  }
501
471
 
502
- .wontum-settings-menu {
472
+ .wontum-settings-panel {
503
473
  position: absolute;
504
474
  bottom: 100%;
505
475
  right: 0;
506
476
  background: rgba(20, 20, 20, 0.95);
507
477
  backdrop-filter: blur(10px);
508
- border-radius: 6px;
509
- padding: 6px 0;
478
+ border-radius: 8px;
510
479
  margin-bottom: 8px;
511
- min-width: 200px;
480
+ min-width: 320px;
512
481
  display: none;
513
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
482
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
483
+ overflow: hidden;
484
+ }
485
+
486
+ .wontum-settings-panel.active {
487
+ display: flex;
488
+ flex-direction: column;
489
+ }
490
+
491
+ .wontum-settings-tabs {
492
+ display: flex;
493
+ background: rgba(0, 0, 0, 0.3);
494
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
495
+ }
496
+
497
+ .wontum-tab {
498
+ flex: 1;
499
+ padding: 10px 12px;
500
+ background: none;
501
+ border: none;
502
+ color: rgba(255, 255, 255, 0.7);
503
+ font-size: 12px;
504
+ cursor: pointer;
505
+ transition: all 0.2s ease;
506
+ border-bottom: 2px solid transparent;
507
+ font-family: inherit;
508
+ }
509
+
510
+ .wontum-tab:hover {
511
+ background: rgba(255, 255, 255, 0.05);
512
+ color: rgba(255, 255, 255, 0.9);
514
513
  }
515
514
 
516
- .wontum-settings-menu.active {
515
+ .wontum-tab.active {
516
+ color: var(--primary-color);
517
+ border-bottom-color: var(--primary-color);
518
+ background: rgba(59, 130, 246, 0.1);
519
+ }
520
+
521
+ .wontum-settings-content {
522
+ min-height: 120px;
523
+ max-height: 300px;
524
+ overflow-y: auto;
525
+ }
526
+
527
+ .wontum-tab-panel {
528
+ display: none;
529
+ }
530
+
531
+ .wontum-tab-panel.active {
517
532
  display: block;
518
533
  }
519
534
 
535
+ .wontum-settings-menu {
536
+ padding: 6px 0;
537
+ }
538
+
520
539
  .wontum-settings-option {
521
540
  padding: 12px 16px;
522
541
  cursor: pointer;
@@ -564,21 +583,7 @@ class dt {
564
583
  }
565
584
 
566
585
  .wontum-subtitle-menu {
567
- position: absolute;
568
- bottom: 100%;
569
- right: 0;
570
- background: rgba(20, 20, 20, 0.95);
571
- backdrop-filter: blur(10px);
572
- border-radius: 6px;
573
586
  padding: 6px 0;
574
- margin-bottom: 8px;
575
- display: none;
576
- min-width: 150px;
577
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
578
- }
579
-
580
- .wontum-subtitle-menu.active {
581
- display: block;
582
587
  }
583
588
 
584
589
  .wontum-subtitle-option {
@@ -611,7 +616,7 @@ class dt {
611
616
  transform: translateY(0) !important;
612
617
  pointer-events: all !important;
613
618
  }
614
- `, document.head.appendChild(f), this.container.classList.add("wontum-player-container");
619
+ `, document.head.appendChild(m), this.container.classList.add("wontum-player-container");
615
620
  }
616
621
  createProgressBar() {
617
622
  const t = document.createElement("div");
@@ -655,32 +660,32 @@ class dt {
655
660
 
656
661
  <div class="wontum-spacer"></div>
657
662
 
658
- <div class="wontum-subtitle-container" style="position: relative;">
659
- <button class="wontum-btn wontum-subtitle-btn" aria-label="Subtitles">
660
- ${this.getSubtitleIcon()}
661
- </button>
662
- <div class="wontum-subtitle-menu"></div>
663
- </div>
664
-
665
- <div class="wontum-speed-container" style="position: relative;">
666
- <button class="wontum-btn wontum-speed-btn" aria-label="Playback Speed">
667
- ${this.getSpeedIcon()}
668
- </button>
669
- <div class="wontum-speed-menu"></div>
670
- </div>
671
-
672
- <div class="wontum-quality-container" style="position: relative;">
673
- <button class="wontum-btn wontum-quality-btn" aria-label="Quality">
674
- ${this.getQualityIcon()}
675
- </button>
676
- <div class="wontum-quality-menu"></div>
677
- </div>
678
-
679
663
  <div class="wontum-settings-container" style="position: relative;">
680
664
  <button class="wontum-btn wontum-settings-btn" aria-label="Settings">
681
665
  ${this.getSettingsIcon()}
682
666
  </button>
683
- <div class="wontum-settings-menu"></div>
667
+ <div class="wontum-settings-panel">
668
+ <div class="wontum-settings-tabs">
669
+ <button class="wontum-tab active" data-tab="general">General</button>
670
+ <button class="wontum-tab" data-tab="quality">Quality</button>
671
+ <button class="wontum-tab" data-tab="speed">Speed</button>
672
+ <button class="wontum-tab" data-tab="subtitles">Subtitles</button>
673
+ </div>
674
+ <div class="wontum-settings-content">
675
+ <div class="wontum-tab-panel active" data-panel="general">
676
+ <div class="wontum-settings-menu"></div>
677
+ </div>
678
+ <div class="wontum-tab-panel" data-panel="quality">
679
+ <div class="wontum-quality-menu"></div>
680
+ </div>
681
+ <div class="wontum-tab-panel" data-panel="speed">
682
+ <div class="wontum-speed-menu"></div>
683
+ </div>
684
+ <div class="wontum-tab-panel" data-panel="subtitles">
685
+ <div class="wontum-subtitle-menu"></div>
686
+ </div>
687
+ </div>
688
+ </div>
684
689
  </div>
685
690
 
686
691
  <button class="wontum-btn wontum-fullscreen-btn" aria-label="Fullscreen">
@@ -700,28 +705,28 @@ class dt {
700
705
  this.player.skipBackward(10);
701
706
  }), this.skipForwardButton.addEventListener("click", () => {
702
707
  this.player.skipForward(10);
703
- }), this.progressInput.addEventListener("input", (e) => {
704
- const s = e.target, r = parseFloat(s.value), i = this.player.getState(), l = r / 100 * i.duration;
705
- this.player.seek(l);
706
- }), this.volumeSlider.addEventListener("input", (e) => {
707
- const s = e.target, r = parseFloat(s.value) / 100;
708
- this.player.setVolume(r);
708
+ }), this.progressInput.addEventListener("input", (n) => {
709
+ const i = n.target, s = parseFloat(i.value), r = this.player.getState(), a = s / 100 * r.duration;
710
+ this.player.seek(a);
711
+ }), this.volumeSlider.addEventListener("input", (n) => {
712
+ const i = n.target, s = parseFloat(i.value) / 100;
713
+ this.player.setVolume(s);
709
714
  }), this.volumeButton.addEventListener("click", () => {
710
715
  this.player.getState().muted ? this.player.unmute() : this.player.mute();
711
716
  }), this.fullscreenButton.addEventListener("click", () => {
712
717
  this.player.getState().fullscreen ? this.player.exitFullscreen() : this.player.enterFullscreen();
713
- }), this.qualityButton.addEventListener("click", () => {
714
- var s, r, i;
715
- this.controlsContainer.querySelector(".wontum-quality-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active");
716
- }), this.subtitleButton.addEventListener("click", () => {
717
- var s, r, i;
718
- this.controlsContainer.querySelector(".wontum-subtitle-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active"), this.updateSubtitleMenu();
719
- }), this.speedButton.addEventListener("click", () => {
720
- var s, r, i;
721
- this.controlsContainer.querySelector(".wontum-speed-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || i.classList.remove("active"), this.updateSpeedMenu();
722
718
  }), this.settingsButton.addEventListener("click", () => {
723
- var s, r, i;
724
- this.controlsContainer.querySelector(".wontum-settings-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active"), this.updateSettingsMenu();
719
+ const n = this.controlsContainer.querySelector(".wontum-settings-panel");
720
+ n.classList.toggle("active"), n.classList.contains("active") && (this.updateSettingsMenu(), this.updateQualityMenu(), this.updateSpeedMenu(), this.updateSubtitleMenu());
721
+ });
722
+ const t = this.controlsContainer.querySelectorAll(".wontum-tab");
723
+ t.forEach((n) => {
724
+ n.addEventListener("click", (i) => {
725
+ const s = i.currentTarget, r = s.getAttribute("data-tab");
726
+ t.forEach((d) => d.classList.remove("active")), s.classList.add("active"), this.controlsContainer.querySelectorAll(".wontum-tab-panel").forEach((d) => d.classList.remove("active"));
727
+ const c = this.controlsContainer.querySelector(`[data-panel="${r}"]`);
728
+ c == null || c.classList.add("active");
729
+ });
725
730
  }), this.player.getVideoElement().addEventListener("click", () => {
726
731
  this.player.getState().playing ? this.player.pause() : this.player.play();
727
732
  }), this.container.addEventListener("mousemove", () => {
@@ -736,19 +741,19 @@ class dt {
736
741
  }), this.player.on("pause", () => {
737
742
  this.playButton.innerHTML = this.getPlayIcon();
738
743
  }), this.player.on("timeupdate", (t) => {
739
- const { currentTime: e } = t.data, s = this.player.getState();
740
- if (s.duration > 0) {
741
- const i = e / s.duration * 100;
742
- this.progressBar.style.width = `${i}%`, this.progressInput.value = i.toString();
744
+ const { currentTime: e } = t.data, n = this.player.getState();
745
+ if (n.duration > 0) {
746
+ const s = e / n.duration * 100;
747
+ this.progressBar.style.width = `${s}%`, this.progressInput.value = s.toString();
743
748
  }
744
- const r = this.controlsContainer.querySelector(".wontum-current-time");
745
- r.textContent = this.formatTime(e);
749
+ const i = this.controlsContainer.querySelector(".wontum-current-time");
750
+ i.textContent = this.formatTime(e);
746
751
  }), this.player.on("loadedmetadata", (t) => {
747
- const { duration: e } = t.data, s = this.controlsContainer.querySelector(".wontum-duration");
748
- s.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
752
+ const { duration: e } = t.data, n = this.controlsContainer.querySelector(".wontum-duration");
753
+ n.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
749
754
  }), this.player.on("volumechange", (t) => {
750
- const { volume: e, muted: s } = t.data;
751
- this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = s ? this.getMutedIcon() : this.getVolumeIcon();
755
+ const { volume: e, muted: n } = t.data;
756
+ this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = n ? this.getMutedIcon() : this.getVolumeIcon();
752
757
  }), this.player.on("waiting", () => {
753
758
  const t = this.controlsContainer.querySelector(".wontum-loading");
754
759
  t.style.display = "block";
@@ -763,35 +768,35 @@ class dt {
763
768
  t.innerHTML = '<div class="wontum-subtitle-option">No subtitles available</div>';
764
769
  return;
765
770
  }
766
- const s = e.findIndex((r) => r.mode === "showing");
771
+ const n = e.findIndex((i) => i.mode === "showing");
767
772
  t.innerHTML = `
768
- <div class="wontum-subtitle-option ${s === -1 ? "active" : ""}" data-track="-1">Off</div>
773
+ <div class="wontum-subtitle-option ${n === -1 ? "active" : ""}" data-track="-1">Off</div>
769
774
  ${e.map(
770
- (r, i) => `
771
- <div class="wontum-subtitle-option ${i === s ? "active" : ""}" data-track="${i}">
772
- ${r.label || r.language || `Track ${i + 1}`}
775
+ (i, s) => `
776
+ <div class="wontum-subtitle-option ${s === n ? "active" : ""}" data-track="${s}">
777
+ ${i.label || i.language || `Track ${s + 1}`}
773
778
  </div>
774
779
  `
775
780
  ).join("")}
776
- `, t.querySelectorAll(".wontum-subtitle-option").forEach((r) => {
777
- r.addEventListener("click", (i) => {
778
- const l = i.target, u = parseInt(l.dataset.track || "-1");
779
- u === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(u), t.querySelectorAll(".wontum-subtitle-option").forEach((g) => g.classList.remove("active")), l.classList.add("active"), t.classList.remove("active");
781
+ `, t.querySelectorAll(".wontum-subtitle-option").forEach((i) => {
782
+ i.addEventListener("click", (s) => {
783
+ const r = s.target, a = parseInt(r.dataset.track || "-1");
784
+ a === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(a), t.querySelectorAll(".wontum-subtitle-option").forEach((c) => c.classList.remove("active")), r.classList.add("active");
780
785
  });
781
786
  });
782
787
  }
783
788
  updateSpeedMenu() {
784
- const t = this.controlsContainer.querySelector(".wontum-speed-menu"), s = this.player.getState().playbackRate || 1, r = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
785
- t.innerHTML = r.map(
786
- (i) => `
787
- <div class="wontum-speed-option ${s === i ? "active" : ""}" data-speed="${i}">
788
- ${i === 1 ? "Normal" : i + "x"}
789
+ const t = this.controlsContainer.querySelector(".wontum-speed-menu"), n = this.player.getState().playbackRate || 1, i = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
790
+ t.innerHTML = i.map(
791
+ (s) => `
792
+ <div class="wontum-speed-option ${n === s ? "active" : ""}" data-speed="${s}">
793
+ ${s === 1 ? "Normal" : s + "x"}
789
794
  </div>
790
795
  `
791
- ).join(""), t.querySelectorAll(".wontum-speed-option").forEach((i) => {
792
- i.addEventListener("click", (l) => {
793
- const u = l.target, g = parseFloat(u.dataset.speed || "1");
794
- this.player.setPlaybackRate(g), t.querySelectorAll(".wontum-speed-option").forEach((y) => y.classList.remove("active")), u.classList.add("active"), t.classList.remove("active");
796
+ ).join(""), t.querySelectorAll(".wontum-speed-option").forEach((s) => {
797
+ s.addEventListener("click", (r) => {
798
+ const a = r.target, c = parseFloat(a.dataset.speed || "1");
799
+ this.player.setPlaybackRate(c), t.querySelectorAll(".wontum-speed-option").forEach((d) => d.classList.remove("active")), a.classList.add("active");
795
800
  });
796
801
  });
797
802
  }
@@ -809,18 +814,22 @@ class dt {
809
814
  });
810
815
  }
811
816
  updateQualityMenu(t) {
812
- const e = this.controlsContainer.querySelector(".wontum-quality-menu");
817
+ const e = this.controlsContainer.querySelector(".wontum-quality-menu"), n = t || this.player.getQualities();
818
+ if (!n || n.length === 0) {
819
+ e.innerHTML = '<div class="wontum-quality-option">No qualities available</div>';
820
+ return;
821
+ }
813
822
  e.innerHTML = `
814
823
  <div class="wontum-quality-option active" data-quality="-1">Auto</div>
815
- ${t.map(
816
- (s, r) => `
817
- <div class="wontum-quality-option" data-quality="${r}">${s.name}</div>
824
+ ${n.map(
825
+ (i, s) => `
826
+ <div class="wontum-quality-option" data-quality="${s}">${i.name}</div>
818
827
  `
819
828
  ).join("")}
820
- `, e.querySelectorAll(".wontum-quality-option").forEach((s) => {
821
- s.addEventListener("click", (r) => {
822
- const i = r.target, l = parseInt(i.dataset.quality || "-1");
823
- this.player.setQuality(l), e.querySelectorAll(".wontum-quality-option").forEach((u) => u.classList.remove("active")), i.classList.add("active"), e.classList.remove("active");
829
+ `, e.querySelectorAll(".wontum-quality-option").forEach((i) => {
830
+ i.addEventListener("click", (s) => {
831
+ const r = s.target, a = parseInt(r.dataset.quality || "-1");
832
+ this.player.setQuality(a), e.querySelectorAll(".wontum-quality-option").forEach((c) => c.classList.remove("active")), r.classList.add("active");
824
833
  });
825
834
  });
826
835
  }
@@ -838,8 +847,8 @@ class dt {
838
847
  }
839
848
  formatTime(t) {
840
849
  if (isNaN(t)) return "0:00";
841
- const e = Math.floor(t / 60), s = Math.floor(t % 60);
842
- return `${e}:${s.toString().padStart(2, "0")}`;
850
+ const e = Math.floor(t / 60), n = Math.floor(t % 60);
851
+ return `${e}:${n.toString().padStart(2, "0")}`;
843
852
  }
844
853
  // SVG Icons
845
854
  getPlayIcon() {
@@ -857,9 +866,6 @@ class dt {
857
866
  getFullscreenIcon() {
858
867
  return '<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
859
868
  }
860
- getQualityIcon() {
861
- return '<svg viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm7-1c0 .55-.45 1-1 1h-.75v1.5h-1.5V15H14c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v4zm-3.5-.5h2v-3h-2v3z"/></svg>';
862
- }
863
869
  getSkipBackwardIcon() {
864
870
  return `<svg viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
865
871
  <circle cx="30" cy="30" r="28" stroke="white" stroke-width="2"/>
@@ -878,12 +884,6 @@ class dt {
878
884
  <text x="30" y="35" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">10</text>
879
885
  </svg>`;
880
886
  }
881
- getSubtitleIcon() {
882
- return '<svg viewBox="0 0 24 24"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"/></svg>';
883
- }
884
- getSpeedIcon() {
885
- return '<svg viewBox="0 0 24 24"><path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/></svg>';
886
- }
887
887
  getSettingsIcon() {
888
888
  return '<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>';
889
889
  }
@@ -891,7 +891,7 @@ class dt {
891
891
  this.hideControlsTimeout && clearTimeout(this.hideControlsTimeout), this.controlsContainer.remove();
892
892
  }
893
893
  }
894
- class ht {
894
+ class Q {
895
895
  constructor(t) {
896
896
  o(this, "config");
897
897
  o(this, "urlCache", /* @__PURE__ */ new Map());
@@ -912,8 +912,8 @@ class ht {
912
912
  if (!((e = this.config) != null && e.cloudFrontDomains) || this.config.cloudFrontDomains.length === 0)
913
913
  return !1;
914
914
  try {
915
- const s = new URL(t);
916
- return this.config.cloudFrontDomains.some((r) => s.hostname.includes(r));
915
+ const n = new URL(t);
916
+ return this.config.cloudFrontDomains.some((i) => n.hostname.includes(i));
917
917
  } catch {
918
918
  return !1;
919
919
  }
@@ -934,10 +934,10 @@ class ht {
934
934
  return t;
935
935
  if ((e = this.config) != null && e.signUrl)
936
936
  try {
937
- const s = await this.config.signUrl(t);
938
- return this.signedUrls.add(t), s;
939
- } catch (s) {
940
- throw console.error("Failed to sign CloudFront URL:", s), new Error("Failed to sign CloudFront URL");
937
+ const n = await this.config.signUrl(t);
938
+ return this.signedUrls.add(t), n;
939
+ } catch (n) {
940
+ throw console.error("Failed to sign CloudFront URL:", n), new Error("Failed to sign CloudFront URL");
941
941
  }
942
942
  return console.warn("No signUrl function provided. CloudFront cookies may not be set."), t;
943
943
  }
@@ -950,34 +950,34 @@ class ht {
950
950
  const e = t.match(/s3[.-]([^.]+)\.amazonaws\.com\/(.+)/);
951
951
  if (e)
952
952
  return e[2];
953
- const s = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
954
- return s ? s[2] : t;
953
+ const n = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
954
+ return n ? n[2] : t;
955
955
  }
956
956
  /**
957
957
  * Get presigned URL from cache or generate new one
958
958
  */
959
959
  async getPresignedUrl(t) {
960
- var r;
961
- const e = this.extractS3Key(t), s = this.urlCache.get(e);
962
- if (s && s.expiresAt > Date.now())
963
- return s.url;
964
- if ((r = this.config) != null && r.getPresignedUrl)
960
+ var i;
961
+ const e = this.extractS3Key(t), n = this.urlCache.get(e);
962
+ if (n && n.expiresAt > Date.now())
963
+ return n.url;
964
+ if ((i = this.config) != null && i.getPresignedUrl)
965
965
  try {
966
- const i = await this.config.getPresignedUrl(e);
966
+ const s = await this.config.getPresignedUrl(e);
967
967
  return this.urlCache.set(e, {
968
- url: i,
968
+ url: s,
969
969
  expiresAt: Date.now() + 50 * 60 * 1e3
970
- }), i;
971
- } catch (i) {
972
- throw console.error("Failed to generate presigned URL:", i), new Error("Failed to generate presigned URL for S3 object");
970
+ }), s;
971
+ } catch (s) {
972
+ throw console.error("Failed to generate presigned URL:", s), new Error("Failed to generate presigned URL for S3 object");
973
973
  }
974
974
  return console.warn("No getPresignedUrl function provided. Using direct S3 URL (requires public bucket)"), t;
975
975
  }
976
976
  /**
977
977
  * Helper to construct S3 URL from bucket and key
978
978
  */
979
- static constructS3Url(t, e, s = "us-east-1") {
980
- return `https://${t}.s3.${s}.amazonaws.com/${e}`;
979
+ static constructS3Url(t, e, n = "us-east-1") {
980
+ return `https://${t}.s3.${n}.amazonaws.com/${e}`;
981
981
  }
982
982
  /**
983
983
  * Helper to parse S3 URI (s3://bucket/key)
@@ -985,8 +985,8 @@ class ht {
985
985
  static parseS3Uri(t) {
986
986
  if (!t.startsWith("s3://"))
987
987
  return null;
988
- const e = t.replace("s3://", "").split("/"), s = e[0], r = e.slice(1).join("/");
989
- return { bucket: s, key: r };
988
+ const e = t.replace("s3://", "").split("/"), n = e[0], i = e.slice(1).join("/");
989
+ return { bucket: n, key: i };
990
990
  }
991
991
  /**
992
992
  * Clear URL cache and signed URLs
@@ -995,7 +995,7 @@ class ht {
995
995
  this.urlCache.clear(), this.signedUrls.clear();
996
996
  }
997
997
  }
998
- class st {
998
+ class R {
999
999
  constructor(t) {
1000
1000
  o(this, "container");
1001
1001
  o(this, "videoElement");
@@ -1005,6 +1005,7 @@ class st {
1005
1005
  o(this, "analytics");
1006
1006
  o(this, "s3Handler");
1007
1007
  o(this, "uiController");
1008
+ o(this, "qualities", []);
1008
1009
  o(this, "state", {
1009
1010
  playing: !1,
1010
1011
  paused: !0,
@@ -1021,12 +1022,12 @@ class st {
1021
1022
  });
1022
1023
  if (this.config = t, this.container = typeof t.container == "string" ? document.querySelector(t.container) : t.container, !this.container)
1023
1024
  throw new Error("Container element not found");
1024
- this.analytics = new ut(t.analytics), this.s3Handler = new ht(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new dt(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1025
+ this.analytics = new j(t.analytics), this.s3Handler = new Q(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new W(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1025
1026
  }
1026
1027
  addSubtitleTracks(t) {
1027
1028
  t.forEach((e) => {
1028
- const s = document.createElement("track");
1029
- s.kind = "subtitles", s.label = e.label, s.src = e.src, s.srclang = e.srclang, e.default && (s.default = !0), this.videoElement.appendChild(s);
1029
+ const n = document.createElement("track");
1030
+ n.kind = "subtitles", n.label = e.label, n.src = e.src, n.srclang = e.srclang, e.default && (n.default = !0), this.videoElement.appendChild(n);
1030
1031
  });
1031
1032
  }
1032
1033
  createVideoElement() {
@@ -1089,16 +1090,16 @@ class st {
1089
1090
  async loadSource(t) {
1090
1091
  try {
1091
1092
  const e = await this.s3Handler.processUrl(t);
1092
- if (k.isSupported())
1093
- this.hls = new k(this.config.hlsConfig), this.hls.loadSource(e), this.hls.attachMedia(this.videoElement), this.hls.on(k.Events.MANIFEST_PARSED, (s, r) => {
1094
- const i = this.extractQualities(r.levels);
1095
- this.state.availableQualities = i.map((l) => l.name), this.emit("loadedmetadata", { qualities: i });
1096
- }), this.hls.on(k.Events.LEVEL_SWITCHED, (s, r) => {
1097
- var l;
1098
- const i = (l = this.hls) == null ? void 0 : l.levels[r.level];
1099
- i && (this.state.quality = `${i.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1100
- }), this.hls.on(k.Events.ERROR, (s, r) => {
1101
- r.fatal && this.handleHlsError(r);
1093
+ if (p.isSupported())
1094
+ this.hls = new p(this.config.hlsConfig), this.hls.loadSource(e), this.hls.attachMedia(this.videoElement), this.hls.on(p.Events.MANIFEST_PARSED, (n, i) => {
1095
+ const s = this.extractQualities(i.levels);
1096
+ this.qualities = s;
1097
+ }), this.hls.on(p.Events.LEVEL_SWITCHED, (n, i) => {
1098
+ var r;
1099
+ const s = (r = this.hls) == null ? void 0 : r.levels[i.level];
1100
+ s && (this.state.quality = `${s.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1101
+ }), this.hls.on(p.Events.ERROR, (n, i) => {
1102
+ i.fatal && this.handleHlsError(i);
1102
1103
  });
1103
1104
  else if (this.videoElement.canPlayType("application/vnd.apple.mpegurl"))
1104
1105
  this.videoElement.src = e;
@@ -1117,13 +1118,13 @@ class st {
1117
1118
  }));
1118
1119
  }
1119
1120
  handleHlsError(t) {
1120
- var e, s;
1121
+ var e, n;
1121
1122
  switch (t.type) {
1122
- case k.ErrorTypes.NETWORK_ERROR:
1123
+ case p.ErrorTypes.NETWORK_ERROR:
1123
1124
  console.error("Network error occurred"), (e = this.hls) == null || e.startLoad();
1124
1125
  break;
1125
- case k.ErrorTypes.MEDIA_ERROR:
1126
- console.error("Media error occurred"), (s = this.hls) == null || s.recoverMediaError();
1126
+ case p.ErrorTypes.MEDIA_ERROR:
1127
+ console.error("Media error occurred"), (n = this.hls) == null || n.recoverMediaError();
1127
1128
  break;
1128
1129
  default:
1129
1130
  console.error("Fatal error occurred:", t), this.destroy();
@@ -1173,6 +1174,9 @@ class st {
1173
1174
  setQuality(t) {
1174
1175
  this.hls && (this.hls.currentLevel = t);
1175
1176
  }
1177
+ getQualities() {
1178
+ return this.qualities;
1179
+ }
1176
1180
  enterFullscreen() {
1177
1181
  this.container.requestFullscreen && (this.container.requestFullscreen(), this.state.fullscreen = !0, this.emit("fullscreenchange", { fullscreen: !0 }));
1178
1182
  }
@@ -1190,8 +1194,8 @@ class st {
1190
1194
  */
1191
1195
  enableSubtitles(t) {
1192
1196
  const e = this.videoElement.textTracks;
1193
- for (let s = 0; s < e.length; s++)
1194
- e[s].mode = s === t ? "showing" : "hidden";
1197
+ for (let n = 0; n < e.length; n++)
1198
+ e[n].mode = n === t ? "showing" : "hidden";
1195
1199
  }
1196
1200
  /**
1197
1201
  * Disable all subtitles
@@ -1206,7 +1210,7 @@ class st {
1206
1210
  */
1207
1211
  toggleSubtitles() {
1208
1212
  const t = this.videoElement.textTracks;
1209
- return Array.from(t).some((s) => s.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1213
+ return Array.from(t).some((n) => n.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1210
1214
  }
1211
1215
  /**
1212
1216
  * Get available subtitle tracks
@@ -1225,407 +1229,132 @@ class st {
1225
1229
  this.eventListeners.has(t) || this.eventListeners.set(t, /* @__PURE__ */ new Set()), this.eventListeners.get(t).add(e);
1226
1230
  }
1227
1231
  off(t, e) {
1228
- var s;
1229
- (s = this.eventListeners.get(t)) == null || s.delete(e);
1232
+ var n;
1233
+ (n = this.eventListeners.get(t)) == null || n.delete(e);
1230
1234
  }
1231
1235
  emit(t, e) {
1232
- var r;
1233
- const s = {
1236
+ var i;
1237
+ const n = {
1234
1238
  type: t,
1235
1239
  data: e,
1236
1240
  timestamp: Date.now()
1237
1241
  };
1238
- (r = this.eventListeners.get(t)) == null || r.forEach((i) => {
1239
- i(s);
1242
+ (i = this.eventListeners.get(t)) == null || i.forEach((s) => {
1243
+ s(n);
1240
1244
  });
1241
1245
  }
1242
1246
  destroy() {
1243
1247
  this.hls && (this.hls.destroy(), this.hls = null), this.uiController.destroy(), this.videoElement.remove(), this.eventListeners.clear(), this.analytics.destroy();
1244
1248
  }
1245
1249
  }
1246
- var Y = { exports: {} }, _ = {};
1247
- /**
1248
- * @license React
1249
- * react-jsx-runtime.production.js
1250
- *
1251
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1252
- *
1253
- * This source code is licensed under the MIT license found in the
1254
- * LICENSE file in the root directory of this source tree.
1255
- */
1256
- var tt;
1257
- function mt() {
1258
- if (tt) return _;
1259
- tt = 1;
1260
- var c = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
1261
- function e(s, r, i) {
1262
- var l = null;
1263
- if (i !== void 0 && (l = "" + i), r.key !== void 0 && (l = "" + r.key), "key" in r) {
1264
- i = {};
1265
- for (var u in r)
1266
- u !== "key" && (i[u] = r[u]);
1267
- } else i = r;
1268
- return r = i.ref, {
1269
- $$typeof: c,
1270
- type: s,
1271
- key: l,
1272
- ref: r !== void 0 ? r : null,
1273
- props: i
1274
- };
1275
- }
1276
- return _.Fragment = t, _.jsx = e, _.jsxs = e, _;
1277
- }
1278
- var q = {};
1279
- /**
1280
- * @license React
1281
- * react-jsx-runtime.development.js
1282
- *
1283
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1284
- *
1285
- * This source code is licensed under the MIT license found in the
1286
- * LICENSE file in the root directory of this source tree.
1287
- */
1288
- var et;
1289
- function pt() {
1290
- return et || (et = 1, process.env.NODE_ENV !== "production" && function() {
1291
- function c(n) {
1292
- if (n == null) return null;
1293
- if (typeof n == "function")
1294
- return n.$$typeof === O ? null : n.displayName || n.name || null;
1295
- if (typeof n == "string") return n;
1296
- switch (n) {
1297
- case E:
1298
- return "Fragment";
1299
- case B:
1300
- return "Profiler";
1301
- case I:
1302
- return "StrictMode";
1303
- case D:
1304
- return "Suspense";
1305
- case H:
1306
- return "SuspenseList";
1307
- case L:
1308
- return "Activity";
1309
- }
1310
- if (typeof n == "object")
1311
- switch (typeof n.tag == "number" && console.error(
1312
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1313
- ), n.$$typeof) {
1314
- case M:
1315
- return "Portal";
1316
- case F:
1317
- return n.displayName || "Context";
1318
- case $:
1319
- return (n._context.displayName || "Context") + ".Consumer";
1320
- case z:
1321
- var a = n.render;
1322
- return n = n.displayName, n || (n = a.displayName || a.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
1323
- case T:
1324
- return a = n.displayName || null, a !== null ? a : c(n.type) || "Memo";
1325
- case w:
1326
- a = n._payload, n = n._init;
1327
- try {
1328
- return c(n(a));
1329
- } catch {
1330
- }
1331
- }
1332
- return null;
1333
- }
1334
- function t(n) {
1335
- return "" + n;
1336
- }
1337
- function e(n) {
1338
- try {
1339
- t(n);
1340
- var a = !1;
1341
- } catch {
1342
- a = !0;
1343
- }
1344
- if (a) {
1345
- a = console;
1346
- var d = a.error, h = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
1347
- return d.call(
1348
- a,
1349
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1350
- h
1351
- ), t(n);
1352
- }
1353
- }
1354
- function s(n) {
1355
- if (n === E) return "<>";
1356
- if (typeof n == "object" && n !== null && n.$$typeof === w)
1357
- return "<...>";
1358
- try {
1359
- var a = c(n);
1360
- return a ? "<" + a + ">" : "<...>";
1361
- } catch {
1362
- return "<...>";
1363
- }
1364
- }
1365
- function r() {
1366
- var n = R.A;
1367
- return n === null ? null : n.getOwner();
1368
- }
1369
- function i() {
1370
- return Error("react-stack-top-frame");
1371
- }
1372
- function l(n) {
1373
- if (p.call(n, "key")) {
1374
- var a = Object.getOwnPropertyDescriptor(n, "key").get;
1375
- if (a && a.isReactWarning) return !1;
1376
- }
1377
- return n.key !== void 0;
1378
- }
1379
- function u(n, a) {
1380
- function d() {
1381
- J || (J = !0, console.error(
1382
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1383
- a
1384
- ));
1385
- }
1386
- d.isReactWarning = !0, Object.defineProperty(n, "key", {
1387
- get: d,
1388
- configurable: !0
1389
- });
1390
- }
1391
- function g() {
1392
- var n = c(this.type);
1393
- return X[n] || (X[n] = !0, console.error(
1394
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1395
- )), n = this.props.ref, n !== void 0 ? n : null;
1396
- }
1397
- function y(n, a, d, h, j, N) {
1398
- var m = d.ref;
1399
- return n = {
1400
- $$typeof: C,
1401
- type: n,
1402
- key: a,
1403
- props: d,
1404
- _owner: h
1405
- }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(n, "ref", {
1406
- enumerable: !1,
1407
- get: g
1408
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
1409
- configurable: !1,
1410
- enumerable: !1,
1411
- writable: !0,
1412
- value: 0
1413
- }), Object.defineProperty(n, "_debugInfo", {
1414
- configurable: !1,
1415
- enumerable: !1,
1416
- writable: !0,
1417
- value: null
1418
- }), Object.defineProperty(n, "_debugStack", {
1419
- configurable: !1,
1420
- enumerable: !1,
1421
- writable: !0,
1422
- value: j
1423
- }), Object.defineProperty(n, "_debugTask", {
1424
- configurable: !1,
1425
- enumerable: !1,
1426
- writable: !0,
1427
- value: N
1428
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
1429
- }
1430
- function f(n, a, d, h, j, N) {
1431
- var m = a.children;
1432
- if (m !== void 0)
1433
- if (h)
1434
- if (v(m)) {
1435
- for (h = 0; h < m.length; h++)
1436
- P(m[h]);
1437
- Object.freeze && Object.freeze(m);
1438
- } else
1439
- console.error(
1440
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1441
- );
1442
- else P(m);
1443
- if (p.call(a, "key")) {
1444
- m = c(n);
1445
- var S = Object.keys(a).filter(function(ot) {
1446
- return ot !== "key";
1447
- });
1448
- h = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", K[m + h] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
1449
- `A props object containing a "key" prop is being spread into JSX:
1450
- let props = %s;
1451
- <%s {...props} />
1452
- React keys must be passed directly to JSX without using spread:
1453
- let props = %s;
1454
- <%s key={someKey} {...props} />`,
1455
- h,
1456
- m,
1457
- S,
1458
- m
1459
- ), K[m + h] = !0);
1460
- }
1461
- if (m = null, d !== void 0 && (e(d), m = "" + d), l(a) && (e(a.key), m = "" + a.key), "key" in a) {
1462
- d = {};
1463
- for (var U in a)
1464
- U !== "key" && (d[U] = a[U]);
1465
- } else d = a;
1466
- return m && u(
1467
- d,
1468
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
1469
- ), y(
1470
- n,
1471
- m,
1472
- d,
1473
- r(),
1474
- j,
1475
- N
1476
- );
1477
- }
1478
- function P(n) {
1479
- A(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === w && (n._payload.status === "fulfilled" ? A(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
1480
- }
1481
- function A(n) {
1482
- return typeof n == "object" && n !== null && n.$$typeof === C;
1483
- }
1484
- var b = ct, C = Symbol.for("react.transitional.element"), M = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), $ = Symbol.for("react.consumer"), F = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), H = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), L = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), R = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, p = Object.prototype.hasOwnProperty, v = Array.isArray, x = console.createTask ? console.createTask : function() {
1485
- return null;
1486
- };
1487
- b = {
1488
- react_stack_bottom_frame: function(n) {
1489
- return n();
1490
- }
1491
- };
1492
- var J, X = {}, G = b.react_stack_bottom_frame.bind(
1493
- b,
1494
- i
1495
- )(), Z = x(s(i)), K = {};
1496
- q.Fragment = E, q.jsx = function(n, a, d) {
1497
- var h = 1e4 > R.recentlyCreatedOwnerStacks++;
1498
- return f(
1499
- n,
1500
- a,
1501
- d,
1502
- !1,
1503
- h ? Error("react-stack-top-frame") : G,
1504
- h ? x(s(n)) : Z
1505
- );
1506
- }, q.jsxs = function(n, a, d) {
1507
- var h = 1e4 > R.recentlyCreatedOwnerStacks++;
1508
- return f(
1509
- n,
1510
- a,
1511
- d,
1512
- !0,
1513
- h ? Error("react-stack-top-frame") : G,
1514
- h ? x(s(n)) : Z
1515
- );
1516
- };
1517
- }()), q;
1518
- }
1519
- process.env.NODE_ENV === "production" ? Y.exports = mt() : Y.exports = pt();
1520
- var rt = Y.exports;
1521
- const yt = (c) => {
1250
+ const X = (l) => {
1522
1251
  const {
1523
1252
  src: t,
1524
1253
  autoplay: e,
1525
- muted: s,
1526
- controls: r = !0,
1527
- poster: i,
1528
- preload: l,
1529
- theme: u,
1530
- s3Config: g,
1531
- analytics: y,
1532
- hlsConfig: f,
1533
- subtitles: P,
1254
+ muted: n,
1255
+ controls: i = !0,
1256
+ poster: s,
1257
+ preload: r,
1258
+ theme: a,
1259
+ s3Config: c,
1260
+ analytics: d,
1261
+ hlsConfig: m,
1262
+ subtitles: z,
1534
1263
  stickyControls: A,
1535
- onReady: b,
1536
- onPlay: C,
1537
- onPause: M,
1538
- onEnded: E,
1539
- onTimeUpdate: I,
1540
- onVolumeChange: B,
1541
- onError: $,
1542
- onLoadedMetadata: F,
1543
- onQualityChange: z,
1544
- style: D,
1545
- className: H,
1546
- width: T = "100%",
1547
- height: w = "500px"
1548
- } = c, L = V(null), O = V(null);
1549
- return Q(() => {
1550
- if (!L.current) return;
1551
- const R = {
1264
+ onReady: k,
1265
+ onPlay: E,
1266
+ onPause: x,
1267
+ onEnded: S,
1268
+ onTimeUpdate: C,
1269
+ onVolumeChange: L,
1270
+ onError: T,
1271
+ onLoadedMetadata: q,
1272
+ onQualityChange: M,
1273
+ style: H,
1274
+ className: U,
1275
+ width: g = "100%",
1276
+ height: v = "500px"
1277
+ } = l, y = w(null), B = w(null);
1278
+ return f(() => {
1279
+ if (!y.current) return;
1280
+ const D = {
1552
1281
  src: t,
1553
- container: L.current,
1282
+ container: y.current,
1554
1283
  autoplay: e,
1555
- muted: s,
1556
- controls: r,
1557
- poster: i,
1558
- preload: l,
1559
- theme: u,
1560
- s3Config: g,
1561
- analytics: y,
1562
- hlsConfig: f,
1563
- subtitles: P,
1284
+ muted: n,
1285
+ controls: i,
1286
+ poster: s,
1287
+ preload: r,
1288
+ theme: a,
1289
+ s3Config: c,
1290
+ analytics: d,
1291
+ hlsConfig: m,
1292
+ subtitles: z,
1564
1293
  stickyControls: A
1565
- }, p = new st(R);
1566
- return O.current = p, C && p.on("play", C), M && p.on("pause", M), E && p.on("ended", E), $ && p.on("error", (v) => {
1567
- var x;
1568
- return $((x = v.data) == null ? void 0 : x.error);
1569
- }), F && p.on("loadedmetadata", F), z && p.on("qualitychange", (v) => z(v.data.level)), I && p.on("timeupdate", (v) => I(v.data.currentTime)), B && p.on("volumechange", (v) => B(v.data.volume, v.data.muted)), b && b(p), () => {
1570
- p.destroy(), O.current = null;
1294
+ }, u = new R(D);
1295
+ return B.current = u, E && u.on("play", E), x && u.on("pause", x), S && u.on("ended", S), T && u.on("error", (h) => {
1296
+ var I;
1297
+ return T((I = h.data) == null ? void 0 : I.error);
1298
+ }), q && u.on("loadedmetadata", q), M && u.on("qualitychange", (h) => M(h.data.level)), C && u.on("timeupdate", (h) => C(h.data.currentTime)), L && u.on("volumechange", (h) => L(h.data.volume, h.data.muted)), k && k(u), () => {
1299
+ u.destroy(), B.current = null;
1571
1300
  };
1572
- }, [t]), /* @__PURE__ */ rt.jsx(
1301
+ }, [t]), /* @__PURE__ */ $(
1573
1302
  "div",
1574
1303
  {
1575
- ref: L,
1576
- className: H,
1304
+ ref: y,
1305
+ className: U,
1577
1306
  style: {
1578
- width: typeof T == "number" ? `${T}px` : T,
1579
- height: typeof w == "number" ? `${w}px` : w,
1580
- ...D
1307
+ width: typeof g == "number" ? `${g}px` : g,
1308
+ height: typeof v == "number" ? `${v}px` : v,
1309
+ ...H
1581
1310
  }
1582
1311
  }
1583
1312
  );
1584
- }, bt = (c) => {
1585
- const [t, e] = W(null), [s, r] = W(null), i = V(null);
1586
- return Q(() => {
1587
- if (!i.current) return;
1588
- const l = new st({
1589
- ...c,
1590
- container: i.current
1313
+ }, G = (l) => {
1314
+ const [t, e] = b(null), [n, i] = b(null), s = w(null);
1315
+ return f(() => {
1316
+ if (!s.current) return;
1317
+ const r = new R({
1318
+ ...l,
1319
+ container: s.current
1591
1320
  });
1592
- e(l);
1593
- const u = () => {
1594
- r(l.getState());
1321
+ e(r);
1322
+ const a = () => {
1323
+ i(r.getState());
1595
1324
  };
1596
- return l.on("play", u), l.on("pause", u), l.on("timeupdate", u), l.on("volumechange", u), l.on("loadedmetadata", u), () => {
1597
- l.destroy();
1325
+ return r.on("play", a), r.on("pause", a), r.on("timeupdate", a), r.on("volumechange", a), r.on("loadedmetadata", a), () => {
1326
+ r.destroy();
1598
1327
  };
1599
- }, [c.src]), {
1600
- containerRef: i,
1328
+ }, [l.src]), {
1329
+ containerRef: s,
1601
1330
  player: t,
1602
- state: s
1331
+ state: n
1603
1332
  };
1604
- }, it = nt.createContext({
1333
+ }, P = F.createContext({
1605
1334
  player: null,
1606
1335
  state: null
1607
- }), wt = (c) => {
1608
- const { player: t, children: e } = c, [s, r] = W(t.getState());
1609
- return Q(() => {
1610
- const i = () => {
1611
- r(t.getState());
1336
+ }), J = (l) => {
1337
+ const { player: t, children: e } = l, [n, i] = b(t.getState());
1338
+ return f(() => {
1339
+ const s = () => {
1340
+ i(t.getState());
1612
1341
  };
1613
- return t.on("play", i), t.on("pause", i), t.on("timeupdate", i), t.on("volumechange", i), t.on("loadedmetadata", i), () => {
1342
+ return t.on("play", s), t.on("pause", s), t.on("timeupdate", s), t.on("volumechange", s), t.on("loadedmetadata", s), () => {
1614
1343
  };
1615
- }, [t]), /* @__PURE__ */ rt.jsx(it.Provider, { value: { player: t, state: s }, children: e });
1616
- }, kt = () => {
1617
- const c = nt.useContext(it);
1618
- if (!c.player)
1344
+ }, [t]), /* @__PURE__ */ $(P.Provider, { value: { player: t, state: n }, children: e });
1345
+ }, Z = () => {
1346
+ const l = F.useContext(P);
1347
+ if (!l.player)
1619
1348
  throw new Error("useWontumPlayerContext must be used within WontumPlayerProvider");
1620
- return c;
1349
+ return l;
1621
1350
  };
1622
1351
  export {
1623
- ut as Analytics,
1624
- ht as S3Handler,
1625
- dt as UIController,
1626
- st as WontumPlayer,
1627
- wt as WontumPlayerProvider,
1628
- yt as WontumPlayerReact,
1629
- bt as useWontumPlayer,
1630
- kt as useWontumPlayerContext
1352
+ j as Analytics,
1353
+ Q as S3Handler,
1354
+ W as UIController,
1355
+ R as WontumPlayer,
1356
+ J as WontumPlayerProvider,
1357
+ X as WontumPlayerReact,
1358
+ G as useWontumPlayer,
1359
+ Z as useWontumPlayerContext
1631
1360
  };