@arraypress/waveform-player 1.29.0 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -305,6 +305,19 @@ function resampleData(data, targetLength) {
305
305
  }
306
306
  return result;
307
307
  }
308
+ function inTimeRanges(ranges, time) {
309
+ for (let i = 0; i < ranges.length; i++) {
310
+ if (ranges.start(i) - 0.05 <= time && time <= ranges.end(i) + 0.05) return true;
311
+ }
312
+ return false;
313
+ }
314
+ function coversDuration(ranges, duration) {
315
+ if (!Number.isFinite(duration) || duration <= 0) return false;
316
+ for (let i = 0; i < ranges.length; i++) {
317
+ if (ranges.start(i) <= 0.05 && ranges.end(i) >= duration - 0.1) return true;
318
+ }
319
+ return false;
320
+ }
308
321
 
309
322
  // src/js/drawing.js
310
323
  function fitBars(canvas, pitch) {
@@ -890,7 +903,9 @@ var DEFAULT_OPTIONS = {
890
903
  errorText: "Unable to load audio",
891
904
  // Localizable UI strings (alongside seekLabel / seekValueText / errorText).
892
905
  // These are screen-reader / assistive-tech facing, so translate them for
893
- // non-English UIs. playPauseLabel/speedLabel are aria-labels; artworkAlt is
906
+ // non-English UIs. playPauseLabel/speedLabel are aria-labels (the speed
907
+ // button prefixes speedLabel with its visible rate, "1.5x Playback speed",
908
+ // for WCAG 2.5.3 Label in Name); artworkAlt is
894
909
  // the cover image alt text; unknownTrackText is the Media Session (lock-
895
910
  // screen) title fallback used when no track title is set.
896
911
  playPauseLabel: "Play/Pause",
@@ -1048,11 +1063,16 @@ var ARTWORK_FALLBACK = "data:image/svg+xml," + encodeURIComponent(
1048
1063
  var SEEK_STEP_SECONDS = 5;
1049
1064
  var SEEK_PAGE_SECONDS = 10;
1050
1065
  var INTERACTIVE_ELEMENTS = 'button, a[href], input, [role="slider"]';
1066
+ function speedButtonLabel(rate, label) {
1067
+ return label ? `${rate}x ${label}` : `${rate}x`;
1068
+ }
1051
1069
  var WaveformPlayer = class _WaveformPlayer {
1052
1070
  /** @type {Map<string, WaveformPlayer>} */
1053
1071
  static instances = /* @__PURE__ */ new Map();
1054
1072
  /** @type {WaveformPlayer|null} */
1055
1073
  static currentlyPlaying = null;
1074
+ /** Audio URLs already warned about lacking byte-range support. @private */
1075
+ static _noRangeWarned = /* @__PURE__ */ new Set();
1056
1076
  /**
1057
1077
  * Create a new WaveformPlayer instance.
1058
1078
  *
@@ -1261,7 +1281,7 @@ var WaveformPlayer = class _WaveformPlayer {
1261
1281
  ` : ""}
1262
1282
  ${this.options.showPlaybackSpeed ? `
1263
1283
  <div class="waveform-speed">
1264
- <button class="speed-btn" aria-label="${escapeHtml(this.options.speedLabel)}" aria-haspopup="menu" aria-expanded="false">
1284
+ <button class="speed-btn" aria-label="${escapeHtml(speedButtonLabel(1, this.options.speedLabel))}" aria-haspopup="menu" aria-expanded="false">
1265
1285
  <span class="speed-value">1x</span>
1266
1286
  </button>
1267
1287
  <div class="speed-menu" role="menu" aria-label="${escapeHtml(this.options.speedLabel)}" style="display: none;">
@@ -1285,13 +1305,15 @@ var WaveformPlayer = class _WaveformPlayer {
1285
1305
  <div class="waveform-track waveform-align-${buttonAlign}">
1286
1306
  ${buttonHTML}
1287
1307
 
1288
- <div class="waveform-container">
1289
- <canvas></canvas>
1290
- <div class="waveform-markers"></div>
1291
- <div class="waveform-loading" style="display:none;"></div>
1292
- <div class="waveform-error" style="display:none;" role="alert">
1293
- <span class="waveform-error-text">${escapeHtml(this.options.errorText)}</span>
1308
+ <div class="waveform-surface">
1309
+ <div class="waveform-container">
1310
+ <canvas></canvas>
1311
+ <div class="waveform-loading" style="display:none;"></div>
1312
+ <div class="waveform-error" style="display:none;" role="alert">
1313
+ <span class="waveform-error-text">${escapeHtml(this.options.errorText)}</span>
1314
+ </div>
1294
1315
  </div>
1316
+ <div class="waveform-markers"></div>
1295
1317
  </div>
1296
1318
  </div>
1297
1319
 
@@ -1312,6 +1334,7 @@ var WaveformPlayer = class _WaveformPlayer {
1312
1334
  this.bpmValueEl = this.container.querySelector(".bpm-value");
1313
1335
  this.loadingEl = this.container.querySelector(".waveform-loading");
1314
1336
  this.errorEl = this.container.querySelector(".waveform-error");
1337
+ this.surfaceEl = this.container.querySelector(".waveform-surface");
1315
1338
  this.markersContainer = this.container.querySelector(".waveform-markers");
1316
1339
  this.speedBtn = this.container.querySelector(".speed-btn");
1317
1340
  this.speedMenu = this.container.querySelector(".speed-menu");
@@ -1881,7 +1904,7 @@ var WaveformPlayer = class _WaveformPlayer {
1881
1904
  this.audio.addEventListener("seeked", () => this._updatePositionState());
1882
1905
  this.audio.addEventListener("ratechange", () => this._updatePositionState());
1883
1906
  this.audio.addEventListener("timeupdate", () => {
1884
- if (this.isPlaying && Date.now() - this._frameAt > 500) this.updateProgress();
1907
+ if (this.isPlaying && !this._seekReload && Date.now() - this._frameAt > 500) this.updateProgress();
1885
1908
  });
1886
1909
  }
1887
1910
  this.canvas.addEventListener("click", (e) => this.handleCanvasClick(e));
@@ -2062,6 +2085,8 @@ var WaveformPlayer = class _WaveformPlayer {
2062
2085
  * @private
2063
2086
  */
2064
2087
  _resetTrack() {
2088
+ this._cancelCacheSeek?.();
2089
+ this._seekReload = null;
2065
2090
  this.progress = 0;
2066
2091
  this.waveformData = [];
2067
2092
  this._extDuration = 0;
@@ -2291,10 +2316,11 @@ var WaveformPlayer = class _WaveformPlayer {
2291
2316
  }
2292
2317
  const position = marker.time / duration * 100;
2293
2318
  const markerEl = document.createElement("button");
2319
+ markerEl.type = "button";
2294
2320
  markerEl.className = "waveform-marker";
2295
2321
  markerEl.style.left = `${position}%`;
2296
2322
  markerEl.style.backgroundColor = marker.color || "rgba(255, 255, 255, 0.5)";
2297
- markerEl.setAttribute("aria-label", marker.label);
2323
+ markerEl.setAttribute("aria-label", marker.label ? `${marker.label}, ${formatTime(marker.time)}` : formatTime(marker.time));
2298
2324
  markerEl.setAttribute("data-time", marker.time);
2299
2325
  const tooltip = document.createElement("span");
2300
2326
  tooltip.className = "waveform-marker-tooltip";
@@ -2302,7 +2328,7 @@ var WaveformPlayer = class _WaveformPlayer {
2302
2328
  markerEl.appendChild(tooltip);
2303
2329
  markerEl.addEventListener("click", (e) => {
2304
2330
  e.stopPropagation();
2305
- this.seekTo(marker.time);
2331
+ this.seekToSeconds(marker.time);
2306
2332
  if (this.options.playOnSeek && !this.isPlaying) {
2307
2333
  this.play();
2308
2334
  }
@@ -2372,10 +2398,11 @@ var WaveformPlayer = class _WaveformPlayer {
2372
2398
  this.seekEl.appendChild(tip);
2373
2399
  this.hoverTimeEl = tip;
2374
2400
  if (!this.options.showHoverTime) return;
2375
- this.seekEl.addEventListener("pointermove", (e) => {
2401
+ const hoverEl = this.surfaceEl || this.seekEl;
2402
+ hoverEl.addEventListener("pointermove", (e) => {
2376
2403
  if (!this._dragging) this._updateHoverTip(e.clientX);
2377
2404
  });
2378
- this.seekEl.addEventListener("pointerleave", () => {
2405
+ hoverEl.addEventListener("pointerleave", () => {
2379
2406
  if (!this._dragging) this._hideHoverTip();
2380
2407
  });
2381
2408
  }
@@ -2551,7 +2578,7 @@ var WaveformPlayer = class _WaveformPlayer {
2551
2578
  * @fires WaveformPlayer#waveformplayer:play
2552
2579
  */
2553
2580
  onPlay() {
2554
- if (this.isDestroying) return;
2581
+ if (this.isDestroying || this._seekReload) return;
2555
2582
  this.isPlaying = true;
2556
2583
  this.setPlayButtonState(true);
2557
2584
  this.startSmoothUpdate();
@@ -2570,7 +2597,7 @@ var WaveformPlayer = class _WaveformPlayer {
2570
2597
  * @fires WaveformPlayer#waveformplayer:pause
2571
2598
  */
2572
2599
  onPause() {
2573
- if (this.isDestroying) return;
2600
+ if (this.isDestroying || this._seekReload) return;
2574
2601
  this.isPlaying = false;
2575
2602
  this.setPlayButtonState(false);
2576
2603
  this.stopSmoothUpdate();
@@ -2786,11 +2813,10 @@ var WaveformPlayer = class _WaveformPlayer {
2786
2813
  */
2787
2814
  updateSpeedUI() {
2788
2815
  if (!this.audio) return;
2816
+ const rate = this.audio.playbackRate;
2789
2817
  const speedValue = this.container.querySelector(".speed-value");
2790
- if (speedValue) {
2791
- const rate = this.audio.playbackRate;
2792
- speedValue.textContent = rate === 1 ? "1x" : `${rate}x`;
2793
- }
2818
+ if (speedValue) speedValue.textContent = `${rate}x`;
2819
+ this.speedBtn?.setAttribute("aria-label", speedButtonLabel(rate, this.options.speedLabel));
2794
2820
  this.container.querySelectorAll(".speed-option").forEach((btn) => {
2795
2821
  const on = parseFloat(btn.dataset.rate) === this.audio.playbackRate;
2796
2822
  btn.classList.toggle("active", on);
@@ -2957,6 +2983,112 @@ var WaveformPlayer = class _WaveformPlayer {
2957
2983
  this.play();
2958
2984
  }
2959
2985
  }
2986
+ /**
2987
+ * Move the owned `<audio>` to `time`. The single path every self-mode seek
2988
+ * takes ({@link WaveformPlayer#seekTo}, {@link WaveformPlayer#seekToPercent},
2989
+ * so clicks, drags, keys and the slider too).
2990
+ *
2991
+ * Some hosts ignore HTTP byte ranges: they answer a `Range` request with
2992
+ * `200` and the whole file (Cloudflare Pages and Workers static assets, and
2993
+ * plenty of plain servers). Chromium then can't seek the media at all —
2994
+ * `seekable` stays `0–0` even once every byte has arrived — which is the
2995
+ * "long tracks snap back to 0" symptom. The copy in the browser's HTTP
2996
+ * cache *is* seekable (why a page refresh "fixes" it), so when the target
2997
+ * isn't seekable this reloads the element from cache and seeks there; see
2998
+ * {@link WaveformPlayer#_seekViaCache}. Detection is by the element's own
2999
+ * `seekable`, not the browser, so engines that can already seek (WebKit,
3000
+ * Firefox) never take that path; it runs at most once per file.
3001
+ * @param {number} time - Target position in seconds.
3002
+ * @private
3003
+ */
3004
+ _seekAudio(time) {
3005
+ const audio = this.audio;
3006
+ const seekable = audio.seekable;
3007
+ if (!Number.isFinite(audio.duration) || !seekable || seekable.length === 0 || inTimeRanges(seekable, time) || this._seekReloadedUrl === this.options.url) {
3008
+ audio.currentTime = time;
3009
+ return;
3010
+ }
3011
+ this._seekViaCache(time);
3012
+ }
3013
+ /**
3014
+ * Seek on a host without byte-range support: once the whole file is
3015
+ * downloaded (raising `preload` to `auto` until it is, then restoring it),
3016
+ * reload the element from the browser cache and seek there. Repeated seeks
3017
+ * while waiting just update the target. Warns once per URL, since the
3018
+ * real fix is serving audio from a range-capable host.
3019
+ * @param {number} time - Target position in seconds.
3020
+ * @private
3021
+ */
3022
+ _seekViaCache(time) {
3023
+ const audio = this.audio;
3024
+ const url = this.options.url;
3025
+ this._cacheSeekTime = time;
3026
+ if (!_WaveformPlayer._noRangeWarned.has(url)) {
3027
+ _WaveformPlayer._noRangeWarned.add(url);
3028
+ console.warn(`[WaveformPlayer] ${url}: the host ignores HTTP Range requests, so seeking waits for the download and reloads from cache. Serve audio with Range support for instant seeks.`);
3029
+ }
3030
+ if (this._cancelCacheSeek) return;
3031
+ if (coversDuration(audio.buffered, audio.duration)) {
3032
+ this._reloadForSeek(url);
3033
+ return;
3034
+ }
3035
+ const preload = audio.preload;
3036
+ audio.preload = "auto";
3037
+ this.setLoading(true);
3038
+ const stop = () => {
3039
+ audio.removeEventListener("progress", check);
3040
+ audio.removeEventListener("canplaythrough", check);
3041
+ audio.preload = preload;
3042
+ this._cancelCacheSeek = null;
3043
+ };
3044
+ const check = () => {
3045
+ if (this.audio !== audio || this.options.url !== url) return stop();
3046
+ if (!coversDuration(audio.buffered, audio.duration)) return;
3047
+ stop();
3048
+ this._reloadForSeek(url);
3049
+ };
3050
+ this._cancelCacheSeek = stop;
3051
+ audio.addEventListener("progress", check, { signal: this._ac.signal });
3052
+ audio.addEventListener("canplaythrough", check, { signal: this._ac.signal });
3053
+ }
3054
+ /**
3055
+ * Reload the fully-downloaded file from cache, seek to the pending target
3056
+ * and resume. The element's own pause/play events during the reload are
3057
+ * internal plumbing, so onPause/onPlay ignore them while `_seekReload` is
3058
+ * set: consumers (the bar, waveform-tracker) see a seek, not a pause and a
3059
+ * new play, and the button doesn't flicker.
3060
+ * @param {string} url - The file being reloaded.
3061
+ * @private
3062
+ */
3063
+ _reloadForSeek(url) {
3064
+ const audio = this.audio;
3065
+ const wasPlaying = !audio.paused && !audio.ended;
3066
+ const rate = audio.playbackRate;
3067
+ this._seekReloadedUrl = url;
3068
+ this._seekReload = { wasPlaying };
3069
+ const finish = () => {
3070
+ this._seekReload = null;
3071
+ this.setLoading(false);
3072
+ this.updateProgress();
3073
+ };
3074
+ audio.addEventListener("loadedmetadata", () => {
3075
+ if (this.audio !== audio || this.options.url !== url) return;
3076
+ audio.playbackRate = rate;
3077
+ audio.currentTime = this._cacheSeekTime;
3078
+ if (!wasPlaying) {
3079
+ finish();
3080
+ return;
3081
+ }
3082
+ audio.play().then(() => {
3083
+ finish();
3084
+ this.startSmoothUpdate();
3085
+ }, () => {
3086
+ finish();
3087
+ this.onPause();
3088
+ });
3089
+ }, { once: true, signal: this._ac.signal });
3090
+ audio.load();
3091
+ }
2960
3092
  /**
2961
3093
  * Seek the owned `<audio>` element to an absolute time, clamped to
2962
3094
  * `[0, duration]`, and refresh progress. Self mode only — a no-op when
@@ -2968,7 +3100,7 @@ var WaveformPlayer = class _WaveformPlayer {
2968
3100
  seekTo(seconds) {
2969
3101
  const s = Number(seconds);
2970
3102
  if (this.audio && this.audio.duration && Number.isFinite(s)) {
2971
- this.audio.currentTime = clamp(s, 0, this.audio.duration);
3103
+ this._seekAudio(clamp(s, 0, this.audio.duration));
2972
3104
  this.updateProgress();
2973
3105
  }
2974
3106
  }
@@ -2981,7 +3113,7 @@ var WaveformPlayer = class _WaveformPlayer {
2981
3113
  seekToPercent(percent) {
2982
3114
  const p = Number(percent);
2983
3115
  if (this.audio && this.audio.duration && Number.isFinite(p)) {
2984
- this.audio.currentTime = this.audio.duration * clamp(p);
3116
+ this._seekAudio(this.audio.duration * clamp(p));
2985
3117
  this.updateProgress();
2986
3118
  }
2987
3119
  }
@@ -1 +1 @@
1
- .waveform-player{font-family:inherit;color:inherit;line-height:var(--waveform-line-height, 1.4);--wfp-accent: #71717a;--wfp-button-color: rgba(255, 255, 255, .9);--wfp-text-color: #ffffff;--wfp-text-secondary-color: rgba(255, 255, 255, .6);--wfp-btn-artwork-color: rgba(255, 255, 255, .9);--wfp-btn-artwork-scrim: rgba(0, 0, 0, .5)}.waveform-player.waveform-theme-light{--wfp-button-color: rgba(0, 0, 0, .8);--wfp-text-color: #333333;--wfp-text-secondary-color: rgba(0, 0, 0, .6)}.waveform-player *{box-sizing:border-box}.waveform-body{display:flex;flex-direction:column;gap:var(--waveform-body-gap, 8px)}.waveform-track{display:flex;align-items:center;gap:var(--waveform-track-gap, 12px);position:relative}.waveform-btn{width:var(--wfp-btn-size, 36px);height:var(--wfp-btn-size, 36px);min-width:var(--wfp-btn-size, 36px);border-radius:var(--wfp-btn-radius, 50%);border:2px solid currentColor;background:transparent;color:var(--wfp-button-color, inherit);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease;padding:0;opacity:.9;flex-shrink:0}.waveform-btn:hover:not(:disabled){opacity:1;transform:scale(1.05)}.waveform-btn-minimal{width:calc(var(--wfp-btn-size, 36px) * 1.1);height:calc(var(--wfp-btn-size, 36px) * 1.1);min-width:calc(var(--wfp-btn-size, 36px) * 1.1);border:none;border-radius:0;opacity:.7}.waveform-btn-minimal:hover:not(:disabled){opacity:1;transform:none}.waveform-btn.waveform-btn-minimal svg{width:calc(var(--wfp-btn-size, 36px) * .94);height:calc(var(--wfp-btn-size, 36px) * .94)}.waveform-btn:disabled{cursor:not-allowed;opacity:.3}.waveform-btn>*{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.waveform-btn svg{width:calc(var(--wfp-btn-size, 36px) * .45);height:calc(var(--wfp-btn-size, 36px) * .45);fill:currentColor;display:block}.waveform-btn-has-artwork{--wfp-btn-size: 64px;--wfp-btn-radius: 8px;position:relative;overflow:hidden;border:none;color:var(--wfp-btn-artwork-color)}.waveform-btn>.waveform-btn-artwork{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;z-index:0}.waveform-btn-has-artwork:after{content:"";position:absolute;inset:0;background:var(--wfp-btn-artwork-scrim);pointer-events:none;z-index:1}.waveform-btn-has-artwork>:not(.waveform-btn-artwork){position:relative;z-index:2}.waveform-icon-play svg{margin-left:1px}.waveform-container{flex:1;position:relative;cursor:pointer;min-width:0;width:100%}.waveform-container:focus-visible{outline:2px solid currentColor}.waveform-container canvas{display:block;width:100%;height:100%;max-width:100%;transition:opacity .3s ease;position:relative;z-index:1}.waveform-info{display:flex;align-items:center;gap:8px;font-size:13px;min-height:20px}.waveform-text{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}.waveform-title{color:var(--wfp-text-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.waveform-artist{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.waveform-time{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;flex-shrink:0}.waveform-bpm{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;flex-shrink:0;display:inline-flex;align-items:center;gap:4px}.waveform-loading{position:absolute;inset:0;background:#0000001a;z-index:10}.waveform-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#0003;z-index:10}.waveform-error-text{font-size:12px;opacity:.7;text-align:center;padding:0 20px}.waveform-markers{position:absolute;inset:0;pointer-events:none;z-index:5}.waveform-marker{position:absolute;top:0;width:2px;height:100%;background:#ffffff80;border:none;padding:0;cursor:pointer;pointer-events:all;transition:all .2s}.waveform-marker:hover{width:4px;z-index:20}.waveform-marker.active{width:4px;background:currentColor;z-index:10}.waveform-marker-tooltip{position:absolute;bottom:calc(100% + 4px);left:50%;transform:translate(-50%);background:#000000e6;color:#fff;padding:4px 8px;border-radius:4px;font-size:11px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s;z-index:1000}.waveform-marker:hover .waveform-marker-tooltip,.waveform-marker.show-label .waveform-marker-tooltip{opacity:1}.waveform-hover-time{position:absolute;bottom:calc(100% + 4px);transform:translate(-50%);background:#000000e6;color:#fff;padding:3px 7px;border-radius:4px;font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;z-index:1000}.waveform-seek-handle{position:absolute;top:50%;left:0;width:11px;height:11px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #00000059;transform:translate(-50%,-50%) scale(0);opacity:0;transition:opacity .12s ease,transform .12s ease;pointer-events:none;z-index:6}.waveform-seek-handle.is-visible{opacity:1;transform:translate(-50%,-50%) scale(1)}.waveform-seek-handle.is-active{transform:translate(-50%,-50%) scale(1.25)}.waveform-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.waveform-marker:focus-visible{outline:2px solid currentColor;outline-offset:1px;width:4px}.waveform-speed{position:relative;flex-shrink:0}.speed-btn{background:transparent;border:1px solid rgba(255,255,255,.2);border-radius:4px;padding:4px 8px;color:inherit;font-size:11px;cursor:pointer;transition:all .2s;min-width:40px}.speed-btn:hover{background:#ffffff0d;border-color:#ffffff4d}.speed-value{font-weight:600}.speed-menu{position:absolute;bottom:100%;right:0;margin-bottom:4px;background:#000000f2;border:1px solid rgba(255,255,255,.2);border-radius:6px;padding:4px;z-index:100;min-width:60px}.speed-option{display:block;width:100%;background:transparent;border:none;color:#ffffffb3;padding:6px 12px;font-size:12px;cursor:pointer;transition:all .2s;text-align:left;border-radius:4px}.speed-option:hover{background:#ffffff1a;color:#fff}.speed-option.active{background:#ffffff29;color:#fff;font-weight:600}.waveform-player.waveform-focused{outline:2px solid var(--wfp-accent);outline-offset:2px;border-radius:4px}.waveform-player:focus{outline:none}.waveform-player:focus-visible{outline:1px solid var(--wfp-accent);outline-offset:1px}.waveform-layout-preview .waveform-meta{display:none!important}.waveform-layout-preview .waveform-info{justify-content:center}.waveform-layout-preview .waveform-text{flex:0 1 auto;align-items:center;text-align:center}.waveform-player.waveform-focused{outline:none}.waveform-track.waveform-align-top{align-items:flex-start}.waveform-track.waveform-align-top .waveform-btn{margin-top:5px}.waveform-track.waveform-align-center{align-items:center}.waveform-track.waveform-align-bottom{align-items:flex-end}.waveform-track.waveform-align-bottom .waveform-btn{margin-bottom:5px}@media(max-width:480px){.waveform-btn{width:var(--wfp-btn-size, 32px);height:var(--wfp-btn-size, 32px);min-width:var(--wfp-btn-size, 32px)}.waveform-container{min-height:50px}.waveform-info{font-size:12px}.waveform-artist,.waveform-time,.waveform-bpm{font-size:10px}}@media(prefers-reduced-motion:reduce){.waveform-player *,.waveform-player *:before,.waveform-player *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}
1
+ .waveform-player{font-family:inherit;color:inherit;line-height:var(--waveform-line-height, 1.4);--wfp-accent: #71717a;--wfp-button-color: rgba(255, 255, 255, .9);--wfp-text-color: #ffffff;--wfp-text-secondary-color: rgba(255, 255, 255, .6);--wfp-btn-artwork-color: rgba(255, 255, 255, .9);--wfp-btn-artwork-scrim: rgba(0, 0, 0, .5)}.waveform-player.waveform-theme-light{--wfp-button-color: rgba(0, 0, 0, .8);--wfp-text-color: #333333;--wfp-text-secondary-color: rgba(0, 0, 0, .6)}.waveform-player *{box-sizing:border-box}.waveform-body{display:flex;flex-direction:column;gap:var(--waveform-body-gap, 8px)}.waveform-track{display:flex;align-items:center;gap:var(--waveform-track-gap, 12px);position:relative}.waveform-btn{width:var(--wfp-btn-size, 36px);height:var(--wfp-btn-size, 36px);min-width:var(--wfp-btn-size, 36px);border-radius:var(--wfp-btn-radius, 50%);border:2px solid currentColor;background:transparent;color:var(--wfp-button-color, inherit);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease;padding:0;opacity:.9;flex-shrink:0}.waveform-btn:hover:not(:disabled){opacity:1;transform:scale(1.05)}.waveform-btn-minimal{width:calc(var(--wfp-btn-size, 36px) * 1.1);height:calc(var(--wfp-btn-size, 36px) * 1.1);min-width:calc(var(--wfp-btn-size, 36px) * 1.1);border:none;border-radius:0;opacity:.7}.waveform-btn-minimal:hover:not(:disabled){opacity:1;transform:none}.waveform-btn.waveform-btn-minimal svg{width:calc(var(--wfp-btn-size, 36px) * .94);height:calc(var(--wfp-btn-size, 36px) * .94)}.waveform-btn:disabled{cursor:not-allowed;opacity:.3}.waveform-btn>*{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.waveform-btn svg{width:calc(var(--wfp-btn-size, 36px) * .45);height:calc(var(--wfp-btn-size, 36px) * .45);fill:currentColor;display:block}.waveform-btn-has-artwork{--wfp-btn-size: 64px;--wfp-btn-radius: 8px;position:relative;overflow:hidden;border:none;color:var(--wfp-btn-artwork-color)}.waveform-btn>.waveform-btn-artwork{display:block;position:absolute;inset:0;width:100%;height:100%;object-fit:cover;pointer-events:none;z-index:0}.waveform-btn-has-artwork:after{content:"";position:absolute;inset:0;background:var(--wfp-btn-artwork-scrim);pointer-events:none;z-index:1}.waveform-btn-has-artwork>:not(.waveform-btn-artwork){position:relative;z-index:2}.waveform-icon-play svg{margin-left:1px}.waveform-surface{flex:1;position:relative;min-width:0;width:100%}.waveform-container{flex:1;position:relative;cursor:pointer;min-width:0;width:100%}.waveform-container:focus-visible{outline:2px solid currentColor}.waveform-container canvas{display:block;width:100%;height:100%;max-width:100%;transition:opacity .3s ease;position:relative;z-index:1}.waveform-info{display:flex;align-items:center;gap:8px;font-size:13px;min-height:20px}.waveform-text{flex:1;display:flex;flex-direction:column;gap:2px;min-width:0}.waveform-title{color:var(--wfp-text-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}.waveform-artist{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.waveform-time{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;flex-shrink:0}.waveform-bpm{color:var(--wfp-text-secondary-color);font-size:11px;white-space:nowrap;flex-shrink:0;display:inline-flex;align-items:center;gap:4px}.waveform-loading{position:absolute;inset:0;background:#0000001a;z-index:10}.waveform-error{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#0003;z-index:10}.waveform-error-text{font-size:12px;opacity:.7;text-align:center;padding:0 20px}.waveform-markers{position:absolute;inset:0;pointer-events:none;z-index:5}.waveform-marker{position:absolute;top:0;width:2px;height:100%;background:#ffffff80;border:none;padding:0;cursor:pointer;pointer-events:all;transition:all .2s}.waveform-marker:hover{width:4px;z-index:20}.waveform-marker.active{width:4px;background:currentColor;z-index:10}.waveform-marker-tooltip{position:absolute;bottom:calc(100% + 4px);left:50%;transform:translate(-50%);background:#000000e6;color:#fff;padding:4px 8px;border-radius:4px;font-size:11px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .2s;z-index:1000}.waveform-marker:hover .waveform-marker-tooltip,.waveform-marker.show-label .waveform-marker-tooltip{opacity:1}.waveform-hover-time{position:absolute;bottom:calc(100% + 4px);transform:translate(-50%);background:#000000e6;color:#fff;padding:3px 7px;border-radius:4px;font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;z-index:1000}.waveform-seek-handle{position:absolute;top:50%;left:0;width:11px;height:11px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #00000059;transform:translate(-50%,-50%) scale(0);opacity:0;transition:opacity .12s ease,transform .12s ease;pointer-events:none;z-index:6}.waveform-seek-handle.is-visible{opacity:1;transform:translate(-50%,-50%) scale(1)}.waveform-seek-handle.is-active{transform:translate(-50%,-50%) scale(1.25)}.waveform-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.waveform-marker:focus-visible{outline:2px solid currentColor;outline-offset:1px;width:4px}.waveform-speed{position:relative;flex-shrink:0}.speed-btn{background:transparent;border:1px solid rgba(255,255,255,.2);border-radius:4px;padding:4px 8px;color:inherit;font-size:11px;cursor:pointer;transition:all .2s;min-width:40px}.speed-btn:hover{background:#ffffff0d;border-color:#ffffff4d}.speed-value{font-weight:600}.speed-menu{position:absolute;bottom:100%;right:0;margin-bottom:4px;background:#000000f2;border:1px solid rgba(255,255,255,.2);border-radius:6px;padding:4px;z-index:100;min-width:60px}.speed-option{display:block;width:100%;background:transparent;border:none;color:#ffffffb3;padding:6px 12px;font-size:12px;cursor:pointer;transition:all .2s;text-align:left;border-radius:4px}.speed-option:hover{background:#ffffff1a;color:#fff}.speed-option.active{background:#ffffff29;color:#fff;font-weight:600}.waveform-player.waveform-focused{outline:2px solid var(--wfp-accent);outline-offset:2px;border-radius:4px}.waveform-player:focus{outline:none}.waveform-player:focus-visible{outline:1px solid var(--wfp-accent);outline-offset:1px}.waveform-layout-preview .waveform-meta{display:none!important}.waveform-layout-preview .waveform-info{justify-content:center}.waveform-layout-preview .waveform-text{flex:0 1 auto;align-items:center;text-align:center}.waveform-player.waveform-focused{outline:none}.waveform-track.waveform-align-top{align-items:flex-start}.waveform-track.waveform-align-top .waveform-btn{margin-top:5px}.waveform-track.waveform-align-center{align-items:center}.waveform-track.waveform-align-bottom{align-items:flex-end}.waveform-track.waveform-align-bottom .waveform-btn{margin-bottom:5px}@media(max-width:480px){.waveform-btn{width:var(--wfp-btn-size, 32px);height:var(--wfp-btn-size, 32px);min-width:var(--wfp-btn-size, 32px)}.waveform-container{min-height:50px}.waveform-info{font-size:12px}.waveform-artist,.waveform-time,.waveform-bpm{font-size:10px}}@media(prefers-reduced-motion:reduce){.waveform-player *,.waveform-player *:before,.waveform-player *:after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}