@djangocfg/ui-tools 2.1.335 → 2.1.336
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/README.md +68 -2
- package/dist/ChatRoot-IIYQEWUU.mjs +5 -0
- package/dist/ChatRoot-IIYQEWUU.mjs.map +1 -0
- package/dist/ChatRoot-PNNGQCYF.css +7 -0
- package/dist/ChatRoot-PNNGQCYF.css.map +1 -0
- package/dist/ChatRoot-UUKTYM4N.cjs +14 -0
- package/dist/ChatRoot-UUKTYM4N.cjs.map +1 -0
- package/dist/{CronScheduler.client-3O3VU4CI.mjs → CronScheduler.client-DLMXCPAJ.mjs} +4 -4
- package/dist/{CronScheduler.client-3O3VU4CI.mjs.map → CronScheduler.client-DLMXCPAJ.mjs.map} +1 -1
- package/dist/{CronScheduler.client-A4GO6YBY.cjs → CronScheduler.client-WEJF4PWQ.cjs} +14 -14
- package/dist/{CronScheduler.client-A4GO6YBY.cjs.map → CronScheduler.client-WEJF4PWQ.cjs.map} +1 -1
- package/dist/{DocsLayout-XLDB6CJ2.cjs → DocsLayout-N5ZJZPBY.cjs} +200 -199
- package/dist/DocsLayout-N5ZJZPBY.cjs.map +1 -0
- package/dist/{DocsLayout-CTJINVBM.mjs → DocsLayout-VFPPNKSQ.mjs} +7 -6
- package/dist/DocsLayout-VFPPNKSQ.mjs.map +1 -0
- package/dist/JsonSchemaForm-DD7CLRIG.cjs +13 -0
- package/dist/{JsonSchemaForm-6WMS4CIY.cjs.map → JsonSchemaForm-DD7CLRIG.cjs.map} +1 -1
- package/dist/JsonSchemaForm-XKUIVELK.mjs +4 -0
- package/dist/{JsonSchemaForm-KX4JT3M4.mjs.map → JsonSchemaForm-XKUIVELK.mjs.map} +1 -1
- package/dist/JsonTree-55625VVH.mjs +5 -0
- package/dist/{JsonTree-F27RMYSI.cjs.map → JsonTree-55625VVH.mjs.map} +1 -1
- package/dist/JsonTree-DCM5QGWF.cjs +11 -0
- package/dist/{JsonTree-QTJYSHCV.mjs.map → JsonTree-DCM5QGWF.cjs.map} +1 -1
- package/dist/{LottiePlayer.client-6WVWDO75.cjs → LottiePlayer.client-2S7ISJ2S.cjs} +6 -6
- package/dist/{LottiePlayer.client-6WVWDO75.cjs.map → LottiePlayer.client-2S7ISJ2S.cjs.map} +1 -1
- package/dist/{LottiePlayer.client-B4I6WNZM.mjs → LottiePlayer.client-5LDSSJWS.mjs} +4 -4
- package/dist/{LottiePlayer.client-B4I6WNZM.mjs.map → LottiePlayer.client-5LDSSJWS.mjs.map} +1 -1
- package/dist/{MapContainer-RYG4HPH4.cjs → MapContainer-76YL2JXL.cjs} +8 -8
- package/dist/{MapContainer-RYG4HPH4.cjs.map → MapContainer-76YL2JXL.cjs.map} +1 -1
- package/dist/{MapContainer-GXQLP5WY.mjs → MapContainer-7HXBI3OH.mjs} +3 -3
- package/dist/{MapContainer-GXQLP5WY.mjs.map → MapContainer-7HXBI3OH.mjs.map} +1 -1
- package/dist/{Mermaid.client-SXRRI2YW.mjs → Mermaid.client-NL4SVR7F.mjs} +4 -4
- package/dist/{Mermaid.client-SXRRI2YW.mjs.map → Mermaid.client-NL4SVR7F.mjs.map} +1 -1
- package/dist/{Mermaid.client-W76R5AKJ.cjs → Mermaid.client-NNTI6DFX.cjs} +26 -26
- package/dist/{Mermaid.client-W76R5AKJ.cjs.map → Mermaid.client-NNTI6DFX.cjs.map} +1 -1
- package/dist/Player-BRV7XTWR.mjs +4 -0
- package/dist/{Player-M3GC3VPE.mjs.map → Player-BRV7XTWR.mjs.map} +1 -1
- package/dist/Player-PM7F7DD7.cjs +13 -0
- package/dist/{Player-ZL2X5LGG.cjs.map → Player-PM7F7DD7.cjs.map} +1 -1
- package/dist/{PrettyCode.client-RPDIE5CH.cjs → PrettyCode.client-KOHDVPPN.cjs} +13 -13
- package/dist/{PrettyCode.client-RPDIE5CH.cjs.map → PrettyCode.client-KOHDVPPN.cjs.map} +1 -1
- package/dist/{PrettyCode.client-SPMTQEG4.mjs → PrettyCode.client-ZGYGKE7G.mjs} +4 -4
- package/dist/{PrettyCode.client-SPMTQEG4.mjs.map → PrettyCode.client-ZGYGKE7G.mjs.map} +1 -1
- package/dist/TreeRoot-N72OYKXU.cjs +19 -0
- package/dist/{TreeRoot-A3J65L6F.mjs.map → TreeRoot-N72OYKXU.cjs.map} +1 -1
- package/dist/TreeRoot-VGAIXCUA.mjs +4 -0
- package/dist/{TreeRoot-DSK5JILT.cjs.map → TreeRoot-VGAIXCUA.mjs.map} +1 -1
- package/dist/chunk-2ZLKZ5VR.mjs +631 -0
- package/dist/chunk-2ZLKZ5VR.mjs.map +1 -0
- package/dist/{chunk-LFWQ36LJ.mjs → chunk-5G5YBFS6.mjs} +4 -4
- package/dist/{chunk-LFWQ36LJ.mjs.map → chunk-5G5YBFS6.mjs.map} +1 -1
- package/dist/{chunk-IHAY6FO6.cjs → chunk-5I5QNGUG.cjs} +17 -17
- package/dist/{chunk-IHAY6FO6.cjs.map → chunk-5I5QNGUG.cjs.map} +1 -1
- package/dist/{chunk-F2CMIIOH.cjs → chunk-76NNDZH6.cjs} +42 -42
- package/dist/{chunk-F2CMIIOH.cjs.map → chunk-76NNDZH6.cjs.map} +1 -1
- package/dist/chunk-B5AWZOHJ.cjs +649 -0
- package/dist/chunk-B5AWZOHJ.cjs.map +1 -0
- package/dist/{chunk-KR6B3LVY.mjs → chunk-B6IR5KSC.mjs} +3 -3
- package/dist/{chunk-KR6B3LVY.mjs.map → chunk-B6IR5KSC.mjs.map} +1 -1
- package/dist/{chunk-5LBDYFWH.mjs → chunk-C6GXVH5J.mjs} +3 -3
- package/dist/{chunk-5LBDYFWH.mjs.map → chunk-C6GXVH5J.mjs.map} +1 -1
- package/dist/{chunk-NRKD4F5X.cjs → chunk-FEN5S772.cjs} +36 -36
- package/dist/{chunk-NRKD4F5X.cjs.map → chunk-FEN5S772.cjs.map} +1 -1
- package/dist/{chunk-2SMCH62O.cjs → chunk-FP2RLYQZ.cjs} +11 -11
- package/dist/{chunk-2SMCH62O.cjs.map → chunk-FP2RLYQZ.cjs.map} +1 -1
- package/dist/{chunk-MOME6KYD.mjs → chunk-G5IEC7SR.mjs} +3 -3
- package/dist/{chunk-MOME6KYD.mjs.map → chunk-G5IEC7SR.mjs.map} +1 -1
- package/dist/{chunk-SE5IERVH.mjs → chunk-GYIO7W7M.mjs} +3 -3
- package/dist/{chunk-SE5IERVH.mjs.map → chunk-GYIO7W7M.mjs.map} +1 -1
- package/dist/{chunk-3Z3A7FHA.cjs → chunk-IEEAENLX.cjs} +48 -48
- package/dist/{chunk-3Z3A7FHA.cjs.map → chunk-IEEAENLX.cjs.map} +1 -1
- package/dist/{chunk-DFTVB66S.cjs → chunk-KNDLV4PI.cjs} +85 -85
- package/dist/{chunk-DFTVB66S.cjs.map → chunk-KNDLV4PI.cjs.map} +1 -1
- package/dist/{chunk-SSUOENAZ.mjs → chunk-KNEQRUBA.mjs} +3 -3
- package/dist/{chunk-SSUOENAZ.mjs.map → chunk-KNEQRUBA.mjs.map} +1 -1
- package/dist/chunk-KRETIZU6.mjs +2218 -0
- package/dist/chunk-KRETIZU6.mjs.map +1 -0
- package/dist/{chunk-CGILA3WO.mjs → chunk-N2XQF2OL.mjs} +5 -3
- package/dist/{chunk-CGILA3WO.mjs.map → chunk-N2XQF2OL.mjs.map} +1 -1
- package/dist/{chunk-EUADAUBQ.mjs → chunk-N4MZYNR4.mjs} +4 -4
- package/dist/{chunk-EUADAUBQ.mjs.map → chunk-N4MZYNR4.mjs.map} +1 -1
- package/dist/chunk-NRXYYO5V.cjs +2257 -0
- package/dist/chunk-NRXYYO5V.cjs.map +1 -0
- package/dist/{chunk-GGKGH5PM.mjs → chunk-OBRSGM64.mjs} +4 -4
- package/dist/{chunk-GGKGH5PM.mjs.map → chunk-OBRSGM64.mjs.map} +1 -1
- package/dist/{chunk-6JTB2X72.mjs → chunk-ODO4GMW7.mjs} +3 -3
- package/dist/{chunk-6JTB2X72.mjs.map → chunk-ODO4GMW7.mjs.map} +1 -1
- package/dist/{chunk-WGEGR3DF.cjs → chunk-OLISEQHS.cjs} +5 -2
- package/dist/{chunk-WGEGR3DF.cjs.map → chunk-OLISEQHS.cjs.map} +1 -1
- package/dist/{chunk-PZKAH7WQ.mjs → chunk-PVAX67JG.mjs} +3 -3
- package/dist/{chunk-PZKAH7WQ.mjs.map → chunk-PVAX67JG.mjs.map} +1 -1
- package/dist/{chunk-PRPG2T2E.cjs → chunk-QJ6GTUCO.cjs} +6 -6
- package/dist/{chunk-PRPG2T2E.cjs.map → chunk-QJ6GTUCO.cjs.map} +1 -1
- package/dist/chunk-QW4RBGHN.cjs +961 -0
- package/dist/chunk-QW4RBGHN.cjs.map +1 -0
- package/dist/{chunk-33AMWFBZ.cjs → chunk-SGP7V2UW.cjs} +15 -15
- package/dist/{chunk-33AMWFBZ.cjs.map → chunk-SGP7V2UW.cjs.map} +1 -1
- package/dist/{chunk-FX2QFYWF.mjs → chunk-VWQ5WOIL.mjs} +3 -3
- package/dist/{chunk-FX2QFYWF.mjs.map → chunk-VWQ5WOIL.mjs.map} +1 -1
- package/dist/{chunk-ZLQHUZDU.cjs → chunk-YDPDTOSP.cjs} +139 -139
- package/dist/{chunk-ZLQHUZDU.cjs.map → chunk-YDPDTOSP.cjs.map} +1 -1
- package/dist/{chunk-77HQWEQ6.cjs → chunk-YW5IVWHQ.cjs} +33 -33
- package/dist/{chunk-77HQWEQ6.cjs.map → chunk-YW5IVWHQ.cjs.map} +1 -1
- package/dist/{chunk-YXBOAGIM.cjs → chunk-YXZ6GU7H.cjs} +7 -7
- package/dist/{chunk-YXBOAGIM.cjs.map → chunk-YXZ6GU7H.cjs.map} +1 -1
- package/dist/{chunk-62Y65TGK.mjs → chunk-ZUFTH5IR.mjs} +8 -631
- package/dist/chunk-ZUFTH5IR.mjs.map +1 -0
- package/dist/components-EHOGXATG.cjs +22 -0
- package/dist/{components-5UXYNAKR.cjs.map → components-EHOGXATG.cjs.map} +1 -1
- package/dist/components-MQ6DR7TX.cjs +26 -0
- package/dist/{components-CFXOEVPN.mjs.map → components-MQ6DR7TX.cjs.map} +1 -1
- package/dist/components-XRX7QGLB.mjs +5 -0
- package/dist/{components-WYEZL5TE.cjs.map → components-XRX7QGLB.mjs.map} +1 -1
- package/dist/components-YATKRWLH.mjs +5 -0
- package/dist/{components-ZAGG2PBO.mjs.map → components-YATKRWLH.mjs.map} +1 -1
- package/dist/file-icon/index.cjs +6 -6
- package/dist/file-icon/index.mjs +1 -1
- package/dist/index.cjs +735 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +972 -39
- package/dist/index.d.ts +972 -39
- package/dist/index.mjs +387 -31
- package/dist/index.mjs.map +1 -1
- package/dist/tree/index.cjs +38 -38
- package/dist/tree/index.d.cts +2 -2
- package/dist/tree/index.d.ts +2 -2
- package/dist/tree/index.mjs +3 -3
- package/package.json +6 -6
- package/src/index.ts +5 -0
- package/src/stories/index.ts +3 -1
- package/src/tools/Chat/Chat.story.tsx +1006 -0
- package/src/tools/Chat/README.md +528 -0
- package/src/tools/Chat/components/Attachments.tsx +192 -0
- package/src/tools/Chat/components/ChatRoot.tsx +201 -0
- package/src/tools/Chat/components/Composer.tsx +134 -0
- package/src/tools/Chat/components/EmptyState.tsx +47 -0
- package/src/tools/Chat/components/ErrorBanner.tsx +47 -0
- package/src/tools/Chat/components/JumpToLatest.tsx +30 -0
- package/src/tools/Chat/components/MessageActions.tsx +72 -0
- package/src/tools/Chat/components/MessageBubble.tsx +228 -0
- package/src/tools/Chat/components/MessageList.tsx +82 -0
- package/src/tools/Chat/components/Sources.tsx +55 -0
- package/src/tools/Chat/components/StreamingIndicator.tsx +29 -0
- package/src/tools/Chat/components/ToolCalls.tsx +172 -0
- package/src/tools/Chat/components/index.ts +24 -0
- package/src/tools/Chat/config.ts +55 -0
- package/src/tools/Chat/context/ChatProvider.tsx +122 -0
- package/src/tools/Chat/context/index.ts +9 -0
- package/src/tools/Chat/core/audio/audioBus.ts +172 -0
- package/src/tools/Chat/core/audio/index.ts +8 -0
- package/src/tools/Chat/core/audio/preferences.ts +68 -0
- package/src/tools/Chat/core/audio/types.ts +49 -0
- package/src/tools/Chat/core/ids.ts +16 -0
- package/src/tools/Chat/core/index.ts +5 -0
- package/src/tools/Chat/core/markdown.ts +56 -0
- package/src/tools/Chat/core/payload-dispatch.ts +54 -0
- package/src/tools/Chat/core/persona.ts +35 -0
- package/src/tools/Chat/core/reducer.ts +335 -0
- package/src/tools/Chat/core/transport/http.ts +167 -0
- package/src/tools/Chat/core/transport/index.ts +13 -0
- package/src/tools/Chat/core/transport/mock.ts +134 -0
- package/src/tools/Chat/core/transport/sse.ts +116 -0
- package/src/tools/Chat/core/transport/types.ts +24 -0
- package/src/tools/Chat/hooks/index.ts +26 -0
- package/src/tools/Chat/hooks/useChat.ts +440 -0
- package/src/tools/Chat/hooks/useChatAudio.ts +191 -0
- package/src/tools/Chat/hooks/useChatComposer.ts +227 -0
- package/src/tools/Chat/hooks/useChatHistory.ts +59 -0
- package/src/tools/Chat/hooks/useChatLayout.ts +111 -0
- package/src/tools/Chat/hooks/useChatLightbox.ts +34 -0
- package/src/tools/Chat/hooks/useChatScroll.ts +132 -0
- package/src/tools/Chat/index.ts +158 -0
- package/src/tools/Chat/lazy.tsx +14 -0
- package/src/tools/Chat/types.ts +237 -0
- package/src/tools/Chat/utils/collectImageAttachments.ts +13 -0
- package/src/tools/Map/README.md +384 -0
- package/dist/DocsLayout-CTJINVBM.mjs.map +0 -1
- package/dist/DocsLayout-XLDB6CJ2.cjs.map +0 -1
- package/dist/JsonSchemaForm-6WMS4CIY.cjs +0 -13
- package/dist/JsonSchemaForm-KX4JT3M4.mjs +0 -4
- package/dist/JsonTree-F27RMYSI.cjs +0 -11
- package/dist/JsonTree-QTJYSHCV.mjs +0 -5
- package/dist/Player-M3GC3VPE.mjs +0 -4
- package/dist/Player-ZL2X5LGG.cjs +0 -13
- package/dist/TreeRoot-A3J65L6F.mjs +0 -4
- package/dist/TreeRoot-DSK5JILT.cjs +0 -19
- package/dist/chunk-62Y65TGK.mjs.map +0 -1
- package/dist/chunk-TKSFZHCG.cjs +0 -1597
- package/dist/chunk-TKSFZHCG.cjs.map +0 -1
- package/dist/components-5UXYNAKR.cjs +0 -22
- package/dist/components-CFXOEVPN.mjs +0 -5
- package/dist/components-WYEZL5TE.cjs +0 -26
- package/dist/components-ZAGG2PBO.mjs +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOLISEQHS_cjs = require('./chunk-OLISEQHS.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var components = require('@djangocfg/ui-core/components');
|
|
@@ -20,7 +20,7 @@ function getAudioContext() {
|
|
|
20
20
|
_ctx = new Ctor({ latencyHint: "interactive" });
|
|
21
21
|
return _ctx;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
chunkOLISEQHS_cjs.__name(getAudioContext, "getAudioContext");
|
|
24
24
|
async function unlockAudioContext() {
|
|
25
25
|
const ctx = getAudioContext();
|
|
26
26
|
if (ctx.state === "suspended") {
|
|
@@ -30,7 +30,7 @@ async function unlockAudioContext() {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
chunkOLISEQHS_cjs.__name(unlockAudioContext, "unlockAudioContext");
|
|
34
34
|
|
|
35
35
|
// src/tools/AudioPlayer/utils/bucketize.ts
|
|
36
36
|
function bucketize(channel2, buckets) {
|
|
@@ -56,7 +56,7 @@ function bucketize(channel2, buckets) {
|
|
|
56
56
|
}
|
|
57
57
|
return out;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
chunkOLISEQHS_cjs.__name(bucketize, "bucketize");
|
|
60
60
|
|
|
61
61
|
// src/tools/AudioPlayer/audio/decodePeaks.ts
|
|
62
62
|
var SAMPLE_RATE = 22050;
|
|
@@ -67,7 +67,7 @@ function getOfflineCtor() {
|
|
|
67
67
|
if (!Ctor) throw new Error("OfflineAudioContext is not supported");
|
|
68
68
|
return Ctor;
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
chunkOLISEQHS_cjs.__name(getOfflineCtor, "getOfflineCtor");
|
|
71
71
|
async function decodePeaks(src, buckets = DEFAULT_BUCKETS, signal) {
|
|
72
72
|
const response = await fetch(src, { signal, credentials: "same-origin" });
|
|
73
73
|
if (!response.ok) {
|
|
@@ -80,7 +80,7 @@ async function decodePeaks(src, buckets = DEFAULT_BUCKETS, signal) {
|
|
|
80
80
|
const channel2 = audio.getChannelData(0);
|
|
81
81
|
return bucketize(channel2, buckets);
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
chunkOLISEQHS_cjs.__name(decodePeaks, "decodePeaks");
|
|
84
84
|
|
|
85
85
|
// src/tools/AudioPlayer/audio/peaksCache.ts
|
|
86
86
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -101,15 +101,15 @@ async function getPeaks(src, buckets) {
|
|
|
101
101
|
inflight.delete(src);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
chunkOLISEQHS_cjs.__name(getPeaks, "getPeaks");
|
|
105
105
|
function setPeaks(src, peaks) {
|
|
106
106
|
cache.set(src, peaks);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
chunkOLISEQHS_cjs.__name(setPeaks, "setPeaks");
|
|
109
109
|
function getPeaksFromCache(src) {
|
|
110
110
|
return cache.get(src);
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
chunkOLISEQHS_cjs.__name(getPeaksFromCache, "getPeaksFromCache");
|
|
113
113
|
|
|
114
114
|
// src/tools/AudioPlayer/store/activePlayerBus.ts
|
|
115
115
|
var CHANNEL = "djangocfg-audioplayer:active";
|
|
@@ -132,7 +132,7 @@ function getChannel() {
|
|
|
132
132
|
});
|
|
133
133
|
return channel;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
chunkOLISEQHS_cjs.__name(getChannel, "getChannel");
|
|
136
136
|
function registerPlayer(id, pause) {
|
|
137
137
|
pausers.set(id, pause);
|
|
138
138
|
return () => {
|
|
@@ -140,7 +140,7 @@ function registerPlayer(id, pause) {
|
|
|
140
140
|
if (activeId === id) activeId = null;
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
chunkOLISEQHS_cjs.__name(registerPlayer, "registerPlayer");
|
|
144
144
|
function setActivePlayer(id) {
|
|
145
145
|
if (activeId === id) return;
|
|
146
146
|
activeId = id;
|
|
@@ -150,7 +150,7 @@ function setActivePlayer(id) {
|
|
|
150
150
|
for (const l of listeners) l(id);
|
|
151
151
|
getChannel()?.postMessage(id);
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
chunkOLISEQHS_cjs.__name(setActivePlayer, "setActivePlayer");
|
|
154
154
|
|
|
155
155
|
// src/tools/AudioPlayer/store/createLevelsStore.ts
|
|
156
156
|
function createLevelsStore(initial) {
|
|
@@ -177,7 +177,7 @@ function createLevelsStore(initial) {
|
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
chunkOLISEQHS_cjs.__name(createLevelsStore, "createLevelsStore");
|
|
181
181
|
|
|
182
182
|
// src/tools/AudioPlayer/store/preferencesStore.ts
|
|
183
183
|
var STORAGE_KEY = "djangocfg-audioplayer:prefs";
|
|
@@ -190,7 +190,7 @@ function clamp01(v) {
|
|
|
190
190
|
if (!Number.isFinite(v)) return DEFAULT_VOLUME;
|
|
191
191
|
return v < 0 ? 0 : v > 1 ? 1 : v;
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
chunkOLISEQHS_cjs.__name(clamp01, "clamp01");
|
|
194
194
|
function readFromStorage() {
|
|
195
195
|
if (typeof window === "undefined") {
|
|
196
196
|
return { volume: DEFAULT_VOLUME, muted: DEFAULT_MUTED };
|
|
@@ -207,7 +207,7 @@ function readFromStorage() {
|
|
|
207
207
|
return { volume: DEFAULT_VOLUME, muted: DEFAULT_MUTED };
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
chunkOLISEQHS_cjs.__name(readFromStorage, "readFromStorage");
|
|
211
211
|
function writeToStorage(prefs) {
|
|
212
212
|
if (typeof window === "undefined") return;
|
|
213
213
|
try {
|
|
@@ -215,7 +215,7 @@ function writeToStorage(prefs) {
|
|
|
215
215
|
} catch {
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
|
|
218
|
+
chunkOLISEQHS_cjs.__name(writeToStorage, "writeToStorage");
|
|
219
219
|
function bindStorage() {
|
|
220
220
|
if (storageBound || typeof window === "undefined") return;
|
|
221
221
|
storageBound = true;
|
|
@@ -225,38 +225,38 @@ function bindStorage() {
|
|
|
225
225
|
for (const cb of listeners2) cb(cached);
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
chunkOLISEQHS_cjs.__name(bindStorage, "bindStorage");
|
|
229
229
|
function getPreferences() {
|
|
230
230
|
if (!cached) cached = readFromStorage();
|
|
231
231
|
bindStorage();
|
|
232
232
|
return cached;
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
chunkOLISEQHS_cjs.__name(getPreferences, "getPreferences");
|
|
235
235
|
function update(next, persist = true) {
|
|
236
236
|
cached = next;
|
|
237
237
|
if (persist) writeToStorage(next);
|
|
238
238
|
for (const cb of listeners2) cb(next);
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
chunkOLISEQHS_cjs.__name(update, "update");
|
|
241
241
|
function setStoredVolume(volume) {
|
|
242
242
|
const current = getPreferences();
|
|
243
243
|
const v = clamp01(volume);
|
|
244
244
|
if (v === current.volume) return;
|
|
245
245
|
update({ ...current, volume: v });
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
chunkOLISEQHS_cjs.__name(setStoredVolume, "setStoredVolume");
|
|
248
248
|
function setStoredMuted(muted) {
|
|
249
249
|
const current = getPreferences();
|
|
250
250
|
if (muted === current.muted) return;
|
|
251
251
|
update({ ...current, muted });
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
chunkOLISEQHS_cjs.__name(setStoredMuted, "setStoredMuted");
|
|
254
254
|
function subscribePreferences(cb) {
|
|
255
255
|
listeners2.add(cb);
|
|
256
256
|
bindStorage();
|
|
257
257
|
return () => listeners2.delete(cb);
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
chunkOLISEQHS_cjs.__name(subscribePreferences, "subscribePreferences");
|
|
260
260
|
|
|
261
261
|
// src/tools/AudioPlayer/utils/clamp.ts
|
|
262
262
|
function clamp(value, min, max) {
|
|
@@ -264,7 +264,7 @@ function clamp(value, min, max) {
|
|
|
264
264
|
if (value > max) return max;
|
|
265
265
|
return value;
|
|
266
266
|
}
|
|
267
|
-
|
|
267
|
+
chunkOLISEQHS_cjs.__name(clamp, "clamp");
|
|
268
268
|
var AudioRefCtx = react.createContext(null);
|
|
269
269
|
AudioRefCtx.displayName = "AudioPlayerAudioRefCtx";
|
|
270
270
|
var ControlsCtx = react.createContext(null);
|
|
@@ -295,16 +295,16 @@ function readSnapshot(audio) {
|
|
|
295
295
|
errorCode: audio.error?.code ?? null
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
chunkOLISEQHS_cjs.__name(readSnapshot, "readSnapshot");
|
|
299
299
|
function snapshotsEqual(a, b) {
|
|
300
300
|
return a.paused === b.paused && a.ended === b.ended && a.duration === b.duration && a.ready === b.ready && a.errorCode === b.errorCode;
|
|
301
301
|
}
|
|
302
|
-
|
|
302
|
+
chunkOLISEQHS_cjs.__name(snapshotsEqual, "snapshotsEqual");
|
|
303
303
|
function createAudioSnapshotSource(audio) {
|
|
304
304
|
let cached2 = readSnapshot(audio);
|
|
305
305
|
return {
|
|
306
306
|
subscribe(cb) {
|
|
307
|
-
const refresh = /* @__PURE__ */
|
|
307
|
+
const refresh = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
308
308
|
const next = readSnapshot(audio);
|
|
309
309
|
if (!snapshotsEqual(cached2, next)) {
|
|
310
310
|
cached2 = next;
|
|
@@ -324,14 +324,14 @@ function createAudioSnapshotSource(audio) {
|
|
|
324
324
|
}
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
chunkOLISEQHS_cjs.__name(createAudioSnapshotSource, "createAudioSnapshotSource");
|
|
328
328
|
function errorCodeToReason(code) {
|
|
329
329
|
if (code === 2) return "network";
|
|
330
330
|
if (code === 3) return "decode";
|
|
331
331
|
if (code === 4) return "unsupported";
|
|
332
332
|
return "unknown";
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
chunkOLISEQHS_cjs.__name(errorCodeToReason, "errorCodeToReason");
|
|
335
335
|
function snapshotToState(snap, hasSrc, peaks) {
|
|
336
336
|
if (snap.errorCode !== null) {
|
|
337
337
|
return { kind: "error", reason: errorCodeToReason(snap.errorCode), duration: snap.duration };
|
|
@@ -341,19 +341,19 @@ function snapshotToState(snap, hasSrc, peaks) {
|
|
|
341
341
|
const kind = snap.ended ? "ended" : snap.paused ? "paused" : "playing";
|
|
342
342
|
return { kind, duration: snap.duration, peaks };
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
chunkOLISEQHS_cjs.__name(snapshotToState, "snapshotToState");
|
|
345
345
|
function useAudioElementState(source, hasSrc, peaks) {
|
|
346
346
|
const snap = react.useSyncExternalStore(source.subscribe, source.getSnapshot, source.getServerSnapshot);
|
|
347
347
|
return snapshotToState(snap, hasSrc, peaks);
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
chunkOLISEQHS_cjs.__name(useAudioElementState, "useAudioElementState");
|
|
350
350
|
function createAudioElement() {
|
|
351
351
|
const a = new Audio();
|
|
352
352
|
a.crossOrigin = "anonymous";
|
|
353
353
|
a.preload = "metadata";
|
|
354
354
|
return a;
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
chunkOLISEQHS_cjs.__name(createAudioElement, "createAudioElement");
|
|
357
357
|
function PlayerProvider(props) {
|
|
358
358
|
const {
|
|
359
359
|
src,
|
|
@@ -427,10 +427,10 @@ function PlayerProvider(props) {
|
|
|
427
427
|
setActivePeaks(getPeaksFromCache(src));
|
|
428
428
|
}, [src]);
|
|
429
429
|
react.useEffect(() => {
|
|
430
|
-
const handlePlay = /* @__PURE__ */
|
|
431
|
-
const handlePause = /* @__PURE__ */
|
|
432
|
-
const handleEnded = /* @__PURE__ */
|
|
433
|
-
const handleError = /* @__PURE__ */
|
|
430
|
+
const handlePlay = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => onPlay?.(), "handlePlay");
|
|
431
|
+
const handlePause = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => onPause?.(), "handlePause");
|
|
432
|
+
const handleEnded = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => onEnded?.(), "handleEnded");
|
|
433
|
+
const handleError = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
434
434
|
const code = audio.error?.code ?? null;
|
|
435
435
|
const reason = code === 2 ? "network" : code === 3 ? "decode" : code === 4 ? "unsupported" : "unknown";
|
|
436
436
|
onError?.(reason, e);
|
|
@@ -455,7 +455,7 @@ function PlayerProvider(props) {
|
|
|
455
455
|
const unregister = registerPlayer(playerId, () => {
|
|
456
456
|
audio.pause();
|
|
457
457
|
});
|
|
458
|
-
const onPlayHandler = /* @__PURE__ */
|
|
458
|
+
const onPlayHandler = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => setActivePlayer(playerId), "onPlayHandler");
|
|
459
459
|
audio.addEventListener("play", onPlayHandler);
|
|
460
460
|
return () => {
|
|
461
461
|
audio.removeEventListener("play", onPlayHandler);
|
|
@@ -473,7 +473,7 @@ function PlayerProvider(props) {
|
|
|
473
473
|
};
|
|
474
474
|
}, [audio]);
|
|
475
475
|
const controls = react.useMemo(() => {
|
|
476
|
-
const playFn = /* @__PURE__ */
|
|
476
|
+
const playFn = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(async () => {
|
|
477
477
|
if (exclusiveRef.current) setActivePlayer(playerIdRef.current);
|
|
478
478
|
try {
|
|
479
479
|
await unlockAudioContext();
|
|
@@ -486,39 +486,39 @@ function PlayerProvider(props) {
|
|
|
486
486
|
if (!isAbort) onError?.("unknown", e);
|
|
487
487
|
}
|
|
488
488
|
}, "playFn");
|
|
489
|
-
const pauseFn = /* @__PURE__ */
|
|
489
|
+
const pauseFn = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
490
490
|
audio.pause();
|
|
491
491
|
}, "pauseFn");
|
|
492
492
|
return {
|
|
493
493
|
play: playFn,
|
|
494
494
|
pause: pauseFn,
|
|
495
|
-
toggle: /* @__PURE__ */
|
|
495
|
+
toggle: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(async () => {
|
|
496
496
|
if (audio.paused || audio.ended) await playFn();
|
|
497
497
|
else pauseFn();
|
|
498
498
|
}, "toggle"),
|
|
499
|
-
seek: /* @__PURE__ */
|
|
499
|
+
seek: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((seconds) => {
|
|
500
500
|
if (!Number.isFinite(seconds)) return;
|
|
501
501
|
const dur = Number.isFinite(audio.duration) ? audio.duration : 0;
|
|
502
502
|
audio.currentTime = clamp(seconds, 0, dur || seconds);
|
|
503
503
|
}, "seek"),
|
|
504
|
-
seekTo: /* @__PURE__ */
|
|
504
|
+
seekTo: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((ratio) => {
|
|
505
505
|
const r = clamp(ratio, 0, 1);
|
|
506
506
|
const dur = Number.isFinite(audio.duration) ? audio.duration : 0;
|
|
507
507
|
if (dur > 0) audio.currentTime = r * dur;
|
|
508
508
|
}, "seekTo"),
|
|
509
|
-
setVolume: /* @__PURE__ */
|
|
509
|
+
setVolume: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((v) => {
|
|
510
510
|
const next = clamp(v, 0, 1);
|
|
511
511
|
audio.volume = next;
|
|
512
512
|
if (next > 0 && audio.muted) audio.muted = false;
|
|
513
513
|
if (!volumeIsControlled) setStoredVolume(next);
|
|
514
514
|
if (!mutedIsControlled && next > 0) setStoredMuted(false);
|
|
515
515
|
}, "setVolume"),
|
|
516
|
-
toggleMute: /* @__PURE__ */
|
|
516
|
+
toggleMute: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
517
517
|
const next = !audio.muted;
|
|
518
518
|
audio.muted = next;
|
|
519
519
|
if (!mutedIsControlled) setStoredMuted(next);
|
|
520
520
|
}, "toggleMute"),
|
|
521
|
-
toggleLoop: /* @__PURE__ */
|
|
521
|
+
toggleLoop: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
522
522
|
audio.loop = !audio.loop;
|
|
523
523
|
}, "toggleLoop")
|
|
524
524
|
};
|
|
@@ -542,7 +542,7 @@ function PlayerProvider(props) {
|
|
|
542
542
|
);
|
|
543
543
|
return /* @__PURE__ */ jsxRuntime.jsx(AudioRefCtx.Provider, { value: audio, children: /* @__PURE__ */ jsxRuntime.jsx(MetaCtx.Provider, { value: meta, children: /* @__PURE__ */ jsxRuntime.jsx(StateCtx.Provider, { value: state, children: /* @__PURE__ */ jsxRuntime.jsx(ControlsCtx.Provider, { value: controls, children: /* @__PURE__ */ jsxRuntime.jsx(LevelsCtx.Provider, { value: levelsStore, children }) }) }) }) });
|
|
544
544
|
}
|
|
545
|
-
|
|
545
|
+
chunkOLISEQHS_cjs.__name(PlayerProvider, "PlayerProvider");
|
|
546
546
|
function useCtxOrThrow(ctx, name) {
|
|
547
547
|
const value = react.useContext(ctx);
|
|
548
548
|
if (value === null) {
|
|
@@ -550,17 +550,17 @@ function useCtxOrThrow(ctx, name) {
|
|
|
550
550
|
}
|
|
551
551
|
return value;
|
|
552
552
|
}
|
|
553
|
-
|
|
554
|
-
var usePlayerState = /* @__PURE__ */
|
|
555
|
-
var usePlayerControls = /* @__PURE__ */
|
|
556
|
-
var usePlayerLevels = /* @__PURE__ */
|
|
557
|
-
var usePlayerMeta = /* @__PURE__ */
|
|
558
|
-
var usePlayerAudio = /* @__PURE__ */
|
|
559
|
-
var usePlayerPaused = /* @__PURE__ */
|
|
553
|
+
chunkOLISEQHS_cjs.__name(useCtxOrThrow, "useCtxOrThrow");
|
|
554
|
+
var usePlayerState = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => useCtxOrThrow(StateCtx, "usePlayerState"), "usePlayerState");
|
|
555
|
+
var usePlayerControls = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => useCtxOrThrow(ControlsCtx, "usePlayerControls"), "usePlayerControls");
|
|
556
|
+
var usePlayerLevels = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => useCtxOrThrow(LevelsCtx, "usePlayerLevels"), "usePlayerLevels");
|
|
557
|
+
var usePlayerMeta = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => useCtxOrThrow(MetaCtx, "usePlayerMeta"), "usePlayerMeta");
|
|
558
|
+
var usePlayerAudio = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => useCtxOrThrow(AudioRefCtx, "usePlayerAudio"), "usePlayerAudio");
|
|
559
|
+
var usePlayerPaused = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
560
560
|
const s = usePlayerState();
|
|
561
561
|
return s.kind !== "playing";
|
|
562
562
|
}, "usePlayerPaused");
|
|
563
|
-
var usePlayerDuration = /* @__PURE__ */
|
|
563
|
+
var usePlayerDuration = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
564
564
|
const s = usePlayerState();
|
|
565
565
|
return "duration" in s ? s.duration : 0;
|
|
566
566
|
}, "usePlayerDuration");
|
|
@@ -580,7 +580,7 @@ function useElementWidth(el) {
|
|
|
580
580
|
}, [el]);
|
|
581
581
|
return w;
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
chunkOLISEQHS_cjs.__name(useElementWidth, "useElementWidth");
|
|
584
584
|
var OPTS = { preventDefault: true };
|
|
585
585
|
var BINDINGS = [
|
|
586
586
|
{ label: "Play / pause", hint: "Space" },
|
|
@@ -645,7 +645,7 @@ function useKeyboardShortcuts({
|
|
|
645
645
|
);
|
|
646
646
|
return { ref, bindings: BINDINGS };
|
|
647
647
|
}
|
|
648
|
-
|
|
648
|
+
chunkOLISEQHS_cjs.__name(useKeyboardShortcuts, "useKeyboardShortcuts");
|
|
649
649
|
var ACTIONS = [
|
|
650
650
|
"play",
|
|
651
651
|
"pause",
|
|
@@ -668,17 +668,17 @@ function useMediaSession(audio, meta, controls, onPrev, onNext) {
|
|
|
668
668
|
} catch {
|
|
669
669
|
}
|
|
670
670
|
const handlers = {
|
|
671
|
-
play: /* @__PURE__ */
|
|
671
|
+
play: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
672
672
|
void controls.play();
|
|
673
673
|
}, "play"),
|
|
674
|
-
pause: /* @__PURE__ */
|
|
674
|
+
pause: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => controls.pause(), "pause"),
|
|
675
675
|
previoustrack: onPrev ?? null,
|
|
676
676
|
nexttrack: onNext ?? null,
|
|
677
|
-
seekbackward: /* @__PURE__ */
|
|
677
|
+
seekbackward: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((details) => {
|
|
678
678
|
const offset = details.seekOffset ?? 10;
|
|
679
679
|
controls.seek(audio.currentTime - offset);
|
|
680
680
|
}, "seekbackward"),
|
|
681
|
-
seekforward: /* @__PURE__ */
|
|
681
|
+
seekforward: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((details) => {
|
|
682
682
|
const offset = details.seekOffset ?? 10;
|
|
683
683
|
controls.seek(audio.currentTime + offset);
|
|
684
684
|
}, "seekforward")
|
|
@@ -699,7 +699,7 @@ function useMediaSession(audio, meta, controls, onPrev, onNext) {
|
|
|
699
699
|
};
|
|
700
700
|
}, [audio, controls, meta.title, meta.artist, meta.album, meta.cover, onPrev, onNext]);
|
|
701
701
|
}
|
|
702
|
-
|
|
702
|
+
chunkOLISEQHS_cjs.__name(useMediaSession, "useMediaSession");
|
|
703
703
|
function PlayButton({ size = "default" }) {
|
|
704
704
|
const state = usePlayerState();
|
|
705
705
|
const { toggle, play } = usePlayerControls();
|
|
@@ -707,7 +707,7 @@ function PlayButton({ size = "default" }) {
|
|
|
707
707
|
const icon = size === "compact" ? 14 : 16;
|
|
708
708
|
let label = "Play";
|
|
709
709
|
let Icon = lucideReact.Play;
|
|
710
|
-
let onClick = /* @__PURE__ */
|
|
710
|
+
let onClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void toggle(), "onClick");
|
|
711
711
|
let disabled = false;
|
|
712
712
|
switch (state.kind) {
|
|
713
713
|
case "idle":
|
|
@@ -731,12 +731,12 @@ function PlayButton({ size = "default" }) {
|
|
|
731
731
|
case "ended":
|
|
732
732
|
Icon = lucideReact.RotateCcw;
|
|
733
733
|
label = "Replay";
|
|
734
|
-
onClick = /* @__PURE__ */
|
|
734
|
+
onClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void play(), "onClick");
|
|
735
735
|
break;
|
|
736
736
|
case "error":
|
|
737
737
|
Icon = lucideReact.Play;
|
|
738
738
|
label = "Retry";
|
|
739
|
-
onClick = /* @__PURE__ */
|
|
739
|
+
onClick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void play(), "onClick");
|
|
740
740
|
break;
|
|
741
741
|
}
|
|
742
742
|
const button = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -766,7 +766,7 @@ function PlayButton({ size = "default" }) {
|
|
|
766
766
|
] }) })
|
|
767
767
|
] });
|
|
768
768
|
}
|
|
769
|
-
|
|
769
|
+
chunkOLISEQHS_cjs.__name(PlayButton, "PlayButton");
|
|
770
770
|
function IconButton({
|
|
771
771
|
label,
|
|
772
772
|
shortcut,
|
|
@@ -797,14 +797,14 @@ function IconButton({
|
|
|
797
797
|
] }) })
|
|
798
798
|
] });
|
|
799
799
|
}
|
|
800
|
-
|
|
800
|
+
chunkOLISEQHS_cjs.__name(IconButton, "IconButton");
|
|
801
801
|
function SkipButton({ direction, onClick }) {
|
|
802
802
|
if (!onClick) return null;
|
|
803
803
|
const Icon = direction === "prev" ? lucideReact.SkipBack : lucideReact.SkipForward;
|
|
804
804
|
const label = direction === "prev" ? "Previous track" : "Next track";
|
|
805
805
|
return /* @__PURE__ */ jsxRuntime.jsx(IconButton, { label, shortcut: direction === "prev" ? "\u2190" : "\u2192", onClick, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 16, strokeWidth: 1.75 }) });
|
|
806
806
|
}
|
|
807
|
-
|
|
807
|
+
chunkOLISEQHS_cjs.__name(SkipButton, "SkipButton");
|
|
808
808
|
function LoopButton() {
|
|
809
809
|
const audio = usePlayerAudio();
|
|
810
810
|
const { toggleLoop } = usePlayerControls();
|
|
@@ -826,7 +826,7 @@ function LoopButton() {
|
|
|
826
826
|
}
|
|
827
827
|
);
|
|
828
828
|
}
|
|
829
|
-
|
|
829
|
+
chunkOLISEQHS_cjs.__name(LoopButton, "LoopButton");
|
|
830
830
|
var CLOSE_DELAY_MS = 120;
|
|
831
831
|
function isIosSafari() {
|
|
832
832
|
if (typeof navigator === "undefined") return false;
|
|
@@ -834,7 +834,7 @@ function isIosSafari() {
|
|
|
834
834
|
const iOS = /iPad|iPhone|iPod/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
835
835
|
return iOS;
|
|
836
836
|
}
|
|
837
|
-
|
|
837
|
+
chunkOLISEQHS_cjs.__name(isIosSafari, "isIosSafari");
|
|
838
838
|
var HIDE_VOLUME = isIosSafari();
|
|
839
839
|
function VolumeControl() {
|
|
840
840
|
const audio = usePlayerAudio();
|
|
@@ -845,7 +845,7 @@ function VolumeControl() {
|
|
|
845
845
|
const closeTimer = react.useRef(null);
|
|
846
846
|
const isTouch = hooks.useMediaQuery("(hover: none), (pointer: coarse)");
|
|
847
847
|
react.useEffect(() => {
|
|
848
|
-
const sync = /* @__PURE__ */
|
|
848
|
+
const sync = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
849
849
|
setVol(audio.volume);
|
|
850
850
|
setMuted(audio.muted);
|
|
851
851
|
}, "sync");
|
|
@@ -860,7 +860,7 @@ function VolumeControl() {
|
|
|
860
860
|
const containerRef = react.useRef(null);
|
|
861
861
|
react.useEffect(() => {
|
|
862
862
|
if (!isOpen || !isTouch) return;
|
|
863
|
-
const onDown = /* @__PURE__ */
|
|
863
|
+
const onDown = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
864
864
|
if (!containerRef.current) return;
|
|
865
865
|
if (!containerRef.current.contains(e.target)) setOpen(false);
|
|
866
866
|
}, "onDown");
|
|
@@ -882,17 +882,17 @@ function VolumeControl() {
|
|
|
882
882
|
}
|
|
883
883
|
);
|
|
884
884
|
}
|
|
885
|
-
const cancelClose = /* @__PURE__ */
|
|
885
|
+
const cancelClose = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
886
886
|
if (closeTimer.current) {
|
|
887
887
|
clearTimeout(closeTimer.current);
|
|
888
888
|
closeTimer.current = null;
|
|
889
889
|
}
|
|
890
890
|
}, "cancelClose");
|
|
891
|
-
const scheduleClose = /* @__PURE__ */
|
|
891
|
+
const scheduleClose = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
892
892
|
cancelClose();
|
|
893
893
|
closeTimer.current = setTimeout(() => setOpen(false), CLOSE_DELAY_MS);
|
|
894
894
|
}, "scheduleClose");
|
|
895
|
-
const open = /* @__PURE__ */
|
|
895
|
+
const open = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
896
896
|
cancelClose();
|
|
897
897
|
setOpen(true);
|
|
898
898
|
}, "open");
|
|
@@ -901,7 +901,7 @@ function VolumeControl() {
|
|
|
901
901
|
onPointerEnter: open,
|
|
902
902
|
onPointerLeave: scheduleClose,
|
|
903
903
|
onFocusCapture: open,
|
|
904
|
-
onBlurCapture: /* @__PURE__ */
|
|
904
|
+
onBlurCapture: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
905
905
|
if (!e.currentTarget.contains(e.relatedTarget)) scheduleClose();
|
|
906
906
|
}, "onBlurCapture")
|
|
907
907
|
};
|
|
@@ -968,7 +968,7 @@ function VolumeControl() {
|
|
|
968
968
|
)
|
|
969
969
|
] });
|
|
970
970
|
}
|
|
971
|
-
|
|
971
|
+
chunkOLISEQHS_cjs.__name(VolumeControl, "VolumeControl");
|
|
972
972
|
|
|
973
973
|
// src/tools/AudioPlayer/utils/formatTime.ts
|
|
974
974
|
function formatTime(seconds) {
|
|
@@ -984,7 +984,7 @@ function formatTime(seconds) {
|
|
|
984
984
|
}
|
|
985
985
|
return `${m}:${ss}`;
|
|
986
986
|
}
|
|
987
|
-
|
|
987
|
+
chunkOLISEQHS_cjs.__name(formatTime, "formatTime");
|
|
988
988
|
var READ_INTERVAL_MS = 200;
|
|
989
989
|
function TimeDisplay() {
|
|
990
990
|
const audio = usePlayerAudio();
|
|
@@ -996,14 +996,14 @@ function TimeDisplay() {
|
|
|
996
996
|
let raf = 0;
|
|
997
997
|
let last = -1;
|
|
998
998
|
let timer = null;
|
|
999
|
-
const write = /* @__PURE__ */
|
|
999
|
+
const write = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1000
1000
|
const t = audio.currentTime;
|
|
1001
1001
|
if (Math.abs(t - last) < 0.5) return;
|
|
1002
1002
|
last = t;
|
|
1003
1003
|
el.textContent = formatTime(t);
|
|
1004
1004
|
}, "write");
|
|
1005
1005
|
write();
|
|
1006
|
-
const onSeek = /* @__PURE__ */
|
|
1006
|
+
const onSeek = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => write(), "onSeek");
|
|
1007
1007
|
audio.addEventListener("seeked", onSeek);
|
|
1008
1008
|
audio.addEventListener("timeupdate", onSeek);
|
|
1009
1009
|
timer = setInterval(() => {
|
|
@@ -1022,7 +1022,7 @@ function TimeDisplay() {
|
|
|
1022
1022
|
formatTime(duration)
|
|
1023
1023
|
] });
|
|
1024
1024
|
}
|
|
1025
|
-
|
|
1025
|
+
chunkOLISEQHS_cjs.__name(TimeDisplay, "TimeDisplay");
|
|
1026
1026
|
function ControlsRow({ onPrev, onNext, showTime = false }) {
|
|
1027
1027
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
1028
1028
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -1037,7 +1037,7 @@ function ControlsRow({ onPrev, onNext, showTime = false }) {
|
|
|
1037
1037
|
] })
|
|
1038
1038
|
] });
|
|
1039
1039
|
}
|
|
1040
|
-
|
|
1040
|
+
chunkOLISEQHS_cjs.__name(ControlsRow, "ControlsRow");
|
|
1041
1041
|
function CoverPlaceholder({ size }) {
|
|
1042
1042
|
const inset = Math.max(4, Math.round(size * 0.14));
|
|
1043
1043
|
const iconSize = Math.round(size * 0.4);
|
|
@@ -1067,7 +1067,7 @@ function CoverPlaceholder({ size }) {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
);
|
|
1069
1069
|
}
|
|
1070
|
-
|
|
1070
|
+
chunkOLISEQHS_cjs.__name(CoverPlaceholder, "CoverPlaceholder");
|
|
1071
1071
|
function Cover({ src, alt, size }) {
|
|
1072
1072
|
const [errored, setErrored] = react.useState(false);
|
|
1073
1073
|
if (!src || errored) return /* @__PURE__ */ jsxRuntime.jsx(CoverPlaceholder, { size });
|
|
@@ -1086,7 +1086,7 @@ function Cover({ src, alt, size }) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
);
|
|
1088
1088
|
}
|
|
1089
|
-
|
|
1089
|
+
chunkOLISEQHS_cjs.__name(Cover, "Cover");
|
|
1090
1090
|
var VAR = "--audioplayer-pulse";
|
|
1091
1091
|
var MAX_SCALE = 0.03;
|
|
1092
1092
|
var SMOOTH = 0.18;
|
|
@@ -1106,7 +1106,7 @@ function ReactivePulse({ enabled, children }) {
|
|
|
1106
1106
|
}
|
|
1107
1107
|
let raf = 0;
|
|
1108
1108
|
let env = 0;
|
|
1109
|
-
const tick = /* @__PURE__ */
|
|
1109
|
+
const tick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1110
1110
|
const buf = store.getCurrent();
|
|
1111
1111
|
let energy = 0;
|
|
1112
1112
|
const usable = Math.min(buf.length, 32);
|
|
@@ -1136,7 +1136,7 @@ function ReactivePulse({ enabled, children }) {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
);
|
|
1138
1138
|
}
|
|
1139
|
-
|
|
1139
|
+
chunkOLISEQHS_cjs.__name(ReactivePulse, "ReactivePulse");
|
|
1140
1140
|
var REASONS = {
|
|
1141
1141
|
network: "Network error while loading audio.",
|
|
1142
1142
|
decode: "We can't decode this audio.",
|
|
@@ -1172,20 +1172,20 @@ function ErrorState() {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
);
|
|
1174
1174
|
}
|
|
1175
|
-
|
|
1175
|
+
chunkOLISEQHS_cjs.__name(ErrorState, "ErrorState");
|
|
1176
1176
|
function Title() {
|
|
1177
1177
|
const { title } = usePlayerMeta();
|
|
1178
1178
|
if (!title) return null;
|
|
1179
1179
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-sm font-medium text-foreground", title, children: title });
|
|
1180
1180
|
}
|
|
1181
|
-
|
|
1181
|
+
chunkOLISEQHS_cjs.__name(Title, "Title");
|
|
1182
1182
|
function Artist() {
|
|
1183
1183
|
const { artist, album } = usePlayerMeta();
|
|
1184
1184
|
if (!artist && !album) return null;
|
|
1185
1185
|
const text = [artist, album].filter(Boolean).join(" \xB7 ");
|
|
1186
1186
|
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-muted-foreground", title: text, children: text });
|
|
1187
1187
|
}
|
|
1188
|
-
|
|
1188
|
+
chunkOLISEQHS_cjs.__name(Artist, "Artist");
|
|
1189
1189
|
function usePeaks(opts) {
|
|
1190
1190
|
const { src, enabled = true, triggerRef, decodeOnMount = false } = opts;
|
|
1191
1191
|
const cached2 = getPeaksFromCache(src) ?? null;
|
|
@@ -1204,7 +1204,7 @@ function usePeaks(opts) {
|
|
|
1204
1204
|
setLoading(true);
|
|
1205
1205
|
let cancelled = false;
|
|
1206
1206
|
let started = false;
|
|
1207
|
-
const startDecode = /* @__PURE__ */
|
|
1207
|
+
const startDecode = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1208
1208
|
if (started) return;
|
|
1209
1209
|
started = true;
|
|
1210
1210
|
getPeaks(src).then((p) => {
|
|
@@ -1243,7 +1243,7 @@ function usePeaks(opts) {
|
|
|
1243
1243
|
}, [src, enabled, decodeOnMount, triggerRef]);
|
|
1244
1244
|
return { peaks, loading, error };
|
|
1245
1245
|
}
|
|
1246
|
-
|
|
1246
|
+
chunkOLISEQHS_cjs.__name(usePeaks, "usePeaks");
|
|
1247
1247
|
var BAR_COUNT = 28;
|
|
1248
1248
|
function BarsWaveform({ height, barWidth, barGap, bars = BAR_COUNT }) {
|
|
1249
1249
|
const paused = usePlayerPaused();
|
|
@@ -1276,7 +1276,7 @@ function BarsWaveform({ height, barWidth, barGap, bars = BAR_COUNT }) {
|
|
|
1276
1276
|
}
|
|
1277
1277
|
);
|
|
1278
1278
|
}
|
|
1279
|
-
|
|
1279
|
+
chunkOLISEQHS_cjs.__name(BarsWaveform, "BarsWaveform");
|
|
1280
1280
|
|
|
1281
1281
|
// src/tools/AudioPlayer/audio/mediaElementSourceCache.ts
|
|
1282
1282
|
var cache2 = /* @__PURE__ */ new WeakMap();
|
|
@@ -1289,7 +1289,7 @@ function getMediaElementSource(el) {
|
|
|
1289
1289
|
cache2.set(el, node);
|
|
1290
1290
|
return node;
|
|
1291
1291
|
}
|
|
1292
|
-
|
|
1292
|
+
chunkOLISEQHS_cjs.__name(getMediaElementSource, "getMediaElementSource");
|
|
1293
1293
|
|
|
1294
1294
|
// src/tools/AudioPlayer/hooks/useAnalyser.ts
|
|
1295
1295
|
var FFT_SIZE = 1024;
|
|
@@ -1313,7 +1313,7 @@ function useAnalyser(audio, store, enabled) {
|
|
|
1313
1313
|
buffer = new Uint8Array(analyser.frequencyBinCount);
|
|
1314
1314
|
normalized = new Float32Array(analyser.frequencyBinCount);
|
|
1315
1315
|
store.setActive(true);
|
|
1316
|
-
const tick = /* @__PURE__ */
|
|
1316
|
+
const tick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1317
1317
|
if (cancelled || !analyser) return;
|
|
1318
1318
|
if (typeof document !== "undefined" && document.hidden) return;
|
|
1319
1319
|
analyser.getByteFrequencyData(buffer);
|
|
@@ -1337,7 +1337,7 @@ function useAnalyser(audio, store, enabled) {
|
|
|
1337
1337
|
};
|
|
1338
1338
|
}, [audio, store, enabled]);
|
|
1339
1339
|
}
|
|
1340
|
-
|
|
1340
|
+
chunkOLISEQHS_cjs.__name(useAnalyser, "useAnalyser");
|
|
1341
1341
|
|
|
1342
1342
|
// src/tools/AudioPlayer/parts/Waveform/waveformInteraction.ts
|
|
1343
1343
|
var HOVER_X = "--hp";
|
|
@@ -1347,28 +1347,28 @@ function attachSeek(container, audio, options = {}) {
|
|
|
1347
1347
|
let dragging = false;
|
|
1348
1348
|
let movedDuringDrag = false;
|
|
1349
1349
|
const { startsPlayback = true, onPlayRequest } = options;
|
|
1350
|
-
const ratioFor = /* @__PURE__ */
|
|
1350
|
+
const ratioFor = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((clientX) => {
|
|
1351
1351
|
const rect = container.getBoundingClientRect();
|
|
1352
1352
|
if (rect.width === 0) return 0;
|
|
1353
1353
|
return Math.max(0, Math.min(1, (clientX - rect.left) / rect.width));
|
|
1354
1354
|
}, "ratioFor");
|
|
1355
|
-
const seekTo = /* @__PURE__ */
|
|
1355
|
+
const seekTo = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((clientX) => {
|
|
1356
1356
|
const dur = Number.isFinite(audio.duration) ? audio.duration : 0;
|
|
1357
1357
|
if (dur > 0) audio.currentTime = ratioFor(clientX) * dur;
|
|
1358
1358
|
}, "seekTo");
|
|
1359
|
-
const onPointerDown = /* @__PURE__ */
|
|
1359
|
+
const onPointerDown = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
1360
1360
|
if (e.button !== 0 && e.pointerType === "mouse") return;
|
|
1361
1361
|
dragging = true;
|
|
1362
1362
|
movedDuringDrag = false;
|
|
1363
1363
|
container.setPointerCapture?.(e.pointerId);
|
|
1364
1364
|
seekTo(e.clientX);
|
|
1365
1365
|
}, "onPointerDown");
|
|
1366
|
-
const onPointerMove = /* @__PURE__ */
|
|
1366
|
+
const onPointerMove = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
1367
1367
|
if (!dragging) return;
|
|
1368
1368
|
movedDuringDrag = true;
|
|
1369
1369
|
seekTo(e.clientX);
|
|
1370
1370
|
}, "onPointerMove");
|
|
1371
|
-
const onPointerEnd = /* @__PURE__ */
|
|
1371
|
+
const onPointerEnd = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
1372
1372
|
if (!dragging) return;
|
|
1373
1373
|
const wasDrag = movedDuringDrag;
|
|
1374
1374
|
dragging = false;
|
|
@@ -1392,10 +1392,10 @@ function attachSeek(container, audio, options = {}) {
|
|
|
1392
1392
|
container.removeEventListener("pointercancel", onPointerEnd);
|
|
1393
1393
|
};
|
|
1394
1394
|
}
|
|
1395
|
-
|
|
1395
|
+
chunkOLISEQHS_cjs.__name(attachSeek, "attachSeek");
|
|
1396
1396
|
function attachHover(container, audio) {
|
|
1397
1397
|
const tooltip = container.querySelector("[data-audioplayer-time-tip]");
|
|
1398
|
-
const onMove = /* @__PURE__ */
|
|
1398
|
+
const onMove = /* @__PURE__ */ chunkOLISEQHS_cjs.__name((e) => {
|
|
1399
1399
|
const rect = container.getBoundingClientRect();
|
|
1400
1400
|
if (rect.width === 0) return;
|
|
1401
1401
|
const x = Math.max(0, Math.min(rect.width, e.clientX - rect.left));
|
|
@@ -1408,7 +1408,7 @@ function attachHover(container, audio) {
|
|
|
1408
1408
|
tooltip.style.setProperty(TOOLTIP_LABEL, "1");
|
|
1409
1409
|
}
|
|
1410
1410
|
}, "onMove");
|
|
1411
|
-
const onLeave = /* @__PURE__ */
|
|
1411
|
+
const onLeave = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1412
1412
|
container.style.setProperty(HOVER_OPACITY, "0");
|
|
1413
1413
|
if (tooltip) tooltip.style.setProperty(TOOLTIP_LABEL, "0");
|
|
1414
1414
|
}, "onLeave");
|
|
@@ -1419,7 +1419,7 @@ function attachHover(container, audio) {
|
|
|
1419
1419
|
container.removeEventListener("pointerleave", onLeave);
|
|
1420
1420
|
};
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1422
|
+
chunkOLISEQHS_cjs.__name(attachHover, "attachHover");
|
|
1423
1423
|
|
|
1424
1424
|
// src/tools/AudioPlayer/utils/dpr.ts
|
|
1425
1425
|
var MAX_DPR = 2;
|
|
@@ -1429,15 +1429,15 @@ function getDpr() {
|
|
|
1429
1429
|
const dpr = window.devicePixelRatio ?? 1;
|
|
1430
1430
|
return Math.min(Math.max(dpr, 1), MAX_DPR);
|
|
1431
1431
|
}
|
|
1432
|
-
|
|
1432
|
+
chunkOLISEQHS_cjs.__name(getDpr, "getDpr");
|
|
1433
1433
|
function backingWidth(cssWidth, dpr = getDpr()) {
|
|
1434
1434
|
return Math.min(Math.round(cssWidth * dpr), MAX_BACKING_WIDTH);
|
|
1435
1435
|
}
|
|
1436
|
-
|
|
1436
|
+
chunkOLISEQHS_cjs.__name(backingWidth, "backingWidth");
|
|
1437
1437
|
function backingHeight(cssHeight, dpr = getDpr()) {
|
|
1438
1438
|
return Math.round(cssHeight * dpr);
|
|
1439
1439
|
}
|
|
1440
|
-
|
|
1440
|
+
chunkOLISEQHS_cjs.__name(backingHeight, "backingHeight");
|
|
1441
1441
|
|
|
1442
1442
|
// src/tools/AudioPlayer/parts/Waveform/waveformRenderer.ts
|
|
1443
1443
|
function resizeCanvas(canvas) {
|
|
@@ -1454,7 +1454,7 @@ function resizeCanvas(canvas) {
|
|
|
1454
1454
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
1455
1455
|
return { ctx, cssW, cssH };
|
|
1456
1456
|
}
|
|
1457
|
-
|
|
1457
|
+
chunkOLISEQHS_cjs.__name(resizeCanvas, "resizeCanvas");
|
|
1458
1458
|
function paintPeaks(canvas, peaks, opts) {
|
|
1459
1459
|
const sized = resizeCanvas(canvas);
|
|
1460
1460
|
if (!sized) return;
|
|
@@ -1478,7 +1478,7 @@ function paintPeaks(canvas, peaks, opts) {
|
|
|
1478
1478
|
ctx.fillRect(x, mid - h / 2, opts.barWidth, h);
|
|
1479
1479
|
}
|
|
1480
1480
|
}
|
|
1481
|
-
|
|
1481
|
+
chunkOLISEQHS_cjs.__name(paintPeaks, "paintPeaks");
|
|
1482
1482
|
function paintLive(canvas, levels, opts) {
|
|
1483
1483
|
const sized = resizeCanvas(canvas);
|
|
1484
1484
|
if (!sized) return;
|
|
@@ -1498,7 +1498,7 @@ function paintLive(canvas, levels, opts) {
|
|
|
1498
1498
|
ctx.fillRect(i * step, mid - h / 2, opts.barWidth, h);
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
|
|
1501
|
+
chunkOLISEQHS_cjs.__name(paintLive, "paintLive");
|
|
1502
1502
|
function LiveWaveform({ height, barWidth, barGap, seekStartsPlayback }) {
|
|
1503
1503
|
const audio = usePlayerAudio();
|
|
1504
1504
|
const controls = usePlayerControls();
|
|
@@ -1515,7 +1515,7 @@ function LiveWaveform({ height, barWidth, barGap, seekStartsPlayback }) {
|
|
|
1515
1515
|
const canvas = canvasRef.current;
|
|
1516
1516
|
if (!canvas) return;
|
|
1517
1517
|
let raf = 0;
|
|
1518
|
-
const tick = /* @__PURE__ */
|
|
1518
|
+
const tick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1519
1519
|
if (typeof document !== "undefined" && document.hidden) {
|
|
1520
1520
|
raf = requestAnimationFrame(tick);
|
|
1521
1521
|
return;
|
|
@@ -1535,7 +1535,7 @@ function LiveWaveform({ height, barWidth, barGap, seekStartsPlayback }) {
|
|
|
1535
1535
|
if (!container) return;
|
|
1536
1536
|
const detachSeek = attachSeek(container, audio, {
|
|
1537
1537
|
startsPlayback: seekStartsPlayback,
|
|
1538
|
-
onPlayRequest: /* @__PURE__ */
|
|
1538
|
+
onPlayRequest: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void controls.play(), "onPlayRequest")
|
|
1539
1539
|
});
|
|
1540
1540
|
const detachHover = attachHover(container, audio);
|
|
1541
1541
|
return () => {
|
|
@@ -1580,14 +1580,14 @@ function LiveWaveform({ height, barWidth, barGap, seekStartsPlayback }) {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
);
|
|
1582
1582
|
}
|
|
1583
|
-
|
|
1583
|
+
chunkOLISEQHS_cjs.__name(LiveWaveform, "LiveWaveform");
|
|
1584
1584
|
var VAR2 = "--p";
|
|
1585
1585
|
function usePlayheadLoop(audio, el, enabled = true) {
|
|
1586
1586
|
react.useEffect(() => {
|
|
1587
1587
|
if (!enabled || !el) return;
|
|
1588
1588
|
let raf = 0;
|
|
1589
1589
|
let lastPct = -1;
|
|
1590
|
-
const writePct = /* @__PURE__ */
|
|
1590
|
+
const writePct = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1591
1591
|
const dur = audio.duration;
|
|
1592
1592
|
if (!Number.isFinite(dur) || dur <= 0) return;
|
|
1593
1593
|
const pct = Math.max(0, Math.min(100, audio.currentTime / dur * 100));
|
|
@@ -1595,7 +1595,7 @@ function usePlayheadLoop(audio, el, enabled = true) {
|
|
|
1595
1595
|
lastPct = pct;
|
|
1596
1596
|
el.style.setProperty(VAR2, `${pct.toFixed(2)}%`);
|
|
1597
1597
|
}, "writePct");
|
|
1598
|
-
const tick = /* @__PURE__ */
|
|
1598
|
+
const tick = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1599
1599
|
if (typeof document !== "undefined" && document.hidden) {
|
|
1600
1600
|
raf = 0;
|
|
1601
1601
|
return;
|
|
@@ -1603,21 +1603,21 @@ function usePlayheadLoop(audio, el, enabled = true) {
|
|
|
1603
1603
|
writePct();
|
|
1604
1604
|
raf = requestAnimationFrame(tick);
|
|
1605
1605
|
}, "tick");
|
|
1606
|
-
const start = /* @__PURE__ */
|
|
1606
|
+
const start = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1607
1607
|
if (raf) return;
|
|
1608
1608
|
raf = requestAnimationFrame(tick);
|
|
1609
1609
|
}, "start");
|
|
1610
|
-
const stop = /* @__PURE__ */
|
|
1610
|
+
const stop = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1611
1611
|
if (!raf) return;
|
|
1612
1612
|
cancelAnimationFrame(raf);
|
|
1613
1613
|
raf = 0;
|
|
1614
1614
|
writePct();
|
|
1615
1615
|
}, "stop");
|
|
1616
1616
|
if (!audio.paused) start();
|
|
1617
|
-
const onPlay = /* @__PURE__ */
|
|
1618
|
-
const onPauseOrEnd = /* @__PURE__ */
|
|
1619
|
-
const onSeek = /* @__PURE__ */
|
|
1620
|
-
const onVisibility = /* @__PURE__ */
|
|
1617
|
+
const onPlay = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => start(), "onPlay");
|
|
1618
|
+
const onPauseOrEnd = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => stop(), "onPauseOrEnd");
|
|
1619
|
+
const onSeek = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => writePct(), "onSeek");
|
|
1620
|
+
const onVisibility = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => {
|
|
1621
1621
|
if (document.hidden) stop();
|
|
1622
1622
|
else if (!audio.paused) start();
|
|
1623
1623
|
}, "onVisibility");
|
|
@@ -1638,14 +1638,14 @@ function usePlayheadLoop(audio, el, enabled = true) {
|
|
|
1638
1638
|
};
|
|
1639
1639
|
}, [audio, el, enabled]);
|
|
1640
1640
|
}
|
|
1641
|
-
|
|
1641
|
+
chunkOLISEQHS_cjs.__name(usePlayheadLoop, "usePlayheadLoop");
|
|
1642
1642
|
function useThemeWatcher(cb) {
|
|
1643
1643
|
react.useEffect(() => {
|
|
1644
1644
|
const root = document.documentElement;
|
|
1645
1645
|
const obs = new MutationObserver(cb);
|
|
1646
1646
|
obs.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
|
|
1647
1647
|
const mq = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
1648
|
-
const onMq = /* @__PURE__ */
|
|
1648
|
+
const onMq = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => cb(), "onMq");
|
|
1649
1649
|
mq?.addEventListener?.("change", onMq);
|
|
1650
1650
|
return () => {
|
|
1651
1651
|
obs.disconnect();
|
|
@@ -1653,7 +1653,7 @@ function useThemeWatcher(cb) {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
}, [cb]);
|
|
1655
1655
|
}
|
|
1656
|
-
|
|
1656
|
+
chunkOLISEQHS_cjs.__name(useThemeWatcher, "useThemeWatcher");
|
|
1657
1657
|
function PeaksWaveform({ peaks, height, barWidth, barGap, seekStartsPlayback }) {
|
|
1658
1658
|
const audio = usePlayerAudio();
|
|
1659
1659
|
const controls = usePlayerControls();
|
|
@@ -1677,7 +1677,7 @@ function PeaksWaveform({ peaks, height, barWidth, barGap, seekStartsPlayback })
|
|
|
1677
1677
|
if (!container) return;
|
|
1678
1678
|
const detachSeek = attachSeek(container, audio, {
|
|
1679
1679
|
startsPlayback: seekStartsPlayback,
|
|
1680
|
-
onPlayRequest: /* @__PURE__ */
|
|
1680
|
+
onPlayRequest: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void controls.play(), "onPlayRequest")
|
|
1681
1681
|
});
|
|
1682
1682
|
const detachHover = attachHover(container, audio);
|
|
1683
1683
|
return () => {
|
|
@@ -1741,7 +1741,7 @@ function PeaksWaveform({ peaks, height, barWidth, barGap, seekStartsPlayback })
|
|
|
1741
1741
|
}
|
|
1742
1742
|
);
|
|
1743
1743
|
}
|
|
1744
|
-
|
|
1744
|
+
chunkOLISEQHS_cjs.__name(PeaksWaveform, "PeaksWaveform");
|
|
1745
1745
|
function ProgressBar({ height = 4, seekStartsPlayback }) {
|
|
1746
1746
|
const audio = usePlayerAudio();
|
|
1747
1747
|
const controls = usePlayerControls();
|
|
@@ -1753,7 +1753,7 @@ function ProgressBar({ height = 4, seekStartsPlayback }) {
|
|
|
1753
1753
|
if (!container) return;
|
|
1754
1754
|
const detachSeek = attachSeek(container, audio, {
|
|
1755
1755
|
startsPlayback: seekStartsPlayback,
|
|
1756
|
-
onPlayRequest: /* @__PURE__ */
|
|
1756
|
+
onPlayRequest: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => void controls.play(), "onPlayRequest")
|
|
1757
1757
|
});
|
|
1758
1758
|
const detachHover = attachHover(container, audio);
|
|
1759
1759
|
return () => {
|
|
@@ -1815,7 +1815,7 @@ function ProgressBar({ height = 4, seekStartsPlayback }) {
|
|
|
1815
1815
|
}
|
|
1816
1816
|
);
|
|
1817
1817
|
}
|
|
1818
|
-
|
|
1818
|
+
chunkOLISEQHS_cjs.__name(ProgressBar, "ProgressBar");
|
|
1819
1819
|
function WaveformSkeleton({ height }) {
|
|
1820
1820
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1821
1821
|
"div",
|
|
@@ -1830,7 +1830,7 @@ function WaveformSkeleton({ height }) {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
);
|
|
1832
1832
|
}
|
|
1833
|
-
|
|
1833
|
+
chunkOLISEQHS_cjs.__name(WaveformSkeleton, "WaveformSkeleton");
|
|
1834
1834
|
function Waveform({ config, height, seekStartsPlayback }) {
|
|
1835
1835
|
const meta = usePlayerMeta();
|
|
1836
1836
|
const triggerRef = react.useRef(null);
|
|
@@ -1875,7 +1875,7 @@ function Waveform({ config, height, seekStartsPlayback }) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
) });
|
|
1877
1877
|
}
|
|
1878
|
-
|
|
1878
|
+
chunkOLISEQHS_cjs.__name(Waveform, "Waveform");
|
|
1879
1879
|
function DefaultLayout({ waveform, reactiveCover, onPrev, onNext, seekStartsPlayback }) {
|
|
1880
1880
|
const meta = usePlayerMeta();
|
|
1881
1881
|
const cover = /* @__PURE__ */ jsxRuntime.jsx(Cover, { src: meta.cover, alt: meta.title ? `${meta.title} cover` : "", size: 56 });
|
|
@@ -1899,7 +1899,7 @@ function DefaultLayout({ waveform, reactiveCover, onPrev, onNext, seekStartsPlay
|
|
|
1899
1899
|
/* @__PURE__ */ jsxRuntime.jsx(ControlsRow, { onPrev, onNext, showTime: true })
|
|
1900
1900
|
] });
|
|
1901
1901
|
}
|
|
1902
|
-
|
|
1902
|
+
chunkOLISEQHS_cjs.__name(DefaultLayout, "DefaultLayout");
|
|
1903
1903
|
function CompactLayout({ waveform, seekStartsPlayback }) {
|
|
1904
1904
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 p-2", children: [
|
|
1905
1905
|
/* @__PURE__ */ jsxRuntime.jsx(PlayButton, { size: "compact" }),
|
|
@@ -1915,7 +1915,7 @@ function CompactLayout({ waveform, seekStartsPlayback }) {
|
|
|
1915
1915
|
/* @__PURE__ */ jsxRuntime.jsx(VolumeControl, {})
|
|
1916
1916
|
] });
|
|
1917
1917
|
}
|
|
1918
|
-
|
|
1918
|
+
chunkOLISEQHS_cjs.__name(CompactLayout, "CompactLayout");
|
|
1919
1919
|
var COMPACT_BREAKPOINT = 480;
|
|
1920
1920
|
function PlayerShell({
|
|
1921
1921
|
className = "",
|
|
@@ -1953,11 +1953,11 @@ function PlayerShell({
|
|
|
1953
1953
|
handleRef,
|
|
1954
1954
|
() => ({
|
|
1955
1955
|
audio,
|
|
1956
|
-
play: /* @__PURE__ */
|
|
1957
|
-
pause: /* @__PURE__ */
|
|
1958
|
-
seek: /* @__PURE__ */
|
|
1959
|
-
getCurrentTime: /* @__PURE__ */
|
|
1960
|
-
getDuration: /* @__PURE__ */
|
|
1956
|
+
play: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => controls.play(), "play"),
|
|
1957
|
+
pause: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => controls.pause(), "pause"),
|
|
1958
|
+
seek: /* @__PURE__ */ chunkOLISEQHS_cjs.__name((s) => controls.seek(s), "seek"),
|
|
1959
|
+
getCurrentTime: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => audio.currentTime, "getCurrentTime"),
|
|
1960
|
+
getDuration: /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => Number.isFinite(audio.duration) ? audio.duration : 0, "getDuration")
|
|
1961
1961
|
}),
|
|
1962
1962
|
[audio, controls]
|
|
1963
1963
|
);
|
|
@@ -1985,8 +1985,8 @@ function PlayerShell({
|
|
|
1985
1985
|
}
|
|
1986
1986
|
) });
|
|
1987
1987
|
}
|
|
1988
|
-
|
|
1989
|
-
var Player = react.forwardRef(/* @__PURE__ */
|
|
1988
|
+
chunkOLISEQHS_cjs.__name(PlayerShell, "PlayerShell");
|
|
1989
|
+
var Player = react.forwardRef(/* @__PURE__ */ chunkOLISEQHS_cjs.__name(function Player2(props, ref) {
|
|
1990
1990
|
const {
|
|
1991
1991
|
src,
|
|
1992
1992
|
peaks,
|
|
@@ -2057,5 +2057,5 @@ var Player = react.forwardRef(/* @__PURE__ */ chunkWGEGR3DF_cjs.__name(function
|
|
|
2057
2057
|
Player.displayName = "AudioPlayer";
|
|
2058
2058
|
|
|
2059
2059
|
exports.Player = Player;
|
|
2060
|
-
//# sourceMappingURL=chunk-
|
|
2061
|
-
//# sourceMappingURL=chunk-
|
|
2060
|
+
//# sourceMappingURL=chunk-YDPDTOSP.cjs.map
|
|
2061
|
+
//# sourceMappingURL=chunk-YDPDTOSP.cjs.map
|