dirk-cfx-react 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.
@@ -0,0 +1,1020 @@
1
+ 'use strict';
2
+
3
+ var reactFontawesome = require('@fortawesome/react-fontawesome');
4
+ var core = require('@mantine/core');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var framerMotion = require('framer-motion');
7
+ var react = require('react');
8
+ var zustand = require('zustand');
9
+
10
+ // src/components/BorderedIcon.tsx
11
+
12
+ // src/utils/colorWithAlpha.ts
13
+ var colorNames = {
14
+ AliceBlue: { r: 240, g: 248, b: 255 },
15
+ AntiqueWhite: { r: 250, g: 235, b: 215 },
16
+ Aqua: { r: 0, g: 255, b: 255 },
17
+ Aquamarine: { r: 127, g: 255, b: 212 },
18
+ Azure: { r: 240, g: 255, b: 255 },
19
+ Beige: { r: 245, g: 245, b: 220 },
20
+ Bisque: { r: 255, g: 228, b: 196 },
21
+ Black: { r: 0, g: 0, b: 0 },
22
+ BlanchedAlmond: { r: 255, g: 235, b: 205 },
23
+ Blue: { r: 0, g: 0, b: 255 },
24
+ BlueViolet: { r: 138, g: 43, b: 226 },
25
+ Brown: { r: 165, g: 42, b: 42 },
26
+ BurlyWood: { r: 222, g: 184, b: 135 },
27
+ CadetBlue: { r: 95, g: 158, b: 160 },
28
+ Chartreuse: { r: 127, g: 255, b: 0 },
29
+ Chocolate: { r: 210, g: 105, b: 30 },
30
+ Coral: { r: 255, g: 127, b: 80 },
31
+ CornflowerBlue: { r: 100, g: 149, b: 237 },
32
+ Cornsilk: { r: 255, g: 248, b: 220 },
33
+ Crimson: { r: 220, g: 20, b: 60 },
34
+ Cyan: { r: 0, g: 255, b: 255 },
35
+ DarkBlue: { r: 0, g: 0, b: 139 },
36
+ DarkCyan: { r: 0, g: 139, b: 139 },
37
+ DarkGoldenRod: { r: 184, g: 134, b: 11 },
38
+ DarkGray: { r: 169, g: 169, b: 169 },
39
+ DarkGreen: { r: 0, g: 100, b: 0 },
40
+ DarkKhaki: { r: 189, g: 183, b: 107 },
41
+ DarkMagenta: { r: 139, g: 0, b: 139 },
42
+ DarkOliveGreen: { r: 85, g: 107, b: 47 },
43
+ DarkOrange: { r: 255, g: 140, b: 0 },
44
+ DarkOrchid: { r: 153, g: 50, b: 204 },
45
+ DarkRed: { r: 139, g: 0, b: 0 },
46
+ DarkSalmon: { r: 233, g: 150, b: 122 },
47
+ DarkSeaGreen: { r: 143, g: 188, b: 143 },
48
+ DarkSlateBlue: { r: 72, g: 61, b: 139 },
49
+ DarkSlateGray: { r: 47, g: 79, b: 79 },
50
+ DarkTurquoise: { r: 0, g: 206, b: 209 },
51
+ DarkViolet: { r: 148, g: 0, b: 211 },
52
+ DeepPink: { r: 255, g: 20, b: 147 },
53
+ DeepSkyBlue: { r: 0, g: 191, b: 255 },
54
+ DimGray: { r: 105, g: 105, b: 105 },
55
+ DodgerBlue: { r: 30, g: 144, b: 255 },
56
+ FireBrick: { r: 178, g: 34, b: 34 },
57
+ FloralWhite: { r: 255, g: 250, b: 240 },
58
+ ForestGreen: { r: 34, g: 139, b: 34 },
59
+ Fuchsia: { r: 255, g: 0, b: 255 },
60
+ Gainsboro: { r: 220, g: 220, b: 220 },
61
+ GhostWhite: { r: 248, g: 248, b: 255 },
62
+ Gold: { r: 255, g: 215, b: 0 },
63
+ GoldenRod: { r: 218, g: 165, b: 32 },
64
+ Gray: { r: 128, g: 128, b: 128 },
65
+ Green: { r: 0, g: 128, b: 0 },
66
+ GreenYellow: { r: 173, g: 255, b: 47 },
67
+ HoneyDew: { r: 240, g: 255, b: 240 },
68
+ HotPink: { r: 255, g: 105, b: 180 },
69
+ IndianRed: { r: 205, g: 92, b: 92 },
70
+ Indigo: { r: 75, g: 0, b: 130 },
71
+ Ivory: { r: 255, g: 255, b: 240 },
72
+ Khaki: { r: 240, g: 230, b: 140 },
73
+ Lavender: { r: 230, g: 230, b: 250 },
74
+ LavenderBlush: { r: 255, g: 240, b: 245 },
75
+ LawnGreen: { r: 124, g: 252, b: 0 },
76
+ LemonChiffon: { r: 255, g: 250, b: 205 },
77
+ LightBlue: { r: 173, g: 216, b: 230 },
78
+ LightCoral: { r: 240, g: 128, b: 128 },
79
+ LightCyan: { r: 224, g: 255, b: 255 },
80
+ LightGoldenRodYellow: { r: 250, g: 250, b: 210 },
81
+ LightGray: { r: 211, g: 211, b: 211 },
82
+ LightGreen: { r: 144, g: 238, b: 144 },
83
+ LightPink: { r: 255, g: 182, b: 193 },
84
+ LightSalmon: { r: 255, g: 160, b: 122 },
85
+ LightSeaGreen: { r: 32, g: 178, b: 170 },
86
+ LightSkyBlue: { r: 135, g: 206, b: 250 },
87
+ LightSlateGray: { r: 119, g: 136, b: 153 },
88
+ LightSteelBlue: { r: 176, g: 196, b: 222 },
89
+ LightYellow: { r: 255, g: 255, b: 224 },
90
+ Lime: { r: 0, g: 255, b: 0 },
91
+ LimeGreen: { r: 50, g: 205, b: 50 },
92
+ Linen: { r: 250, g: 240, b: 230 },
93
+ Magenta: { r: 255, g: 0, b: 255 },
94
+ Maroon: { r: 128, g: 0, b: 0 },
95
+ // Maroon
96
+ MediumAquaMarine: { r: 102, g: 205, b: 170 },
97
+ MediumBlue: { r: 0, g: 0, b: 205 },
98
+ MediumOrchid: { r: 186, g: 85, b: 211 },
99
+ MediumPurple: { r: 147, g: 112, b: 219 },
100
+ MediumSeaGreen: { r: 60, g: 179, b: 113 },
101
+ MediumSlateBlue: { r: 123, g: 104, b: 238 },
102
+ MediumSpringGreen: { r: 0, g: 250, b: 154 },
103
+ MediumTurquoise: { r: 72, g: 209, b: 204 },
104
+ MediumVioletRed: { r: 199, g: 21, b: 133 },
105
+ MidnightBlue: { r: 25, g: 25, b: 112 },
106
+ MintCream: { r: 245, g: 255, b: 250 },
107
+ MistyRose: { r: 255, g: 228, b: 225 },
108
+ Moccasin: { r: 255, g: 228, b: 181 },
109
+ NavajoWhite: { r: 255, g: 222, b: 173 },
110
+ Navy: { r: 0, g: 0, b: 128 },
111
+ OldLace: { r: 253, g: 245, b: 230 },
112
+ Olive: { r: 128, g: 128, b: 0 },
113
+ OliveDrab: { r: 107, g: 142, b: 35 },
114
+ Orange: { r: 255, g: 165, b: 0 },
115
+ OrangeRed: { r: 255, g: 69, b: 0 },
116
+ Orchid: { r: 218, g: 112, b: 214 },
117
+ PaleGoldenRod: { r: 238, g: 232, b: 170 },
118
+ PaleGreen: { r: 152, g: 251, b: 152 },
119
+ PaleTurquoise: { r: 175, g: 238, b: 238 },
120
+ PaleVioletRed: { r: 219, g: 112, b: 147 },
121
+ PapayaWhip: { r: 255, g: 239, b: 213 },
122
+ PeachPuff: { r: 255, g: 218, b: 185 },
123
+ Peru: { r: 205, g: 133, b: 63 },
124
+ Pink: { r: 255, g: 192, b: 203 },
125
+ Plum: { r: 221, g: 160, b: 221 },
126
+ PowderBlue: { r: 176, g: 224, b: 230 },
127
+ Purple: { r: 128, g: 0, b: 128 },
128
+ RebeccaPurple: { r: 102, g: 51, b: 153 },
129
+ Red: { r: 255, g: 0, b: 0 },
130
+ RosyBrown: { r: 188, g: 143, b: 143 },
131
+ RoyalBlue: { r: 65, g: 105, b: 225 },
132
+ SaddleBrown: { r: 139, g: 69, b: 19 },
133
+ Salmon: { r: 250, g: 128, b: 114 },
134
+ SandyBrown: { r: 244, g: 164, b: 96 },
135
+ SeaGreen: { r: 46, g: 139, b: 87 },
136
+ SeaShell: { r: 255, g: 245, b: 238 },
137
+ Sienna: { r: 160, g: 82, b: 45 },
138
+ Silver: { r: 192, g: 192, b: 192 },
139
+ SkyBlue: { r: 135, g: 206, b: 235 },
140
+ SlateBlue: { r: 106, g: 90, b: 205 },
141
+ SlateGray: { r: 112, g: 128, b: 144 },
142
+ Snow: { r: 255, g: 250, b: 250 },
143
+ SpringGreen: { r: 0, g: 255, b: 127 },
144
+ SteelBlue: { r: 70, g: 130, b: 180 },
145
+ Tan: { r: 210, g: 180, b: 140 },
146
+ Teal: { r: 0, g: 128, b: 128 },
147
+ Thistle: { r: 216, g: 191, b: 216 },
148
+ Tomato: { r: 255, g: 99, b: 71 },
149
+ Turquoise: { r: 64, g: 224, b: 208 },
150
+ Violet: { r: 238, g: 130, b: 238 },
151
+ Wheat: { r: 245, g: 222, b: 179 },
152
+ White: { r: 255, g: 255, b: 255 },
153
+ WhiteSmoke: { r: 245, g: 245, b: 245 },
154
+ Yellow: { r: 255, g: 255, b: 0 },
155
+ YellowGreen: { r: 154, g: 205, b: 50 }
156
+ };
157
+ function colorWithAlpha(color, alpha) {
158
+ const lowerCasedColor = color.toLowerCase();
159
+ if (colorNames[lowerCasedColor]) {
160
+ const rgb = colorNames[lowerCasedColor];
161
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha})`;
162
+ }
163
+ if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
164
+ const hex = color.slice(1);
165
+ const bigint = parseInt(hex, 16);
166
+ const r = bigint >> 16 & 255;
167
+ const g = bigint >> 8 & 255;
168
+ const b = bigint & 255;
169
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
170
+ }
171
+ if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
172
+ const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
173
+ if (result) {
174
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha})`;
175
+ }
176
+ }
177
+ return color;
178
+ }
179
+ function BorderedIcon(props) {
180
+ const theme = core.useMantineTheme();
181
+ return /* @__PURE__ */ jsxRuntime.jsx(
182
+ reactFontawesome.FontAwesomeIcon,
183
+ {
184
+ icon: props.icon,
185
+ color: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][theme.primaryShade], props.hovered ? 0.9 : 0.9),
186
+ style: {
187
+ // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
188
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
189
+ padding: props.p || theme.spacing.xs,
190
+ transition: "all 0.2s ease-in-out",
191
+ aspectRatio: "1/1",
192
+ fontSize: props.fontSize ? props.fontSize : "2.5vh",
193
+ borderRadius: theme.radius.xs,
194
+ // border: `2px solid var(--mantine-primary-color-9)`,
195
+ outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
196
+ boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7], 0.5)}`
197
+ }
198
+ }
199
+ );
200
+ }
201
+ var MotionFlex = framerMotion.motion(core.Flex);
202
+ var MotionText = framerMotion.motion(core.Text);
203
+ var MotionIcon = framerMotion.motion(reactFontawesome.FontAwesomeIcon);
204
+ var MotionImage = framerMotion.motion(core.Image);
205
+ function Counter(props) {
206
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
207
+ MotionFlex,
208
+ {
209
+ initial: { opacity: 0 },
210
+ animate: { opacity: 1 },
211
+ exit: { opacity: 0 },
212
+ fz: "1.25vh",
213
+ h: "1.75vh",
214
+ justify: "center",
215
+ align: "center",
216
+ bg: props.color || "rgba(0, 0, 0, 0.51)",
217
+ style: {
218
+ borderRadius: "50%",
219
+ aspectRatio: "1/1",
220
+ marginBottom: "0.3vh",
221
+ fontFamily: "Akrobat Bold",
222
+ boxShadow: "0 0 5px rgba(0, 0, 0, 0.3)"
223
+ },
224
+ children: props.count
225
+ },
226
+ "counter"
227
+ ) });
228
+ }
229
+ var FloatingParticles = ({
230
+ icons = [],
231
+ particleCount = 55,
232
+ color = "#00a552ff",
233
+ size = 32,
234
+ speed = "slow",
235
+ opacity = 0.3,
236
+ style = {},
237
+ mouseRepelDistance = 150,
238
+ mouseRepelStrength = 50,
239
+ backgroundColor = "transparent"
240
+ }) => {
241
+ const containerRef = react.useRef(null);
242
+ const [particles, setParticles] = react.useState([]);
243
+ const mouseX = framerMotion.useMotionValue(0);
244
+ const mouseY = framerMotion.useMotionValue(0);
245
+ const durationMap = {
246
+ slow: { base: 10, variance: 10 },
247
+ medium: { base: 2, variance: 2 },
248
+ fast: { base: 4, variance: 2 }
249
+ };
250
+ const duration = durationMap[speed];
251
+ const seededRandom = (seed) => {
252
+ const x = Math.sin(seed) * 1e4;
253
+ return x - Math.floor(x);
254
+ };
255
+ react.useEffect(() => {
256
+ if (!containerRef.current) return;
257
+ const bounds = containerRef.current.getBoundingClientRect();
258
+ const newParticles = [...Array(particleCount)].map((_, i) => {
259
+ const seedX = i * 123.456;
260
+ const seedY = i * 789.012;
261
+ const seedDuration = i * 345.678;
262
+ const baseX = seededRandom(seedX) * bounds.width;
263
+ const baseY = seededRandom(seedY) * bounds.height;
264
+ return {
265
+ id: i,
266
+ baseX,
267
+ baseY,
268
+ currentX: baseX,
269
+ currentY: baseY,
270
+ icon: icons.length > 0 ? icons[i % icons.length] : null,
271
+ animationDuration: duration.base + seededRandom(seedDuration) * duration.variance
272
+ };
273
+ });
274
+ setParticles(newParticles);
275
+ }, [particleCount, icons.length, duration.base, duration.variance]);
276
+ react.useEffect(() => {
277
+ if (!containerRef.current) return;
278
+ const handleMouseMove = (e) => {
279
+ const bounds = containerRef.current.getBoundingClientRect();
280
+ const x = e.clientX - bounds.left;
281
+ const y = e.clientY - bounds.top;
282
+ mouseX.set(x);
283
+ mouseY.set(y);
284
+ setParticles(
285
+ (prevParticles) => prevParticles.map((particle) => {
286
+ const dx = x - particle.baseX;
287
+ const dy = y - particle.baseY;
288
+ const distance = Math.sqrt(dx * dx + dy * dy);
289
+ if (distance < mouseRepelDistance && distance > 0) {
290
+ const force = (mouseRepelDistance - distance) / mouseRepelDistance;
291
+ const repelX = dx / distance * force * mouseRepelStrength * -1;
292
+ const repelY = dy / distance * force * mouseRepelStrength * -1;
293
+ return {
294
+ ...particle,
295
+ currentX: particle.baseX + repelX,
296
+ currentY: particle.baseY + repelY
297
+ };
298
+ } else {
299
+ return {
300
+ ...particle,
301
+ currentX: particle.baseX,
302
+ currentY: particle.baseY
303
+ };
304
+ }
305
+ })
306
+ );
307
+ };
308
+ const handleMouseLeave = () => {
309
+ setParticles(
310
+ (prevParticles) => prevParticles.map((particle) => ({
311
+ ...particle,
312
+ currentX: particle.baseX,
313
+ currentY: particle.baseY
314
+ }))
315
+ );
316
+ };
317
+ const container = containerRef.current;
318
+ container.addEventListener("mousemove", handleMouseMove);
319
+ container.addEventListener("mouseleave", handleMouseLeave);
320
+ return () => {
321
+ container.removeEventListener("mousemove", handleMouseMove);
322
+ container.removeEventListener("mouseleave", handleMouseLeave);
323
+ };
324
+ }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
325
+ react.useEffect(() => {
326
+ const handleResize = () => {
327
+ if (!containerRef.current) return;
328
+ const bounds = containerRef.current.getBoundingClientRect();
329
+ setParticles(
330
+ (prevParticles) => prevParticles.map((particle, i) => {
331
+ const seedX = i * 123.456 + bounds.width;
332
+ const seedY = i * 789.012 + bounds.height;
333
+ const newBaseX = seededRandom(seedX) * bounds.width;
334
+ const newBaseY = seededRandom(seedY) * bounds.height;
335
+ return {
336
+ ...particle,
337
+ baseX: newBaseX,
338
+ baseY: newBaseY,
339
+ currentX: newBaseX,
340
+ currentY: newBaseY
341
+ };
342
+ })
343
+ );
344
+ };
345
+ window.addEventListener("resize", handleResize);
346
+ return () => window.removeEventListener("resize", handleResize);
347
+ }, []);
348
+ return /* @__PURE__ */ jsxRuntime.jsx(
349
+ "div",
350
+ {
351
+ ref: containerRef,
352
+ style: {
353
+ position: "absolute",
354
+ overflow: "hidden",
355
+ width: "100%",
356
+ height: "100%",
357
+ zIndex: -1,
358
+ backgroundColor,
359
+ ...style
360
+ },
361
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsxRuntime.jsx(
362
+ framerMotion.motion.div,
363
+ {
364
+ style: {
365
+ position: "absolute",
366
+ width: size,
367
+ height: size,
368
+ color,
369
+ opacity,
370
+ left: 0,
371
+ top: 0
372
+ },
373
+ animate: {
374
+ x: particle.currentX,
375
+ y: particle.currentY,
376
+ scale: [0.8, 1.1, 0.8],
377
+ opacity: [opacity * 0.5, opacity, opacity * 0.5],
378
+ // random rotate between 0 and 360 so that not all particles rotate the same
379
+ rotate: particle.id % 2 === 0 ? [0, 360] : [360, 0]
380
+ },
381
+ transition: {
382
+ x: { type: "spring", stiffness: 150, damping: 20 },
383
+ y: { type: "spring", stiffness: 150, damping: 20 },
384
+ rotate: {
385
+ duration: particle.animationDuration,
386
+ repeat: Infinity,
387
+ ease: "linear"
388
+ },
389
+ scale: {
390
+ duration: particle.animationDuration,
391
+ repeat: Infinity,
392
+ delay: seededRandom(particle.id * 111.222) * 5,
393
+ ease: "easeInOut"
394
+ },
395
+ opacity: {
396
+ duration: particle.animationDuration,
397
+ repeat: Infinity,
398
+ delay: seededRandom(particle.id * 333.444) * 5,
399
+ ease: "easeInOut"
400
+ }
401
+ },
402
+ children: particle.icon ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(reactFontawesome.FontAwesomeIcon, { icon: particle.icon, style: { width: "70%", height: "70%" } }) }) : /* @__PURE__ */ jsxRuntime.jsx(
403
+ "div",
404
+ {
405
+ style: {
406
+ width: "100%",
407
+ height: "100%",
408
+ borderRadius: "50%",
409
+ backgroundColor: color
410
+ }
411
+ }
412
+ )
413
+ },
414
+ particle.id
415
+ )) })
416
+ }
417
+ );
418
+ };
419
+ function Icon(props) {
420
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
421
+ }
422
+ function InfoBox(props) {
423
+ const theme = core.useMantineTheme();
424
+ return /* @__PURE__ */ jsxRuntime.jsxs(
425
+ core.Flex,
426
+ {
427
+ w: "fit-content",
428
+ h: "fit-content",
429
+ style: {
430
+ borderRadius: theme.radius.xs,
431
+ overflow: "hidden",
432
+ border: `0.2vh solid rgba(77,77,77,0.3)`
433
+ },
434
+ align: "center",
435
+ children: [
436
+ /* @__PURE__ */ jsxRuntime.jsx(
437
+ core.Flex,
438
+ {
439
+ miw: "4vh",
440
+ p: "xxs",
441
+ bg: "rgba(77,77,77,0.2)",
442
+ direction: "column",
443
+ justify: "center",
444
+ align: "center",
445
+ children: /* @__PURE__ */ jsxRuntime.jsx(
446
+ core.Text,
447
+ {
448
+ c: "lightgrey",
449
+ size: "xxs",
450
+ style: {
451
+ fontFamily: "Akrobat Bold",
452
+ letterSpacing: "0.05em",
453
+ textTransform: "uppercase"
454
+ },
455
+ children: props.leftSide
456
+ }
457
+ )
458
+ }
459
+ ),
460
+ /* @__PURE__ */ jsxRuntime.jsx(
461
+ core.Flex,
462
+ {
463
+ p: "xxs",
464
+ flex: 1,
465
+ miw: "4vh",
466
+ bg: "rgba(77,77,77,0.5)",
467
+ direction: "column",
468
+ align: "center",
469
+ justify: "center",
470
+ children: /* @__PURE__ */ jsxRuntime.jsx(
471
+ core.Text,
472
+ {
473
+ c: "lightgrey",
474
+ size: "xxs",
475
+ style: {
476
+ fontFamily: "Akrobat Bold",
477
+ letterSpacing: "0.05em",
478
+ textTransform: "uppercase"
479
+ },
480
+ children: props.rightSide
481
+ }
482
+ )
483
+ }
484
+ )
485
+ ]
486
+ }
487
+ );
488
+ }
489
+ function InputContainer(props) {
490
+ const theme = core.useMantineTheme();
491
+ return /* @__PURE__ */ jsxRuntime.jsxs(
492
+ MotionFlex,
493
+ {
494
+ w: props.w || "100%",
495
+ flex: props.flex,
496
+ direction: "column",
497
+ h: props.h,
498
+ gap: props.title ? "xs" : 0,
499
+ bg: props.bg || "rgba(69, 69, 69, 0.42)",
500
+ p: "sm",
501
+ style: {
502
+ borderRadius: theme.radius.xs,
503
+ boxShadow: theme.shadows.sm,
504
+ overflow: "hidden",
505
+ outline: props.error ? `1px solid rgba(255, 100, 100, 0.8)` : "none"
506
+ },
507
+ variants: props.variants,
508
+ children: [
509
+ /* @__PURE__ */ jsxRuntime.jsxs(
510
+ core.Flex,
511
+ {
512
+ align: "center",
513
+ gap: "xs",
514
+ children: [
515
+ /* @__PURE__ */ jsxRuntime.jsxs(
516
+ core.Flex,
517
+ {
518
+ direction: "column",
519
+ gap: "xxs",
520
+ children: [
521
+ props.title && /* @__PURE__ */ jsxRuntime.jsx(
522
+ core.Text,
523
+ {
524
+ size: "sm",
525
+ style: {
526
+ lineHeight: "1.25vh",
527
+ fontFamily: "Akrobat Bold",
528
+ letterSpacing: "0.05em",
529
+ textTransform: "uppercase"
530
+ },
531
+ children: props.title
532
+ }
533
+ ),
534
+ props.description && /* @__PURE__ */ jsxRuntime.jsx(
535
+ core.Text,
536
+ {
537
+ size: "xs",
538
+ c: "rgba(255, 255, 255, 0.8)",
539
+ fw: 400,
540
+ children: props.description
541
+ }
542
+ )
543
+ ]
544
+ }
545
+ ),
546
+ props.error && /* @__PURE__ */ jsxRuntime.jsx(
547
+ core.Text,
548
+ {
549
+ size: "xs",
550
+ c: theme.colors.red[9],
551
+ fw: 600,
552
+ mb: "auto",
553
+ lh: "0.8",
554
+ children: props.error
555
+ }
556
+ ),
557
+ /* @__PURE__ */ jsxRuntime.jsx(
558
+ core.Flex,
559
+ {
560
+ ml: "auto",
561
+ children: props.rightSection
562
+ }
563
+ )
564
+ ]
565
+ }
566
+ ),
567
+ props.children
568
+ ]
569
+ }
570
+ );
571
+ }
572
+
573
+ // src/hooks/useAudio/click_sound.mp3
574
+ var click_sound_default = "../click_sound-PNCRRTM4.mp3";
575
+
576
+ // src/hooks/useAudio/hover_sound.mp3
577
+ var hover_sound_default = "../hover_sound-NBUA222C.mp3";
578
+
579
+ // src/hooks/useAudio/store.ts
580
+ var useAudio = zustand.create(() => {
581
+ const audioRefs = {};
582
+ const sounds = {
583
+ click: click_sound_default,
584
+ hover: hover_sound_default
585
+ };
586
+ for (const [key, src] of Object.entries(sounds)) {
587
+ audioRefs[key] = new Audio(src);
588
+ }
589
+ return {
590
+ play: (sound) => {
591
+ const audio = audioRefs[sound];
592
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
593
+ audio.currentTime = 0;
594
+ audio.volume = 0.1;
595
+ audio.play();
596
+ },
597
+ stop: (sound) => {
598
+ const audio = audioRefs[sound];
599
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
600
+ audio.pause();
601
+ audio.currentTime = 0;
602
+ }
603
+ };
604
+ });
605
+
606
+ // src/utils/misc.ts
607
+ var isEnvBrowser = () => !window.invokeNative;
608
+
609
+ // src/utils/fetchNui.ts
610
+ async function fetchNui(eventName, data, mockData) {
611
+ const options = {
612
+ method: "post",
613
+ headers: {
614
+ "Content-Type": "application/json; charset=UTF-8"
615
+ },
616
+ body: JSON.stringify(data)
617
+ };
618
+ console.log("Mock Data:", mockData);
619
+ console.log("Is Env Browser:", isEnvBrowser());
620
+ const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
621
+ const resp = await fetch(`https://${resourceName}/${eventName}`, options);
622
+ const respFormatted = await resp.json();
623
+ return respFormatted;
624
+ }
625
+ function fetchOnLoad(eventName, data, mockData) {
626
+ return fetchNui(eventName, data, mockData).catch((err) => {
627
+ console.error(`[fetchOnLoad] Failed for ${eventName}:`, err);
628
+ throw err;
629
+ });
630
+ }
631
+ var localeStore = zustand.create((set, get) => {
632
+ return {
633
+ locales: {
634
+ "OccupantsDesc": "Here you can view and manage the occupants of your traphouse. These occupants can be used mainly for selling drugs to the NPCs surrounding your traphouse. However they have other uses to so be careful who you add as an occupant."
635
+ },
636
+ locale: (key, ...args) => {
637
+ const exists = get().locales[key];
638
+ let translation = exists || key;
639
+ if (args.length) {
640
+ translation = translation.replace(/%s/g, () => String(args.shift() || ""));
641
+ }
642
+ return translation;
643
+ }
644
+ };
645
+ });
646
+ localeStore.getState().locale;
647
+ fetchOnLoad("GET_LOCALES").then((data) => {
648
+ localeStore.setState({ locales: data });
649
+ });
650
+ function SegmentedControl(props) {
651
+ const theme = core.useMantineTheme();
652
+ const play = useAudio((state) => state.play);
653
+ const handleChange = (newValue) => {
654
+ if (props.sounds) play("click");
655
+ if (props.onChange) {
656
+ props.onChange(newValue);
657
+ }
658
+ };
659
+ return /* @__PURE__ */ jsxRuntime.jsx(
660
+ core.Flex,
661
+ {
662
+ bg: "rgba(33, 33, 33, 0.6)",
663
+ w: props.w || "fit-content",
664
+ style: {
665
+ borderRadius: theme.radius.xs,
666
+ overflow: "hidden"
667
+ },
668
+ ...props,
669
+ children: props.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
670
+ framerMotion.motion.div,
671
+ {
672
+ initial: { x: -100, opacity: 0 },
673
+ animate: { x: 0, opacity: 1 },
674
+ transition: { duration: 0.3, delay: index * 0.1, ease: "easeInOut" },
675
+ style: {
676
+ display: "flex",
677
+ flexDirection: "row",
678
+ alignItems: "center",
679
+ flex: 1
680
+ },
681
+ children: /* @__PURE__ */ jsxRuntime.jsx(
682
+ Segment,
683
+ {
684
+ label: item.label,
685
+ value: item.value,
686
+ icon: item.icon,
687
+ rightSection: item.rightSection,
688
+ fz: props.fz,
689
+ selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
690
+ onClick: () => {
691
+ if (props.multi) {
692
+ const newValue = Array.isArray(props.value) ? props.value.includes(item.value) ? props.value.filter((v) => v !== item.value) : [...props.value, item.value] : [item.value];
693
+ handleChange(newValue);
694
+ } else {
695
+ handleChange(item.value);
696
+ }
697
+ }
698
+ },
699
+ item.value
700
+ )
701
+ },
702
+ index
703
+ ))
704
+ }
705
+ );
706
+ }
707
+ function Segment(props) {
708
+ const theme = core.useMantineTheme();
709
+ return /* @__PURE__ */ jsxRuntime.jsxs(
710
+ MotionFlex,
711
+ {
712
+ onClick: props.onClick,
713
+ w: "100%",
714
+ direction: "column",
715
+ align: "center",
716
+ h: "100%",
717
+ bg: props.selected ? colorWithAlpha(theme.colors[theme.primaryColor][theme.primaryShade], 0.2) : "transparent",
718
+ pos: "relative",
719
+ style: {
720
+ // position: "relative",
721
+ cursor: "pointer"
722
+ },
723
+ justify: "center",
724
+ whileHover: { scale: 1.05 },
725
+ whileTap: { scale: 0.95 },
726
+ children: [
727
+ /* @__PURE__ */ jsxRuntime.jsxs(
728
+ core.Flex,
729
+ {
730
+ align: "center",
731
+ gap: "xs",
732
+ p: "xs",
733
+ children: [
734
+ props.icon && /* @__PURE__ */ jsxRuntime.jsx(
735
+ MotionIcon,
736
+ {
737
+ icon: props.icon,
738
+ initial: {
739
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
740
+ },
741
+ animate: {
742
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
743
+ },
744
+ exit: {
745
+ color: "inherit"
746
+ },
747
+ style: {
748
+ fontSize: theme.fontSizes.xs,
749
+ marginBottom: "0.2vh"
750
+ }
751
+ }
752
+ ),
753
+ /* @__PURE__ */ jsxRuntime.jsx(
754
+ MotionText,
755
+ {
756
+ size: props.fz || "xs",
757
+ initial: {
758
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
759
+ },
760
+ animate: {
761
+ color: props.selected ? theme.colors[theme.primaryColor][5] : "inherit"
762
+ },
763
+ exit: {
764
+ color: "inherit"
765
+ },
766
+ style: {
767
+ fontFamily: "Akrobat Bold",
768
+ letterSpacing: "0.1em",
769
+ textTransform: "uppercase"
770
+ },
771
+ children: props.label.toUpperCase()
772
+ }
773
+ ),
774
+ props.rightSection
775
+ ]
776
+ }
777
+ ),
778
+ /* @__PURE__ */ jsxRuntime.jsx(
779
+ framerMotion.motion.div,
780
+ {
781
+ initial: false,
782
+ animate: {
783
+ scaleX: props.selected ? 1 : 0,
784
+ opacity: props.selected ? 1 : 0
785
+ },
786
+ transition: {
787
+ duration: 0.3,
788
+ ease: [0.4, 0, 0.2, 1]
789
+ // Custom easing curve for smooth feel
790
+ },
791
+ style: {
792
+ position: "absolute",
793
+ bottom: 0,
794
+ left: 0,
795
+ right: 0,
796
+ height: "0.2vh",
797
+ backgroundColor: theme.colors[theme.primaryColor][5],
798
+ transformOrigin: "center"
799
+ }
800
+ }
801
+ )
802
+ ]
803
+ }
804
+ );
805
+ }
806
+ var NavigationContext = react.createContext(null);
807
+ function useNavigation(selector) {
808
+ const navigation = react.useContext(NavigationContext);
809
+ if (!navigation) {
810
+ throw new Error("useNavigation must be used within a NavigationProvider");
811
+ }
812
+ return zustand.useStore(navigation, selector);
813
+ }
814
+ function useNavigationStore() {
815
+ const navigation = react.useContext(NavigationContext);
816
+ if (!navigation) {
817
+ throw new Error("useNavigationStore must be used within a NavigationProvider");
818
+ }
819
+ return navigation;
820
+ }
821
+ function NavigationProvider({ children, defaultPage }) {
822
+ const storeRef = react.useRef(
823
+ zustand.create(() => ({
824
+ pageId: defaultPage || "home"
825
+ }))
826
+ );
827
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: storeRef.current, children });
828
+ }
829
+ function NavBar(props) {
830
+ const pageId = useNavigation((state) => state.pageId);
831
+ const store = useNavigationStore();
832
+ return /* @__PURE__ */ jsxRuntime.jsx(
833
+ SegmentedControl,
834
+ {
835
+ sounds: true,
836
+ w: "100%",
837
+ value: pageId,
838
+ items: props.items,
839
+ onChange: (value) => {
840
+ store.setState({ pageId: value });
841
+ }
842
+ }
843
+ );
844
+ }
845
+ var containerVariants = {
846
+ hidden: { opacity: 0 },
847
+ visible: {
848
+ opacity: 1,
849
+ transition: {
850
+ staggerChildren: 0.1,
851
+ delayChildren: 0.05
852
+ }
853
+ },
854
+ exit: {
855
+ opacity: 0,
856
+ transition: {
857
+ staggerChildren: 0.05,
858
+ staggerDirection: -1
859
+ }
860
+ }
861
+ };
862
+ var itemVariants = {
863
+ hidden: {
864
+ opacity: 0,
865
+ x: 20,
866
+ scale: 0.95
867
+ },
868
+ visible: {
869
+ opacity: 1,
870
+ x: 0,
871
+ scale: 1,
872
+ transition: {
873
+ type: "spring",
874
+ stiffness: 300,
875
+ damping: 24
876
+ }
877
+ },
878
+ exit: {
879
+ opacity: 0,
880
+ x: -10,
881
+ scale: 0.95,
882
+ transition: {
883
+ duration: 0.2
884
+ }
885
+ }
886
+ };
887
+ function SegmentedProgress(props) {
888
+ const progressPerSegment = 100 / props.segments;
889
+ const filledSegments = Math.floor(props.progress / progressPerSegment);
890
+ const partialFill = props.progress % progressPerSegment / progressPerSegment;
891
+ return /* @__PURE__ */ jsxRuntime.jsx(
892
+ MotionFlex,
893
+ {
894
+ w: "100%",
895
+ h: props.size || "1vh",
896
+ gap: "xs",
897
+ initial: "hidden",
898
+ animate: "visible",
899
+ variants: containerVariants,
900
+ children: [...Array(props.segments)].map((_, index) => {
901
+ const isFilled = index < filledSegments;
902
+ const isPartial = index === filledSegments;
903
+ return /* @__PURE__ */ jsxRuntime.jsx(
904
+ framerMotion.motion.div,
905
+ {
906
+ variants: itemVariants,
907
+ style: {
908
+ width: `${100 / props.segments}%`,
909
+ // Ensures equal width distribution
910
+ height: "100%",
911
+ background: isFilled ? "rgba(255, 255, 255, 0.8)" : isPartial ? `linear-gradient(to right, rgba(255, 255, 255, 0.8) ${partialFill * 100}%, rgba(255, 255, 255, 0.2) ${partialFill * 100}%)` : "rgba(255, 255, 255, 0.2)",
912
+ transition: "background 0.3s ease"
913
+ }
914
+ },
915
+ index
916
+ );
917
+ })
918
+ }
919
+ );
920
+ }
921
+ function Title(props) {
922
+ const theme = core.useMantineTheme();
923
+ return /* @__PURE__ */ jsxRuntime.jsx(
924
+ core.Flex,
925
+ {
926
+ mt: props.mt,
927
+ direction: "column",
928
+ bg: props.bg || "transparent",
929
+ gap: "xs",
930
+ w: props.w || "100%",
931
+ p: props.p || "0",
932
+ style: {
933
+ userSelect: "none",
934
+ borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
935
+ },
936
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
937
+ core.Flex,
938
+ {
939
+ align: "center",
940
+ justify: "center",
941
+ children: [
942
+ /* @__PURE__ */ jsxRuntime.jsxs(
943
+ core.Flex,
944
+ {
945
+ align: "center",
946
+ gap: "sm",
947
+ pr: "xs",
948
+ children: [
949
+ /* @__PURE__ */ jsxRuntime.jsx(
950
+ BorderedIcon,
951
+ {
952
+ icon: props.icon,
953
+ fontSize: theme.fontSizes.md,
954
+ color: props.iconColor
955
+ }
956
+ ),
957
+ /* @__PURE__ */ jsxRuntime.jsxs(
958
+ core.Flex,
959
+ {
960
+ direction: "column",
961
+ gap: "0.25vh",
962
+ children: [
963
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
964
+ lineHeight: theme.fontSizes.md,
965
+ fontFamily: "Akrobat Bold",
966
+ letterSpacing: "0.05em",
967
+ textTransform: "uppercase"
968
+ }, children: props.title }),
969
+ /* @__PURE__ */ jsxRuntime.jsx(
970
+ core.Text,
971
+ {
972
+ size: "xs",
973
+ c: "grey",
974
+ style: { whiteSpace: "normal", wordWrap: "break-word" },
975
+ children: props.description
976
+ }
977
+ )
978
+ ]
979
+ }
980
+ )
981
+ ]
982
+ }
983
+ ),
984
+ /* @__PURE__ */ jsxRuntime.jsx(
985
+ core.Flex,
986
+ {
987
+ ml: "auto",
988
+ align: "center",
989
+ gap: "xs",
990
+ children: props.rightSection
991
+ }
992
+ )
993
+ ]
994
+ }
995
+ )
996
+ }
997
+ );
998
+ }
999
+
1000
+ exports.BorderedIcon = BorderedIcon;
1001
+ exports.Counter = Counter;
1002
+ exports.FloatingParticles = FloatingParticles;
1003
+ exports.Icon = Icon;
1004
+ exports.InfoBox = InfoBox;
1005
+ exports.InputContainer = InputContainer;
1006
+ exports.MotionFlex = MotionFlex;
1007
+ exports.MotionIcon = MotionIcon;
1008
+ exports.MotionImage = MotionImage;
1009
+ exports.MotionText = MotionText;
1010
+ exports.NavBar = NavBar;
1011
+ exports.NavigationContext = NavigationContext;
1012
+ exports.NavigationProvider = NavigationProvider;
1013
+ exports.Segment = Segment;
1014
+ exports.SegmentedControl = SegmentedControl;
1015
+ exports.SegmentedProgress = SegmentedProgress;
1016
+ exports.Title = Title;
1017
+ exports.useNavigation = useNavigation;
1018
+ exports.useNavigationStore = useNavigationStore;
1019
+ //# sourceMappingURL=index.js.map
1020
+ //# sourceMappingURL=index.js.map