@44-audio/components 0.1.0-dev.8 → 1.0.0-alpha.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.
package/dist/player.es.js CHANGED
@@ -1,231 +1,1329 @@
1
- import { h as V, t as le, d as de, c as X, p as Y, a as Z, b as x, s as d, f, A as ce, e as h, g as b, i as k, j as s, k as $, l as L, m as j, n as p, u as ve, r as y, o as R, q as E, v as P, w as W, x as Q, y as ue, z as ge, B as pe } from "./AudioPlayer-bUgQMAfs.mjs";
2
- function fe(i, t, n, r) {
3
- var a = i.__style;
4
- if (V || a !== t) {
5
- var v = le(t);
6
- (!V || v !== i.getAttribute("style")) && (v == null ? i.removeAttribute("style") : i.style.cssText = v), i.__style = t;
7
- }
8
- return r;
9
- }
10
- function me(i, t) {
11
- d(t, !p(t));
12
- }
13
- var _e = f('&bull; <button class="link svelte-8utcjm"> </button>', 1), he = (i, t) => d(t, !0), be = f(' <button class="link svelte-8utcjm">Show more</button>', 1), ye = (i, t) => d(t, !1), ke = f(' <button class="link svelte-8utcjm">Show less</button>', 1), xe = f('<div class="details svelte-8utcjm"><div class="title svelte-8utcjm">Transcription <!></div> <div class="transcription"><!></div></div>'), je = f('<div class="container svelte-8utcjm" role="group" aria-label="44 audio player"><div class="display svelte-8utcjm"><!></div> <!></div>');
14
- const we = {
15
- hash: "svelte-8utcjm",
16
- code: "button.svelte-8utcjm {font:inherit;margin:0;padding:0;box-sizing:border-box;border:none;background:none;cursor:pointer;}.link.svelte-8utcjm {background:none;border:none;color:var(--44-color-2);cursor:pointer;padding:0;font:inherit;}.link.svelte-8utcjm:hover {color:var(--44-color-3);text-decoration:underline;}.container.svelte-8utcjm {padding:16px;}.display.svelte-8utcjm {display:flex;align-items:center;gap:12px;}.details.svelte-8utcjm .title:where(.svelte-8utcjm) {font-weight:bold;margin-top:16px;margin-bottom:8px;}"
1
+ import { h as Wr, a as Qr, i as $r, n as re, s as ee, b as te, c as oe, d as ae, e as ne, f as se, g as ie, U as le, p as fe, j as ce, k as ue, E as de, B as ve, l as pe, m as ye, u as he, T as ge, w as Or, o as be, q as me, r as Rr, t as qr, v as xr, x as _r, y as A, z as pr, A as r, C as j, D as we, F as hr, G as fr, H as E, I as kr, J as u, K as Fr, L as N, M as P, N as tr, O, P as zr, Q as m, R as Z, S as vr, V as Br, W as Ir, X as xe, Y as _e, Z as Dr, _ as Kr, $ as G, a0 as B, a1 as jr, a2 as ke, a3 as Ar, a4 as dr, a5 as er, a6 as Hr, a7 as Zr, a8 as Gr, a9 as Sr, aa as Nr, ab as Lr, ac as ze, ad as C } from "./BarWaveform-BkBkQ8cb.js";
2
+ function Ee(d, e, h) {
3
+ Wr && Qr();
4
+ var s = d, i = le, n, o, a = null, p = $r() ? re : ee;
5
+ function y() {
6
+ n && fe(n), a !== null && (a.lastChild.remove(), s.before(a), a = null), n = o;
7
+ }
8
+ te(() => {
9
+ if (p(i, i = e())) {
10
+ var l = s, z = se();
11
+ z && (a = document.createDocumentFragment(), a.append(l = oe())), o = ae(() => h(l)), z ? ne.add_callback(y) : y();
12
+ }
13
+ }), Wr && (s = ie);
14
+ }
15
+ const Te = () => performance.now(), wr = {
16
+ // don't access requestAnimationFrame eagerly outside method
17
+ // this allows basic testing of user code without JSDOM
18
+ // bunder will eval and remove ternary when the user's app is built
19
+ tick: (
20
+ /** @param {any} _ */
21
+ (d) => requestAnimationFrame(d)
22
+ ),
23
+ now: () => Te(),
24
+ tasks: /* @__PURE__ */ new Set()
17
25
  };
18
- function ee(i, t) {
19
- Y(t, !0), Z(i, we);
20
- let n = x(t, "recordingId", 7), r = x(t, "recording", 7), a = x(t, "audioRef", 7), v = x(t, "apiHost", 7), T = L(!1), m = L(!1), q = L(0), _ = L("idle");
21
- a().addEventListener("play", () => {
22
- d(_, "playing");
23
- }), a().addEventListener("pause", () => {
24
- d(_, "paused");
25
- }), a().addEventListener("ended", () => {
26
- d(_, "idle"), d(q, 0);
27
- }), a().addEventListener("timeupdate", () => {
28
- d(q, a().currentTime * 1e3);
26
+ function Xr() {
27
+ const d = wr.now();
28
+ wr.tasks.forEach((e) => {
29
+ e.c(d) || (wr.tasks.delete(e), e.f());
30
+ }), wr.tasks.size !== 0 && wr.tick(Xr);
31
+ }
32
+ function Le(d) {
33
+ let e;
34
+ return wr.tasks.size === 0 && wr.tick(Xr), {
35
+ promise: new Promise((h) => {
36
+ wr.tasks.add(e = { c: d, f: h });
37
+ }),
38
+ abort() {
39
+ wr.tasks.delete(e);
40
+ }
41
+ };
42
+ }
43
+ function Mr(d, e) {
44
+ Or(() => {
45
+ d.dispatchEvent(new CustomEvent(e));
29
46
  });
30
- var F = {
31
- get recordingId() {
32
- return n();
47
+ }
48
+ function He(d) {
49
+ if (d === "float") return "cssFloat";
50
+ if (d === "offset") return "cssOffset";
51
+ if (d.startsWith("--")) return d;
52
+ const e = d.split("-");
53
+ return e.length === 1 ? e[0] : e[0] + e.slice(1).map(
54
+ /** @param {any} word */
55
+ (h) => h[0].toUpperCase() + h.slice(1)
56
+ ).join("");
57
+ }
58
+ function Ur(d) {
59
+ const e = {}, h = d.split(";");
60
+ for (const s of h) {
61
+ const [i, n] = s.split(":");
62
+ if (!i || n === void 0) break;
63
+ const o = He(i.trim());
64
+ e[o] = n.trim();
65
+ }
66
+ return e;
67
+ }
68
+ const Ie = (d) => d;
69
+ function Er(d, e, h, s) {
70
+ var i = (d & ge) !== 0, n = "in", o, a = e.inert, p = e.style.overflow, y, l;
71
+ function z() {
72
+ return Or(() => o ??= h()(e, s?.() ?? /** @type {P} */
73
+ {}, {
74
+ direction: n
75
+ }));
76
+ }
77
+ var v = {
78
+ is_global: i,
79
+ in() {
80
+ e.inert = a, y?.abort(), Mr(e, "introstart"), y = Yr(e, z(), l, 1, () => {
81
+ Mr(e, "introend"), y?.abort(), y = o = void 0, e.style.overflow = p;
82
+ });
33
83
  },
34
- set recordingId(e) {
35
- n(e), j();
84
+ out(U) {
85
+ {
86
+ U?.(), o = void 0;
87
+ return;
88
+ }
36
89
  },
37
- get recording() {
38
- return r();
90
+ stop: () => {
91
+ y?.abort();
92
+ }
93
+ }, L = (
94
+ /** @type {Effect} */
95
+ ce
96
+ );
97
+ if ((L.transitions ??= []).push(v), ue) {
98
+ var _ = i;
99
+ if (!_) {
100
+ for (var f = (
101
+ /** @type {Effect | null} */
102
+ L.parent
103
+ ); f && (f.f & de) !== 0; )
104
+ for (; (f = f.parent) && (f.f & ve) === 0; )
105
+ ;
106
+ _ = !f || (f.f & pe) !== 0;
107
+ }
108
+ _ && ye(() => {
109
+ he(() => v.in());
110
+ });
111
+ }
112
+ }
113
+ function Yr(d, e, h, s, i) {
114
+ if (be(e)) {
115
+ var n, o = !1;
116
+ return me(() => {
117
+ if (!o) {
118
+ var f = e({ direction: "in" });
119
+ n = Yr(d, f, h, s, i);
120
+ }
121
+ }), {
122
+ abort: () => {
123
+ o = !0, n?.abort();
124
+ },
125
+ deactivate: () => n.deactivate(),
126
+ reset: () => n.reset(),
127
+ t: () => n.t()
128
+ };
129
+ }
130
+ if (!e?.duration)
131
+ return i(), {
132
+ abort: Rr,
133
+ deactivate: Rr,
134
+ reset: Rr,
135
+ t: () => s
136
+ };
137
+ const { delay: a = 0, css: p, tick: y, easing: l = Ie } = e;
138
+ var z = [];
139
+ if (y && y(0, 1), p) {
140
+ var v = Ur(p(0, 1));
141
+ z.push(v, v);
142
+ }
143
+ var L = () => 1 - s, _ = d.animate(z, { duration: a, fill: "forwards" });
144
+ return _.onfinish = () => {
145
+ _.cancel();
146
+ var f = 1 - s, U = s - f, W = (
147
+ /** @type {number} */
148
+ e.duration * Math.abs(U)
149
+ ), J = [];
150
+ if (W > 0) {
151
+ var Q = !1;
152
+ if (p)
153
+ for (var q = Math.ceil(W / 16.666666666666668), $ = 0; $ <= q; $ += 1) {
154
+ var D = f + U * l($ / q), ir = Ur(p(D, 1 - D));
155
+ J.push(ir), Q ||= ir.overflow === "hidden";
156
+ }
157
+ Q && (d.style.overflow = "hidden"), L = () => {
158
+ var sr = (
159
+ /** @type {number} */
160
+ /** @type {globalThis.Animation} */
161
+ _.currentTime
162
+ );
163
+ return f + U * l(sr / W);
164
+ }, y && Le(() => {
165
+ if (_.playState !== "running") return !1;
166
+ var sr = L();
167
+ return y(sr, 1 - sr), !0;
168
+ });
169
+ }
170
+ _ = d.animate(J, { duration: W, fill: "forwards" }), _.onfinish = () => {
171
+ L = () => s, y?.(s, 1 - s), i();
172
+ };
173
+ }, {
174
+ abort: () => {
175
+ _ && (_.cancel(), _.effect = null, _.onfinish = Rr);
39
176
  },
40
- set recording(e) {
41
- r(e), j();
177
+ deactivate: () => {
178
+ i = Rr;
42
179
  },
43
- get audioRef() {
44
- return a();
180
+ reset: () => {
45
181
  },
46
- set audioRef(e) {
47
- a(e), j();
182
+ t: () => L()
183
+ };
184
+ }
185
+ function Ce(d) {
186
+ return new Promise((e) => setTimeout(e, d));
187
+ }
188
+ async function Re(d, e, h) {
189
+ const s = `https://${e}/v1/recordings/${h}/player`;
190
+ qr.delay > 0 && await Ce(qr.delay);
191
+ const i = await fetch(s, { signal: d });
192
+ if (!i.ok)
193
+ throw i.status === 404 ? new Error(`Recording not found: ${h}`) : new Error(`Failed to fetch recording (${i.status})`);
194
+ const n = await i.json();
195
+ if (n.status !== "ready")
196
+ throw new Error(`Recording not ready: ${h}`);
197
+ return n;
198
+ }
199
+ var je = O("<audio hidden></audio>");
200
+ function Ae(d, e) {
201
+ _r(e, !0);
202
+ const h = e.$$host;
203
+ let s = A(e, "recordingId", 7), i = A(e, "apiHost", 7, "api.44.audio"), n = A(e, "preload", 7, "none"), o = j(null), a = j(null), p = j(0), y = j(0), l = j("idle"), z = null, v = null;
204
+ const L = N(() => ({
205
+ waveform: r(o)?.waveform ?? [],
206
+ transcription: r(o)?.transcription ?? null,
207
+ translation: r(o)?.translation ?? null,
208
+ words: r(o)?.words ?? null
209
+ }));
210
+ function _() {
211
+ h.duration = r(y), h.currentTime = r(p), h.state = r(l), h.metadata = r(L), h.setAttribute("data-state", r(l));
212
+ }
213
+ function f(b) {
214
+ _(), h.dispatchEvent(new CustomEvent(b, { bubbles: !0, composed: !0 }));
215
+ }
216
+ function U() {
217
+ if (!r(a)) {
218
+ v = null;
219
+ return;
220
+ }
221
+ u(p, Math.floor(r(a).currentTime * 1e3), !0), f("timeupdate"), v = requestAnimationFrame(U);
222
+ }
223
+ async function W() {
224
+ if (r(l) === "idle") {
225
+ if (!s()) {
226
+ console.warn("fortyfour-recording: recording-id attribute is required");
227
+ return;
228
+ }
229
+ z = new AbortController(), u(l, "loading"), f("loading");
230
+ try {
231
+ const b = await Re(z.signal, i(), s());
232
+ u(o, b, !0), u(y, b.duration, !0), u(l, "ready"), f("loadedmetadata");
233
+ } catch (b) {
234
+ if (b.name === "AbortError")
235
+ return;
236
+ console.warn(`fortyfour-recording: ${b.message}`), u(l, "error"), f("error");
237
+ }
238
+ }
239
+ }
240
+ async function J() {
241
+ if (!r(a)) {
242
+ console.warn("fortyfour-recording: play() called but audio element not ready");
243
+ return;
244
+ }
245
+ try {
246
+ await r(a).play(), u(l, "playing"), f("play"), v || U();
247
+ } catch (b) {
248
+ console.warn(`fortyfour-recording: ${b.message}`), u(l, "error"), f("error");
249
+ }
250
+ }
251
+ function Q() {
252
+ if (!r(a)) {
253
+ console.warn("fortyfour-recording: pause() called but audio element not ready");
254
+ return;
255
+ }
256
+ r(a).pause(), u(l, "paused"), cancelAnimationFrame(v), v = null, f("pause");
257
+ }
258
+ async function q() {
259
+ if (r(l) === "error") {
260
+ console.warn("fortyfour-recording: togglePlay() called while in error state");
261
+ return;
262
+ }
263
+ r(l) !== "loading" && (r(l) === "playing" ? Q() : r(l) === "idle" ? (await W(), await Fr(), r(l) === "ready" && await J()) : await J());
264
+ }
265
+ function $(b) {
266
+ if (!r(a)) {
267
+ console.warn("fortyfour-recording: seek() called but audio element not ready");
268
+ return;
269
+ }
270
+ if (typeof b != "number" || Number.isNaN(b)) {
271
+ console.warn("fortyfour-recording: seek() called with invalid time:", b);
272
+ return;
273
+ }
274
+ if (b < 0 || b > r(y)) {
275
+ console.warn("fortyfour-recording: seek() time out of range:", b, "duration:", r(y));
276
+ return;
277
+ }
278
+ r(a).currentTime = b / 1e3, u(p, Math.floor(b), !0), f("timeupdate");
279
+ }
280
+ async function D() {
281
+ cancelAnimationFrame(v), v = null, u(p, r(y), !0), f("timeupdate"), await Fr(), u(p, 0), r(a).currentTime = 0, f("timeupdate"), u(l, "ready"), f("ended");
282
+ }
283
+ function ir(b) {
284
+ console.warn("fortyfour-recording: audio error", b.target.error), u(l, "error"), f("error");
285
+ }
286
+ function sr() {
287
+ z?.abort(), cancelAnimationFrame(v), v = null, r(a)?.pause(), u(o, null), u(p, 0), u(y, 0), u(l, "idle"), w = s(), f("timeupdate");
288
+ }
289
+ let w = s();
290
+ pr(() => {
291
+ s() !== w && sr(), r(l) === "idle" && (n() === "auto" || n() === "metadata") && W();
292
+ }), h.togglePlay = q, h.pause = Q, h.seek = $, _(), we(() => {
293
+ z?.abort(), r(a)?.pause(), cancelAnimationFrame(v);
294
+ });
295
+ var k = {
296
+ get recordingId() {
297
+ return s();
298
+ },
299
+ set recordingId(b) {
300
+ s(b), P();
48
301
  },
49
302
  get apiHost() {
50
- return v();
303
+ return i();
51
304
  },
52
- set apiHost(e) {
53
- v(e), j();
305
+ set apiHost(b = "api.44.audio") {
306
+ i(b), P();
307
+ },
308
+ get preload() {
309
+ return n();
310
+ },
311
+ set preload(b = "none") {
312
+ n(b), P();
313
+ }
314
+ }, F = hr(), nr = fr(F);
315
+ return Ee(nr, s, (b) => {
316
+ var V = hr(), lr = fr(V);
317
+ {
318
+ var gr = (g) => {
319
+ var x = je();
320
+ zr(x, (t) => u(a, t), () => r(a)), m(() => {
321
+ Z(x, "src", r(o).audioUrl), Z(x, "preload", n() === "auto" ? "auto" : "none");
322
+ }), vr("ended", x, D), vr("error", x, ir), E(g, x);
323
+ };
324
+ tr(lr, (g) => {
325
+ r(o)?.audioUrl && g(gr);
326
+ });
54
327
  }
55
- }, u = je(), w = b(u), O = b(w);
328
+ E(b, V);
329
+ }), E(d, F), kr(k);
330
+ }
331
+ customElements.define("fortyfour-recording", xr(
332
+ Ae,
56
333
  {
57
- let e = ve(() => `https://${v()}/api/v1/recordings/${n()}/audio.mp3`);
58
- ce(O, {
59
- get audioURL() {
60
- return p(e);
61
- },
62
- get waveform() {
63
- return r().waveform;
64
- }
334
+ apiHost: { attribute: "api-host", reflect: !0 },
335
+ recordingId: { attribute: "recording-id", reflect: !0 },
336
+ preload: { reflect: !0 }
337
+ },
338
+ [],
339
+ [],
340
+ !1
341
+ ));
342
+ var Pe = Ar("<path></path>"), Se = Ar("<path></path><!>", 1), Ne = Ar('<line class="line track svelte-r3200f" stroke-linecap="round"></line>'), Be = O('<div class="waveform svelte-r3200f" role="slider" tabindex="0" aria-valuemin="0" aria-label="Audio playback position"><svg width="100%" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" preserveAspectRatio="none" class="svelte-r3200f"><!></svg></div>');
343
+ const We = {
344
+ hash: "svelte-r3200f",
345
+ code: `:host {--fortyfour-line-waveform-track-color: #d1d5db;--fortyfour-line-waveform-progress-color: #3b82f6;--fortyfour-line-waveform-focus-color: #3b82f6;--fortyfour-line-waveform-focus-width: 2px;--fortyfour-line-waveform-focus-offset: 2px;--fortyfour-line-waveform-focus-radius: 4px;display:flex;flex:1;}
346
+
347
+ @media (prefers-color-scheme: dark) {:host {--fortyfour-line-waveform-track-color: #374151;--fortyfour-line-waveform-progress-color: #60a5fa;--fortyfour-line-waveform-focus-color: #60a5fa;}
348
+ }.waveform.svelte-r3200f {flex:1;height:100%;display:flex;align-items:center;cursor:pointer;border-radius:var(--fortyfour-line-waveform-focus-radius);}.waveform.svelte-r3200f:focus-visible {outline:var(--fortyfour-line-waveform-focus-width) solid
349
+ var(--fortyfour-line-waveform-focus-color);outline-offset:var(--fortyfour-line-waveform-focus-offset);}svg.svelte-r3200f {display:block;}.line.svelte-r3200f {fill:none;stroke-linecap:round;stroke-linejoin:round;}.line.sharp.svelte-r3200f {stroke-linecap:square;stroke-linejoin:miter;}.track.svelte-r3200f {stroke:var(--fortyfour-line-waveform-track-color);}.progress.svelte-r3200f {stroke:var(--fortyfour-line-waveform-progress-color);}`
350
+ };
351
+ function qe(d, e) {
352
+ _r(e, !0), Ir(d, We);
353
+ const h = e.$$host;
354
+ let s = A(e, "for", 7, ""), i = A(e, "lineWidth", 7, 2), n = A(e, "height", 7, 56), o = A(e, "sharp", 7, !1), a = j(xe([])), p = j(0), y = j(0), l = j(null), z = j(0), v = j(!1), L = j(null);
355
+ h.style.height = `${n()}px`, _e(() => {
356
+ const t = new ResizeObserver((T) => {
357
+ for (let H of T)
358
+ u(z, H.contentRect.width || 0, !0), u(v, !0);
65
359
  });
360
+ return r(L) && t.observe(r(L)), () => {
361
+ t.disconnect();
362
+ };
363
+ }), pr(() => {
364
+ if (!s()) {
365
+ console.warn("fortyfour-line-waveform: 'for' attribute is required");
366
+ return;
367
+ }
368
+ const t = h.getRootNode();
369
+ if (u(l, t.getElementById(s()), !0), !r(l)) {
370
+ console.warn(`fortyfour-line-waveform: element with id "${s()}" not found`);
371
+ return;
372
+ }
373
+ r(l).metadata?.waveform && u(a, r(l).metadata.waveform, !0), r(l).duration && u(y, r(l).duration, !0), r(l).currentTime && u(p, r(l).currentTime, !0);
374
+ function T() {
375
+ u(a, r(l).metadata?.waveform || [], !0), u(y, r(l).duration, !0);
376
+ }
377
+ function H() {
378
+ u(p, r(l).currentTime, !0);
379
+ }
380
+ return r(l).addEventListener("loadedmetadata", T), r(l).addEventListener("timeupdate", H), () => {
381
+ r(l).removeEventListener("loadedmetadata", T), r(l).removeEventListener("timeupdate", H);
382
+ };
383
+ });
384
+ const _ = 0.15, f = N(() => Math.max(2, Math.floor(r(z) * _))), U = N(() => r(a).length > 0), W = N(() => r(U) ? ke(r(a), r(f)) : []), J = N(() => r(y) > 0 ? r(p) / r(y) : 0), Q = N(() => `${jr(r(p))} of ${jr(r(y))}`), q = N(() => n() / 2), $ = N(() => n() / 2 * 0.8), D = N(() => {
385
+ if (!r(W).length || r(z) === 0)
386
+ return [];
387
+ const t = i() / 2, T = r(z) - t * 2;
388
+ return r(W).map((H, I) => {
389
+ const S = t + I / (r(W).length - 1) * T, M = Math.max(0.05, H / 100), c = I % 2 === 0 ? -1 : 1, R = r(q) + c * M * r($);
390
+ return { x: S, y: R };
391
+ });
392
+ });
393
+ function ir(t, T) {
394
+ if (t.length === 0)
395
+ return "";
396
+ let H = `M ${t[0].x} ${t[0].y}`;
397
+ for (let I = 1; I < t.length; I++) {
398
+ const S = t[I - 1], M = t[I];
399
+ if (T) {
400
+ const c = S.x + (M.x - S.x) / 3, R = S.y, X = S.x + (M.x - S.x) * 2 / 3, ar = M.y;
401
+ H += ` C ${c} ${R}, ${X} ${ar}, ${M.x} ${M.y}`;
402
+ } else
403
+ H += ` L ${M.x} ${M.y}`;
404
+ }
405
+ return H;
66
406
  }
67
- y(w);
68
- var U = h(w, 2);
407
+ const sr = N(() => ir(r(D), !o())), w = N(() => {
408
+ if (r(J) <= 0 || r(z) === 0)
409
+ return 0;
410
+ const t = i() / 2, T = r(z) - t * 2;
411
+ return t + r(J) * T;
412
+ }), k = N(() => {
413
+ if (r(D).length === 0 || r(w) <= 0)
414
+ return "";
415
+ const t = [];
416
+ let T = null;
417
+ for (let I = 0; I < r(D).length; I++)
418
+ if (r(D)[I].x <= r(w))
419
+ t.push(r(D)[I]);
420
+ else {
421
+ T = r(D)[I];
422
+ break;
423
+ }
424
+ if (t.length === 0)
425
+ return "";
426
+ const H = t[t.length - 1];
427
+ if (T && H.x < r(w)) {
428
+ const I = (r(w) - H.x) / (T.x - H.x), S = H.y + I * (T.y - H.y);
429
+ t.push({ x: r(w), y: S });
430
+ }
431
+ return ir(t, !o());
432
+ });
433
+ pr(() => {
434
+ r(U) ? h.removeAttribute("data-placeholder") : h.setAttribute("data-placeholder", "");
435
+ });
436
+ const F = Dr(() => r(l), () => r(y), () => r(L).getBoundingClientRect()), nr = Kr(() => r(l), () => r(y), () => r(p));
437
+ var b = {
438
+ get for() {
439
+ return s();
440
+ },
441
+ set for(t = "") {
442
+ s(t), P();
443
+ },
444
+ get lineWidth() {
445
+ return i();
446
+ },
447
+ set lineWidth(t = 2) {
448
+ i(t), P();
449
+ },
450
+ get height() {
451
+ return n();
452
+ },
453
+ set height(t = 56) {
454
+ n(t), P();
455
+ },
456
+ get sharp() {
457
+ return o();
458
+ },
459
+ set sharp(t = !1) {
460
+ o(t), P();
461
+ }
462
+ }, V = Be();
463
+ V.__click = F, V.__keydown = nr;
464
+ var lr = G(V), gr = G(lr);
69
465
  {
70
- var B = (e) => {
71
- var o = xe(), A = b(o), D = h(b(A));
466
+ var g = (t) => {
467
+ var T = Se(), H = fr(T);
468
+ let I;
469
+ var S = dr(H);
72
470
  {
73
- var G = (l) => {
74
- var g = _e(), C = h(R(g));
75
- C.__click = [me, T];
76
- var K = b(C, !0);
77
- y(C), E(() => P(K, p(T) ? "Original" : "Translation")), s(l, g);
471
+ var M = (c) => {
472
+ var R = Pe();
473
+ let X;
474
+ m(
475
+ (ar) => {
476
+ X = er(R, 0, "line progress svelte-r3200f", null, X, ar), Z(R, "d", r(k)), Z(R, "stroke-width", i());
477
+ },
478
+ [() => ({ sharp: o() })]
479
+ ), E(c, R);
78
480
  };
79
- k(D, (l) => {
80
- r().translation && l(G);
481
+ tr(S, (c) => {
482
+ r(k) && c(M);
81
483
  });
82
484
  }
83
- y(A);
84
- var c = h(A, 2), J = b(c);
485
+ m(
486
+ (c) => {
487
+ I = er(H, 0, "line track svelte-r3200f", null, I, c), Z(H, "d", r(sr)), Z(H, "stroke-width", i());
488
+ },
489
+ [() => ({ sharp: o() })]
490
+ ), E(t, T);
491
+ }, x = (t) => {
492
+ var T = hr(), H = fr(T);
493
+ {
494
+ var I = (S) => {
495
+ var M = Ne();
496
+ m(() => {
497
+ Z(M, "x1", i() / 2), Z(M, "y1", n() / 2), Z(M, "x2", r(z) - i() / 2), Z(M, "y2", n() / 2), Z(M, "stroke-width", i());
498
+ }), E(S, M);
499
+ };
500
+ tr(
501
+ H,
502
+ (S) => {
503
+ r(v) && S(I);
504
+ },
505
+ !0
506
+ );
507
+ }
508
+ E(t, T);
509
+ };
510
+ tr(gr, (t) => {
511
+ r(v) && r(sr) ? t(g) : t(x, !1);
512
+ });
513
+ }
514
+ return B(lr), B(V), zr(V, (t) => u(L, t), () => r(L)), m(() => {
515
+ Z(V, "aria-valuemax", r(y)), Z(V, "aria-valuenow", r(p)), Z(V, "aria-valuetext", r(Q)), Z(lr, "height", n()), Z(lr, "viewBox", `0 0 ${r(z)} ${n()}`);
516
+ }), E(d, V), kr(b);
517
+ }
518
+ Br(["click", "keydown"]);
519
+ customElements.define("fortyfour-line-waveform", xr(
520
+ qe,
521
+ {
522
+ for: { attribute: "for", reflect: !0 },
523
+ lineWidth: { attribute: "line-width", reflect: !0, type: "Number" },
524
+ height: { attribute: "height", reflect: !0, type: "Number" },
525
+ sharp: { attribute: "sharp", reflect: !0, type: "Boolean" }
526
+ },
527
+ [],
528
+ [],
529
+ !0
530
+ ));
531
+ var Fe = O('<div class="container svelte-16bcl3p" role="slider" tabindex="0" aria-valuemin="0" aria-label="Audio playback position"><div class="track svelte-16bcl3p"><div class="progress svelte-16bcl3p"></div></div></div>');
532
+ const Me = {
533
+ hash: "svelte-16bcl3p",
534
+ code: `:host {--fortyfour-progress-bar-track-color: #e5e7eb;--fortyfour-progress-bar-progress-color: #3b82f6;--fortyfour-progress-bar-focus-color: #3b82f6;--fortyfour-progress-bar-focus-width: 2px;--fortyfour-progress-bar-focus-offset: 2px;display:flex;flex:1;}
535
+
536
+ @media (prefers-color-scheme: dark) {:host {--fortyfour-progress-bar-track-color: #374151;--fortyfour-progress-bar-progress-color: #60a5fa;--fortyfour-progress-bar-focus-color: #60a5fa;}
537
+ }.container.svelte-16bcl3p {flex:1;display:flex;align-items:center;cursor:pointer;border-radius:4px;}.container.svelte-16bcl3p:focus-visible {outline:var(--fortyfour-progress-bar-focus-width) solid
538
+ var(--fortyfour-progress-bar-focus-color);outline-offset:var(--fortyfour-progress-bar-focus-offset);}.track.svelte-16bcl3p {width:100%;background:var(--fortyfour-progress-bar-track-color);overflow:hidden;}.progress.svelte-16bcl3p {height:100%;background:var(--fortyfour-progress-bar-progress-color);transition:width 0.1s linear;}`
539
+ };
540
+ function Ue(d, e) {
541
+ _r(e, !0), Ir(d, Me);
542
+ const h = e.$$host;
543
+ let s = A(e, "for", 7, ""), i = A(e, "barHeight", 7, 4), n = A(e, "barRadius", 7, 2), o = j(0), a = j(0), p = j(null), y = j(null);
544
+ pr(() => {
545
+ if (!s()) {
546
+ console.warn("fortyfour-progress-bar: 'for' attribute is required");
547
+ return;
548
+ }
549
+ const q = h.getRootNode();
550
+ if (u(p, q.getElementById(s()), !0), !r(p)) {
551
+ console.warn(`fortyfour-progress-bar: element with id "${s()}" not found`);
552
+ return;
553
+ }
554
+ r(p).duration && u(a, r(p).duration, !0), r(p).currentTime && u(o, r(p).currentTime, !0);
555
+ function $() {
556
+ u(a, r(p).duration, !0);
557
+ }
558
+ function D() {
559
+ u(o, r(p).currentTime, !0);
560
+ }
561
+ return r(p).addEventListener("loadedmetadata", $), r(p).addEventListener("timeupdate", D), () => {
562
+ r(p).removeEventListener("loadedmetadata", $), r(p).removeEventListener("timeupdate", D);
563
+ };
564
+ });
565
+ const l = N(() => r(a) > 0 ? r(o) / r(a) * 100 : 0), z = N(() => `${jr(r(o))} of ${jr(r(a))}`), v = Dr(() => r(p), () => r(a), () => r(y)?.getBoundingClientRect()), L = Kr(() => r(p), () => r(a), () => r(o));
566
+ var _ = {
567
+ get for() {
568
+ return s();
569
+ },
570
+ set for(q = "") {
571
+ s(q), P();
572
+ },
573
+ get barHeight() {
574
+ return i();
575
+ },
576
+ set barHeight(q = 4) {
577
+ i(q), P();
578
+ },
579
+ get barRadius() {
580
+ return n();
581
+ },
582
+ set barRadius(q = 2) {
583
+ n(q), P();
584
+ }
585
+ }, f = Fe();
586
+ f.__click = v, f.__keydown = L;
587
+ var U = G(f);
588
+ let W;
589
+ var J = G(U);
590
+ let Q;
591
+ return B(U), zr(U, (q) => u(y, q), () => r(y)), B(f), m(
592
+ (q, $) => {
593
+ Z(f, "aria-valuemax", r(a)), Z(f, "aria-valuenow", r(o)), Z(f, "aria-valuetext", r(z)), W = Hr(U, "", W, q), Q = Hr(J, "", Q, $);
594
+ },
595
+ [
596
+ () => ({
597
+ height: `${i() ?? ""}px`,
598
+ "border-radius": `${n() ?? ""}px`
599
+ }),
600
+ () => ({
601
+ width: `${r(l) ?? ""}%`,
602
+ "border-radius": `${n() ?? ""}px`
603
+ })
604
+ ]
605
+ ), E(d, f), kr(_);
606
+ }
607
+ Br(["click", "keydown"]);
608
+ customElements.define("fortyfour-progress-bar", xr(
609
+ Ue,
610
+ {
611
+ for: { attribute: "for", reflect: !0 },
612
+ barHeight: { attribute: "bar-height", reflect: !0, type: "Number" },
613
+ barRadius: { attribute: "bar-radius", reflect: !0, type: "Number" }
614
+ },
615
+ [],
616
+ [],
617
+ !0
618
+ ));
619
+ const Oe = (d) => d;
620
+ function Tr(d, { delay: e = 0, duration: h = 400, easing: s = Oe } = {}) {
621
+ const i = +getComputedStyle(d).opacity;
622
+ return {
623
+ delay: e,
624
+ duration: h,
625
+ easing: s,
626
+ css: (n) => `opacity: ${n * i}`
627
+ };
628
+ }
629
+ var De = O("<span> </span>"), Ke = O('<div class="content svelte-1lixazt"><div class="text caption-text svelte-1lixazt"></div></div>'), Ze = O("<span> </span>"), Ge = O('<div class="text caption-text subtitle svelte-1lixazt"></div>'), Xe = O('<div class="content subtitle-content svelte-1lixazt"><!></div>'), Ye = O("<span> </span>"), Ve = O('<div class="content svelte-1lixazt"><div class="text caption-text svelte-1lixazt"></div></div>'), Je = O('<div class="content svelte-1lixazt"><div class="text svelte-1lixazt"> </div></div>'), Qe = O('<div class="placeholder-lines svelte-1lixazt"><span class="placeholder-line svelte-1lixazt"></span> <span class="placeholder-line short svelte-1lixazt"></span></div>'), $e = O("<div><div><!></div></div>");
630
+ const rt = {
631
+ hash: "svelte-1lixazt",
632
+ code: `:host {--fortyfour-transcription-font-family: system-ui, sans-serif;--fortyfour-transcription-font-size: 14px;--fortyfour-transcription-color: #64748b;--fortyfour-transcription-active-color: #1e293b;--fortyfour-transcription-active-bg: #fef08a;--fortyfour-transcription-past-color: #1e293b;--fortyfour-transcription-placeholder-color: #e5e7eb;--fortyfour-transcription-fade-color: white;--fortyfour-transcription-scrollbar-thumb: #d1d5db;--fortyfour-transcription-scrollbar-thumb-hover: #9ca3af;--fortyfour-transcription-focus-color: #3b82f6;display:flex;font-family:var(--fortyfour-transcription-font-family);font-size:var(--fortyfour-transcription-font-size);}
633
+
634
+ @media (prefers-color-scheme: dark) {:host {--fortyfour-transcription-color: #94a3b8;--fortyfour-transcription-active-color: #fef08a;--fortyfour-transcription-active-bg: #422006;--fortyfour-transcription-past-color: #e2e8f0;--fortyfour-transcription-placeholder-color: #374151;--fortyfour-transcription-scrollbar-thumb: #4b5563;--fortyfour-transcription-scrollbar-thumb-hover: #6b7280;--fortyfour-transcription-focus-color: #60a5fa;}
635
+ }.wrapper.svelte-1lixazt {position:relative;width:100%;}.wrapper.scrollable.svelte-1lixazt::before,
636
+ .wrapper.scrollable.svelte-1lixazt::after {content:"";position:absolute;left:0;right:0;height:24px;pointer-events:none;opacity:0;transition:opacity 0.15s ease;}.wrapper.scrollable.svelte-1lixazt::before {top:0;background:linear-gradient(to top, transparent, var(--fortyfour-transcription-fade-color));z-index:1;}.wrapper.scrollable.svelte-1lixazt::after {bottom:0;background:linear-gradient(to bottom, transparent, var(--fortyfour-transcription-fade-color));}.wrapper.can-scroll-up.svelte-1lixazt::before {opacity:1;}.wrapper.can-scroll-down.svelte-1lixazt::after {opacity:1;}.container.svelte-1lixazt {width:100%;}.container.scrollable.svelte-1lixazt {overflow-y:auto;scroll-behavior:smooth;padding-bottom:24px;scrollbar-width:thin;scrollbar-color:var(--fortyfour-transcription-scrollbar-thumb) transparent;}.container.scrollable.svelte-1lixazt::-webkit-scrollbar {width:6px;}.container.scrollable.svelte-1lixazt::-webkit-scrollbar-track {background:transparent;}.container.scrollable.svelte-1lixazt::-webkit-scrollbar-thumb {background-color:var(--fortyfour-transcription-scrollbar-thumb);border-radius:3px;}.container.scrollable.svelte-1lixazt::-webkit-scrollbar-thumb:hover {background-color:var(--fortyfour-transcription-scrollbar-thumb-hover);}.container.scrollable.svelte-1lixazt:focus-visible {outline:2px solid var(--fortyfour-transcription-focus-color);outline-offset:2px;}.content.svelte-1lixazt {width:100%;}.text.svelte-1lixazt {white-space:pre-wrap;word-wrap:break-word;}.caption-text.svelte-1lixazt {white-space:normal;color:var(--fortyfour-transcription-color);}.word.svelte-1lixazt {transition:color 0.15s ease,
637
+ background-color 0.15s ease;border-radius:2px;padding:0 1px;margin:0 -1px;}.word.active[data-type="word"].svelte-1lixazt {color:var(--fortyfour-transcription-active-color);background-color:var(--fortyfour-transcription-active-bg);}.word.past[data-type="word"].svelte-1lixazt {color:var(--fortyfour-transcription-past-color);}.subtitle-content.svelte-1lixazt {min-height:2em;display:flex;align-items:center;justify-content:center;}.subtitle.svelte-1lixazt {text-align:center;}.placeholder-lines.svelte-1lixazt {display:flex;flex-direction:column;gap:0.5em;}.placeholder-line.svelte-1lixazt {display:block;height:1em;background-color:var(--fortyfour-transcription-placeholder-color);border-radius:4px;}.placeholder-line.short.svelte-1lixazt {width:60%;}`
638
+ };
639
+ function et(d, e) {
640
+ _r(e, !0), Ir(d, rt);
641
+ const h = e.$$host;
642
+ let s = A(e, "for", 7, ""), i = A(e, "mode", 7, "static"), n = A(e, "maxHeight", 7, 0), o = j(null);
643
+ const a = N(() => n() > 0);
644
+ let p = j(!1), y = j(!1);
645
+ function l() {
646
+ if (!r(o) || !r(a)) {
647
+ u(p, !1), u(y, !1);
648
+ return;
649
+ }
650
+ const { scrollTop: g, scrollHeight: x, clientHeight: t } = r(o);
651
+ u(p, g > 1), u(y, g + t < x - 1);
652
+ }
653
+ let z = j(null), v = j(null), L = j("none"), _ = j(0);
654
+ const f = Zr(() => r(z) === null, 200), U = N(() => r(z) !== null ? !1 : r(L) === "none" ? !0 : f()), W = N(() => r(v) !== null && r(v).length > 0), J = N(() => !r(W) || i() === "static" ? -1 : r(v).findIndex((g) => r(_) >= g.start && r(_) <= g.end));
655
+ function Q(g) {
656
+ const x = [];
657
+ let t = { words: [], start: 0, end: 0 };
658
+ for (const T of g) {
659
+ t.words.length === 0 && (t.start = T.start), t.words.push(T), t.end = T.end;
660
+ const H = T.text.trim();
661
+ (H.endsWith(".") || H.endsWith("?") || H.endsWith("!")) && (x.push(t), t = { words: [], start: 0, end: 0 });
662
+ }
663
+ return t.words.length > 0 && x.push(t), x;
664
+ }
665
+ const q = N(() => r(W) ? Q(r(v)) : []), $ = N(() => i() !== "subtitle" || r(q).length === 0 ? null : r(q).find((g) => r(_) >= g.start && r(_) <= g.end) ?? null);
666
+ function D(g) {
667
+ return r(_) >= g.start && r(_) <= g.end;
668
+ }
669
+ function ir(g) {
670
+ return r(_) > g.end;
671
+ }
672
+ pr(() => {
673
+ if (!s()) {
674
+ console.warn("fortyfour-transcription: 'for' attribute is required");
675
+ return;
676
+ }
677
+ const x = h.getRootNode().getElementById(s());
678
+ if (!x) {
679
+ console.warn(`fortyfour-transcription: element with id "${s()}" not found`);
680
+ return;
681
+ }
682
+ u(L, x.getAttribute("preload") || "none", !0);
683
+ const t = x.metadata;
684
+ t && (u(z, t.transcription ?? null, !0), u(v, t.words ?? null, !0)), x.currentTime && u(_, x.currentTime, !0);
685
+ function T() {
686
+ const I = x.metadata;
687
+ u(z, I?.transcription ?? null, !0), u(v, I?.words ?? null, !0);
688
+ }
689
+ function H() {
690
+ u(_, x.currentTime, !0);
691
+ }
692
+ return x.addEventListener("loadedmetadata", T), x.addEventListener("timeupdate", H), () => {
693
+ x.removeEventListener("loadedmetadata", T), x.removeEventListener("timeupdate", H);
694
+ };
695
+ }), Gr(h, "data-placeholder", () => r(U)), pr(() => {
696
+ if (!r(o) || !r(a))
697
+ return;
698
+ l(), r(o).addEventListener("scroll", l);
699
+ const g = new ResizeObserver(l);
700
+ return g.observe(r(o)), () => {
701
+ r(o).removeEventListener("scroll", l), g.disconnect();
702
+ };
703
+ }), pr(() => {
704
+ if (!r(a) || i() !== "karaoke")
705
+ return;
706
+ if (r(_) < 0.1) {
707
+ r(o)?.scrollTo({ top: 0, behavior: "smooth" });
708
+ return;
709
+ }
710
+ if (r(J) < 0)
711
+ return;
712
+ const g = r(o)?.querySelector(".word.active");
713
+ if (g) {
714
+ const x = r(o).getBoundingClientRect(), t = g.getBoundingClientRect(), T = r(o).scrollTop + (t.top - x.top) - x.height / 2 + t.height / 2;
715
+ r(o).scrollTo({ top: T, behavior: "smooth" });
716
+ }
717
+ });
718
+ var sr = {
719
+ get for() {
720
+ return s();
721
+ },
722
+ set for(g = "") {
723
+ s(g), P();
724
+ },
725
+ get mode() {
726
+ return i();
727
+ },
728
+ set mode(g = "static") {
729
+ i(g), P();
730
+ },
731
+ get maxHeight() {
732
+ return n();
733
+ },
734
+ set maxHeight(g = 0) {
735
+ n(g), P();
736
+ }
737
+ }, w = $e();
738
+ let k;
739
+ var F = G(w);
740
+ let nr, b;
741
+ var V = G(F);
742
+ {
743
+ var lr = (g) => {
744
+ var x = Ke(), t = G(x);
745
+ Sr(t, 21, () => r(v), Nr, (T, H, I) => {
746
+ var S = De();
747
+ let M;
748
+ var c = G(S, !0);
749
+ B(S), m(
750
+ (R) => {
751
+ M = er(S, 1, "word svelte-1lixazt", null, M, R), Z(S, "data-type", r(H).type), Lr(c, r(H).text);
752
+ },
753
+ [
754
+ () => ({
755
+ active: I === r(J),
756
+ past: I < r(J)
757
+ })
758
+ ]
759
+ ), E(T, S);
760
+ }), B(t), B(x), Er(1, x, () => Tr, () => ({ duration: 400 })), E(g, x);
761
+ }, gr = (g) => {
762
+ var x = hr(), t = fr(x);
85
763
  {
86
- var te = (l) => {
87
- var g = W();
88
- E(() => P(g, r().translation)), s(l, g);
89
- }, re = (l) => {
90
- var g = Q(), C = R(g);
764
+ var T = (I) => {
765
+ var S = Xe(), M = G(S);
91
766
  {
92
- var K = (H) => {
93
- var S = Q(), ie = R(S);
767
+ var c = (R) => {
768
+ var X = Ge();
769
+ Sr(X, 21, () => r($).words, Nr, (ar, cr) => {
770
+ var or = Ze();
771
+ let K;
772
+ var ur = G(or, !0);
773
+ B(or), m(
774
+ (Y) => {
775
+ K = er(or, 1, "word svelte-1lixazt", null, K, Y), Z(or, "data-type", r(cr).type), Lr(ur, r(cr).text);
776
+ },
777
+ [
778
+ () => ({
779
+ active: D(r(cr)),
780
+ past: ir(r(cr))
781
+ })
782
+ ]
783
+ ), E(ar, or);
784
+ }), B(X), Er(1, X, () => Tr, () => ({ duration: 200 })), E(R, X);
785
+ };
786
+ tr(M, (R) => {
787
+ r($) && R(c);
788
+ });
789
+ }
790
+ B(S), E(I, S);
791
+ }, H = (I) => {
792
+ var S = hr(), M = fr(S);
793
+ {
794
+ var c = (X) => {
795
+ var ar = Ve(), cr = G(ar);
796
+ Sr(cr, 21, () => r(v), Nr, (or, K, ur) => {
797
+ var Y = hr(), rr = fr(Y);
798
+ {
799
+ var yr = (br) => {
800
+ var mr = Ye();
801
+ let Cr;
802
+ var Pr = G(mr, !0);
803
+ B(mr), m(
804
+ (Jr) => {
805
+ Cr = er(mr, 1, "word svelte-1lixazt", null, Cr, Jr), Z(mr, "data-type", r(K).type), Lr(Pr, r(K).text);
806
+ },
807
+ [() => ({ active: ur === r(J) })]
808
+ ), Er(1, mr, () => Tr, () => ({ duration: 150 })), E(br, mr);
809
+ };
810
+ tr(rr, (br) => {
811
+ r(_) >= r(K).start && br(yr);
812
+ });
813
+ }
814
+ E(or, Y);
815
+ }), B(cr), B(ar), Er(1, ar, () => Tr, () => ({ duration: 400 })), E(X, ar);
816
+ }, R = (X) => {
817
+ var ar = hr(), cr = fr(ar);
94
818
  {
95
- var oe = (I) => {
96
- var z = be(), M = R(z), N = h(M);
97
- N.__click = [he, m], E((ne) => P(M, `${ne ?? ""}... `), [() => r().transcription.slice(0, 200)]), s(I, z);
98
- }, se = (I) => {
99
- var z = ke(), M = R(z), N = h(M);
100
- N.__click = [ye, m], E(() => P(M, `${r().transcription ?? ""} `)), s(I, z);
819
+ var or = (ur) => {
820
+ var Y = Je(), rr = G(Y), yr = G(rr, !0);
821
+ B(rr), B(Y), m(() => Lr(yr, r(z))), Er(1, Y, () => Tr, () => ({ duration: 400 })), E(ur, Y);
822
+ }, K = (ur) => {
823
+ var Y = hr(), rr = fr(Y);
824
+ {
825
+ var yr = (br) => {
826
+ var mr = Qe();
827
+ let Cr;
828
+ m((Pr) => Cr = Hr(mr, "", Cr, Pr), [
829
+ () => ({ height: r(a) ? `${n()}px` : void 0 })
830
+ ]), E(br, mr);
831
+ };
832
+ tr(
833
+ rr,
834
+ (br) => {
835
+ r(U) && br(yr);
836
+ },
837
+ !0
838
+ );
839
+ }
840
+ E(ur, Y);
101
841
  };
102
- k(ie, (I) => {
103
- p(m) ? I(se, !1) : I(oe);
104
- });
842
+ tr(
843
+ cr,
844
+ (ur) => {
845
+ r(z) ? ur(or) : ur(K, !1);
846
+ },
847
+ !0
848
+ );
105
849
  }
106
- s(H, S);
107
- }, ae = (H) => {
108
- var S = W();
109
- E(() => P(S, r().transcription)), s(H, S);
850
+ E(X, ar);
110
851
  };
111
- k(
112
- C,
113
- (H) => {
114
- r().transcription.length > 200 ? H(K) : H(ae, !1);
852
+ tr(
853
+ M,
854
+ (X) => {
855
+ i() === "progressive" && r(W) ? X(c) : X(R, !1);
115
856
  },
116
857
  !0
117
858
  );
118
859
  }
119
- s(l, g);
860
+ E(I, S);
120
861
  };
121
- k(J, (l) => {
122
- p(T) ? l(te) : l(re, !1);
123
- });
862
+ tr(
863
+ t,
864
+ (I) => {
865
+ i() === "subtitle" && r(W) ? I(T) : I(H, !1);
866
+ },
867
+ !0
868
+ );
124
869
  }
125
- y(c), y(o), s(e, o);
870
+ E(g, x);
126
871
  };
127
- k(U, (e) => {
128
- r().transcription && e(B);
872
+ tr(V, (g) => {
873
+ i() === "karaoke" && r(W) ? g(lr) : g(gr, !1);
129
874
  });
130
875
  }
131
- return y(u), s(i, u), $(F);
876
+ return B(F), zr(F, (g) => u(o, g), () => r(o)), B(w), m(
877
+ (g, x, t) => {
878
+ k = er(w, 1, "wrapper svelte-1lixazt", null, k, g), nr = er(F, 1, "container svelte-1lixazt", null, nr, x), b = Hr(F, "", b, t);
879
+ },
880
+ [
881
+ () => ({
882
+ scrollable: r(a),
883
+ "can-scroll-up": r(p),
884
+ "can-scroll-down": r(y)
885
+ }),
886
+ () => ({ scrollable: r(a) }),
887
+ () => ({
888
+ "max-height": r(a) ? `${n()}px` : void 0
889
+ })
890
+ ]
891
+ ), E(d, w), kr(sr);
132
892
  }
133
- de(["click"]);
134
- X(ee, { recordingId: {}, recording: {}, audioRef: {}, apiHost: {} }, [], [], !0);
135
- var He = f("<p>Loading...</p>"), Ie = f("<p>Error loading recording.</p>"), Re = f('<div class="container svelte-1kcle3q" role="group" aria-label="44 audio player"><!> <audio></audio></div>');
136
- const Ee = {
137
- hash: "svelte-1kcle3q",
138
- code: ":host {display:inline-block;font-size:inherit;font-family:system-ui;line-height:1.35;color:var(--44-color-1);}.container.svelte-1kcle3q {width:100%;border-radius:16px;background:var(--44-color-0);color:var(--44-color-1);}"
893
+ customElements.define("fortyfour-transcription", xr(
894
+ et,
895
+ {
896
+ for: { attribute: "for", reflect: !0 },
897
+ mode: { attribute: "mode", reflect: !0 },
898
+ maxHeight: { attribute: "max-height", reflect: !0, type: "Number" }
899
+ },
900
+ [],
901
+ [],
902
+ !0
903
+ ));
904
+ var tt = O('<div class="content svelte-z1j7sg"><div class="text svelte-z1j7sg"> </div></div>'), ot = O('<div class="placeholder-lines svelte-z1j7sg"><span class="placeholder-line svelte-z1j7sg"></span> <span class="placeholder-line short svelte-z1j7sg"></span></div>'), at = O("<div><div><!></div></div>");
905
+ const nt = {
906
+ hash: "svelte-z1j7sg",
907
+ code: `:host {--fortyfour-translation-font-family: system-ui, sans-serif;--fortyfour-translation-font-size: 14px;--fortyfour-translation-placeholder-color: #e5e7eb;--fortyfour-translation-fade-color: white;--fortyfour-translation-scrollbar-thumb: #d1d5db;--fortyfour-translation-scrollbar-thumb-hover: #9ca3af;--fortyfour-translation-focus-color: #3b82f6;display:flex;font-family:var(--fortyfour-translation-font-family);font-size:var(--fortyfour-translation-font-size);}
908
+
909
+ @media (prefers-color-scheme: dark) {:host {--fortyfour-translation-placeholder-color: #374151;--fortyfour-translation-scrollbar-thumb: #4b5563;--fortyfour-translation-scrollbar-thumb-hover: #6b7280;--fortyfour-translation-focus-color: #60a5fa;}
910
+ }.wrapper.svelte-z1j7sg {position:relative;width:100%;}.wrapper.scrollable.svelte-z1j7sg::before,
911
+ .wrapper.scrollable.svelte-z1j7sg::after {content:"";position:absolute;left:0;right:0;height:24px;pointer-events:none;opacity:0;transition:opacity 0.15s ease;}.wrapper.scrollable.svelte-z1j7sg::before {top:0;background:linear-gradient(to top, transparent, var(--fortyfour-translation-fade-color));z-index:1;}.wrapper.scrollable.svelte-z1j7sg::after {bottom:0;background:linear-gradient(to bottom, transparent, var(--fortyfour-translation-fade-color));}.wrapper.can-scroll-up.svelte-z1j7sg::before {opacity:1;}.wrapper.can-scroll-down.svelte-z1j7sg::after {opacity:1;}.container.svelte-z1j7sg {width:100%;}.container.scrollable.svelte-z1j7sg {overflow-y:auto;scroll-behavior:smooth;padding-bottom:24px;scrollbar-width:thin;scrollbar-color:var(--fortyfour-translation-scrollbar-thumb) transparent;}.container.scrollable.svelte-z1j7sg::-webkit-scrollbar {width:6px;}.container.scrollable.svelte-z1j7sg::-webkit-scrollbar-track {background:transparent;}.container.scrollable.svelte-z1j7sg::-webkit-scrollbar-thumb {background-color:var(--fortyfour-translation-scrollbar-thumb);border-radius:3px;}.container.scrollable.svelte-z1j7sg::-webkit-scrollbar-thumb:hover {background-color:var(--fortyfour-translation-scrollbar-thumb-hover);}.container.scrollable.svelte-z1j7sg:focus-visible {outline:2px solid var(--fortyfour-translation-focus-color);outline-offset:2px;}.content.svelte-z1j7sg {width:100%;}.text.svelte-z1j7sg {white-space:pre-wrap;word-wrap:break-word;}.placeholder-lines.svelte-z1j7sg {display:flex;flex-direction:column;gap:0.5em;}.placeholder-line.svelte-z1j7sg {display:block;height:1em;background-color:var(--fortyfour-translation-placeholder-color);border-radius:4px;}.placeholder-line.short.svelte-z1j7sg {width:60%;}`
139
912
  };
140
- function Le(i, t) {
141
- Y(t, !0), Z(i, Ee);
142
- let n = x(t, "recordingId", 7), r = x(t, "theme", 7), a = x(t, "apiHost", 7, "api.44.audio");
143
- const T = r().split(",").map((e) => e.trim()).map((e, o) => `--44-color-${o}: ${e};`).join(" ");
144
- let m, q = L(!0), _ = L(null);
145
- ue(async () => {
146
- try {
147
- const e = await fetch(`https://${a()}/api/v1/recordings/${n()}/player`);
148
- if (!e.ok)
149
- throw new Error("Failed to fetch data");
150
- const o = await e.json();
151
- o.status === "ready" && d(_, o, !0);
152
- } catch (e) {
153
- console.error(e);
154
- } finally {
155
- d(q, !1);
913
+ function st(d, e) {
914
+ _r(e, !0), Ir(d, nt);
915
+ const h = e.$$host;
916
+ let s = A(e, "for", 7, ""), i = A(e, "maxHeight", 7, 0), n = j(null);
917
+ const o = N(() => i() > 0);
918
+ let a = j(!1), p = j(!1);
919
+ function y() {
920
+ if (!r(n) || !r(o)) {
921
+ u(a, !1), u(p, !1);
922
+ return;
923
+ }
924
+ const { scrollTop: w, scrollHeight: k, clientHeight: F } = r(n);
925
+ u(a, w > 1), u(p, w + F < k - 1);
926
+ }
927
+ let l = j(null), z = j("none");
928
+ function v(w) {
929
+ if (!w)
930
+ return w;
931
+ const k = document.createElement("textarea");
932
+ return k.innerHTML = w, k.value;
933
+ }
934
+ const L = N(() => v(r(l))), _ = Zr(() => r(l) === null, 200), f = N(() => r(l) !== null ? !1 : r(z) === "none" ? !0 : _());
935
+ pr(() => {
936
+ if (!s()) {
937
+ console.warn("fortyfour-translation: 'for' attribute is required");
938
+ return;
156
939
  }
940
+ const k = h.getRootNode().getElementById(s());
941
+ if (!k) {
942
+ console.warn(`fortyfour-translation: element with id "${s()}" not found`);
943
+ return;
944
+ }
945
+ u(z, k.getAttribute("preload") || "none", !0);
946
+ const F = k.metadata;
947
+ F && u(l, F.translation ?? null, !0);
948
+ function nr() {
949
+ const b = k.metadata;
950
+ u(l, b?.translation ?? null, !0);
951
+ }
952
+ return k.addEventListener("loadedmetadata", nr), () => {
953
+ k.removeEventListener("loadedmetadata", nr);
954
+ };
955
+ }), Gr(h, "data-placeholder", () => r(f)), pr(() => {
956
+ if (!r(n) || !r(o))
957
+ return;
958
+ y(), r(n).addEventListener("scroll", y);
959
+ const w = new ResizeObserver(y);
960
+ return w.observe(r(n)), () => {
961
+ r(n).removeEventListener("scroll", y), w.disconnect();
962
+ };
157
963
  });
158
- var F = {
964
+ var U = {
965
+ get for() {
966
+ return s();
967
+ },
968
+ set for(w = "") {
969
+ s(w), P();
970
+ },
971
+ get maxHeight() {
972
+ return i();
973
+ },
974
+ set maxHeight(w = 0) {
975
+ i(w), P();
976
+ }
977
+ }, W = at();
978
+ let J;
979
+ var Q = G(W);
980
+ let q, $;
981
+ var D = G(Q);
982
+ {
983
+ var ir = (w) => {
984
+ var k = tt(), F = G(k), nr = G(F, !0);
985
+ B(F), B(k), m(() => Lr(nr, r(L))), Er(1, k, () => Tr, () => ({ duration: 400 })), E(w, k);
986
+ }, sr = (w) => {
987
+ var k = hr(), F = fr(k);
988
+ {
989
+ var nr = (b) => {
990
+ var V = ot();
991
+ let lr;
992
+ m((gr) => lr = Hr(V, "", lr, gr), [
993
+ () => ({ height: r(o) ? `${i()}px` : void 0 })
994
+ ]), E(b, V);
995
+ };
996
+ tr(
997
+ F,
998
+ (b) => {
999
+ r(f) && b(nr);
1000
+ },
1001
+ !0
1002
+ );
1003
+ }
1004
+ E(w, k);
1005
+ };
1006
+ tr(D, (w) => {
1007
+ r(L) ? w(ir) : w(sr, !1);
1008
+ });
1009
+ }
1010
+ return B(Q), zr(Q, (w) => u(n, w), () => r(n)), B(W), m(
1011
+ (w, k, F) => {
1012
+ J = er(W, 1, "wrapper svelte-z1j7sg", null, J, w), q = er(Q, 1, "container svelte-z1j7sg", null, q, k), $ = Hr(Q, "", $, F);
1013
+ },
1014
+ [
1015
+ () => ({
1016
+ scrollable: r(o),
1017
+ "can-scroll-up": r(a),
1018
+ "can-scroll-down": r(p)
1019
+ }),
1020
+ () => ({ scrollable: r(o) }),
1021
+ () => ({
1022
+ "max-height": r(o) ? `${i()}px` : void 0
1023
+ })
1024
+ ]
1025
+ ), E(d, W), kr(U);
1026
+ }
1027
+ customElements.define("fortyfour-translation", xr(
1028
+ st,
1029
+ {
1030
+ for: { attribute: "for", reflect: !0 },
1031
+ maxHeight: { attribute: "max-height", reflect: !0, type: "Number" }
1032
+ },
1033
+ [],
1034
+ [],
1035
+ !0
1036
+ ));
1037
+ var it = Ar('<svg viewBox="0 0 359 254" aria-label="44" fill="currentColor"><path d="M92,300 C92.2666667,290.933333 92.8,280.533333 93.6,268.8 C93.8666667,262.666667 94,258.4 94,256 L6,256 L6,161.2 C7.33333333,159.333333 9.2,156.533333 11.6,152.8 C27.0666667,129.866667 39.3333333,110.733333 48.4,95.4 C57.4666667,80.0666667 65.2,63.8666667 71.6,46.8 L186,46.8 C128.4,122.533333 85.8666667,187.066667 58.4,240.4 L94,240.4 C94,240.133333 94,239.6 94,238.8 C93.4666667,228.666667 92.8,219.6 92,211.6 L185.2,72.4 C181.733333,91.0666667 180,127.333333 180,181.2 C180,235.066667 181.733333,274.666667 185.2,300 L92,300 Z" transform="translate(-6, -46)"></path><path d="M271,300 C271.266667,290.933333 271.8,280.533333 272.6,268.8 C272.866667,262.666667 273,258.4 273,256 L185,256 L185,161.2 C186.333333,159.333333 188.2,156.533333 190.6,152.8 C206.066667,129.866667 218.333333,110.733333 227.4,95.4 C236.466667,80.0666667 244.2,63.8666667 250.6,46.8 L365,46.8 C307.4,122.533333 264.866667,187.066667 237.4,240.4 L273,240.4 C273,240.133333 273,239.6 273,238.8 C272.466667,228.666667 271.8,219.6 271,211.6 L364.2,72.4 C360.733333,91.0666667 359,127.333333 359,181.2 C359,235.066667 360.733333,274.666667 364.2,300 L271,300 Z" transform="translate(-6, -46)"></path></svg>');
1038
+ function Vr(d, e) {
1039
+ _r(e, !0);
1040
+ let h = A(e, "class", 7, ""), s = A(e, "height", 7, "1em"), i = A(e, "width", 7, "auto");
1041
+ var n = {
1042
+ get class() {
1043
+ return h();
1044
+ },
1045
+ set class(a = "") {
1046
+ h(a), P();
1047
+ },
1048
+ get height() {
1049
+ return s();
1050
+ },
1051
+ set height(a = "1em") {
1052
+ s(a), P();
1053
+ },
1054
+ get width() {
1055
+ return i();
1056
+ },
1057
+ set width(a = "auto") {
1058
+ i(a), P();
1059
+ }
1060
+ }, o = it();
1061
+ return m(() => {
1062
+ er(o, 0, ze(h())), Z(o, "height", s()), Z(o, "width", i());
1063
+ }), E(d, o), kr(n);
1064
+ }
1065
+ xr(Vr, { class: {}, height: {}, width: {} }, [], [], !0);
1066
+ var lt = O("<fortyfour-progress-bar></fortyfour-progress-bar>", 2), ft = O("<fortyfour-line-waveform></fortyfour-line-waveform>", 2), ct = O("<fortyfour-bar-waveform></fortyfour-bar-waveform>", 2), ut = (d, e) => u(e, !r(e)), dt = O('<span class="label-separator svelte-14nd1et">•</span> <button class="translation-toggle svelte-14nd1et"> </button>', 1), vt = O("<fortyfour-translation></fortyfour-translation>", 2), pt = O("<fortyfour-transcription></fortyfour-transcription>", 2), yt = O('<div class="transcription-box svelte-14nd1et"><div class="transcription-header svelte-14nd1et"><span class="transcription-label svelte-14nd1et">TRANSCRIPT</span> <!></div> <!></div>'), ht = O('<a class="branding svelte-14nd1et" href="https://44.audio" target="_blank" rel="noopener noreferrer"><span class="branding-text svelte-14nd1et">powered by</span> <!></a>'), gt = O('<fortyfour-recording></fortyfour-recording> <div><div class="player svelte-14nd1et"><fortyfour-play-button></fortyfour-play-button> <!> <div class="duration svelte-14nd1et"><fortyfour-duration><span slot="placeholder">0:00</span></fortyfour-duration> <span class="separator svelte-14nd1et">/</span> <fortyfour-duration><span slot="placeholder">0:00</span></fortyfour-duration></div></div> <!></div> <!>', 3);
1067
+ const bt = {
1068
+ hash: "svelte-14nd1et",
1069
+ code: `:host {--fortyfour-player-font-family: system-ui, sans-serif;--fortyfour-player-font-size: 14px;--fortyfour-player-accent: #c4956a;--fortyfour-player-background: #faf8f5;--fortyfour-player-surface: #f0ede8;--fortyfour-player-text: #2c2620;--fortyfour-player-muted: #8c8279;--fortyfour-player-border: #d9d4cc;display:block;font-family:var(--fortyfour-player-font-family);font-size:var(--fortyfour-player-font-size);}.container.svelte-14nd1et {border:1px solid var(--fortyfour-player-border);border-radius:12px;background:var(--fortyfour-player-background);overflow:hidden;}.container.square.svelte-14nd1et {border-radius:0;}.container.compact.svelte-14nd1et .player:where(.svelte-14nd1et) {height:44px;padding:0.5rem 0.75rem;gap:0.75rem;}.container.compact.svelte-14nd1et .transcription-box:where(.svelte-14nd1et) {padding:0.5rem 0.75rem;}.container.compact.svelte-14nd1et fortyfour-play-button:where(.svelte-14nd1et) {--fortyfour-play-button-size: 40px;}.container.comfortable.svelte-14nd1et .player:where(.svelte-14nd1et) {height:68px;padding:1rem 1.25rem;gap:1.25rem;}.container.comfortable.svelte-14nd1et .transcription-box:where(.svelte-14nd1et) {padding:1rem 1.25rem;}.container.comfortable.svelte-14nd1et fortyfour-play-button:where(.svelte-14nd1et) {--fortyfour-play-button-size: 56px;}.player.svelte-14nd1et {display:flex;align-items:center;gap:1rem;height:56px;padding:0.75rem 1rem;}fortyfour-play-button.svelte-14nd1et {--fortyfour-play-button-size: 48px;--fortyfour-play-button-background-color: var(--fortyfour-player-accent);--fortyfour-play-button-icon-color: var(--fortyfour-player-background);--fortyfour-play-button-border-width: 0;--fortyfour-play-button-focus-color: var(--fortyfour-player-accent);flex-shrink:0;}fortyfour-bar-waveform.svelte-14nd1et,
1070
+ fortyfour-line-waveform.svelte-14nd1et,
1071
+ fortyfour-progress-bar.svelte-14nd1et {height:100%;flex:1;}fortyfour-bar-waveform.svelte-14nd1et {--waveform-progress-color: var(--fortyfour-player-accent);--waveform-track-color: var(--fortyfour-player-border);--waveform-focus-color: var(--fortyfour-player-accent);}fortyfour-line-waveform.svelte-14nd1et {--fortyfour-line-waveform-progress-color: var(--fortyfour-player-accent);--fortyfour-line-waveform-track-color: var(--fortyfour-player-border);--fortyfour-line-waveform-focus-color: var(--fortyfour-player-accent);}fortyfour-progress-bar.svelte-14nd1et {--fortyfour-progress-bar-progress-color: var(--fortyfour-player-accent);--fortyfour-progress-bar-track-color: var(--fortyfour-player-border);--fortyfour-progress-bar-focus-color: var(--fortyfour-player-accent);}.duration.svelte-14nd1et {display:flex;align-items:center;gap:0.25rem;flex-shrink:0;}.elapsed.svelte-14nd1et {--fortyfour-duration-font-family: var(--fortyfour-player-font-family);--fortyfour-duration-font-size: 1em;--fortyfour-duration-color: var(--fortyfour-player-text);font-weight:500;}.separator.svelte-14nd1et {font-size:1em;color:var(--fortyfour-player-muted);}.total.svelte-14nd1et {--fortyfour-duration-font-family: var(--fortyfour-player-font-family);--fortyfour-duration-font-size: 1em;--fortyfour-duration-color: var(--fortyfour-player-muted);}.transcription-box.svelte-14nd1et {background:var(--fortyfour-player-surface);padding:0.75rem 1rem;border-top:1px solid var(--fortyfour-player-border);}.transcription-header.svelte-14nd1et {display:flex;align-items:center;gap:0.5em;margin-bottom:0.5rem;}.transcription-label.svelte-14nd1et {font-size:0.7em;font-weight:600;letter-spacing:0.05em;color:var(--fortyfour-player-muted);}.label-separator.svelte-14nd1et {font-size:0.7em;color:var(--fortyfour-player-muted);}.translation-toggle.svelte-14nd1et {font-size:0.7em;font-weight:600;letter-spacing:0.05em;color:var(--fortyfour-player-accent);background:none;border:none;padding:0;cursor:pointer;}.translation-toggle.svelte-14nd1et:hover {text-decoration:underline;}.translation-toggle.svelte-14nd1et:focus-visible {outline:2px solid var(--fortyfour-player-accent);outline-offset:2px;border-radius:2px;}fortyfour-transcription.svelte-14nd1et,
1072
+ fortyfour-translation.svelte-14nd1et {display:block;line-height:1.5;color:var(--fortyfour-player-text);--fortyfour-transcription-font-family: var(--fortyfour-player-font-family);--fortyfour-transcription-font-size: 1em;--fortyfour-translation-font-family: var(--fortyfour-player-font-family);--fortyfour-translation-font-size: 1em;--fortyfour-transcription-color: var(--fortyfour-player-muted);--fortyfour-transcription-active-color: var(--fortyfour-player-background);--fortyfour-transcription-active-bg: var(--fortyfour-player-accent);--fortyfour-transcription-past-color: var(--fortyfour-player-text);--fortyfour-transcription-fade-color: var(--fortyfour-player-surface);--fortyfour-transcription-placeholder-color: var(--fortyfour-player-border);--fortyfour-transcription-scrollbar-thumb: var(--fortyfour-player-border);--fortyfour-transcription-scrollbar-thumb-hover: var(--fortyfour-player-muted);--fortyfour-transcription-focus-color: var(--fortyfour-player-accent);--fortyfour-translation-fade-color: var(--fortyfour-player-surface);--fortyfour-translation-placeholder-color: var(--fortyfour-player-border);--fortyfour-translation-scrollbar-thumb: var(--fortyfour-player-border);--fortyfour-translation-scrollbar-thumb-hover: var(--fortyfour-player-muted);--fortyfour-translation-focus-color: var(--fortyfour-player-accent);}.branding.svelte-14nd1et {display:flex;align-items:center;gap:0.3em;width:fit-content;margin-left:auto;margin-top:0.5rem;margin-right:1rem;text-decoration:none;color:var(--fortyfour-player-muted);border-radius:4px;white-space:nowrap;}.branding.svelte-14nd1et:focus-visible {outline:2px solid var(--fortyfour-player-accent);outline-offset:2px;}.branding-text.svelte-14nd1et {font-size:0.7em;font-weight:400;letter-spacing:0.01em;}`
1073
+ };
1074
+ function mt(d, e) {
1075
+ _r(e, !0), Ir(d, bt);
1076
+ const h = e.$$host;
1077
+ let s = A(e, "recordingId", 7), i = A(e, "apiHost", 7, "api.44.audio"), n = A(e, "shape", 7, "rounded"), o = A(e, "preload", 7, "none"), a = A(e, "spacing", 7, "default"), p = A(e, "progress", 7, "bar-waveform"), y = A(e, "hideTranscript", 7, !1), l = A(e, "hideTranslation", 7, !1), z = A(e, "hideBranding", 7, !1);
1078
+ const v = `fortyfour-player-${crypto.randomUUID().slice(0, 8)}`;
1079
+ let L = j(null), _ = j(!1), f = j(!1);
1080
+ const U = N(() => n() === "square"), W = N(() => r(U) ? "square" : "circle"), J = N(() => r(U) ? "0" : "2"), Q = N(() => p() || "bar-waveform"), q = N(() => a() === "compact" ? 28 : a() === "comfortable" ? 48 : 40), $ = N(() => a() === "compact" ? 4 : a() === "comfortable" ? 8 : 6);
1081
+ function D() {
1082
+ const c = r(L)?.state ?? "idle";
1083
+ h.setAttribute("data-state", c);
1084
+ }
1085
+ function ir() {
1086
+ const c = r(L)?.metadata?.translation;
1087
+ u(_, c != null && c !== "", !0);
1088
+ }
1089
+ pr(() => {
1090
+ r(L) && (D(), ir());
1091
+ }), h.pause = () => r(L)?.pause(), h.togglePlay = () => r(L)?.togglePlay(), h.seek = (c) => r(L)?.seek(c);
1092
+ var sr = {
159
1093
  get recordingId() {
1094
+ return s();
1095
+ },
1096
+ set recordingId(c) {
1097
+ s(c), P();
1098
+ },
1099
+ get apiHost() {
1100
+ return i();
1101
+ },
1102
+ set apiHost(c = "api.44.audio") {
1103
+ i(c), P();
1104
+ },
1105
+ get shape() {
160
1106
  return n();
161
1107
  },
162
- set recordingId(e) {
163
- n(e), j();
1108
+ set shape(c = "rounded") {
1109
+ n(c), P();
164
1110
  },
165
- get theme() {
166
- return r();
1111
+ get preload() {
1112
+ return o();
167
1113
  },
168
- set theme(e) {
169
- r(e), j();
1114
+ set preload(c = "none") {
1115
+ o(c), P();
170
1116
  },
171
- get apiHost() {
1117
+ get spacing() {
172
1118
  return a();
173
1119
  },
174
- set apiHost(e = "api.44.audio") {
175
- a(e), j();
1120
+ set spacing(c = "default") {
1121
+ a(c), P();
1122
+ },
1123
+ get progress() {
1124
+ return p();
1125
+ },
1126
+ set progress(c = "bar-waveform") {
1127
+ p(c), P();
1128
+ },
1129
+ get hideTranscript() {
1130
+ return y();
1131
+ },
1132
+ set hideTranscript(c = !1) {
1133
+ y(c), P();
1134
+ },
1135
+ get hideTranslation() {
1136
+ return l();
1137
+ },
1138
+ set hideTranslation(c = !1) {
1139
+ l(c), P();
1140
+ },
1141
+ get hideBranding() {
1142
+ return z();
1143
+ },
1144
+ set hideBranding(c = !1) {
1145
+ z(c), P();
176
1146
  }
177
- }, u = Re(), w = b(u);
1147
+ }, w = gt(), k = fr(w);
1148
+ m(() => C(k, "id", v)), m(() => C(k, "api-host", i())), m(() => C(k, "recording-id", s())), m(() => C(k, "preload", o())), zr(k, (c) => u(L, c), () => r(L));
1149
+ var F = dr(k, 2);
1150
+ let nr;
1151
+ var b = G(F), V = G(b);
1152
+ m(() => C(V, "for", v)), m(() => C(V, "shape", r(W))), er(V, 1, "svelte-14nd1et");
1153
+ var lr = dr(V, 2);
178
1154
  {
179
- var O = (e) => {
180
- var o = He();
181
- s(e, o);
182
- }, U = (e) => {
183
- var o = Q(), A = R(o);
1155
+ var gr = (c) => {
1156
+ var R = lt();
1157
+ m(() => C(R, "for", v)), m(() => C(R, "bar-height", r($))), m(() => C(R, "bar-radius", r(J))), er(R, 1, "svelte-14nd1et"), E(c, R);
1158
+ }, g = (c) => {
1159
+ var R = hr(), X = fr(R);
184
1160
  {
185
- var D = (c) => {
186
- ee(c, {
187
- get apiHost() {
188
- return a();
189
- },
190
- get recordingId() {
191
- return n();
192
- },
193
- get recording() {
194
- return p(_);
195
- },
196
- get audioRef() {
197
- return m;
198
- }
199
- });
200
- }, G = (c) => {
201
- var J = Ie();
202
- s(c, J);
1161
+ var ar = (or) => {
1162
+ var K = ft();
1163
+ m(() => C(K, "for", v)), C(K, "line-width", "2"), m(() => C(K, "height", r(q))), m(() => C(K, "sharp", r(U))), er(K, 1, "svelte-14nd1et"), E(or, K);
1164
+ }, cr = (or) => {
1165
+ var K = ct();
1166
+ m(() => C(K, "for", v)), C(K, "bar-width", "4"), C(K, "bar-gap", "2"), m(() => C(K, "bar-radius", r(J))), m(() => C(K, "height", r(q))), er(K, 1, "svelte-14nd1et"), E(or, K);
203
1167
  };
204
- k(
205
- A,
206
- (c) => {
207
- p(_) ? c(D) : c(G, !1);
1168
+ tr(
1169
+ X,
1170
+ (or) => {
1171
+ r(Q) === "line-waveform" ? or(ar) : or(cr, !1);
208
1172
  },
209
1173
  !0
210
1174
  );
211
1175
  }
212
- s(e, o);
1176
+ E(c, R);
213
1177
  };
214
- k(w, (e) => {
215
- p(q) ? e(O) : e(U, !1);
1178
+ tr(lr, (c) => {
1179
+ r(Q) === "progress-bar" ? c(gr) : c(g, !1);
216
1180
  });
217
1181
  }
218
- var B = h(w, 2);
219
- return ge(B, (e) => m = e, () => m), y(u), E(() => {
220
- fe(u, T), pe(B, "src", `https://${a() ?? ""}/api/v1/recordings/${n() ?? ""}/audio.mp3`);
221
- }), s(i, u), $(F);
1182
+ var x = dr(lr, 2), t = G(x);
1183
+ er(t, 1, "elapsed svelte-14nd1et"), m(() => C(t, "for", v)), C(t, "format", "elapsed");
1184
+ var T = dr(t, 4);
1185
+ er(T, 1, "total svelte-14nd1et"), m(() => C(T, "for", v)), C(T, "format", "total"), B(x), B(b);
1186
+ var H = dr(b, 2);
1187
+ {
1188
+ var I = (c) => {
1189
+ var R = yt(), X = G(R), ar = dr(G(X), 2);
1190
+ {
1191
+ var cr = (Y) => {
1192
+ var rr = dt(), yr = dr(fr(rr), 2);
1193
+ yr.__click = [ut, f];
1194
+ var br = G(yr, !0);
1195
+ B(yr), m(() => {
1196
+ Z(yr, "aria-pressed", r(f)), Lr(br, r(f) ? "ORIGINAL" : "TRANSLATION");
1197
+ }), E(Y, rr);
1198
+ };
1199
+ tr(ar, (Y) => {
1200
+ r(_) && !l() && Y(cr);
1201
+ });
1202
+ }
1203
+ B(X);
1204
+ var or = dr(X, 2);
1205
+ {
1206
+ var K = (Y) => {
1207
+ var rr = vt();
1208
+ m(() => C(rr, "for", v)), C(rr, "max-height", "96"), er(rr, 1, "svelte-14nd1et"), E(Y, rr);
1209
+ }, ur = (Y) => {
1210
+ var rr = pt();
1211
+ m(() => C(rr, "for", v)), C(rr, "mode", "karaoke"), C(rr, "max-height", "96"), er(rr, 1, "svelte-14nd1et"), E(Y, rr);
1212
+ };
1213
+ tr(or, (Y) => {
1214
+ r(f) && !l() ? Y(K) : Y(ur, !1);
1215
+ });
1216
+ }
1217
+ B(R), E(c, R);
1218
+ };
1219
+ tr(H, (c) => {
1220
+ y() || c(I);
1221
+ });
1222
+ }
1223
+ B(F);
1224
+ var S = dr(F, 2);
1225
+ {
1226
+ var M = (c) => {
1227
+ var R = ht(), X = dr(G(R), 2);
1228
+ Vr(X, { class: "branding-logo", height: "0.65em" }), B(R), E(c, R);
1229
+ };
1230
+ tr(S, (c) => {
1231
+ z() || c(M);
1232
+ });
1233
+ }
1234
+ return m((c) => nr = er(F, 1, "container svelte-14nd1et", null, nr, c), [
1235
+ () => ({
1236
+ square: r(U),
1237
+ compact: a() === "compact",
1238
+ comfortable: a() === "comfortable"
1239
+ })
1240
+ ]), vr("loadedmetadata", k, () => {
1241
+ D(), ir();
1242
+ }), vr("play", k, D), vr("pause", k, D), vr("error", k, D), vr("ended", k, D), E(d, w), kr(sr);
1243
+ }
1244
+ Br(["click"]);
1245
+ customElements.define("fortyfour-player", xr(
1246
+ mt,
1247
+ {
1248
+ apiHost: { attribute: "api-host", reflect: !0 },
1249
+ recordingId: { attribute: "recording-id", reflect: !0 },
1250
+ shape: { attribute: "shape", reflect: !0 },
1251
+ preload: { attribute: "preload", reflect: !0 },
1252
+ spacing: { attribute: "spacing", reflect: !0 },
1253
+ progress: { attribute: "progress", reflect: !0 },
1254
+ hideTranscript: { attribute: "hide-transcript", reflect: !0, type: "Boolean" },
1255
+ hideTranslation: {
1256
+ attribute: "hide-translation",
1257
+ reflect: !0,
1258
+ type: "Boolean"
1259
+ },
1260
+ hideBranding: { attribute: "hide-branding", reflect: !0, type: "Boolean" }
1261
+ },
1262
+ [],
1263
+ [],
1264
+ !0
1265
+ ));
1266
+ var wt = O("<fortyfour-recording></fortyfour-recording> <fortyfour-play-button></fortyfour-play-button>", 3);
1267
+ const xt = {
1268
+ hash: "svelte-1i43bu9",
1269
+ code: `:host {--fortyfour-mini-player-accent: #c4956a;--fortyfour-mini-player-background: #faf8f5;display:inline-block;}
1270
+
1271
+ @media (prefers-color-scheme: dark) {:host {--fortyfour-mini-player-accent: #d4a574;--fortyfour-mini-player-background: #1c1917;}
1272
+ }fortyfour-play-button.svelte-1i43bu9 {--fortyfour-play-button-size: 48px;--fortyfour-play-button-background-color: var(--fortyfour-mini-player-background);--fortyfour-play-button-icon-color: var(--fortyfour-mini-player-accent);--fortyfour-play-button-border-width: 0;--fortyfour-play-button-ring-width: 3px;--fortyfour-play-button-ring-fill-color: var(--fortyfour-mini-player-accent);--fortyfour-play-button-ring-track-color: var(--fortyfour-mini-player-background);--fortyfour-play-button-focus-color: var(--fortyfour-mini-player-accent);}fortyfour-play-button.small.svelte-1i43bu9 {--fortyfour-play-button-size: 32px;--fortyfour-play-button-ring-width: 2px;}fortyfour-play-button.large.svelte-1i43bu9 {--fortyfour-play-button-size: 64px;--fortyfour-play-button-ring-width: 4px;}`
1273
+ };
1274
+ function _t(d, e) {
1275
+ _r(e, !0), Ir(d, xt);
1276
+ const h = e.$$host;
1277
+ let s = A(e, "recordingId", 7), i = A(e, "apiHost", 7, "api.44.audio"), n = A(e, "size", 7, "medium"), o = A(e, "preload", 7, "none");
1278
+ const a = `fortyfour-mini-player-${crypto.randomUUID().slice(0, 8)}`;
1279
+ let p = j(null);
1280
+ function y() {
1281
+ const f = r(p)?.state ?? "idle";
1282
+ h.setAttribute("data-state", f);
1283
+ }
1284
+ pr(() => {
1285
+ r(p) && y();
1286
+ });
1287
+ var l = {
1288
+ get recordingId() {
1289
+ return s();
1290
+ },
1291
+ set recordingId(f) {
1292
+ s(f), P();
1293
+ },
1294
+ get apiHost() {
1295
+ return i();
1296
+ },
1297
+ set apiHost(f = "api.44.audio") {
1298
+ i(f), P();
1299
+ },
1300
+ get size() {
1301
+ return n();
1302
+ },
1303
+ set size(f = "medium") {
1304
+ n(f), P();
1305
+ },
1306
+ get preload() {
1307
+ return o();
1308
+ },
1309
+ set preload(f = "none") {
1310
+ o(f), P();
1311
+ }
1312
+ }, z = wt(), v = fr(z);
1313
+ m(() => C(v, "id", a)), m(() => C(v, "api-host", i())), m(() => C(v, "recording-id", s())), m(() => C(v, "preload", o())), zr(v, (f) => u(p, f), () => r(p));
1314
+ var L = dr(v, 2);
1315
+ let _;
1316
+ return m(() => C(L, "for", a)), C(L, "shape", "circle"), C(L, "visualization", "ring"), m((f) => _ = er(L, 1, "button svelte-1i43bu9", null, _, f), [
1317
+ () => ({ small: n() === "small", large: n() === "large" })
1318
+ ]), vr("loadedmetadata", v, y), vr("play", v, y), vr("pause", v, y), vr("error", v, y), vr("ended", v, y), E(d, z), kr(l);
222
1319
  }
223
- customElements.define("fortyfour-audio-player", X(
224
- Le,
1320
+ customElements.define("fortyfour-mini-player", xr(
1321
+ _t,
225
1322
  {
226
- apiHost: { attribute: "api-host" },
227
- recordingId: { attribute: "recording-id" },
228
- theme: { attribute: "theme" }
1323
+ apiHost: { attribute: "api-host", reflect: !0 },
1324
+ recordingId: { attribute: "recording-id", reflect: !0 },
1325
+ size: { attribute: "size", reflect: !0 },
1326
+ preload: { attribute: "preload", reflect: !0 }
229
1327
  },
230
1328
  [],
231
1329
  [],