dirk-cfx-react 1.1.2 → 1.1.6

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,1413 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var zustand = require('zustand');
5
+ var reactFontawesome = require('@fortawesome/react-fontawesome');
6
+ var core = require('@mantine/core');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var framerMotion = require('framer-motion');
9
+ var clickSoundUrl = require('../click_sound-PNCRRTM4.mp3');
10
+ var hoverSoundUrl = require('../hover_sound-NBUA222C.mp3');
11
+ var hooks = require('@mantine/hooks');
12
+
13
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
14
+
15
+ var clickSoundUrl__default = /*#__PURE__*/_interopDefault(clickSoundUrl);
16
+ var hoverSoundUrl__default = /*#__PURE__*/_interopDefault(hoverSoundUrl);
17
+
18
+ // src/utils/colorWithAlpha.ts
19
+ var colorNames = {
20
+ AliceBlue: { r: 240, g: 248, b: 255 },
21
+ AntiqueWhite: { r: 250, g: 235, b: 215 },
22
+ Aqua: { r: 0, g: 255, b: 255 },
23
+ Aquamarine: { r: 127, g: 255, b: 212 },
24
+ Azure: { r: 240, g: 255, b: 255 },
25
+ Beige: { r: 245, g: 245, b: 220 },
26
+ Bisque: { r: 255, g: 228, b: 196 },
27
+ Black: { r: 0, g: 0, b: 0 },
28
+ BlanchedAlmond: { r: 255, g: 235, b: 205 },
29
+ Blue: { r: 0, g: 0, b: 255 },
30
+ BlueViolet: { r: 138, g: 43, b: 226 },
31
+ Brown: { r: 165, g: 42, b: 42 },
32
+ BurlyWood: { r: 222, g: 184, b: 135 },
33
+ CadetBlue: { r: 95, g: 158, b: 160 },
34
+ Chartreuse: { r: 127, g: 255, b: 0 },
35
+ Chocolate: { r: 210, g: 105, b: 30 },
36
+ Coral: { r: 255, g: 127, b: 80 },
37
+ CornflowerBlue: { r: 100, g: 149, b: 237 },
38
+ Cornsilk: { r: 255, g: 248, b: 220 },
39
+ Crimson: { r: 220, g: 20, b: 60 },
40
+ Cyan: { r: 0, g: 255, b: 255 },
41
+ DarkBlue: { r: 0, g: 0, b: 139 },
42
+ DarkCyan: { r: 0, g: 139, b: 139 },
43
+ DarkGoldenRod: { r: 184, g: 134, b: 11 },
44
+ DarkGray: { r: 169, g: 169, b: 169 },
45
+ DarkGreen: { r: 0, g: 100, b: 0 },
46
+ DarkKhaki: { r: 189, g: 183, b: 107 },
47
+ DarkMagenta: { r: 139, g: 0, b: 139 },
48
+ DarkOliveGreen: { r: 85, g: 107, b: 47 },
49
+ DarkOrange: { r: 255, g: 140, b: 0 },
50
+ DarkOrchid: { r: 153, g: 50, b: 204 },
51
+ DarkRed: { r: 139, g: 0, b: 0 },
52
+ DarkSalmon: { r: 233, g: 150, b: 122 },
53
+ DarkSeaGreen: { r: 143, g: 188, b: 143 },
54
+ DarkSlateBlue: { r: 72, g: 61, b: 139 },
55
+ DarkSlateGray: { r: 47, g: 79, b: 79 },
56
+ DarkTurquoise: { r: 0, g: 206, b: 209 },
57
+ DarkViolet: { r: 148, g: 0, b: 211 },
58
+ DeepPink: { r: 255, g: 20, b: 147 },
59
+ DeepSkyBlue: { r: 0, g: 191, b: 255 },
60
+ DimGray: { r: 105, g: 105, b: 105 },
61
+ DodgerBlue: { r: 30, g: 144, b: 255 },
62
+ FireBrick: { r: 178, g: 34, b: 34 },
63
+ FloralWhite: { r: 255, g: 250, b: 240 },
64
+ ForestGreen: { r: 34, g: 139, b: 34 },
65
+ Fuchsia: { r: 255, g: 0, b: 255 },
66
+ Gainsboro: { r: 220, g: 220, b: 220 },
67
+ GhostWhite: { r: 248, g: 248, b: 255 },
68
+ Gold: { r: 255, g: 215, b: 0 },
69
+ GoldenRod: { r: 218, g: 165, b: 32 },
70
+ Gray: { r: 128, g: 128, b: 128 },
71
+ Green: { r: 0, g: 128, b: 0 },
72
+ GreenYellow: { r: 173, g: 255, b: 47 },
73
+ HoneyDew: { r: 240, g: 255, b: 240 },
74
+ HotPink: { r: 255, g: 105, b: 180 },
75
+ IndianRed: { r: 205, g: 92, b: 92 },
76
+ Indigo: { r: 75, g: 0, b: 130 },
77
+ Ivory: { r: 255, g: 255, b: 240 },
78
+ Khaki: { r: 240, g: 230, b: 140 },
79
+ Lavender: { r: 230, g: 230, b: 250 },
80
+ LavenderBlush: { r: 255, g: 240, b: 245 },
81
+ LawnGreen: { r: 124, g: 252, b: 0 },
82
+ LemonChiffon: { r: 255, g: 250, b: 205 },
83
+ LightBlue: { r: 173, g: 216, b: 230 },
84
+ LightCoral: { r: 240, g: 128, b: 128 },
85
+ LightCyan: { r: 224, g: 255, b: 255 },
86
+ LightGoldenRodYellow: { r: 250, g: 250, b: 210 },
87
+ LightGray: { r: 211, g: 211, b: 211 },
88
+ LightGreen: { r: 144, g: 238, b: 144 },
89
+ LightPink: { r: 255, g: 182, b: 193 },
90
+ LightSalmon: { r: 255, g: 160, b: 122 },
91
+ LightSeaGreen: { r: 32, g: 178, b: 170 },
92
+ LightSkyBlue: { r: 135, g: 206, b: 250 },
93
+ LightSlateGray: { r: 119, g: 136, b: 153 },
94
+ LightSteelBlue: { r: 176, g: 196, b: 222 },
95
+ LightYellow: { r: 255, g: 255, b: 224 },
96
+ Lime: { r: 0, g: 255, b: 0 },
97
+ LimeGreen: { r: 50, g: 205, b: 50 },
98
+ Linen: { r: 250, g: 240, b: 230 },
99
+ Magenta: { r: 255, g: 0, b: 255 },
100
+ Maroon: { r: 128, g: 0, b: 0 },
101
+ // Maroon
102
+ MediumAquaMarine: { r: 102, g: 205, b: 170 },
103
+ MediumBlue: { r: 0, g: 0, b: 205 },
104
+ MediumOrchid: { r: 186, g: 85, b: 211 },
105
+ MediumPurple: { r: 147, g: 112, b: 219 },
106
+ MediumSeaGreen: { r: 60, g: 179, b: 113 },
107
+ MediumSlateBlue: { r: 123, g: 104, b: 238 },
108
+ MediumSpringGreen: { r: 0, g: 250, b: 154 },
109
+ MediumTurquoise: { r: 72, g: 209, b: 204 },
110
+ MediumVioletRed: { r: 199, g: 21, b: 133 },
111
+ MidnightBlue: { r: 25, g: 25, b: 112 },
112
+ MintCream: { r: 245, g: 255, b: 250 },
113
+ MistyRose: { r: 255, g: 228, b: 225 },
114
+ Moccasin: { r: 255, g: 228, b: 181 },
115
+ NavajoWhite: { r: 255, g: 222, b: 173 },
116
+ Navy: { r: 0, g: 0, b: 128 },
117
+ OldLace: { r: 253, g: 245, b: 230 },
118
+ Olive: { r: 128, g: 128, b: 0 },
119
+ OliveDrab: { r: 107, g: 142, b: 35 },
120
+ Orange: { r: 255, g: 165, b: 0 },
121
+ OrangeRed: { r: 255, g: 69, b: 0 },
122
+ Orchid: { r: 218, g: 112, b: 214 },
123
+ PaleGoldenRod: { r: 238, g: 232, b: 170 },
124
+ PaleGreen: { r: 152, g: 251, b: 152 },
125
+ PaleTurquoise: { r: 175, g: 238, b: 238 },
126
+ PaleVioletRed: { r: 219, g: 112, b: 147 },
127
+ PapayaWhip: { r: 255, g: 239, b: 213 },
128
+ PeachPuff: { r: 255, g: 218, b: 185 },
129
+ Peru: { r: 205, g: 133, b: 63 },
130
+ Pink: { r: 255, g: 192, b: 203 },
131
+ Plum: { r: 221, g: 160, b: 221 },
132
+ PowderBlue: { r: 176, g: 224, b: 230 },
133
+ Purple: { r: 128, g: 0, b: 128 },
134
+ RebeccaPurple: { r: 102, g: 51, b: 153 },
135
+ Red: { r: 255, g: 0, b: 0 },
136
+ RosyBrown: { r: 188, g: 143, b: 143 },
137
+ RoyalBlue: { r: 65, g: 105, b: 225 },
138
+ SaddleBrown: { r: 139, g: 69, b: 19 },
139
+ Salmon: { r: 250, g: 128, b: 114 },
140
+ SandyBrown: { r: 244, g: 164, b: 96 },
141
+ SeaGreen: { r: 46, g: 139, b: 87 },
142
+ SeaShell: { r: 255, g: 245, b: 238 },
143
+ Sienna: { r: 160, g: 82, b: 45 },
144
+ Silver: { r: 192, g: 192, b: 192 },
145
+ SkyBlue: { r: 135, g: 206, b: 235 },
146
+ SlateBlue: { r: 106, g: 90, b: 205 },
147
+ SlateGray: { r: 112, g: 128, b: 144 },
148
+ Snow: { r: 255, g: 250, b: 250 },
149
+ SpringGreen: { r: 0, g: 255, b: 127 },
150
+ SteelBlue: { r: 70, g: 130, b: 180 },
151
+ Tan: { r: 210, g: 180, b: 140 },
152
+ Teal: { r: 0, g: 128, b: 128 },
153
+ Thistle: { r: 216, g: 191, b: 216 },
154
+ Tomato: { r: 255, g: 99, b: 71 },
155
+ Turquoise: { r: 64, g: 224, b: 208 },
156
+ Violet: { r: 238, g: 130, b: 238 },
157
+ Wheat: { r: 245, g: 222, b: 179 },
158
+ White: { r: 255, g: 255, b: 255 },
159
+ WhiteSmoke: { r: 245, g: 245, b: 245 },
160
+ Yellow: { r: 255, g: 255, b: 0 },
161
+ YellowGreen: { r: 154, g: 205, b: 50 }
162
+ };
163
+ function colorWithAlpha(color, alpha4) {
164
+ const lowerCasedColor = color.toLowerCase();
165
+ if (colorNames[lowerCasedColor]) {
166
+ const rgb = colorNames[lowerCasedColor];
167
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha4})`;
168
+ }
169
+ if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
170
+ const hex = color.slice(1);
171
+ const bigint = parseInt(hex, 16);
172
+ const r = bigint >> 16 & 255;
173
+ const g = bigint >> 8 & 255;
174
+ const b = bigint & 255;
175
+ return `rgba(${r}, ${g}, ${b}, ${alpha4})`;
176
+ }
177
+ if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
178
+ const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
179
+ if (result) {
180
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha4})`;
181
+ }
182
+ }
183
+ return color;
184
+ }
185
+
186
+ // src/utils/misc.ts
187
+ var isEnvBrowser = () => !window.invokeNative;
188
+
189
+ // src/utils/fetchNui.ts
190
+ async function fetchNui(eventName, data, mockData) {
191
+ const options = {
192
+ method: "post",
193
+ headers: {
194
+ "Content-Type": "application/json; charset=UTF-8"
195
+ },
196
+ body: JSON.stringify(data)
197
+ };
198
+ if (isEnvBrowser() && mockData === void 0) {
199
+ console.warn(
200
+ `[fetchNui] Called fetchNui for event "${eventName}" in browser environment without mockData. Returning empty object.`
201
+ );
202
+ return {};
203
+ }
204
+ const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : "nui-frame-app";
205
+ const resp = await fetch(`https://${resourceName}/${eventName}`, options);
206
+ return await resp.json();
207
+ }
208
+ async function registerInitialFetch(eventName, data, mockData) {
209
+ const fetcher = () => fetchNui(eventName, data, mockData);
210
+ return fetcher();
211
+ }
212
+ var localeStore = zustand.create((set, get) => {
213
+ return {
214
+ locales: {
215
+ "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."
216
+ },
217
+ locale: (key, ...args) => {
218
+ const exists = get().locales[key];
219
+ let translation = exists || key;
220
+ if (args.length) {
221
+ translation = translation.replace(/%s/g, () => String(args.shift() || ""));
222
+ }
223
+ return translation;
224
+ }
225
+ };
226
+ });
227
+ var locale = localeStore.getState().locale;
228
+ registerInitialFetch("GET_LOCALES", void 0).then((data) => {
229
+ localeStore.setState({ locales: data });
230
+ });
231
+ var useSettings = zustand.create(() => ({
232
+ hydrated: false,
233
+ game: "fivem",
234
+ primaryColor: "dirk",
235
+ primaryShade: 9,
236
+ itemImgPath: "",
237
+ customTheme: [
238
+ "#f0f4ff",
239
+ "#d9e3ff",
240
+ "#bfcfff",
241
+ "#a6bbff",
242
+ "#8ca7ff",
243
+ "#7393ff",
244
+ "#5a7fff",
245
+ "#406bff",
246
+ "#2547ff",
247
+ "#0b33ff"
248
+ ]
249
+ }));
250
+ registerInitialFetch("GET_SETTINGS").then((data) => {
251
+ useSettings.setState({
252
+ ...data,
253
+ hydrated: true
254
+ });
255
+ }).catch(() => {
256
+ useSettings.setState({ hydrated: true });
257
+ });
258
+ function BorderedIcon(props) {
259
+ const theme = core.useMantineTheme();
260
+ return /* @__PURE__ */ jsxRuntime.jsx(
261
+ reactFontawesome.FontAwesomeIcon,
262
+ {
263
+ icon: props.icon,
264
+ color: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][theme.primaryShade], props.hovered ? 0.9 : 0.9),
265
+ style: {
266
+ // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
267
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
268
+ padding: props.p || theme.spacing.xs,
269
+ transition: "all 0.2s ease-in-out",
270
+ aspectRatio: "1/1",
271
+ fontSize: props.fontSize ? props.fontSize : "2.5vh",
272
+ borderRadius: theme.radius.xs,
273
+ // border: `2px solid var(--mantine-primary-color-9)`,
274
+ outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
275
+ boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7], 0.5)}`
276
+ }
277
+ }
278
+ );
279
+ }
280
+ var MotionFlex = framerMotion.motion.create(core.Flex);
281
+ var MotionText = framerMotion.motion.create(core.Text);
282
+ var MotionImage = framerMotion.motion.create(core.Image);
283
+ var MotionIcon = framerMotion.motion.create(reactFontawesome.FontAwesomeIcon);
284
+ function Counter(props) {
285
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
286
+ MotionFlex,
287
+ {
288
+ initial: { opacity: 0 },
289
+ animate: { opacity: 1 },
290
+ exit: { opacity: 0 },
291
+ fz: "1.25vh",
292
+ h: "1.75vh",
293
+ justify: "center",
294
+ align: "center",
295
+ bg: props.color || "rgba(0, 0, 0, 0.51)",
296
+ style: {
297
+ borderRadius: "50%",
298
+ aspectRatio: "1/1",
299
+ marginBottom: "0.3vh",
300
+ fontFamily: "Akrobat Bold",
301
+ boxShadow: "0 0 5px rgba(0, 0, 0, 0.3)",
302
+ ...props.style
303
+ },
304
+ children: props.count
305
+ },
306
+ "counter"
307
+ ) });
308
+ }
309
+ var FloatingParticles = ({
310
+ icons = [],
311
+ particleCount = 55,
312
+ color = "#00a552ff",
313
+ size = 32,
314
+ speed = "slow",
315
+ opacity = 0.3,
316
+ style = {},
317
+ mouseRepelDistance = 150,
318
+ mouseRepelStrength = 50,
319
+ backgroundColor = "transparent"
320
+ }) => {
321
+ const containerRef = react.useRef(null);
322
+ const [particles, setParticles] = react.useState([]);
323
+ const mouseX = framerMotion.useMotionValue(0);
324
+ const mouseY = framerMotion.useMotionValue(0);
325
+ const durationMap = {
326
+ slow: { base: 10, variance: 10 },
327
+ medium: { base: 2, variance: 2 },
328
+ fast: { base: 4, variance: 2 }
329
+ };
330
+ const duration = durationMap[speed];
331
+ const seededRandom = (seed) => {
332
+ const x = Math.sin(seed) * 1e4;
333
+ return x - Math.floor(x);
334
+ };
335
+ react.useEffect(() => {
336
+ if (!containerRef.current) return;
337
+ const bounds = containerRef.current.getBoundingClientRect();
338
+ const newParticles = [...Array(particleCount)].map((_, i) => {
339
+ const seedX = i * 123.456;
340
+ const seedY = i * 789.012;
341
+ const seedDuration = i * 345.678;
342
+ const baseX = seededRandom(seedX) * bounds.width;
343
+ const baseY = seededRandom(seedY) * bounds.height;
344
+ return {
345
+ id: i,
346
+ baseX,
347
+ baseY,
348
+ currentX: baseX,
349
+ currentY: baseY,
350
+ icon: icons.length > 0 ? icons[i % icons.length] : null,
351
+ animationDuration: duration.base + seededRandom(seedDuration) * duration.variance
352
+ };
353
+ });
354
+ setParticles(newParticles);
355
+ }, [particleCount, icons.length, duration.base, duration.variance]);
356
+ react.useEffect(() => {
357
+ if (!containerRef.current) return;
358
+ const handleMouseMove = (e) => {
359
+ const bounds = containerRef.current.getBoundingClientRect();
360
+ const x = e.clientX - bounds.left;
361
+ const y = e.clientY - bounds.top;
362
+ mouseX.set(x);
363
+ mouseY.set(y);
364
+ setParticles(
365
+ (prevParticles) => prevParticles.map((particle) => {
366
+ const dx = x - particle.baseX;
367
+ const dy = y - particle.baseY;
368
+ const distance = Math.sqrt(dx * dx + dy * dy);
369
+ if (distance < mouseRepelDistance && distance > 0) {
370
+ const force = (mouseRepelDistance - distance) / mouseRepelDistance;
371
+ const repelX = dx / distance * force * mouseRepelStrength * -1;
372
+ const repelY = dy / distance * force * mouseRepelStrength * -1;
373
+ return {
374
+ ...particle,
375
+ currentX: particle.baseX + repelX,
376
+ currentY: particle.baseY + repelY
377
+ };
378
+ } else {
379
+ return {
380
+ ...particle,
381
+ currentX: particle.baseX,
382
+ currentY: particle.baseY
383
+ };
384
+ }
385
+ })
386
+ );
387
+ };
388
+ const handleMouseLeave = () => {
389
+ setParticles(
390
+ (prevParticles) => prevParticles.map((particle) => ({
391
+ ...particle,
392
+ currentX: particle.baseX,
393
+ currentY: particle.baseY
394
+ }))
395
+ );
396
+ };
397
+ const container = containerRef.current;
398
+ container.addEventListener("mousemove", handleMouseMove);
399
+ container.addEventListener("mouseleave", handleMouseLeave);
400
+ return () => {
401
+ container.removeEventListener("mousemove", handleMouseMove);
402
+ container.removeEventListener("mouseleave", handleMouseLeave);
403
+ };
404
+ }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
405
+ react.useEffect(() => {
406
+ const handleResize = () => {
407
+ if (!containerRef.current) return;
408
+ const bounds = containerRef.current.getBoundingClientRect();
409
+ setParticles(
410
+ (prevParticles) => prevParticles.map((particle, i) => {
411
+ const seedX = i * 123.456 + bounds.width;
412
+ const seedY = i * 789.012 + bounds.height;
413
+ const newBaseX = seededRandom(seedX) * bounds.width;
414
+ const newBaseY = seededRandom(seedY) * bounds.height;
415
+ return {
416
+ ...particle,
417
+ baseX: newBaseX,
418
+ baseY: newBaseY,
419
+ currentX: newBaseX,
420
+ currentY: newBaseY
421
+ };
422
+ })
423
+ );
424
+ };
425
+ window.addEventListener("resize", handleResize);
426
+ return () => window.removeEventListener("resize", handleResize);
427
+ }, []);
428
+ return /* @__PURE__ */ jsxRuntime.jsx(
429
+ "div",
430
+ {
431
+ ref: containerRef,
432
+ style: {
433
+ position: "absolute",
434
+ overflow: "hidden",
435
+ width: "100%",
436
+ height: "100%",
437
+ zIndex: -1,
438
+ backgroundColor,
439
+ ...style
440
+ },
441
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsxRuntime.jsx(
442
+ framerMotion.motion.div,
443
+ {
444
+ style: {
445
+ position: "absolute",
446
+ width: size,
447
+ height: size,
448
+ color,
449
+ opacity,
450
+ left: 0,
451
+ top: 0
452
+ },
453
+ animate: {
454
+ x: particle.currentX,
455
+ y: particle.currentY,
456
+ scale: [0.8, 1.1, 0.8],
457
+ opacity: [opacity * 0.5, opacity, opacity * 0.5],
458
+ // random rotate between 0 and 360 so that not all particles rotate the same
459
+ rotate: particle.id % 2 === 0 ? [0, 360] : [360, 0]
460
+ },
461
+ transition: {
462
+ x: { type: "spring", stiffness: 150, damping: 20 },
463
+ y: { type: "spring", stiffness: 150, damping: 20 },
464
+ rotate: {
465
+ duration: particle.animationDuration,
466
+ repeat: Infinity,
467
+ ease: "linear"
468
+ },
469
+ scale: {
470
+ duration: particle.animationDuration,
471
+ repeat: Infinity,
472
+ delay: seededRandom(particle.id * 111.222) * 5,
473
+ ease: "easeInOut"
474
+ },
475
+ opacity: {
476
+ duration: particle.animationDuration,
477
+ repeat: Infinity,
478
+ delay: seededRandom(particle.id * 333.444) * 5,
479
+ ease: "easeInOut"
480
+ }
481
+ },
482
+ 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(
483
+ "div",
484
+ {
485
+ style: {
486
+ width: "100%",
487
+ height: "100%",
488
+ borderRadius: "50%",
489
+ backgroundColor: color
490
+ }
491
+ }
492
+ )
493
+ },
494
+ particle.id
495
+ )) })
496
+ }
497
+ );
498
+ };
499
+ function InfoBox(props) {
500
+ const theme = core.useMantineTheme();
501
+ return /* @__PURE__ */ jsxRuntime.jsxs(
502
+ core.Flex,
503
+ {
504
+ w: "fit-content",
505
+ h: "fit-content",
506
+ style: {
507
+ borderRadius: theme.radius.xs,
508
+ overflow: "hidden",
509
+ border: `0.2vh solid rgba(77,77,77,0.3)`
510
+ },
511
+ align: "center",
512
+ children: [
513
+ /* @__PURE__ */ jsxRuntime.jsx(
514
+ core.Flex,
515
+ {
516
+ miw: "4vh",
517
+ p: "xxs",
518
+ bg: "rgba(77,77,77,0.2)",
519
+ direction: "column",
520
+ justify: "center",
521
+ align: "center",
522
+ children: /* @__PURE__ */ jsxRuntime.jsx(
523
+ core.Text,
524
+ {
525
+ c: "lightgrey",
526
+ size: "xxs",
527
+ style: {
528
+ fontFamily: "Akrobat Bold",
529
+ letterSpacing: "0.05em",
530
+ textTransform: "uppercase"
531
+ },
532
+ children: props.leftSide
533
+ }
534
+ )
535
+ }
536
+ ),
537
+ /* @__PURE__ */ jsxRuntime.jsx(
538
+ core.Flex,
539
+ {
540
+ p: "xxs",
541
+ flex: 1,
542
+ miw: "4vh",
543
+ bg: "rgba(77,77,77,0.5)",
544
+ direction: "column",
545
+ align: "center",
546
+ justify: "center",
547
+ children: /* @__PURE__ */ jsxRuntime.jsx(
548
+ core.Text,
549
+ {
550
+ c: "lightgrey",
551
+ size: "xxs",
552
+ style: {
553
+ fontFamily: "Akrobat Bold",
554
+ letterSpacing: "0.05em",
555
+ textTransform: "uppercase"
556
+ },
557
+ children: props.rightSide
558
+ }
559
+ )
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ );
565
+ }
566
+ function InputContainer(props) {
567
+ const theme = core.useMantineTheme();
568
+ return /* @__PURE__ */ jsxRuntime.jsxs(
569
+ MotionFlex,
570
+ {
571
+ w: props.w || "100%",
572
+ flex: props.flex,
573
+ direction: "column",
574
+ h: props.h,
575
+ gap: props.title ? "xs" : 0,
576
+ bg: props.bg || core.alpha("var(--mantine-color-dark-9)", 0.65),
577
+ p: props.p || "sm",
578
+ style: {
579
+ borderRadius: theme.radius.xs,
580
+ boxShadow: theme.shadows.sm,
581
+ overflow: "hidden",
582
+ border: props.error ? `1px solid rgba(255, 100, 100, 0.8)` : "1px solid var(--mantine-color-dark-7)",
583
+ ...props.style
584
+ },
585
+ variants: props.variants,
586
+ children: [
587
+ /* @__PURE__ */ jsxRuntime.jsxs(
588
+ core.Flex,
589
+ {
590
+ align: "center",
591
+ gap: "xs",
592
+ children: [
593
+ (props.title || props.description) && /* @__PURE__ */ jsxRuntime.jsxs(
594
+ core.Flex,
595
+ {
596
+ direction: "column",
597
+ gap: "xxs",
598
+ p: props.p == "0" ? "sm" : 0,
599
+ children: [
600
+ props.title && /* @__PURE__ */ jsxRuntime.jsx(
601
+ core.Text,
602
+ {
603
+ size: "sm",
604
+ style: {
605
+ lineHeight: "1.25vh",
606
+ fontFamily: "Akrobat Bold",
607
+ letterSpacing: "0.05em",
608
+ textTransform: "uppercase"
609
+ },
610
+ children: props.title
611
+ }
612
+ ),
613
+ props.description && /* @__PURE__ */ jsxRuntime.jsx(
614
+ core.Text,
615
+ {
616
+ size: "xs",
617
+ c: "rgba(255, 255, 255, 0.8)",
618
+ fw: 400,
619
+ children: props.description
620
+ }
621
+ )
622
+ ]
623
+ }
624
+ ),
625
+ props.error && /* @__PURE__ */ jsxRuntime.jsx(
626
+ core.Text,
627
+ {
628
+ size: "xs",
629
+ c: theme.colors.red[9],
630
+ fw: 600,
631
+ mb: "auto",
632
+ lh: "0.8",
633
+ children: props.error
634
+ }
635
+ ),
636
+ /* @__PURE__ */ jsxRuntime.jsx(
637
+ core.Flex,
638
+ {
639
+ ml: "auto",
640
+ children: props.rightSection
641
+ }
642
+ )
643
+ ]
644
+ }
645
+ ),
646
+ props.children
647
+ ]
648
+ }
649
+ );
650
+ }
651
+ var useAudio = zustand.create(() => {
652
+ const audioRefs = {};
653
+ const sounds = {
654
+ click: clickSoundUrl__default.default,
655
+ hover: hoverSoundUrl__default.default
656
+ };
657
+ for (const [key, src] of Object.entries(sounds)) {
658
+ audioRefs[key] = new Audio(src);
659
+ }
660
+ return {
661
+ play: (sound) => {
662
+ const audio = audioRefs[sound];
663
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
664
+ audio.currentTime = 0;
665
+ audio.volume = 0.1;
666
+ audio.play();
667
+ },
668
+ stop: (sound) => {
669
+ const audio = audioRefs[sound];
670
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
671
+ audio.pause();
672
+ audio.currentTime = 0;
673
+ }
674
+ };
675
+ });
676
+ function SegmentedControl(props) {
677
+ const theme = core.useMantineTheme();
678
+ const play = useAudio((state) => state.play);
679
+ const handleChange = (newValue) => {
680
+ if (props.sounds) play("click");
681
+ if (props.onChange) {
682
+ props.onChange(newValue);
683
+ }
684
+ };
685
+ return /* @__PURE__ */ jsxRuntime.jsx(
686
+ core.Flex,
687
+ {
688
+ bg: "rgba(33, 33, 33, 0.6)",
689
+ w: props.w || "fit-content",
690
+ style: {
691
+ borderRadius: props.roundEdges !== false ? theme.radius.xs : 0,
692
+ overflow: "hidden"
693
+ },
694
+ ...props,
695
+ children: props.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
696
+ framerMotion.motion.div,
697
+ {
698
+ initial: { x: -100, opacity: 0 },
699
+ animate: { x: 0, opacity: 1 },
700
+ transition: { duration: 0.3, delay: index * 0.1, ease: "easeInOut" },
701
+ style: {
702
+ display: "flex",
703
+ flexDirection: "row",
704
+ alignItems: "center",
705
+ flex: 1
706
+ },
707
+ children: /* @__PURE__ */ jsxRuntime.jsx(
708
+ Segment,
709
+ {
710
+ label: item.label,
711
+ value: item.value,
712
+ icon: item.icon,
713
+ rightSection: item.rightSection,
714
+ fz: props.fz,
715
+ color: props.color,
716
+ selected: !props.multi ? props.value === item.value : Array.isArray(props.value) && props.value.includes(item.value),
717
+ onClick: () => {
718
+ if (props.multi) {
719
+ const newValue = Array.isArray(props.value) ? props.value.includes(item.value) ? props.value.filter((v) => v !== item.value) : [...props.value, item.value] : [item.value];
720
+ handleChange(newValue);
721
+ } else {
722
+ handleChange(item.value);
723
+ }
724
+ }
725
+ },
726
+ item.value
727
+ )
728
+ },
729
+ index
730
+ ))
731
+ }
732
+ );
733
+ }
734
+ function Segment(props) {
735
+ const theme = core.useMantineTheme();
736
+ return /* @__PURE__ */ jsxRuntime.jsxs(
737
+ MotionFlex,
738
+ {
739
+ onClick: props.onClick,
740
+ w: "100%",
741
+ direction: "column",
742
+ align: "center",
743
+ h: "100%",
744
+ bg: props.selected ? props.color ? core.alpha(props.color, 0.2) : colorWithAlpha(theme.colors[theme.primaryColor][theme.primaryShade], 0.2) : "transparent",
745
+ pos: "relative",
746
+ style: {
747
+ // position: "relative",
748
+ cursor: "pointer"
749
+ },
750
+ justify: "center",
751
+ whileHover: { scale: 1.05 },
752
+ whileTap: { scale: 0.95 },
753
+ children: [
754
+ /* @__PURE__ */ jsxRuntime.jsxs(
755
+ core.Flex,
756
+ {
757
+ align: "center",
758
+ gap: "xs",
759
+ p: "xs",
760
+ children: [
761
+ props.icon && /* @__PURE__ */ jsxRuntime.jsx(
762
+ MotionIcon,
763
+ {
764
+ icon: props.icon,
765
+ initial: {
766
+ color: props.selected ? props.color || theme.colors[theme.primaryColor][5] : "inherit"
767
+ },
768
+ animate: {
769
+ color: props.selected ? props.color || theme.colors[theme.primaryColor][5] : "inherit"
770
+ },
771
+ exit: {
772
+ color: "inherit"
773
+ },
774
+ style: {
775
+ fontSize: theme.fontSizes.xs,
776
+ marginBottom: "0.2vh"
777
+ }
778
+ }
779
+ ),
780
+ /* @__PURE__ */ jsxRuntime.jsx(
781
+ MotionText,
782
+ {
783
+ size: props.fz || "xs",
784
+ initial: {
785
+ color: props.selected ? props.color || theme.colors[theme.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
786
+ },
787
+ animate: {
788
+ color: props.selected ? props.color || theme.colors[theme.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
789
+ },
790
+ exit: {
791
+ color: "rgba(255, 255, 255, 0.7)"
792
+ },
793
+ style: {
794
+ fontFamily: "Akrobat Bold",
795
+ letterSpacing: "0.1em",
796
+ textTransform: "uppercase"
797
+ },
798
+ children: props.label.toUpperCase()
799
+ }
800
+ ),
801
+ props.rightSection
802
+ ]
803
+ }
804
+ ),
805
+ /* @__PURE__ */ jsxRuntime.jsx(
806
+ framerMotion.motion.div,
807
+ {
808
+ initial: false,
809
+ animate: {
810
+ scaleX: props.selected ? 1 : 0,
811
+ opacity: props.selected ? 1 : 0
812
+ },
813
+ transition: {
814
+ duration: 0.3,
815
+ ease: [0.4, 0, 0.2, 1]
816
+ // Custom easing curve for smooth feel
817
+ },
818
+ style: {
819
+ position: "absolute",
820
+ bottom: 0,
821
+ left: 0,
822
+ right: 0,
823
+ height: "0.2vh",
824
+ backgroundColor: props.color || theme.colors[theme.primaryColor][5],
825
+ transformOrigin: "center"
826
+ }
827
+ }
828
+ )
829
+ ]
830
+ }
831
+ );
832
+ }
833
+ var NavigationContext = react.createContext(null);
834
+ function useNavigation(selector) {
835
+ const navigation = react.useContext(NavigationContext);
836
+ if (!navigation) {
837
+ throw new Error("useNavigation must be used within a NavigationProvider");
838
+ }
839
+ return zustand.useStore(navigation, selector);
840
+ }
841
+ function useNavigationStore() {
842
+ const navigation = react.useContext(NavigationContext);
843
+ if (!navigation) {
844
+ throw new Error("useNavigationStore must be used within a NavigationProvider");
845
+ }
846
+ return navigation;
847
+ }
848
+ function NavigationProvider({ children, defaultPage }) {
849
+ const storeRef = react.useRef(
850
+ zustand.create(() => ({
851
+ pageId: defaultPage || "home"
852
+ }))
853
+ );
854
+ return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value: storeRef.current, children });
855
+ }
856
+ function NavBar(props) {
857
+ const pageId = useNavigation((state) => state.pageId);
858
+ const store = useNavigationStore();
859
+ return /* @__PURE__ */ jsxRuntime.jsx(
860
+ SegmentedControl,
861
+ {
862
+ sounds: true,
863
+ w: "100%",
864
+ value: pageId,
865
+ items: props.items,
866
+ onChange: (value) => {
867
+ store.setState({ pageId: value });
868
+ }
869
+ }
870
+ );
871
+ }
872
+ var containerVariants = {
873
+ hidden: { opacity: 0 },
874
+ visible: {
875
+ opacity: 1,
876
+ transition: {
877
+ staggerChildren: 0.1,
878
+ delayChildren: 0.05
879
+ }
880
+ },
881
+ exit: {
882
+ opacity: 0,
883
+ transition: {
884
+ staggerChildren: 0.05,
885
+ staggerDirection: -1
886
+ }
887
+ }
888
+ };
889
+ var itemVariants = {
890
+ hidden: {
891
+ opacity: 0,
892
+ x: 20,
893
+ scale: 0.95
894
+ },
895
+ visible: {
896
+ opacity: 1,
897
+ x: 0,
898
+ scale: 1,
899
+ transition: {
900
+ type: "spring",
901
+ stiffness: 300,
902
+ damping: 24
903
+ }
904
+ },
905
+ exit: {
906
+ opacity: 0,
907
+ x: -10,
908
+ scale: 0.95,
909
+ transition: {
910
+ duration: 0.2
911
+ }
912
+ }
913
+ };
914
+ function SegmentedProgress(props) {
915
+ const progressPerSegment = 100 / props.segments;
916
+ const filledSegments = Math.floor(props.progress / progressPerSegment);
917
+ const partialFill = props.progress % progressPerSegment / progressPerSegment;
918
+ return /* @__PURE__ */ jsxRuntime.jsx(
919
+ MotionFlex,
920
+ {
921
+ w: "100%",
922
+ h: props.size || "1vh",
923
+ gap: "xs",
924
+ initial: "hidden",
925
+ animate: "visible",
926
+ variants: containerVariants,
927
+ children: [...Array(props.segments)].map((_, index) => {
928
+ const isFilled = index < filledSegments;
929
+ const isPartial = index === filledSegments;
930
+ return /* @__PURE__ */ jsxRuntime.jsx(
931
+ framerMotion.motion.div,
932
+ {
933
+ variants: itemVariants,
934
+ style: {
935
+ width: `${100 / props.segments}%`,
936
+ // Ensures equal width distribution
937
+ height: "100%",
938
+ 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)",
939
+ transition: "background 0.3s ease"
940
+ }
941
+ },
942
+ index
943
+ );
944
+ })
945
+ }
946
+ );
947
+ }
948
+ function Title(props) {
949
+ const game = useSettings((state) => state.game);
950
+ const theme = core.useMantineTheme();
951
+ return /* @__PURE__ */ jsxRuntime.jsx(
952
+ core.Flex,
953
+ {
954
+ direction: "column",
955
+ bg: props.bg || "transparent",
956
+ gap: "xs",
957
+ w: props.w || "100%",
958
+ p: props.p || "0",
959
+ style: {
960
+ userSelect: "none",
961
+ borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
962
+ },
963
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
964
+ core.Flex,
965
+ {
966
+ align: "center",
967
+ justify: "center",
968
+ children: [
969
+ /* @__PURE__ */ jsxRuntime.jsxs(
970
+ core.Flex,
971
+ {
972
+ align: "center",
973
+ gap: "sm",
974
+ pr: "xs",
975
+ children: [
976
+ /* @__PURE__ */ jsxRuntime.jsx(
977
+ BorderedIcon,
978
+ {
979
+ icon: props.icon,
980
+ fontSize: theme.fontSizes.md,
981
+ color: props.iconColor
982
+ }
983
+ ),
984
+ /* @__PURE__ */ jsxRuntime.jsxs(
985
+ core.Flex,
986
+ {
987
+ direction: "column",
988
+ gap: "0.25vh",
989
+ children: [
990
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
991
+ lineHeight: theme.fontSizes.md,
992
+ fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
993
+ letterSpacing: "0.05em",
994
+ textTransform: "uppercase"
995
+ }, children: props.title }),
996
+ /* @__PURE__ */ jsxRuntime.jsx(
997
+ core.Text,
998
+ {
999
+ size: "xs",
1000
+ c: "grey",
1001
+ style: { whiteSpace: "normal", wordWrap: "break-word" },
1002
+ children: props.description
1003
+ }
1004
+ )
1005
+ ]
1006
+ }
1007
+ )
1008
+ ]
1009
+ }
1010
+ ),
1011
+ /* @__PURE__ */ jsxRuntime.jsx(
1012
+ core.Flex,
1013
+ {
1014
+ ml: "auto",
1015
+ align: "center",
1016
+ gap: "xs",
1017
+ children: props.rightSection
1018
+ }
1019
+ )
1020
+ ]
1021
+ }
1022
+ )
1023
+ }
1024
+ );
1025
+ }
1026
+ function LevelBanner(props) {
1027
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1028
+ MotionFlex,
1029
+ {
1030
+ w: "35vh",
1031
+ pos: "absolute",
1032
+ left: "50%",
1033
+ align: "center",
1034
+ gap: "xs",
1035
+ style: {
1036
+ borderRadius: core.useMantineTheme().radius.xxs
1037
+ },
1038
+ initial: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1039
+ animate: { opacity: 1, y: 0, transform: "translateX(-50%)" },
1040
+ exit: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1041
+ transition: { duration: 0.3 },
1042
+ direction: "column",
1043
+ children: [
1044
+ /* @__PURE__ */ jsxRuntime.jsxs(
1045
+ core.Flex,
1046
+ {
1047
+ w: "100%",
1048
+ justify: "space-between",
1049
+ children: [
1050
+ /* @__PURE__ */ jsxRuntime.jsxs(
1051
+ core.Text,
1052
+ {
1053
+ size: "xxs",
1054
+ c: "rgba(255, 255, 255, 0.9)",
1055
+ style: {
1056
+ fontFamily: "Akrobat Bold",
1057
+ letterSpacing: "0.1em"
1058
+ },
1059
+ children: [
1060
+ "LVL ",
1061
+ props.level
1062
+ ]
1063
+ }
1064
+ ),
1065
+ /* @__PURE__ */ jsxRuntime.jsxs(
1066
+ core.Text,
1067
+ {
1068
+ size: "xxs",
1069
+ c: "rgba(255, 255, 255, 0.7)",
1070
+ style: {
1071
+ fontFamily: "Akrobat Bold",
1072
+ letterSpacing: "0.1em"
1073
+ },
1074
+ children: [
1075
+ props.exp,
1076
+ "/",
1077
+ props.nextLevelXP,
1078
+ " XP"
1079
+ ]
1080
+ }
1081
+ ),
1082
+ /* @__PURE__ */ jsxRuntime.jsxs(
1083
+ core.Text,
1084
+ {
1085
+ size: "xxs",
1086
+ c: "rgba(255, 255, 255, 0.7)",
1087
+ style: {
1088
+ fontFamily: "Akrobat Bold",
1089
+ letterSpacing: "0.1em"
1090
+ },
1091
+ children: [
1092
+ "LVL ",
1093
+ props.level + 1
1094
+ ]
1095
+ }
1096
+ )
1097
+ ]
1098
+ }
1099
+ ),
1100
+ /* @__PURE__ */ jsxRuntime.jsx(
1101
+ core.Progress,
1102
+ {
1103
+ color: props.color,
1104
+ w: "100%",
1105
+ size: "sm",
1106
+ value: props.progressToLevel
1107
+ }
1108
+ )
1109
+ ]
1110
+ }
1111
+ );
1112
+ }
1113
+ function LevelPanel(props) {
1114
+ const theme = core.useMantineTheme();
1115
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1116
+ core.Flex,
1117
+ {
1118
+ w: "fit-content",
1119
+ pr: "8vh",
1120
+ pl: "8vh",
1121
+ bg: "linear-gradient(180deg, rgba(30, 30, 30, 0.82) 0%, rgba(30, 30, 30, 0.3) 50%, rgba(30, 30, 30, 0.6) 100%)",
1122
+ style: {
1123
+ borderRadius: theme.radius.xs,
1124
+ boxShadow: theme.shadows.sm,
1125
+ outline: "0.2vh solid rgba(255,255,255,0.1)"
1126
+ },
1127
+ justify: "center",
1128
+ align: "center",
1129
+ direction: "column",
1130
+ p: "sm",
1131
+ children: [
1132
+ /* @__PURE__ */ jsxRuntime.jsx(
1133
+ core.RingProgress,
1134
+ {
1135
+ size: 190,
1136
+ roundCaps: true,
1137
+ thickness: 10,
1138
+ sections: [{ value: props.progressToLevel, color: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9) }],
1139
+ label: /* @__PURE__ */ jsxRuntime.jsx(
1140
+ core.Flex,
1141
+ {
1142
+ justify: "center",
1143
+ align: "center",
1144
+ direction: "column",
1145
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1146
+ core.Text,
1147
+ {
1148
+ size: "6vh",
1149
+ c: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9),
1150
+ style: {
1151
+ fontFamily: "Akrobat Black",
1152
+ textShadow: `0 0 10px ${core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.7)}`
1153
+ },
1154
+ children: props.level
1155
+ }
1156
+ )
1157
+ }
1158
+ )
1159
+ }
1160
+ ),
1161
+ /* @__PURE__ */ jsxRuntime.jsx(
1162
+ core.Text,
1163
+ {
1164
+ size: "sm",
1165
+ style: {
1166
+ fontFamily: "Akrobat Black",
1167
+ letterSpacing: "0.05em",
1168
+ textTransform: "uppercase"
1169
+ },
1170
+ children: props.text || locale("Level")
1171
+ }
1172
+ ),
1173
+ /* @__PURE__ */ jsxRuntime.jsxs(
1174
+ core.Text,
1175
+ {
1176
+ size: "xs",
1177
+ c: "rgba(255,255,255,0.6)",
1178
+ children: [
1179
+ props.exp,
1180
+ "/",
1181
+ props.nextLevelXP,
1182
+ " ",
1183
+ locale("EXP")
1184
+ ]
1185
+ }
1186
+ )
1187
+ ]
1188
+ }
1189
+ );
1190
+ }
1191
+ var ModalContext = react.createContext(null);
1192
+ function useModal(selector) {
1193
+ const modal = react.useContext(ModalContext);
1194
+ if (!modal) {
1195
+ throw new Error("useModal must be used within a ModalProvider");
1196
+ }
1197
+ return zustand.useStore(modal, selector);
1198
+ }
1199
+ function ModalProvider({ children, defaultPage }) {
1200
+ const storeRef = react.useRef(
1201
+ zustand.create(() => ({
1202
+ active: null
1203
+ }))
1204
+ );
1205
+ return /* @__PURE__ */ jsxRuntime.jsxs(ModalContext.Provider, { value: storeRef.current, children: [
1206
+ /* @__PURE__ */ jsxRuntime.jsx(Modal, {}),
1207
+ children
1208
+ ] });
1209
+ }
1210
+ function useModalActions() {
1211
+ const modal = react.useContext(ModalContext);
1212
+ if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
1213
+ const showModal = (openModal) => {
1214
+ modal.setState({ active: openModal });
1215
+ };
1216
+ const hideModal = () => {
1217
+ modal.setState({ active: null });
1218
+ };
1219
+ return { showModal, hideModal };
1220
+ }
1221
+ function Modal() {
1222
+ const active = useModal((state) => state.active);
1223
+ const { hideModal } = useModalActions();
1224
+ const ref = hooks.useClickOutside(() => {
1225
+ if (!active) return;
1226
+ if (active.clickOutside == false) return;
1227
+ if (active) {
1228
+ hideModal();
1229
+ }
1230
+ });
1231
+ const theme = core.useMantineTheme();
1232
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: active && /* @__PURE__ */ jsxRuntime.jsx(
1233
+ MotionFlex,
1234
+ {
1235
+ h: "100%",
1236
+ w: "100%",
1237
+ bg: "rgba(0, 0, 0, 0.3)",
1238
+ pos: "absolute",
1239
+ style: {
1240
+ zIndex: 2e3,
1241
+ filter: "drop-shadow(0 0 2vh black)"
1242
+ },
1243
+ initial: { opacity: 0 },
1244
+ animate: { opacity: 1 },
1245
+ exit: { opacity: 0 },
1246
+ align: "center",
1247
+ justify: "center",
1248
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1249
+ MotionFlex,
1250
+ {
1251
+ pos: "absolute",
1252
+ top: "50%",
1253
+ left: "50%",
1254
+ ref,
1255
+ w: active.width || "40%",
1256
+ style: {
1257
+ transform: "translate(-50%, -50%)",
1258
+ borderRadius: theme.radius.xs,
1259
+ boxShadow: theme.shadows.xl,
1260
+ zIndex: 2100
1261
+ },
1262
+ bg: "rgba(48, 48, 48, 0.84)",
1263
+ initial: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
1264
+ animate: { scale: 1, opacity: 1, transform: "translate(-50%, -50%)" },
1265
+ exit: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
1266
+ p: "sm",
1267
+ direction: "column",
1268
+ maw: "70%",
1269
+ gap: "xs",
1270
+ children: [
1271
+ /* @__PURE__ */ jsxRuntime.jsxs(
1272
+ core.Flex,
1273
+ {
1274
+ direction: "column",
1275
+ w: "100%",
1276
+ children: [
1277
+ /* @__PURE__ */ jsxRuntime.jsxs(
1278
+ core.Flex,
1279
+ {
1280
+ w: "100%",
1281
+ align: "center",
1282
+ gap: "xs",
1283
+ children: [
1284
+ active.icon && /* @__PURE__ */ jsxRuntime.jsx(
1285
+ reactFontawesome.FontAwesomeIcon,
1286
+ {
1287
+ icon: active.icon,
1288
+ style: {
1289
+ fontSize: theme.fontSizes.xs
1290
+ }
1291
+ }
1292
+ ),
1293
+ /* @__PURE__ */ jsxRuntime.jsx(
1294
+ core.Text,
1295
+ {
1296
+ size: "sm",
1297
+ children: active.title
1298
+ }
1299
+ ),
1300
+ /* @__PURE__ */ jsxRuntime.jsx(
1301
+ MotionIcon,
1302
+ {
1303
+ icon: "times",
1304
+ color: "rgba(255, 255, 255, 0.7)",
1305
+ whileHover: {
1306
+ scale: 1.1,
1307
+ filter: "brightness(1.2)"
1308
+ },
1309
+ style: {
1310
+ marginLeft: "auto",
1311
+ cursor: "pointer",
1312
+ fontSize: theme.fontSizes.sm
1313
+ },
1314
+ onClick: () => {
1315
+ hideModal();
1316
+ }
1317
+ }
1318
+ )
1319
+ ]
1320
+ }
1321
+ ),
1322
+ active.description && /* @__PURE__ */ jsxRuntime.jsx(
1323
+ core.Text,
1324
+ {
1325
+ size: "xs",
1326
+ c: "rgba(255, 255, 255, 0.7)",
1327
+ children: active.description
1328
+ }
1329
+ )
1330
+ ]
1331
+ }
1332
+ ),
1333
+ active.children
1334
+ ]
1335
+ }
1336
+ )
1337
+ }
1338
+ ) });
1339
+ }
1340
+ function PromptModal(props) {
1341
+ const theme = core.useMantineTheme();
1342
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1343
+ MotionFlex,
1344
+ {
1345
+ gap: "sm",
1346
+ direction: "column",
1347
+ flex: 1,
1348
+ children: [
1349
+ /* @__PURE__ */ jsxRuntime.jsx(
1350
+ core.Text,
1351
+ {
1352
+ size: "xs",
1353
+ c: "rgba(255, 255, 255, 0.8)",
1354
+ children: props.message
1355
+ }
1356
+ ),
1357
+ /* @__PURE__ */ jsxRuntime.jsx(
1358
+ core.Flex,
1359
+ {
1360
+ gap: "sm",
1361
+ children: props.buttons.map((button, index) => /* @__PURE__ */ jsxRuntime.jsx(
1362
+ core.Button,
1363
+ {
1364
+ variant: button.variant,
1365
+ color: button.color,
1366
+ flex: 0.5,
1367
+ onClick: button.onClick,
1368
+ leftSection: button.icon ? /* @__PURE__ */ jsxRuntime.jsx(
1369
+ reactFontawesome.FontAwesomeIcon,
1370
+ {
1371
+ icon: button.icon,
1372
+ style: {
1373
+ fontSize: theme.fontSizes.xs
1374
+ }
1375
+ }
1376
+ ) : void 0,
1377
+ children: button.text
1378
+ },
1379
+ index
1380
+ ))
1381
+ }
1382
+ )
1383
+ ]
1384
+ }
1385
+ );
1386
+ }
1387
+
1388
+ exports.BorderedIcon = BorderedIcon;
1389
+ exports.Counter = Counter;
1390
+ exports.FloatingParticles = FloatingParticles;
1391
+ exports.InfoBox = InfoBox;
1392
+ exports.InputContainer = InputContainer;
1393
+ exports.LevelBanner = LevelBanner;
1394
+ exports.LevelPanel = LevelPanel;
1395
+ exports.ModalContext = ModalContext;
1396
+ exports.ModalProvider = ModalProvider;
1397
+ exports.MotionFlex = MotionFlex;
1398
+ exports.MotionIcon = MotionIcon;
1399
+ exports.MotionImage = MotionImage;
1400
+ exports.MotionText = MotionText;
1401
+ exports.NavBar = NavBar;
1402
+ exports.NavigationContext = NavigationContext;
1403
+ exports.NavigationProvider = NavigationProvider;
1404
+ exports.PromptModal = PromptModal;
1405
+ exports.SegmentedControl = SegmentedControl;
1406
+ exports.SegmentedProgress = SegmentedProgress;
1407
+ exports.Title = Title;
1408
+ exports.useModal = useModal;
1409
+ exports.useModalActions = useModalActions;
1410
+ exports.useNavigation = useNavigation;
1411
+ exports.useNavigationStore = useNavigationStore;
1412
+ //# sourceMappingURL=index.cjs.map
1413
+ //# sourceMappingURL=index.cjs.map