@manas-dev/sound-lab 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Manas Barman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @manas-dev/sound-lab
2
+
3
+ <div align="center">
4
+ <img src="https://raw.githubusercontent.com/ManasBarman229/sound-lab/main/media/banner.svg" alt="Sound Lab Banner" width="100%" />
5
+ </div>
6
+
7
+ <div align="center">
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@manas-dev/sound-lab.svg?style=flat-square)](https://www.npmjs.com/package/@manas-dev/sound-lab)
10
+ [![License](https://img.shields.io/npm/l/@manas-dev/sound-lab.svg?style=flat-square)](LICENSE)
11
+ [![Downloads](https://img.shields.io/npm/dm/@manas-dev/sound-lab.svg?style=flat-square)](https://www.npmjs.com/package/@manas-dev/sound-lab)
12
+
13
+ </div>
14
+
15
+ <br />
16
+
17
+ > **A lightweight React library for interactive UI sound effects.**
18
+ > Enhance user engagement with haptic-like audio feedback, featuring reliable debouncing and a customizable control panel.
19
+
20
+ ## ✨ Features
21
+
22
+ - 🔊 **Interactive Feedback**: Add sounds to clicks, hovers, and toggles effortlessly.
23
+ - 🎛️ **Sound Lab UI**: Built-in control panel for users to adjust volume, toggle mute, and switch profiles.
24
+ - 🎧 **Rich Profiles**: Comes with 9+ engineered sound profiles (`Glass`, `Thock`, `Mechanical`, `Sci-Fi`, etc.).
25
+ - ⚡ **Performance Optimized**: Uses Web Audio API with intelligent debouncing to prevent audio spam.
26
+ - 🛡️ **Type-Safe**: Fully typed with TypeScript.
27
+
28
+ ## 📦 Installation
29
+
30
+ ```bash
31
+ npm install @manas-dev/sound-lab lucide-react
32
+ # or
33
+ yarn add @manas-dev/sound-lab lucide-react
34
+ ```
35
+
36
+ ## 🚀 Quick Start
37
+
38
+ ### 1. Wrap your application
39
+
40
+ Wrap your root component with `SoundProvider`.
41
+
42
+ ```tsx
43
+ import { SoundProvider } from '@manas-dev/sound-lab';
44
+
45
+ function App() {
46
+ return (
47
+ <SoundProvider>
48
+ <YourApp />
49
+ </SoundProvider>
50
+ );
51
+ }
52
+ ```
53
+
54
+ ### 2. Add the Sound Controls
55
+
56
+ Allow users to customize their experience (optional but recommended).
57
+
58
+ ```tsx
59
+ import { SoundControls } from '@manas-dev/sound-lab';
60
+
61
+ const Layout = () => (
62
+ <>
63
+ <SoundControls isDark={true} activeColor="purple" />
64
+ {/* ... content */}
65
+ </>
66
+ );
67
+ ```
68
+
69
+ ### 3. Use in Components
70
+
71
+ Trigger sounds on interaction using the `useSound` hook.
72
+
73
+ ```tsx
74
+ import { useSound } from '@manas-dev/sound-lab';
75
+
76
+ const Button = () => {
77
+ const { playSound } = useSound();
78
+
79
+ return (
80
+ <button
81
+ onClick={() => playSound('click')}
82
+ onMouseEnter={() => playSound('hover')}
83
+ className="btn-primary"
84
+ >
85
+ Click Me
86
+ </button>
87
+ );
88
+ };
89
+ ```
90
+
91
+ ## 🎚️ Sound Profiles
92
+
93
+ The library includes several carefully tuned oscillator-based sound profiles:
94
+
95
+ | Profile | Description |
96
+ | :--- | :--- |
97
+ | **Glass** | High-pitched, clean, crystalline pings. (Default) |
98
+ | **Thock** | Deep, "creamy" mechanical keyboard sound. |
99
+ | **Mechanical** | Sharp, clicky switch sounds. |
100
+ | **Console** | Retro game console blips. |
101
+ | **Sci-Fi** | Futuristic sweeps and zaps. |
102
+ | **Lofi** | Mellow, softened tones. |
103
+ | **Minecraft** | Organic "plops" and "dings". |
104
+
105
+ ## 📜 License
106
+
107
+ MIT © [Manas Barman](https://github.com/ManasBarman229)
@@ -0,0 +1,18 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { SoundProfileType, SoundType } from './data/profiles';
3
+
4
+ interface SoundContextType {
5
+ isSoundEnabled: boolean;
6
+ setIsSoundEnabled: (enabled: boolean) => void;
7
+ soundProfile: SoundProfileType;
8
+ setSoundProfile: (profile: SoundProfileType) => void;
9
+ volume: number;
10
+ setVolume: (volume: number) => void;
11
+ playSound: (type?: SoundType) => void;
12
+ }
13
+ export declare const useSound: () => SoundContextType;
14
+ interface SoundProviderProps {
15
+ children: ReactNode;
16
+ }
17
+ export declare const SoundProvider: React.FC<SoundProviderProps>;
18
+ export {};
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+
3
+ interface SoundControlsProps {
4
+ activeColor?: string;
5
+ isDark?: boolean;
6
+ }
7
+ export declare const SoundControls: React.FC<SoundControlsProps>;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export type SoundType = 'hover' | 'click' | 'switch';
2
+ export type SoundProfileType = 'glass' | 'thock' | 'console' | 'minecraft' | 'retro' | 'lofi' | 'mechanical' | 'scifi' | 'bubble';
3
+ export declare const playSoundEffect: (ctx: AudioContext, profile: SoundProfileType, type: SoundType, volume: number) => void;
@@ -0,0 +1,3 @@
1
+ export * from './SoundContext';
2
+ export * from './SoundControls';
3
+ export * from './data/profiles';
@@ -0,0 +1,812 @@
1
+ import Ne, { createContext as gt, useContext as ht, useState as z, useRef as ie, useEffect as Fe } from "react";
2
+ import { Music as ae, X as bt, Sparkles as xt, Keyboard as qe, Gamepad2 as Pe, Box as yt, Headphones as Rt, Zap as At, Droplets as Vt } from "lucide-react";
3
+ var se = { exports: {} }, W = {};
4
+ /**
5
+ * @license React
6
+ * react-jsx-runtime.production.min.js
7
+ *
8
+ * Copyright (c) Facebook, Inc. and its affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ var ke;
14
+ function wt() {
15
+ if (ke) return W;
16
+ ke = 1;
17
+ var T = Ne, l = Symbol.for("react.element"), o = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, t = T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, r = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function i(x, v, S) {
19
+ var y, h = {}, V = null, j = null;
20
+ S !== void 0 && (V = "" + S), v.key !== void 0 && (V = "" + v.key), v.ref !== void 0 && (j = v.ref);
21
+ for (y in v) u.call(v, y) && !r.hasOwnProperty(y) && (h[y] = v[y]);
22
+ if (x && x.defaultProps) for (y in v = x.defaultProps, v) h[y] === void 0 && (h[y] = v[y]);
23
+ return { $$typeof: l, type: x, key: V, ref: j, props: h, _owner: t.current };
24
+ }
25
+ return W.Fragment = o, W.jsx = i, W.jsxs = i, W;
26
+ }
27
+ var Y = {};
28
+ /**
29
+ * @license React
30
+ * react-jsx-runtime.development.js
31
+ *
32
+ * Copyright (c) Facebook, Inc. and its affiliates.
33
+ *
34
+ * This source code is licensed under the MIT license found in the
35
+ * LICENSE file in the root directory of this source tree.
36
+ */
37
+ var $e;
38
+ function Et() {
39
+ return $e || ($e = 1, process.env.NODE_ENV !== "production" && function() {
40
+ var T = Ne, l = Symbol.for("react.element"), o = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), t = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), x = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), C = Symbol.iterator, I = "@@iterator";
41
+ function O(e) {
42
+ if (e === null || typeof e != "object")
43
+ return null;
44
+ var n = C && e[C] || e[I];
45
+ return typeof n == "function" ? n : null;
46
+ }
47
+ var q = T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
48
+ function R(e) {
49
+ {
50
+ for (var n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), s = 1; s < n; s++)
51
+ a[s - 1] = arguments[s];
52
+ J("error", e, a);
53
+ }
54
+ }
55
+ function J(e, n, a) {
56
+ {
57
+ var s = q.ReactDebugCurrentFrame, d = s.getStackAddendum();
58
+ d !== "" && (n += "%s", a = a.concat([d]));
59
+ var m = a.map(function(f) {
60
+ return String(f);
61
+ });
62
+ m.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, m);
63
+ }
64
+ }
65
+ var K = !1, w = !1, Ie = !1, Me = !1, Le = !1, oe;
66
+ oe = Symbol.for("react.module.reference");
67
+ function We(e) {
68
+ return !!(typeof e == "string" || typeof e == "function" || e === u || e === r || Le || e === t || e === S || e === y || Me || e === j || K || w || Ie || typeof e == "object" && e !== null && (e.$$typeof === V || e.$$typeof === h || e.$$typeof === i || e.$$typeof === x || e.$$typeof === v || // This needs to include all possible module reference object
69
+ // types supported by any Flight configuration anywhere since
70
+ // we don't know which Flight build this will end up being used
71
+ // with.
72
+ e.$$typeof === oe || e.getModuleId !== void 0));
73
+ }
74
+ function Ye(e, n, a) {
75
+ var s = e.displayName;
76
+ if (s)
77
+ return s;
78
+ var d = n.displayName || n.name || "";
79
+ return d !== "" ? a + "(" + d + ")" : a;
80
+ }
81
+ function ue(e) {
82
+ return e.displayName || "Context";
83
+ }
84
+ function P(e) {
85
+ if (e == null)
86
+ return null;
87
+ if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
88
+ return e.displayName || e.name || null;
89
+ if (typeof e == "string")
90
+ return e;
91
+ switch (e) {
92
+ case u:
93
+ return "Fragment";
94
+ case o:
95
+ return "Portal";
96
+ case r:
97
+ return "Profiler";
98
+ case t:
99
+ return "StrictMode";
100
+ case S:
101
+ return "Suspense";
102
+ case y:
103
+ return "SuspenseList";
104
+ }
105
+ if (typeof e == "object")
106
+ switch (e.$$typeof) {
107
+ case x:
108
+ var n = e;
109
+ return ue(n) + ".Consumer";
110
+ case i:
111
+ var a = e;
112
+ return ue(a._context) + ".Provider";
113
+ case v:
114
+ return Ye(e, e.render, "ForwardRef");
115
+ case h:
116
+ var s = e.displayName || null;
117
+ return s !== null ? s : P(e.type) || "Memo";
118
+ case V: {
119
+ var d = e, m = d._payload, f = d._init;
120
+ try {
121
+ return P(f(m));
122
+ } catch {
123
+ return null;
124
+ }
125
+ }
126
+ }
127
+ return null;
128
+ }
129
+ var k = Object.assign, M = 0, le, ce, fe, de, me, pe, Te;
130
+ function ve() {
131
+ }
132
+ ve.__reactDisabledLog = !0;
133
+ function De() {
134
+ {
135
+ if (M === 0) {
136
+ le = console.log, ce = console.info, fe = console.warn, de = console.error, me = console.group, pe = console.groupCollapsed, Te = console.groupEnd;
137
+ var e = {
138
+ configurable: !0,
139
+ enumerable: !0,
140
+ value: ve,
141
+ writable: !0
142
+ };
143
+ Object.defineProperties(console, {
144
+ info: e,
145
+ log: e,
146
+ warn: e,
147
+ error: e,
148
+ group: e,
149
+ groupCollapsed: e,
150
+ groupEnd: e
151
+ });
152
+ }
153
+ M++;
154
+ }
155
+ }
156
+ function Ue() {
157
+ {
158
+ if (M--, M === 0) {
159
+ var e = {
160
+ configurable: !0,
161
+ enumerable: !0,
162
+ writable: !0
163
+ };
164
+ Object.defineProperties(console, {
165
+ log: k({}, e, {
166
+ value: le
167
+ }),
168
+ info: k({}, e, {
169
+ value: ce
170
+ }),
171
+ warn: k({}, e, {
172
+ value: fe
173
+ }),
174
+ error: k({}, e, {
175
+ value: de
176
+ }),
177
+ group: k({}, e, {
178
+ value: me
179
+ }),
180
+ groupCollapsed: k({}, e, {
181
+ value: pe
182
+ }),
183
+ groupEnd: k({}, e, {
184
+ value: Te
185
+ })
186
+ });
187
+ }
188
+ M < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
189
+ }
190
+ }
191
+ var X = q.ReactCurrentDispatcher, H;
192
+ function D(e, n, a) {
193
+ {
194
+ if (H === void 0)
195
+ try {
196
+ throw Error();
197
+ } catch (d) {
198
+ var s = d.stack.trim().match(/\n( *(at )?)/);
199
+ H = s && s[1] || "";
200
+ }
201
+ return `
202
+ ` + H + e;
203
+ }
204
+ }
205
+ var Z = !1, U;
206
+ {
207
+ var Be = typeof WeakMap == "function" ? WeakMap : Map;
208
+ U = new Be();
209
+ }
210
+ function ge(e, n) {
211
+ if (!e || Z)
212
+ return "";
213
+ {
214
+ var a = U.get(e);
215
+ if (a !== void 0)
216
+ return a;
217
+ }
218
+ var s;
219
+ Z = !0;
220
+ var d = Error.prepareStackTrace;
221
+ Error.prepareStackTrace = void 0;
222
+ var m;
223
+ m = X.current, X.current = null, De();
224
+ try {
225
+ if (n) {
226
+ var f = function() {
227
+ throw Error();
228
+ };
229
+ if (Object.defineProperty(f.prototype, "props", {
230
+ set: function() {
231
+ throw Error();
232
+ }
233
+ }), typeof Reflect == "object" && Reflect.construct) {
234
+ try {
235
+ Reflect.construct(f, []);
236
+ } catch (E) {
237
+ s = E;
238
+ }
239
+ Reflect.construct(e, [], f);
240
+ } else {
241
+ try {
242
+ f.call();
243
+ } catch (E) {
244
+ s = E;
245
+ }
246
+ e.call(f.prototype);
247
+ }
248
+ } else {
249
+ try {
250
+ throw Error();
251
+ } catch (E) {
252
+ s = E;
253
+ }
254
+ e();
255
+ }
256
+ } catch (E) {
257
+ if (E && s && typeof E.stack == "string") {
258
+ for (var c = E.stack.split(`
259
+ `), A = s.stack.split(`
260
+ `), g = c.length - 1, b = A.length - 1; g >= 1 && b >= 0 && c[g] !== A[b]; )
261
+ b--;
262
+ for (; g >= 1 && b >= 0; g--, b--)
263
+ if (c[g] !== A[b]) {
264
+ if (g !== 1 || b !== 1)
265
+ do
266
+ if (g--, b--, b < 0 || c[g] !== A[b]) {
267
+ var _ = `
268
+ ` + c[g].replace(" at new ", " at ");
269
+ return e.displayName && _.includes("<anonymous>") && (_ = _.replace("<anonymous>", e.displayName)), typeof e == "function" && U.set(e, _), _;
270
+ }
271
+ while (g >= 1 && b >= 0);
272
+ break;
273
+ }
274
+ }
275
+ } finally {
276
+ Z = !1, X.current = m, Ue(), Error.prepareStackTrace = d;
277
+ }
278
+ var F = e ? e.displayName || e.name : "", $ = F ? D(F) : "";
279
+ return typeof e == "function" && U.set(e, $), $;
280
+ }
281
+ function Ge(e, n, a) {
282
+ return ge(e, !1);
283
+ }
284
+ function Je(e) {
285
+ var n = e.prototype;
286
+ return !!(n && n.isReactComponent);
287
+ }
288
+ function B(e, n, a) {
289
+ if (e == null)
290
+ return "";
291
+ if (typeof e == "function")
292
+ return ge(e, Je(e));
293
+ if (typeof e == "string")
294
+ return D(e);
295
+ switch (e) {
296
+ case S:
297
+ return D("Suspense");
298
+ case y:
299
+ return D("SuspenseList");
300
+ }
301
+ if (typeof e == "object")
302
+ switch (e.$$typeof) {
303
+ case v:
304
+ return Ge(e.render);
305
+ case h:
306
+ return B(e.type, n, a);
307
+ case V: {
308
+ var s = e, d = s._payload, m = s._init;
309
+ try {
310
+ return B(m(d), n, a);
311
+ } catch {
312
+ }
313
+ }
314
+ }
315
+ return "";
316
+ }
317
+ var L = Object.prototype.hasOwnProperty, he = {}, be = q.ReactDebugCurrentFrame;
318
+ function G(e) {
319
+ if (e) {
320
+ var n = e._owner, a = B(e.type, e._source, n ? n.type : null);
321
+ be.setExtraStackFrame(a);
322
+ } else
323
+ be.setExtraStackFrame(null);
324
+ }
325
+ function Ke(e, n, a, s, d) {
326
+ {
327
+ var m = Function.call.bind(L);
328
+ for (var f in e)
329
+ if (m(e, f)) {
330
+ var c = void 0;
331
+ try {
332
+ if (typeof e[f] != "function") {
333
+ var A = Error((s || "React class") + ": " + a + " type `" + f + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[f] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
334
+ throw A.name = "Invariant Violation", A;
335
+ }
336
+ c = e[f](n, f, s, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
337
+ } catch (g) {
338
+ c = g;
339
+ }
340
+ c && !(c instanceof Error) && (G(d), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", s || "React class", a, f, typeof c), G(null)), c instanceof Error && !(c.message in he) && (he[c.message] = !0, G(d), R("Failed %s type: %s", a, c.message), G(null));
341
+ }
342
+ }
343
+ }
344
+ var Xe = Array.isArray;
345
+ function Q(e) {
346
+ return Xe(e);
347
+ }
348
+ function He(e) {
349
+ {
350
+ var n = typeof Symbol == "function" && Symbol.toStringTag, a = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
351
+ return a;
352
+ }
353
+ }
354
+ function Ze(e) {
355
+ try {
356
+ return xe(e), !1;
357
+ } catch {
358
+ return !0;
359
+ }
360
+ }
361
+ function xe(e) {
362
+ return "" + e;
363
+ }
364
+ function ye(e) {
365
+ if (Ze(e))
366
+ return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", He(e)), xe(e);
367
+ }
368
+ var Re = q.ReactCurrentOwner, Qe = {
369
+ key: !0,
370
+ ref: !0,
371
+ __self: !0,
372
+ __source: !0
373
+ }, Ae, Ve;
374
+ function et(e) {
375
+ if (L.call(e, "ref")) {
376
+ var n = Object.getOwnPropertyDescriptor(e, "ref").get;
377
+ if (n && n.isReactWarning)
378
+ return !1;
379
+ }
380
+ return e.ref !== void 0;
381
+ }
382
+ function tt(e) {
383
+ if (L.call(e, "key")) {
384
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
385
+ if (n && n.isReactWarning)
386
+ return !1;
387
+ }
388
+ return e.key !== void 0;
389
+ }
390
+ function rt(e, n) {
391
+ typeof e.ref == "string" && Re.current;
392
+ }
393
+ function nt(e, n) {
394
+ {
395
+ var a = function() {
396
+ Ae || (Ae = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
397
+ };
398
+ a.isReactWarning = !0, Object.defineProperty(e, "key", {
399
+ get: a,
400
+ configurable: !0
401
+ });
402
+ }
403
+ }
404
+ function at(e, n) {
405
+ {
406
+ var a = function() {
407
+ Ve || (Ve = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
408
+ };
409
+ a.isReactWarning = !0, Object.defineProperty(e, "ref", {
410
+ get: a,
411
+ configurable: !0
412
+ });
413
+ }
414
+ }
415
+ var it = function(e, n, a, s, d, m, f) {
416
+ var c = {
417
+ // This tag allows us to uniquely identify this as a React Element
418
+ $$typeof: l,
419
+ // Built-in properties that belong on the element
420
+ type: e,
421
+ key: n,
422
+ ref: a,
423
+ props: f,
424
+ // Record the component responsible for creating this element.
425
+ _owner: m
426
+ };
427
+ return c._store = {}, Object.defineProperty(c._store, "validated", {
428
+ configurable: !1,
429
+ enumerable: !1,
430
+ writable: !0,
431
+ value: !1
432
+ }), Object.defineProperty(c, "_self", {
433
+ configurable: !1,
434
+ enumerable: !1,
435
+ writable: !1,
436
+ value: s
437
+ }), Object.defineProperty(c, "_source", {
438
+ configurable: !1,
439
+ enumerable: !1,
440
+ writable: !1,
441
+ value: d
442
+ }), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
443
+ };
444
+ function st(e, n, a, s, d) {
445
+ {
446
+ var m, f = {}, c = null, A = null;
447
+ a !== void 0 && (ye(a), c = "" + a), tt(n) && (ye(n.key), c = "" + n.key), et(n) && (A = n.ref, rt(n, d));
448
+ for (m in n)
449
+ L.call(n, m) && !Qe.hasOwnProperty(m) && (f[m] = n[m]);
450
+ if (e && e.defaultProps) {
451
+ var g = e.defaultProps;
452
+ for (m in g)
453
+ f[m] === void 0 && (f[m] = g[m]);
454
+ }
455
+ if (c || A) {
456
+ var b = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
457
+ c && nt(f, b), A && at(f, b);
458
+ }
459
+ return it(e, c, A, d, s, Re.current, f);
460
+ }
461
+ }
462
+ var ee = q.ReactCurrentOwner, we = q.ReactDebugCurrentFrame;
463
+ function N(e) {
464
+ if (e) {
465
+ var n = e._owner, a = B(e.type, e._source, n ? n.type : null);
466
+ we.setExtraStackFrame(a);
467
+ } else
468
+ we.setExtraStackFrame(null);
469
+ }
470
+ var te;
471
+ te = !1;
472
+ function re(e) {
473
+ return typeof e == "object" && e !== null && e.$$typeof === l;
474
+ }
475
+ function Ee() {
476
+ {
477
+ if (ee.current) {
478
+ var e = P(ee.current.type);
479
+ if (e)
480
+ return `
481
+
482
+ Check the render method of \`` + e + "`.";
483
+ }
484
+ return "";
485
+ }
486
+ }
487
+ function ot(e) {
488
+ return "";
489
+ }
490
+ var _e = {};
491
+ function ut(e) {
492
+ {
493
+ var n = Ee();
494
+ if (!n) {
495
+ var a = typeof e == "string" ? e : e.displayName || e.name;
496
+ a && (n = `
497
+
498
+ Check the top-level render call using <` + a + ">.");
499
+ }
500
+ return n;
501
+ }
502
+ }
503
+ function Se(e, n) {
504
+ {
505
+ if (!e._store || e._store.validated || e.key != null)
506
+ return;
507
+ e._store.validated = !0;
508
+ var a = ut(n);
509
+ if (_e[a])
510
+ return;
511
+ _e[a] = !0;
512
+ var s = "";
513
+ e && e._owner && e._owner !== ee.current && (s = " It was passed a child from " + P(e._owner.type) + "."), N(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, s), N(null);
514
+ }
515
+ }
516
+ function je(e, n) {
517
+ {
518
+ if (typeof e != "object")
519
+ return;
520
+ if (Q(e))
521
+ for (var a = 0; a < e.length; a++) {
522
+ var s = e[a];
523
+ re(s) && Se(s, n);
524
+ }
525
+ else if (re(e))
526
+ e._store && (e._store.validated = !0);
527
+ else if (e) {
528
+ var d = O(e);
529
+ if (typeof d == "function" && d !== e.entries)
530
+ for (var m = d.call(e), f; !(f = m.next()).done; )
531
+ re(f.value) && Se(f.value, n);
532
+ }
533
+ }
534
+ }
535
+ function lt(e) {
536
+ {
537
+ var n = e.type;
538
+ if (n == null || typeof n == "string")
539
+ return;
540
+ var a;
541
+ if (typeof n == "function")
542
+ a = n.propTypes;
543
+ else if (typeof n == "object" && (n.$$typeof === v || // Note: Memo only checks outer props here.
544
+ // Inner props are checked in the reconciler.
545
+ n.$$typeof === h))
546
+ a = n.propTypes;
547
+ else
548
+ return;
549
+ if (a) {
550
+ var s = P(n);
551
+ Ke(a, e.props, "prop", s, e);
552
+ } else if (n.PropTypes !== void 0 && !te) {
553
+ te = !0;
554
+ var d = P(n);
555
+ R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", d || "Unknown");
556
+ }
557
+ typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
558
+ }
559
+ }
560
+ function ct(e) {
561
+ {
562
+ for (var n = Object.keys(e.props), a = 0; a < n.length; a++) {
563
+ var s = n[a];
564
+ if (s !== "children" && s !== "key") {
565
+ N(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", s), N(null);
566
+ break;
567
+ }
568
+ }
569
+ e.ref !== null && (N(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), N(null));
570
+ }
571
+ }
572
+ var Ce = {};
573
+ function Oe(e, n, a, s, d, m) {
574
+ {
575
+ var f = We(e);
576
+ if (!f) {
577
+ var c = "";
578
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
579
+ var A = ot();
580
+ A ? c += A : c += Ee();
581
+ var g;
582
+ e === null ? g = "null" : Q(e) ? g = "array" : e !== void 0 && e.$$typeof === l ? (g = "<" + (P(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : g = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", g, c);
583
+ }
584
+ var b = st(e, n, a, d, m);
585
+ if (b == null)
586
+ return b;
587
+ if (f) {
588
+ var _ = n.children;
589
+ if (_ !== void 0)
590
+ if (s)
591
+ if (Q(_)) {
592
+ for (var F = 0; F < _.length; F++)
593
+ je(_[F], e);
594
+ Object.freeze && Object.freeze(_);
595
+ } else
596
+ R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
597
+ else
598
+ je(_, e);
599
+ }
600
+ if (L.call(n, "key")) {
601
+ var $ = P(e), E = Object.keys(n).filter(function(vt) {
602
+ return vt !== "key";
603
+ }), ne = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
604
+ if (!Ce[$ + ne]) {
605
+ var Tt = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
606
+ R(`A props object containing a "key" prop is being spread into JSX:
607
+ let props = %s;
608
+ <%s {...props} />
609
+ React keys must be passed directly to JSX without using spread:
610
+ let props = %s;
611
+ <%s key={someKey} {...props} />`, ne, $, Tt, $), Ce[$ + ne] = !0;
612
+ }
613
+ }
614
+ return e === u ? ct(b) : lt(b), b;
615
+ }
616
+ }
617
+ function ft(e, n, a) {
618
+ return Oe(e, n, a, !0);
619
+ }
620
+ function dt(e, n, a) {
621
+ return Oe(e, n, a, !1);
622
+ }
623
+ var mt = dt, pt = ft;
624
+ Y.Fragment = u, Y.jsx = mt, Y.jsxs = pt;
625
+ }()), Y;
626
+ }
627
+ process.env.NODE_ENV === "production" ? se.exports = wt() : se.exports = Et();
628
+ var p = se.exports;
629
+ const _t = (T, l, o, u) => {
630
+ const t = T.currentTime, r = T.createOscillator(), i = T.createGain();
631
+ r.connect(i), i.connect(T.destination), l === "lofi" ? o === "hover" ? (r.type = "sine", r.frequency.setValueAtTime(800, t), r.frequency.exponentialRampToValueAtTime(300, t + 0.05), i.gain.setValueAtTime(0.1 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.04), r.start(t), r.stop(t + 0.05)) : o === "click" ? (r.type = "triangle", r.frequency.setValueAtTime(300, t), r.frequency.exponentialRampToValueAtTime(50, t + 0.15), i.gain.setValueAtTime(0.3 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.15), r.start(t), r.stop(t + 0.15)) : o === "switch" && (r.type = "sine", r.frequency.setValueAtTime(200, t), r.frequency.linearRampToValueAtTime(400, t + 0.1), i.gain.setValueAtTime(0.2 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : l === "glass" ? o === "hover" ? (r.type = "sine", r.frequency.setValueAtTime(1200, t), r.frequency.exponentialRampToValueAtTime(1800, t + 0.05), i.gain.setValueAtTime(0.08 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : o === "click" ? (r.type = "sine", r.frequency.setValueAtTime(800, t), r.frequency.exponentialRampToValueAtTime(100, t + 0.2), i.gain.setValueAtTime(0.25 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.2), r.start(t), r.stop(t + 0.2)) : o === "switch" && (r.type = "sine", r.frequency.setValueAtTime(1500, t), r.frequency.exponentialRampToValueAtTime(800, t + 0.3), i.gain.setValueAtTime(0.15 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.3), r.start(t), r.stop(t + 0.3)) : l === "retro" ? o === "hover" ? (r.type = "square", r.frequency.setValueAtTime(150, t), r.frequency.linearRampToValueAtTime(100, t + 0.05), i.gain.setValueAtTime(0.05 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : o === "click" ? (r.type = "square", r.frequency.setValueAtTime(440, t), r.frequency.setValueAtTime(880, t + 0.05), i.gain.setValueAtTime(0.1 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "switch" && (r.type = "square", r.frequency.setValueAtTime(220, t), r.frequency.linearRampToValueAtTime(880, t + 0.1), i.gain.setValueAtTime(0.1 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : l === "thock" ? o === "hover" ? (r.type = "triangle", r.frequency.setValueAtTime(120, t), r.frequency.exponentialRampToValueAtTime(60, t + 0.05), i.gain.setValueAtTime(0.15 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : o === "click" ? (r.type = "triangle", r.frequency.setValueAtTime(100, t), r.frequency.exponentialRampToValueAtTime(30, t + 0.1), i.gain.setValueAtTime(0.4 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "switch" && (r.type = "triangle", r.frequency.setValueAtTime(200, t), r.frequency.exponentialRampToValueAtTime(80, t + 0.1), i.gain.setValueAtTime(0.2 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : l === "console" ? o === "hover" ? (r.type = "square", r.frequency.setValueAtTime(1e3, t), r.frequency.linearRampToValueAtTime(1500, t + 0.03), i.gain.setValueAtTime(0.05 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.03), r.start(t), r.stop(t + 0.03)) : o === "click" ? (r.type = "square", r.frequency.setValueAtTime(800, t), r.frequency.linearRampToValueAtTime(1200, t + 0.05), i.gain.setValueAtTime(0.1 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : o === "switch" && (r.type = "square", r.frequency.setValueAtTime(1200, t), r.frequency.linearRampToValueAtTime(2e3, t + 0.1), i.gain.setValueAtTime(0.1 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : l === "minecraft" ? o === "hover" ? (r.type = "sine", r.frequency.setValueAtTime(1500, t), r.frequency.linearRampToValueAtTime(1800, t + 0.05), i.gain.setValueAtTime(0.1 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "click" ? (r.type = "sine", r.frequency.setValueAtTime(600, t), r.frequency.exponentialRampToValueAtTime(200, t + 0.1), i.gain.setValueAtTime(0.3 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "switch" && (r.type = "square", r.frequency.setValueAtTime(250, t), r.frequency.exponentialRampToValueAtTime(50, t + 0.05), i.gain.setValueAtTime(0.15 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : l === "mechanical" ? o === "hover" ? (r.type = "square", r.frequency.setValueAtTime(2e3, t), r.frequency.exponentialRampToValueAtTime(1e3, t + 0.02), i.gain.setValueAtTime(0.1 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.02), r.start(t), r.stop(t + 0.02)) : o === "click" ? (r.type = "sawtooth", r.frequency.setValueAtTime(500, t), r.frequency.exponentialRampToValueAtTime(100, t + 0.1), i.gain.setValueAtTime(0.3 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "switch" && (r.type = "square", r.frequency.setValueAtTime(300, t), r.frequency.linearRampToValueAtTime(600, t + 0.05), i.gain.setValueAtTime(0.2 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.05), r.start(t), r.stop(t + 0.05)) : l === "scifi" ? o === "hover" ? (r.type = "sine", r.frequency.setValueAtTime(1500, t), i.gain.setValueAtTime(0.15 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.03), r.start(t), r.stop(t + 0.03)) : o === "click" ? (r.type = "sine", r.frequency.setValueAtTime(1e3, t), r.frequency.linearRampToValueAtTime(2500, t + 0.15), i.gain.setValueAtTime(0.4 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.15), r.start(t), r.stop(t + 0.15)) : o === "switch" && (r.type = "sine", r.frequency.setValueAtTime(500, t), r.frequency.linearRampToValueAtTime(1500, t + 0.2), i.gain.setValueAtTime(0.2 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.2), r.start(t), r.stop(t + 0.2)) : l === "bubble" && (o === "hover" ? (r.type = "sine", r.frequency.setValueAtTime(600, t), r.frequency.exponentialRampToValueAtTime(300, t + 0.1), i.gain.setValueAtTime(0.2 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.1), r.start(t), r.stop(t + 0.1)) : o === "click" ? (r.type = "sine", r.frequency.setValueAtTime(800, t), r.frequency.exponentialRampToValueAtTime(200, t + 0.2), i.gain.setValueAtTime(0.4 * u, t), i.gain.exponentialRampToValueAtTime(1e-3, t + 0.2), r.start(t), r.stop(t + 0.2)) : o === "switch" && (r.type = "triangle", r.frequency.setValueAtTime(300, t), r.frequency.exponentialRampToValueAtTime(600, t + 0.2), i.gain.setValueAtTime(0.2 * u, t), i.gain.linearRampToValueAtTime(1e-3, t + 0.2), r.start(t), r.stop(t + 0.2)));
632
+ }, ze = gt(void 0), St = () => {
633
+ const T = ht(ze);
634
+ if (!T)
635
+ throw new Error("useSound must be used within a SoundProvider");
636
+ return T;
637
+ }, Ot = ({ children: T }) => {
638
+ const [l, o] = z(!0), [u, t] = z("glass"), [r, i] = z(0.5), x = ie(null), v = ie(0);
639
+ Fe(() => {
640
+ const h = () => {
641
+ if (l) {
642
+ if (!x.current) {
643
+ const V = window.AudioContext || window.webkitAudioContext;
644
+ x.current = new V();
645
+ }
646
+ x.current && x.current.state === "suspended" && x.current.resume();
647
+ }
648
+ };
649
+ return window.addEventListener("click", h), window.addEventListener("touchstart", h), window.addEventListener("keydown", h), () => {
650
+ window.removeEventListener("click", h), window.removeEventListener("touchstart", h), window.removeEventListener("keydown", h);
651
+ };
652
+ }, [l]);
653
+ const y = {
654
+ isSoundEnabled: l,
655
+ setIsSoundEnabled: o,
656
+ soundProfile: u,
657
+ setSoundProfile: t,
658
+ volume: r,
659
+ setVolume: i,
660
+ playSound: (h = "hover") => {
661
+ if (!l) return;
662
+ if (!x.current) {
663
+ const C = window.AudioContext || window.webkitAudioContext;
664
+ x.current = new C();
665
+ }
666
+ const V = x.current.currentTime;
667
+ if (V - v.current < 0.05) return;
668
+ v.current = V;
669
+ const j = x.current;
670
+ j.state === "suspended" && j.resume().catch((C) => console.error("AudioContext resume failed:", C)), _t(j, u, h, r);
671
+ }
672
+ };
673
+ return /* @__PURE__ */ p.jsx(ze.Provider, { value: y, children: T });
674
+ }, qt = ({ activeColor: T = "blue", isDark: l = !0 }) => {
675
+ const {
676
+ isSoundEnabled: o,
677
+ setIsSoundEnabled: u,
678
+ soundProfile: t,
679
+ setSoundProfile: r,
680
+ volume: i,
681
+ setVolume: x,
682
+ playSound: v
683
+ } = St(), [S, y] = z(!1), [h, V] = z(null), [j, C] = z(!1), I = (w) => {
684
+ V(w), C(!0), setTimeout(() => C(!1), 2e3);
685
+ }, O = ie(null), q = () => {
686
+ O.current && (clearTimeout(O.current), O.current = null);
687
+ }, R = () => {
688
+ O.current = setTimeout(() => {
689
+ y(!1);
690
+ }, 1e3);
691
+ };
692
+ Fe(() => () => {
693
+ O.current && clearTimeout(O.current);
694
+ }, []);
695
+ const J = [
696
+ { id: "glass", name: "Glass", icon: xt },
697
+ { id: "thock", name: "Thock", icon: qe },
698
+ { id: "console", name: "Console", icon: Pe },
699
+ { id: "minecraft", name: "Minecraft", icon: yt },
700
+ { id: "retro", name: "Retro", icon: Pe },
701
+ { id: "lofi", name: "Lofi", icon: Rt },
702
+ { id: "mechanical", name: "Clicky", icon: qe },
703
+ { id: "scifi", name: "Sci-Fi", icon: At },
704
+ { id: "bubble", name: "Bubble", icon: Vt }
705
+ ], K = `text-${T}-500`;
706
+ return /* @__PURE__ */ p.jsxs("div", { className: "fixed top-4 right-16 md:right-24 z-50", children: [
707
+ j && /* @__PURE__ */ p.jsx("div", { className: `absolute top-16 right-0 md:right-auto md:left-[-200px] px-4 py-2 rounded-xl shadow-lg backdrop-blur-md border animate-in slide-in-from-top-2 fade-in duration-300 z-[60] whitespace-nowrap
708
+ ${l ? "bg-zinc-800/90 border-zinc-700 text-white" : "bg-white/90 border-slate-200 text-slate-800"}`, children: /* @__PURE__ */ p.jsx("span", { className: "text-xs font-bold", children: h }) }),
709
+ S && /* @__PURE__ */ p.jsxs(
710
+ "div",
711
+ {
712
+ onMouseEnter: q,
713
+ onMouseLeave: R,
714
+ className: `absolute top-full right-0 mt-4 p-4 rounded-3xl border w-[280px] backdrop-blur-xl shadow-2xl animate-in slide-in-from-top-5 fade-in z-50
715
+ ${l ? "bg-zinc-900/95 border-zinc-800" : "bg-white/95 border-white/60"}`,
716
+ children: [
717
+ /* @__PURE__ */ p.jsxs("div", { className: "flex justify-between items-center mb-4", children: [
718
+ /* @__PURE__ */ p.jsxs("div", { className: "flex items-center gap-2", children: [
719
+ /* @__PURE__ */ p.jsx(ae, { size: 14, className: l ? "text-zinc-400" : "text-slate-400" }),
720
+ /* @__PURE__ */ p.jsx("span", { className: `text-xs font-bold uppercase tracking-wider ${l ? "text-zinc-500" : "text-slate-500"}`, children: "Sound Lab" })
721
+ ] }),
722
+ /* @__PURE__ */ p.jsx(
723
+ "button",
724
+ {
725
+ onClick: () => {
726
+ y(!1), v("click");
727
+ },
728
+ className: `p-1 rounded-full ${l ? "hover:bg-zinc-800" : "hover:bg-slate-100"}`,
729
+ "aria-label": "Close sound menu",
730
+ children: /* @__PURE__ */ p.jsx(bt, { size: 14, className: l ? "text-zinc-400" : "text-slate-400" })
731
+ }
732
+ )
733
+ ] }),
734
+ /* @__PURE__ */ p.jsxs("div", { className: `flex items-center justify-between p-3 rounded-xl mb-4 transition-colors
735
+ ${l ? "bg-zinc-800/50" : "bg-slate-50"}`, children: [
736
+ /* @__PURE__ */ p.jsx("span", { className: `text-xs font-medium ${l ? "text-zinc-300" : "text-slate-600"}`, children: "Master Audio" }),
737
+ /* @__PURE__ */ p.jsx(
738
+ "button",
739
+ {
740
+ onClick: () => {
741
+ u(!o), o ? I("Sound Disabled") : (setTimeout(() => v("switch"), 50), I("Sound Enabled"));
742
+ },
743
+ className: `relative w-10 h-6 rounded-full transition-colors duration-300 ${o ? `bg-${T}-500` : l ? "bg-zinc-700" : "bg-slate-300"}`,
744
+ "aria-label": o ? "Disable sound" : "Enable sound",
745
+ children: /* @__PURE__ */ p.jsx("span", { className: `absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform duration-300 ${o ? "translate-x-4" : "translate-x-0"}` })
746
+ }
747
+ )
748
+ ] }),
749
+ /* @__PURE__ */ p.jsxs("div", { className: `p-3 rounded-xl mb-4 transition-colors ${l ? "bg-zinc-800/50" : "bg-slate-50"}`, children: [
750
+ /* @__PURE__ */ p.jsxs("div", { className: "flex justify-between items-center mb-2", children: [
751
+ /* @__PURE__ */ p.jsx("span", { className: `text-xs font-medium ${l ? "text-zinc-300" : "text-slate-600"}`, children: "Volume" }),
752
+ /* @__PURE__ */ p.jsxs("span", { className: `text-xs font-bold ${K}`, children: [
753
+ Math.round(i * 100),
754
+ "%"
755
+ ] })
756
+ ] }),
757
+ /* @__PURE__ */ p.jsx(
758
+ "input",
759
+ {
760
+ type: "range",
761
+ min: "0",
762
+ max: "1",
763
+ step: "0.05",
764
+ value: i,
765
+ onChange: (w) => {
766
+ x(parseFloat(w.target.value)), o || u(!0);
767
+ },
768
+ className: `w-full h-1.5 rounded-full appearance-none cursor-pointer accent-${T}-500 ${l ? "bg-zinc-700" : "bg-slate-300"}`,
769
+ "aria-label": "Volume control"
770
+ }
771
+ )
772
+ ] }),
773
+ /* @__PURE__ */ p.jsx("div", { className: "grid grid-cols-3 gap-2", children: J.map((w) => /* @__PURE__ */ p.jsxs(
774
+ "button",
775
+ {
776
+ onClick: () => {
777
+ r(w.id), o || u(!0), setTimeout(() => v("click"), 50), I(`Profile: ${w.name}`);
778
+ },
779
+ className: `flex flex-col items-center gap-1 p-2 rounded-xl border transition-all duration-300
780
+ ${t === w.id ? l ? `bg-${T}-500/10 border-${T}-500/50` : `bg-${T}-50 border-${T}-200` : l ? "bg-transparent border-transparent hover:bg-zinc-800" : "bg-transparent border-transparent hover:bg-slate-100"}`,
781
+ children: [
782
+ /* @__PURE__ */ p.jsx(w.icon, { size: 16, className: t === w.id ? `text-${T}-500` : l ? "text-zinc-500" : "text-slate-400" }),
783
+ /* @__PURE__ */ p.jsx("span", { className: `text-[10px] font-medium ${t === w.id ? l ? "text-white" : `text-${T}-700` : l ? "text-zinc-500" : "text-slate-500"}`, children: w.name })
784
+ ]
785
+ },
786
+ w.id
787
+ )) })
788
+ ]
789
+ }
790
+ ),
791
+ /* @__PURE__ */ p.jsx(
792
+ "button",
793
+ {
794
+ onClick: () => {
795
+ y(!S), v("click");
796
+ },
797
+ className: `p-2 md:p-3 rounded-full transition-all duration-300 text-slate-400 hover:text-slate-600 hover:bg-slate-50
798
+ ${l ? "hover:bg-zinc-800 hover:text-zinc-200" : ""}
799
+ ${S || o ? l ? "text-white" : "text-slate-800" : ""}
800
+ `,
801
+ "aria-label": "Open sound menu",
802
+ children: o ? /* @__PURE__ */ p.jsx(ae, { size: 20, className: "md:w-6 md:h-6 animate-pulse" }) : /* @__PURE__ */ p.jsx(ae, { size: 20, className: "md:w-6 md:h-6" })
803
+ }
804
+ )
805
+ ] });
806
+ };
807
+ export {
808
+ qt as SoundControls,
809
+ Ot as SoundProvider,
810
+ _t as playSoundEffect,
811
+ St as useSound
812
+ };
@@ -0,0 +1,37 @@
1
+ (function(C,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react"],y):(C=typeof globalThis<"u"?globalThis:C||self,y(C.SoundLab={},C.React,C.LucideReact))})(this,function(C,y,S){"use strict";var X={exports:{}},W={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var oe;function ze(){if(oe)return W;oe=1;var T=y,l=Symbol.for("react.element"),o=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,t=T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n={key:!0,ref:!0,__self:!0,__source:!0};function i(x,v,O){var R,h={},w=null,P=null;O!==void 0&&(w=""+O),v.key!==void 0&&(w=""+v.key),v.ref!==void 0&&(P=v.ref);for(R in v)u.call(v,R)&&!n.hasOwnProperty(R)&&(h[R]=v[R]);if(x&&x.defaultProps)for(R in v=x.defaultProps,v)h[R]===void 0&&(h[R]=v[R]);return{$$typeof:l,type:x,key:w,ref:P,props:h,_owner:t.current}}return W.Fragment=o,W.jsx=i,W.jsxs=i,W}var Y={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ue;function Ie(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&function(){var T=y,l=Symbol.for("react.element"),o=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),t=Symbol.for("react.strict_mode"),n=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),x=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),k=Symbol.iterator,D="@@iterator";function q(e){if(e===null||typeof e!="object")return null;var r=k&&e[k]||e[D];return typeof r=="function"?r:null}var N=T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function A(e){{for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;s<r;s++)a[s-1]=arguments[s];H("error",e,a)}}function H(e,r,a){{var s=N.ReactDebugCurrentFrame,d=s.getStackAddendum();d!==""&&(r+="%s",a=a.concat([d]));var p=a.map(function(f){return String(f)});p.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,p)}}var Z=!1,E=!1,We=!1,Ye=!1,De=!1,de;de=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===u||e===n||De||e===t||e===O||e===R||Ye||e===P||Z||E||We||typeof e=="object"&&e!==null&&(e.$$typeof===w||e.$$typeof===h||e.$$typeof===i||e.$$typeof===x||e.$$typeof===v||e.$$typeof===de||e.getModuleId!==void 0))}function Ue(e,r,a){var s=e.displayName;if(s)return s;var d=r.displayName||r.name||"";return d!==""?a+"("+d+")":a}function me(e){return e.displayName||"Context"}function F(e){if(e==null)return null;if(typeof e.tag=="number"&&A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case u:return"Fragment";case o:return"Portal";case n:return"Profiler";case t:return"StrictMode";case O:return"Suspense";case R:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case x:var r=e;return me(r)+".Consumer";case i:var a=e;return me(a._context)+".Provider";case v:return Ue(e,e.render,"ForwardRef");case h:var s=e.displayName||null;return s!==null?s:F(e.type)||"Memo";case w:{var d=e,p=d._payload,f=d._init;try{return F(f(p))}catch{return null}}}return null}var z=Object.assign,$=0,pe,Te,ve,ge,he,be,ye;function xe(){}xe.__reactDisabledLog=!0;function Be(){{if($===0){pe=console.log,Te=console.info,ve=console.warn,ge=console.error,he=console.group,be=console.groupCollapsed,ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}}function Ge(){{if($--,$===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:z({},e,{value:pe}),info:z({},e,{value:Te}),warn:z({},e,{value:ve}),error:z({},e,{value:ge}),group:z({},e,{value:he}),groupCollapsed:z({},e,{value:be}),groupEnd:z({},e,{value:ye})})}$<0&&A("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Q=N.ReactCurrentDispatcher,ee;function B(e,r,a){{if(ee===void 0)try{throw Error()}catch(d){var s=d.stack.trim().match(/\n( *(at )?)/);ee=s&&s[1]||""}return`
18
+ `+ee+e}}var te=!1,G;{var Ke=typeof WeakMap=="function"?WeakMap:Map;G=new Ke}function Re(e,r){if(!e||te)return"";{var a=G.get(e);if(a!==void 0)return a}var s;te=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=Q.current,Q.current=null,Be();try{if(r){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(_){s=_}Reflect.construct(e,[],f)}else{try{f.call()}catch(_){s=_}e.call(f.prototype)}}else{try{throw Error()}catch(_){s=_}e()}}catch(_){if(_&&s&&typeof _.stack=="string"){for(var c=_.stack.split(`
19
+ `),V=s.stack.split(`
20
+ `),g=c.length-1,b=V.length-1;g>=1&&b>=0&&c[g]!==V[b];)b--;for(;g>=1&&b>=0;g--,b--)if(c[g]!==V[b]){if(g!==1||b!==1)do if(g--,b--,b<0||c[g]!==V[b]){var j=`
21
+ `+c[g].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,j),j}while(g>=1&&b>=0);break}}}finally{te=!1,Q.current=p,Ge(),Error.prepareStackTrace=d}var L=e?e.displayName||e.name:"",I=L?B(L):"";return typeof e=="function"&&G.set(e,I),I}function Je(e,r,a){return Re(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,a){if(e==null)return"";if(typeof e=="function")return Re(e,Xe(e));if(typeof e=="string")return B(e);switch(e){case O:return B("Suspense");case R:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return Je(e.render);case h:return K(e.type,r,a);case w:{var s=e,d=s._payload,p=s._init;try{return K(p(d),r,a)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Ae={},Ve=N.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,a=K(e.type,e._source,r?r.type:null);Ve.setExtraStackFrame(a)}else Ve.setExtraStackFrame(null)}function He(e,r,a,s,d){{var p=Function.call.bind(U);for(var f in e)if(p(e,f)){var c=void 0;try{if(typeof e[f]!="function"){var V=Error((s||"React class")+": "+a+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw V.name="Invariant Violation",V}c=e[f](r,f,s,a,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(g){c=g}c&&!(c instanceof Error)&&(J(d),A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",s||"React class",a,f,typeof c),J(null)),c instanceof Error&&!(c.message in Ae)&&(Ae[c.message]=!0,J(d),A("Failed %s type: %s",a,c.message),J(null))}}}var Ze=Array.isArray;function ne(e){return Ze(e)}function Qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,a=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a}}function et(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function Ee(e){if(et(e))return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),we(e)}var _e=N.ReactCurrentOwner,tt={key:!0,ref:!0,__self:!0,__source:!0},Se,je;function nt(e){if(U.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function rt(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function at(e,r){typeof e.ref=="string"&&_e.current}function it(e,r){{var a=function(){Se||(Se=!0,A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}}function st(e,r){{var a=function(){je||(je=!0,A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};a.isReactWarning=!0,Object.defineProperty(e,"ref",{get:a,configurable:!0})}}var ot=function(e,r,a,s,d,p,f){var c={$$typeof:l,type:e,key:r,ref:a,props:f,_owner:p};return c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ut(e,r,a,s,d){{var p,f={},c=null,V=null;a!==void 0&&(Ee(a),c=""+a),rt(r)&&(Ee(r.key),c=""+r.key),nt(r)&&(V=r.ref,at(r,d));for(p in r)U.call(r,p)&&!tt.hasOwnProperty(p)&&(f[p]=r[p]);if(e&&e.defaultProps){var g=e.defaultProps;for(p in g)f[p]===void 0&&(f[p]=g[p])}if(c||V){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;c&&it(f,b),V&&st(f,b)}return ot(e,c,V,d,s,_e.current,f)}}var re=N.ReactCurrentOwner,Ce=N.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,a=K(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(a)}else Ce.setExtraStackFrame(null)}var ae;ae=!1;function ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function Oe(){{if(re.current){var e=F(re.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function lt(e){return""}var Pe={};function ct(e){{var r=Oe();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
24
+
25
+ Check the top-level render call using <`+a+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=ct(r);if(Pe[a])return;Pe[a]=!0;var s="";e&&e._owner&&e._owner!==re.current&&(s=" It was passed a child from "+F(e._owner.type)+"."),M(e),A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,s),M(null)}}function qe(e,r){{if(typeof e!="object")return;if(ne(e))for(var a=0;a<e.length;a++){var s=e[a];ie(s)&&ke(s,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var d=q(e);if(typeof d=="function"&&d!==e.entries)for(var p=d.call(e),f;!(f=p.next()).done;)ie(f.value)&&ke(f.value,r)}}}function ft(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===v||r.$$typeof===h))a=r.propTypes;else return;if(a){var s=F(r);He(a,e.props,"prop",s,e)}else if(r.PropTypes!==void 0&&!ae){ae=!0;var d=F(r);A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dt(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var s=r[a];if(s!=="children"&&s!=="key"){M(e),A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),M(null);break}}e.ref!==null&&(M(e),A("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var Ne={};function Fe(e,r,a,s,d,p){{var f=$e(e);if(!f){var c="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(c+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var V=lt();V?c+=V:c+=Oe();var g;e===null?g="null":ne(e)?g="array":e!==void 0&&e.$$typeof===l?(g="<"+(F(e.type)||"Unknown")+" />",c=" Did you accidentally export a JSX literal instead of a component?"):g=typeof e,A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",g,c)}var b=ut(e,r,a,d,p);if(b==null)return b;if(f){var j=r.children;if(j!==void 0)if(s)if(ne(j)){for(var L=0;L<j.length;L++)qe(j[L],e);Object.freeze&&Object.freeze(j)}else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else qe(j,e)}if(U.call(r,"key")){var I=F(e),_=Object.keys(r).filter(function(ht){return ht!=="key"}),se=_.length>0?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}";if(!Ne[I+se]){var gt=_.length>0?"{"+_.join(": ..., ")+": ...}":"{}";A(`A props object containing a "key" prop is being spread into JSX:
26
+ let props = %s;
27
+ <%s {...props} />
28
+ React keys must be passed directly to JSX without using spread:
29
+ let props = %s;
30
+ <%s key={someKey} {...props} />`,se,I,gt,I),Ne[I+se]=!0}}return e===u?dt(b):ft(b),b}}function mt(e,r,a){return Fe(e,r,a,!0)}function pt(e,r,a){return Fe(e,r,a,!1)}var Tt=pt,vt=mt;Y.Fragment=u,Y.jsx=Tt,Y.jsxs=vt}()),Y}process.env.NODE_ENV==="production"?X.exports=ze():X.exports=Ie();var m=X.exports;const le=(T,l,o,u)=>{const t=T.currentTime,n=T.createOscillator(),i=T.createGain();n.connect(i),i.connect(T.destination),l==="lofi"?o==="hover"?(n.type="sine",n.frequency.setValueAtTime(800,t),n.frequency.exponentialRampToValueAtTime(300,t+.05),i.gain.setValueAtTime(.1*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.04),n.start(t),n.stop(t+.05)):o==="click"?(n.type="triangle",n.frequency.setValueAtTime(300,t),n.frequency.exponentialRampToValueAtTime(50,t+.15),i.gain.setValueAtTime(.3*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.15),n.start(t),n.stop(t+.15)):o==="switch"&&(n.type="sine",n.frequency.setValueAtTime(200,t),n.frequency.linearRampToValueAtTime(400,t+.1),i.gain.setValueAtTime(.2*u,t),i.gain.linearRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):l==="glass"?o==="hover"?(n.type="sine",n.frequency.setValueAtTime(1200,t),n.frequency.exponentialRampToValueAtTime(1800,t+.05),i.gain.setValueAtTime(.08*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):o==="click"?(n.type="sine",n.frequency.setValueAtTime(800,t),n.frequency.exponentialRampToValueAtTime(100,t+.2),i.gain.setValueAtTime(.25*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.2),n.start(t),n.stop(t+.2)):o==="switch"&&(n.type="sine",n.frequency.setValueAtTime(1500,t),n.frequency.exponentialRampToValueAtTime(800,t+.3),i.gain.setValueAtTime(.15*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.3),n.start(t),n.stop(t+.3)):l==="retro"?o==="hover"?(n.type="square",n.frequency.setValueAtTime(150,t),n.frequency.linearRampToValueAtTime(100,t+.05),i.gain.setValueAtTime(.05*u,t),i.gain.linearRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):o==="click"?(n.type="square",n.frequency.setValueAtTime(440,t),n.frequency.setValueAtTime(880,t+.05),i.gain.setValueAtTime(.1*u,t),i.gain.linearRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="switch"&&(n.type="square",n.frequency.setValueAtTime(220,t),n.frequency.linearRampToValueAtTime(880,t+.1),i.gain.setValueAtTime(.1*u,t),i.gain.linearRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):l==="thock"?o==="hover"?(n.type="triangle",n.frequency.setValueAtTime(120,t),n.frequency.exponentialRampToValueAtTime(60,t+.05),i.gain.setValueAtTime(.15*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):o==="click"?(n.type="triangle",n.frequency.setValueAtTime(100,t),n.frequency.exponentialRampToValueAtTime(30,t+.1),i.gain.setValueAtTime(.4*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="switch"&&(n.type="triangle",n.frequency.setValueAtTime(200,t),n.frequency.exponentialRampToValueAtTime(80,t+.1),i.gain.setValueAtTime(.2*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):l==="console"?o==="hover"?(n.type="square",n.frequency.setValueAtTime(1e3,t),n.frequency.linearRampToValueAtTime(1500,t+.03),i.gain.setValueAtTime(.05*u,t),i.gain.linearRampToValueAtTime(.001,t+.03),n.start(t),n.stop(t+.03)):o==="click"?(n.type="square",n.frequency.setValueAtTime(800,t),n.frequency.linearRampToValueAtTime(1200,t+.05),i.gain.setValueAtTime(.1*u,t),i.gain.linearRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):o==="switch"&&(n.type="square",n.frequency.setValueAtTime(1200,t),n.frequency.linearRampToValueAtTime(2e3,t+.1),i.gain.setValueAtTime(.1*u,t),i.gain.linearRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):l==="minecraft"?o==="hover"?(n.type="sine",n.frequency.setValueAtTime(1500,t),n.frequency.linearRampToValueAtTime(1800,t+.05),i.gain.setValueAtTime(.1*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="click"?(n.type="sine",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(200,t+.1),i.gain.setValueAtTime(.3*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="switch"&&(n.type="square",n.frequency.setValueAtTime(250,t),n.frequency.exponentialRampToValueAtTime(50,t+.05),i.gain.setValueAtTime(.15*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):l==="mechanical"?o==="hover"?(n.type="square",n.frequency.setValueAtTime(2e3,t),n.frequency.exponentialRampToValueAtTime(1e3,t+.02),i.gain.setValueAtTime(.1*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.02),n.start(t),n.stop(t+.02)):o==="click"?(n.type="sawtooth",n.frequency.setValueAtTime(500,t),n.frequency.exponentialRampToValueAtTime(100,t+.1),i.gain.setValueAtTime(.3*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="switch"&&(n.type="square",n.frequency.setValueAtTime(300,t),n.frequency.linearRampToValueAtTime(600,t+.05),i.gain.setValueAtTime(.2*u,t),i.gain.linearRampToValueAtTime(.001,t+.05),n.start(t),n.stop(t+.05)):l==="scifi"?o==="hover"?(n.type="sine",n.frequency.setValueAtTime(1500,t),i.gain.setValueAtTime(.15*u,t),i.gain.linearRampToValueAtTime(.001,t+.03),n.start(t),n.stop(t+.03)):o==="click"?(n.type="sine",n.frequency.setValueAtTime(1e3,t),n.frequency.linearRampToValueAtTime(2500,t+.15),i.gain.setValueAtTime(.4*u,t),i.gain.linearRampToValueAtTime(.001,t+.15),n.start(t),n.stop(t+.15)):o==="switch"&&(n.type="sine",n.frequency.setValueAtTime(500,t),n.frequency.linearRampToValueAtTime(1500,t+.2),i.gain.setValueAtTime(.2*u,t),i.gain.linearRampToValueAtTime(.001,t+.2),n.start(t),n.stop(t+.2)):l==="bubble"&&(o==="hover"?(n.type="sine",n.frequency.setValueAtTime(600,t),n.frequency.exponentialRampToValueAtTime(300,t+.1),i.gain.setValueAtTime(.2*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.1),n.start(t),n.stop(t+.1)):o==="click"?(n.type="sine",n.frequency.setValueAtTime(800,t),n.frequency.exponentialRampToValueAtTime(200,t+.2),i.gain.setValueAtTime(.4*u,t),i.gain.exponentialRampToValueAtTime(.001,t+.2),n.start(t),n.stop(t+.2)):o==="switch"&&(n.type="triangle",n.frequency.setValueAtTime(300,t),n.frequency.exponentialRampToValueAtTime(600,t+.2),i.gain.setValueAtTime(.2*u,t),i.gain.linearRampToValueAtTime(.001,t+.2),n.start(t),n.stop(t+.2)))},ce=y.createContext(void 0),fe=()=>{const T=y.useContext(ce);if(!T)throw new Error("useSound must be used within a SoundProvider");return T},Me=({children:T})=>{const[l,o]=y.useState(!0),[u,t]=y.useState("glass"),[n,i]=y.useState(.5),x=y.useRef(null),v=y.useRef(0);y.useEffect(()=>{const h=()=>{if(l){if(!x.current){const w=window.AudioContext||window.webkitAudioContext;x.current=new w}x.current&&x.current.state==="suspended"&&x.current.resume()}};return window.addEventListener("click",h),window.addEventListener("touchstart",h),window.addEventListener("keydown",h),()=>{window.removeEventListener("click",h),window.removeEventListener("touchstart",h),window.removeEventListener("keydown",h)}},[l]);const R={isSoundEnabled:l,setIsSoundEnabled:o,soundProfile:u,setSoundProfile:t,volume:n,setVolume:i,playSound:(h="hover")=>{if(!l)return;if(!x.current){const k=window.AudioContext||window.webkitAudioContext;x.current=new k}const w=x.current.currentTime;if(w-v.current<.05)return;v.current=w;const P=x.current;P.state==="suspended"&&P.resume().catch(k=>console.error("AudioContext resume failed:",k)),le(P,u,h,n)}};return m.jsx(ce.Provider,{value:R,children:T})},Le=({activeColor:T="blue",isDark:l=!0})=>{const{isSoundEnabled:o,setIsSoundEnabled:u,soundProfile:t,setSoundProfile:n,volume:i,setVolume:x,playSound:v}=fe(),[O,R]=y.useState(!1),[h,w]=y.useState(null),[P,k]=y.useState(!1),D=E=>{w(E),k(!0),setTimeout(()=>k(!1),2e3)},q=y.useRef(null),N=()=>{q.current&&(clearTimeout(q.current),q.current=null)},A=()=>{q.current=setTimeout(()=>{R(!1)},1e3)};y.useEffect(()=>()=>{q.current&&clearTimeout(q.current)},[]);const H=[{id:"glass",name:"Glass",icon:S.Sparkles},{id:"thock",name:"Thock",icon:S.Keyboard},{id:"console",name:"Console",icon:S.Gamepad2},{id:"minecraft",name:"Minecraft",icon:S.Box},{id:"retro",name:"Retro",icon:S.Gamepad2},{id:"lofi",name:"Lofi",icon:S.Headphones},{id:"mechanical",name:"Clicky",icon:S.Keyboard},{id:"scifi",name:"Sci-Fi",icon:S.Zap},{id:"bubble",name:"Bubble",icon:S.Droplets}],Z=`text-${T}-500`;return m.jsxs("div",{className:"fixed top-4 right-16 md:right-24 z-50",children:[P&&m.jsx("div",{className:`absolute top-16 right-0 md:right-auto md:left-[-200px] px-4 py-2 rounded-xl shadow-lg backdrop-blur-md border animate-in slide-in-from-top-2 fade-in duration-300 z-[60] whitespace-nowrap
31
+ ${l?"bg-zinc-800/90 border-zinc-700 text-white":"bg-white/90 border-slate-200 text-slate-800"}`,children:m.jsx("span",{className:"text-xs font-bold",children:h})}),O&&m.jsxs("div",{onMouseEnter:N,onMouseLeave:A,className:`absolute top-full right-0 mt-4 p-4 rounded-3xl border w-[280px] backdrop-blur-xl shadow-2xl animate-in slide-in-from-top-5 fade-in z-50
32
+ ${l?"bg-zinc-900/95 border-zinc-800":"bg-white/95 border-white/60"}`,children:[m.jsxs("div",{className:"flex justify-between items-center mb-4",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(S.Music,{size:14,className:l?"text-zinc-400":"text-slate-400"}),m.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${l?"text-zinc-500":"text-slate-500"}`,children:"Sound Lab"})]}),m.jsx("button",{onClick:()=>{R(!1),v("click")},className:`p-1 rounded-full ${l?"hover:bg-zinc-800":"hover:bg-slate-100"}`,"aria-label":"Close sound menu",children:m.jsx(S.X,{size:14,className:l?"text-zinc-400":"text-slate-400"})})]}),m.jsxs("div",{className:`flex items-center justify-between p-3 rounded-xl mb-4 transition-colors
33
+ ${l?"bg-zinc-800/50":"bg-slate-50"}`,children:[m.jsx("span",{className:`text-xs font-medium ${l?"text-zinc-300":"text-slate-600"}`,children:"Master Audio"}),m.jsx("button",{onClick:()=>{u(!o),o?D("Sound Disabled"):(setTimeout(()=>v("switch"),50),D("Sound Enabled"))},className:`relative w-10 h-6 rounded-full transition-colors duration-300 ${o?`bg-${T}-500`:l?"bg-zinc-700":"bg-slate-300"}`,"aria-label":o?"Disable sound":"Enable sound",children:m.jsx("span",{className:`absolute top-1 left-1 w-4 h-4 rounded-full bg-white transition-transform duration-300 ${o?"translate-x-4":"translate-x-0"}`})})]}),m.jsxs("div",{className:`p-3 rounded-xl mb-4 transition-colors ${l?"bg-zinc-800/50":"bg-slate-50"}`,children:[m.jsxs("div",{className:"flex justify-between items-center mb-2",children:[m.jsx("span",{className:`text-xs font-medium ${l?"text-zinc-300":"text-slate-600"}`,children:"Volume"}),m.jsxs("span",{className:`text-xs font-bold ${Z}`,children:[Math.round(i*100),"%"]})]}),m.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:i,onChange:E=>{x(parseFloat(E.target.value)),o||u(!0)},className:`w-full h-1.5 rounded-full appearance-none cursor-pointer accent-${T}-500 ${l?"bg-zinc-700":"bg-slate-300"}`,"aria-label":"Volume control"})]}),m.jsx("div",{className:"grid grid-cols-3 gap-2",children:H.map(E=>m.jsxs("button",{onClick:()=>{n(E.id),o||u(!0),setTimeout(()=>v("click"),50),D(`Profile: ${E.name}`)},className:`flex flex-col items-center gap-1 p-2 rounded-xl border transition-all duration-300
34
+ ${t===E.id?l?`bg-${T}-500/10 border-${T}-500/50`:`bg-${T}-50 border-${T}-200`:l?"bg-transparent border-transparent hover:bg-zinc-800":"bg-transparent border-transparent hover:bg-slate-100"}`,children:[m.jsx(E.icon,{size:16,className:t===E.id?`text-${T}-500`:l?"text-zinc-500":"text-slate-400"}),m.jsx("span",{className:`text-[10px] font-medium ${t===E.id?l?"text-white":`text-${T}-700`:l?"text-zinc-500":"text-slate-500"}`,children:E.name})]},E.id))})]}),m.jsx("button",{onClick:()=>{R(!O),v("click")},className:`p-2 md:p-3 rounded-full transition-all duration-300 text-slate-400 hover:text-slate-600 hover:bg-slate-50
35
+ ${l?"hover:bg-zinc-800 hover:text-zinc-200":""}
36
+ ${O||o?l?"text-white":"text-slate-800":""}
37
+ `,"aria-label":"Open sound menu",children:o?m.jsx(S.Music,{size:20,className:"md:w-6 md:h-6 animate-pulse"}):m.jsx(S.Music,{size:20,className:"md:w-6 md:h-6"})})]})};C.SoundControls=Le,C.SoundProvider=Me,C.playSoundEffect=le,C.useSound=fe,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@manas-dev/sound-lab",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.umd.js",
6
+ "module": "./dist/index.es.js",
7
+ "types": "./dist/index.d.ts",
8
+ "description": "A lightweight React audio library providing interactive UI sound effects and a customizable Sound Lab control panel.",
9
+ "keywords": [
10
+ "react",
11
+ "sound",
12
+ "audio",
13
+ "ui-sfx",
14
+ "sound-effects",
15
+ "accessibility",
16
+ "hooks",
17
+ "interaction"
18
+ ],
19
+ "author": "Manas Barman",
20
+ "license": "MIT",
21
+ "homepage": "https://github.com/ManasBarman229/sound-lab#readme",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/ManasBarman229/sound-lab.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/ManasBarman229/sound-lab/issues"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "import": "./dist/index.es.js",
35
+ "require": "./dist/index.umd.js",
36
+ "types": "./dist/index.d.ts"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "LICENSE",
42
+ "README.md"
43
+ ],
44
+ "scripts": {
45
+ "build": "vite build",
46
+ "prepublishOnly": "npm run build"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=18.0.0",
50
+ "react-dom": ">=18.0.0",
51
+ "lucide-react": ">=0.200.0"
52
+ },
53
+ "devDependencies": {
54
+ "react": "^18.2.0",
55
+ "react-dom": "^18.2.0",
56
+ "lucide-react": "^0.263.1",
57
+ "vite": "^5.0.0",
58
+ "@vitejs/plugin-react": "^4.0.0",
59
+ "vite-plugin-dts": "^3.0.0",
60
+ "typescript": "^5.0.0",
61
+ "@types/react": "^18.0.0",
62
+ "@types/react-dom": "^18.0.0"
63
+ }
64
+ }