dirk-cfx-react 1.1.2 → 1.1.5

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,1402 @@
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
+ function BorderedIcon(props) {
232
+ const theme = core.useMantineTheme();
233
+ return /* @__PURE__ */ jsxRuntime.jsx(
234
+ reactFontawesome.FontAwesomeIcon,
235
+ {
236
+ icon: props.icon,
237
+ color: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][theme.primaryShade], props.hovered ? 0.9 : 0.9),
238
+ style: {
239
+ // backgroundColor: colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7 as number], (props.hoverable ? (props.hovered ? 0.3 : 0.2) : 0.2)),
240
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
241
+ padding: props.p || theme.spacing.xs,
242
+ transition: "all 0.2s ease-in-out",
243
+ aspectRatio: "1/1",
244
+ fontSize: props.fontSize ? props.fontSize : "2.5vh",
245
+ borderRadius: theme.radius.xs,
246
+ // border: `2px solid var(--mantine-primary-color-9)`,
247
+ outline: `0.2vh solid ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][9], 0.8)}`,
248
+ boxShadow: `inset 0 0 2vh ${colorWithAlpha(props.color ? props.color : theme.colors[theme.primaryColor][7], 0.5)}`
249
+ }
250
+ }
251
+ );
252
+ }
253
+ var MotionFlex = framerMotion.motion.create(core.Flex);
254
+ var MotionText = framerMotion.motion.create(core.Text);
255
+ var MotionImage = framerMotion.motion.create(core.Image);
256
+ var MotionIcon = framerMotion.motion.create(reactFontawesome.FontAwesomeIcon);
257
+ function Counter(props) {
258
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: props.count > 0 && /* @__PURE__ */ jsxRuntime.jsx(
259
+ MotionFlex,
260
+ {
261
+ initial: { opacity: 0 },
262
+ animate: { opacity: 1 },
263
+ exit: { opacity: 0 },
264
+ fz: "1.25vh",
265
+ h: "1.75vh",
266
+ justify: "center",
267
+ align: "center",
268
+ bg: props.color || "rgba(0, 0, 0, 0.51)",
269
+ style: {
270
+ borderRadius: "50%",
271
+ aspectRatio: "1/1",
272
+ marginBottom: "0.3vh",
273
+ fontFamily: "Akrobat Bold",
274
+ boxShadow: "0 0 5px rgba(0, 0, 0, 0.3)",
275
+ ...props.style
276
+ },
277
+ children: props.count
278
+ },
279
+ "counter"
280
+ ) });
281
+ }
282
+ var FloatingParticles = ({
283
+ icons = [],
284
+ particleCount = 55,
285
+ color = "#00a552ff",
286
+ size = 32,
287
+ speed = "slow",
288
+ opacity = 0.3,
289
+ style = {},
290
+ mouseRepelDistance = 150,
291
+ mouseRepelStrength = 50,
292
+ backgroundColor = "transparent"
293
+ }) => {
294
+ const containerRef = react.useRef(null);
295
+ const [particles, setParticles] = react.useState([]);
296
+ const mouseX = framerMotion.useMotionValue(0);
297
+ const mouseY = framerMotion.useMotionValue(0);
298
+ const durationMap = {
299
+ slow: { base: 10, variance: 10 },
300
+ medium: { base: 2, variance: 2 },
301
+ fast: { base: 4, variance: 2 }
302
+ };
303
+ const duration = durationMap[speed];
304
+ const seededRandom = (seed) => {
305
+ const x = Math.sin(seed) * 1e4;
306
+ return x - Math.floor(x);
307
+ };
308
+ react.useEffect(() => {
309
+ if (!containerRef.current) return;
310
+ const bounds = containerRef.current.getBoundingClientRect();
311
+ const newParticles = [...Array(particleCount)].map((_, i) => {
312
+ const seedX = i * 123.456;
313
+ const seedY = i * 789.012;
314
+ const seedDuration = i * 345.678;
315
+ const baseX = seededRandom(seedX) * bounds.width;
316
+ const baseY = seededRandom(seedY) * bounds.height;
317
+ return {
318
+ id: i,
319
+ baseX,
320
+ baseY,
321
+ currentX: baseX,
322
+ currentY: baseY,
323
+ icon: icons.length > 0 ? icons[i % icons.length] : null,
324
+ animationDuration: duration.base + seededRandom(seedDuration) * duration.variance
325
+ };
326
+ });
327
+ setParticles(newParticles);
328
+ }, [particleCount, icons.length, duration.base, duration.variance]);
329
+ react.useEffect(() => {
330
+ if (!containerRef.current) return;
331
+ const handleMouseMove = (e) => {
332
+ const bounds = containerRef.current.getBoundingClientRect();
333
+ const x = e.clientX - bounds.left;
334
+ const y = e.clientY - bounds.top;
335
+ mouseX.set(x);
336
+ mouseY.set(y);
337
+ setParticles(
338
+ (prevParticles) => prevParticles.map((particle) => {
339
+ const dx = x - particle.baseX;
340
+ const dy = y - particle.baseY;
341
+ const distance = Math.sqrt(dx * dx + dy * dy);
342
+ if (distance < mouseRepelDistance && distance > 0) {
343
+ const force = (mouseRepelDistance - distance) / mouseRepelDistance;
344
+ const repelX = dx / distance * force * mouseRepelStrength * -1;
345
+ const repelY = dy / distance * force * mouseRepelStrength * -1;
346
+ return {
347
+ ...particle,
348
+ currentX: particle.baseX + repelX,
349
+ currentY: particle.baseY + repelY
350
+ };
351
+ } else {
352
+ return {
353
+ ...particle,
354
+ currentX: particle.baseX,
355
+ currentY: particle.baseY
356
+ };
357
+ }
358
+ })
359
+ );
360
+ };
361
+ const handleMouseLeave = () => {
362
+ setParticles(
363
+ (prevParticles) => prevParticles.map((particle) => ({
364
+ ...particle,
365
+ currentX: particle.baseX,
366
+ currentY: particle.baseY
367
+ }))
368
+ );
369
+ };
370
+ const container = containerRef.current;
371
+ container.addEventListener("mousemove", handleMouseMove);
372
+ container.addEventListener("mouseleave", handleMouseLeave);
373
+ return () => {
374
+ container.removeEventListener("mousemove", handleMouseMove);
375
+ container.removeEventListener("mouseleave", handleMouseLeave);
376
+ };
377
+ }, [mouseX, mouseY, mouseRepelDistance, mouseRepelStrength]);
378
+ react.useEffect(() => {
379
+ const handleResize = () => {
380
+ if (!containerRef.current) return;
381
+ const bounds = containerRef.current.getBoundingClientRect();
382
+ setParticles(
383
+ (prevParticles) => prevParticles.map((particle, i) => {
384
+ const seedX = i * 123.456 + bounds.width;
385
+ const seedY = i * 789.012 + bounds.height;
386
+ const newBaseX = seededRandom(seedX) * bounds.width;
387
+ const newBaseY = seededRandom(seedY) * bounds.height;
388
+ return {
389
+ ...particle,
390
+ baseX: newBaseX,
391
+ baseY: newBaseY,
392
+ currentX: newBaseX,
393
+ currentY: newBaseY
394
+ };
395
+ })
396
+ );
397
+ };
398
+ window.addEventListener("resize", handleResize);
399
+ return () => window.removeEventListener("resize", handleResize);
400
+ }, []);
401
+ return /* @__PURE__ */ jsxRuntime.jsx(
402
+ "div",
403
+ {
404
+ ref: containerRef,
405
+ style: {
406
+ position: "absolute",
407
+ overflow: "hidden",
408
+ width: "100%",
409
+ height: "100%",
410
+ zIndex: -1,
411
+ backgroundColor,
412
+ ...style
413
+ },
414
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: particles.map((particle) => /* @__PURE__ */ jsxRuntime.jsx(
415
+ framerMotion.motion.div,
416
+ {
417
+ style: {
418
+ position: "absolute",
419
+ width: size,
420
+ height: size,
421
+ color,
422
+ opacity,
423
+ left: 0,
424
+ top: 0
425
+ },
426
+ animate: {
427
+ x: particle.currentX,
428
+ y: particle.currentY,
429
+ scale: [0.8, 1.1, 0.8],
430
+ opacity: [opacity * 0.5, opacity, opacity * 0.5],
431
+ // random rotate between 0 and 360 so that not all particles rotate the same
432
+ rotate: particle.id % 2 === 0 ? [0, 360] : [360, 0]
433
+ },
434
+ transition: {
435
+ x: { type: "spring", stiffness: 150, damping: 20 },
436
+ y: { type: "spring", stiffness: 150, damping: 20 },
437
+ rotate: {
438
+ duration: particle.animationDuration,
439
+ repeat: Infinity,
440
+ ease: "linear"
441
+ },
442
+ scale: {
443
+ duration: particle.animationDuration,
444
+ repeat: Infinity,
445
+ delay: seededRandom(particle.id * 111.222) * 5,
446
+ ease: "easeInOut"
447
+ },
448
+ opacity: {
449
+ duration: particle.animationDuration,
450
+ repeat: Infinity,
451
+ delay: seededRandom(particle.id * 333.444) * 5,
452
+ ease: "easeInOut"
453
+ }
454
+ },
455
+ 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(
456
+ "div",
457
+ {
458
+ style: {
459
+ width: "100%",
460
+ height: "100%",
461
+ borderRadius: "50%",
462
+ backgroundColor: color
463
+ }
464
+ }
465
+ )
466
+ },
467
+ particle.id
468
+ )) })
469
+ }
470
+ );
471
+ };
472
+ function InfoBox(props) {
473
+ const theme = core.useMantineTheme();
474
+ return /* @__PURE__ */ jsxRuntime.jsxs(
475
+ core.Flex,
476
+ {
477
+ w: "fit-content",
478
+ h: "fit-content",
479
+ style: {
480
+ borderRadius: theme.radius.xs,
481
+ overflow: "hidden",
482
+ border: `0.2vh solid rgba(77,77,77,0.3)`
483
+ },
484
+ align: "center",
485
+ children: [
486
+ /* @__PURE__ */ jsxRuntime.jsx(
487
+ core.Flex,
488
+ {
489
+ miw: "4vh",
490
+ p: "xxs",
491
+ bg: "rgba(77,77,77,0.2)",
492
+ direction: "column",
493
+ justify: "center",
494
+ align: "center",
495
+ children: /* @__PURE__ */ jsxRuntime.jsx(
496
+ core.Text,
497
+ {
498
+ c: "lightgrey",
499
+ size: "xxs",
500
+ style: {
501
+ fontFamily: "Akrobat Bold",
502
+ letterSpacing: "0.05em",
503
+ textTransform: "uppercase"
504
+ },
505
+ children: props.leftSide
506
+ }
507
+ )
508
+ }
509
+ ),
510
+ /* @__PURE__ */ jsxRuntime.jsx(
511
+ core.Flex,
512
+ {
513
+ p: "xxs",
514
+ flex: 1,
515
+ miw: "4vh",
516
+ bg: "rgba(77,77,77,0.5)",
517
+ direction: "column",
518
+ align: "center",
519
+ justify: "center",
520
+ children: /* @__PURE__ */ jsxRuntime.jsx(
521
+ core.Text,
522
+ {
523
+ c: "lightgrey",
524
+ size: "xxs",
525
+ style: {
526
+ fontFamily: "Akrobat Bold",
527
+ letterSpacing: "0.05em",
528
+ textTransform: "uppercase"
529
+ },
530
+ children: props.rightSide
531
+ }
532
+ )
533
+ }
534
+ )
535
+ ]
536
+ }
537
+ );
538
+ }
539
+ function InputContainer(props) {
540
+ const theme = core.useMantineTheme();
541
+ return /* @__PURE__ */ jsxRuntime.jsxs(
542
+ MotionFlex,
543
+ {
544
+ w: props.w || "100%",
545
+ flex: props.flex,
546
+ direction: "column",
547
+ h: props.h,
548
+ gap: props.title ? "xs" : 0,
549
+ bg: props.bg || core.alpha("var(--mantine-color-dark-9)", 0.65),
550
+ p: props.p || "sm",
551
+ style: {
552
+ borderRadius: theme.radius.xs,
553
+ boxShadow: theme.shadows.sm,
554
+ overflow: "hidden",
555
+ border: props.error ? `1px solid rgba(255, 100, 100, 0.8)` : "1px solid var(--mantine-color-dark-7)",
556
+ ...props.style
557
+ },
558
+ variants: props.variants,
559
+ children: [
560
+ /* @__PURE__ */ jsxRuntime.jsxs(
561
+ core.Flex,
562
+ {
563
+ align: "center",
564
+ gap: "xs",
565
+ children: [
566
+ (props.title || props.description) && /* @__PURE__ */ jsxRuntime.jsxs(
567
+ core.Flex,
568
+ {
569
+ direction: "column",
570
+ gap: "xxs",
571
+ p: props.p == "0" ? "sm" : 0,
572
+ children: [
573
+ props.title && /* @__PURE__ */ jsxRuntime.jsx(
574
+ core.Text,
575
+ {
576
+ size: "sm",
577
+ style: {
578
+ lineHeight: "1.25vh",
579
+ fontFamily: "Akrobat Bold",
580
+ letterSpacing: "0.05em",
581
+ textTransform: "uppercase"
582
+ },
583
+ children: props.title
584
+ }
585
+ ),
586
+ props.description && /* @__PURE__ */ jsxRuntime.jsx(
587
+ core.Text,
588
+ {
589
+ size: "xs",
590
+ c: "rgba(255, 255, 255, 0.8)",
591
+ fw: 400,
592
+ children: props.description
593
+ }
594
+ )
595
+ ]
596
+ }
597
+ ),
598
+ props.error && /* @__PURE__ */ jsxRuntime.jsx(
599
+ core.Text,
600
+ {
601
+ size: "xs",
602
+ c: theme.colors.red[9],
603
+ fw: 600,
604
+ mb: "auto",
605
+ lh: "0.8",
606
+ children: props.error
607
+ }
608
+ ),
609
+ /* @__PURE__ */ jsxRuntime.jsx(
610
+ core.Flex,
611
+ {
612
+ ml: "auto",
613
+ children: props.rightSection
614
+ }
615
+ )
616
+ ]
617
+ }
618
+ ),
619
+ props.children
620
+ ]
621
+ }
622
+ );
623
+ }
624
+ var useAudio = zustand.create(() => {
625
+ const audioRefs = {};
626
+ const sounds = {
627
+ click: clickSoundUrl__default.default,
628
+ hover: hoverSoundUrl__default.default
629
+ };
630
+ for (const [key, src] of Object.entries(sounds)) {
631
+ audioRefs[key] = new Audio(src);
632
+ }
633
+ return {
634
+ play: (sound) => {
635
+ const audio = audioRefs[sound];
636
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
637
+ audio.currentTime = 0;
638
+ audio.volume = 0.1;
639
+ audio.play();
640
+ },
641
+ stop: (sound) => {
642
+ const audio = audioRefs[sound];
643
+ if (!audio) return console.warn(`Sound '${sound}' not found.`);
644
+ audio.pause();
645
+ audio.currentTime = 0;
646
+ }
647
+ };
648
+ });
649
+ function SegmentedControl(props) {
650
+ const theme = core.useMantineTheme();
651
+ const play = useAudio((state) => state.play);
652
+ const handleChange = (newValue) => {
653
+ if (props.sounds) play("click");
654
+ if (props.onChange) {
655
+ props.onChange(newValue);
656
+ }
657
+ };
658
+ return /* @__PURE__ */ jsxRuntime.jsx(
659
+ core.Flex,
660
+ {
661
+ bg: "rgba(33, 33, 33, 0.6)",
662
+ w: props.w || "fit-content",
663
+ style: {
664
+ borderRadius: props.roundEdges !== false ? theme.radius.xs : 0,
665
+ overflow: "hidden"
666
+ },
667
+ ...props,
668
+ children: props.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
669
+ framerMotion.motion.div,
670
+ {
671
+ initial: { x: -100, opacity: 0 },
672
+ animate: { x: 0, opacity: 1 },
673
+ transition: { duration: 0.3, delay: index * 0.1, ease: "easeInOut" },
674
+ style: {
675
+ display: "flex",
676
+ flexDirection: "row",
677
+ alignItems: "center",
678
+ flex: 1
679
+ },
680
+ children: /* @__PURE__ */ jsxRuntime.jsx(
681
+ Segment,
682
+ {
683
+ label: item.label,
684
+ value: item.value,
685
+ icon: item.icon,
686
+ rightSection: item.rightSection,
687
+ fz: props.fz,
688
+ color: props.color,
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 ? props.color ? core.alpha(props.color, 0.2) : 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 ? props.color || theme.colors[theme.primaryColor][5] : "inherit"
740
+ },
741
+ animate: {
742
+ color: props.selected ? props.color || 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 ? props.color || theme.colors[theme.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
759
+ },
760
+ animate: {
761
+ color: props.selected ? props.color || theme.colors[theme.primaryColor][5] : "rgba(255, 255, 255, 0.7)"
762
+ },
763
+ exit: {
764
+ color: "rgba(255, 255, 255, 0.7)"
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: props.color || 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
+ var useSettings = zustand.create(() => ({
922
+ hydrated: false,
923
+ game: "fivem",
924
+ primaryColor: "dirk",
925
+ primaryShade: 9,
926
+ itemImgPath: "",
927
+ customTheme: {}
928
+ }));
929
+ registerInitialFetch("GET_SETTINGS").then((data) => {
930
+ useSettings.setState({
931
+ ...data,
932
+ hydrated: true
933
+ });
934
+ }).catch(() => {
935
+ useSettings.setState({ hydrated: true });
936
+ });
937
+ function Title(props) {
938
+ const game = useSettings((state) => state.game);
939
+ const theme = core.useMantineTheme();
940
+ return /* @__PURE__ */ jsxRuntime.jsx(
941
+ core.Flex,
942
+ {
943
+ direction: "column",
944
+ bg: props.bg || "transparent",
945
+ gap: "xs",
946
+ w: props.w || "100%",
947
+ p: props.p || "0",
948
+ style: {
949
+ userSelect: "none",
950
+ borderBottom: props.removeBorder ? "none" : `0.2vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
951
+ },
952
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
953
+ core.Flex,
954
+ {
955
+ align: "center",
956
+ justify: "center",
957
+ children: [
958
+ /* @__PURE__ */ jsxRuntime.jsxs(
959
+ core.Flex,
960
+ {
961
+ align: "center",
962
+ gap: "sm",
963
+ pr: "xs",
964
+ children: [
965
+ /* @__PURE__ */ jsxRuntime.jsx(
966
+ BorderedIcon,
967
+ {
968
+ icon: props.icon,
969
+ fontSize: theme.fontSizes.md,
970
+ color: props.iconColor
971
+ }
972
+ ),
973
+ /* @__PURE__ */ jsxRuntime.jsxs(
974
+ core.Flex,
975
+ {
976
+ direction: "column",
977
+ gap: "0.25vh",
978
+ children: [
979
+ /* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
980
+ lineHeight: theme.fontSizes.md,
981
+ fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
982
+ letterSpacing: "0.05em",
983
+ textTransform: "uppercase"
984
+ }, children: props.title }),
985
+ /* @__PURE__ */ jsxRuntime.jsx(
986
+ core.Text,
987
+ {
988
+ size: "xs",
989
+ c: "grey",
990
+ style: { whiteSpace: "normal", wordWrap: "break-word" },
991
+ children: props.description
992
+ }
993
+ )
994
+ ]
995
+ }
996
+ )
997
+ ]
998
+ }
999
+ ),
1000
+ /* @__PURE__ */ jsxRuntime.jsx(
1001
+ core.Flex,
1002
+ {
1003
+ ml: "auto",
1004
+ align: "center",
1005
+ gap: "xs",
1006
+ children: props.rightSection
1007
+ }
1008
+ )
1009
+ ]
1010
+ }
1011
+ )
1012
+ }
1013
+ );
1014
+ }
1015
+ function LevelBanner(props) {
1016
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1017
+ MotionFlex,
1018
+ {
1019
+ w: "35vh",
1020
+ pos: "absolute",
1021
+ left: "50%",
1022
+ align: "center",
1023
+ gap: "xs",
1024
+ style: {
1025
+ borderRadius: core.useMantineTheme().radius.xxs
1026
+ },
1027
+ initial: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1028
+ animate: { opacity: 1, y: 0, transform: "translateX(-50%)" },
1029
+ exit: { opacity: 0, y: -10, transform: "translateX(-50%)" },
1030
+ transition: { duration: 0.3 },
1031
+ direction: "column",
1032
+ children: [
1033
+ /* @__PURE__ */ jsxRuntime.jsxs(
1034
+ core.Flex,
1035
+ {
1036
+ w: "100%",
1037
+ justify: "space-between",
1038
+ children: [
1039
+ /* @__PURE__ */ jsxRuntime.jsxs(
1040
+ core.Text,
1041
+ {
1042
+ size: "xxs",
1043
+ c: "rgba(255, 255, 255, 0.9)",
1044
+ style: {
1045
+ fontFamily: "Akrobat Bold",
1046
+ letterSpacing: "0.1em"
1047
+ },
1048
+ children: [
1049
+ "LVL ",
1050
+ props.level
1051
+ ]
1052
+ }
1053
+ ),
1054
+ /* @__PURE__ */ jsxRuntime.jsxs(
1055
+ core.Text,
1056
+ {
1057
+ size: "xxs",
1058
+ c: "rgba(255, 255, 255, 0.7)",
1059
+ style: {
1060
+ fontFamily: "Akrobat Bold",
1061
+ letterSpacing: "0.1em"
1062
+ },
1063
+ children: [
1064
+ props.exp,
1065
+ "/",
1066
+ props.nextLevelXP,
1067
+ " XP"
1068
+ ]
1069
+ }
1070
+ ),
1071
+ /* @__PURE__ */ jsxRuntime.jsxs(
1072
+ core.Text,
1073
+ {
1074
+ size: "xxs",
1075
+ c: "rgba(255, 255, 255, 0.7)",
1076
+ style: {
1077
+ fontFamily: "Akrobat Bold",
1078
+ letterSpacing: "0.1em"
1079
+ },
1080
+ children: [
1081
+ "LVL ",
1082
+ props.level + 1
1083
+ ]
1084
+ }
1085
+ )
1086
+ ]
1087
+ }
1088
+ ),
1089
+ /* @__PURE__ */ jsxRuntime.jsx(
1090
+ core.Progress,
1091
+ {
1092
+ color: props.color,
1093
+ w: "100%",
1094
+ size: "sm",
1095
+ value: props.progressToLevel
1096
+ }
1097
+ )
1098
+ ]
1099
+ }
1100
+ );
1101
+ }
1102
+ function LevelPanel(props) {
1103
+ const theme = core.useMantineTheme();
1104
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1105
+ core.Flex,
1106
+ {
1107
+ w: "fit-content",
1108
+ pr: "8vh",
1109
+ pl: "8vh",
1110
+ 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%)",
1111
+ style: {
1112
+ borderRadius: theme.radius.xs,
1113
+ boxShadow: theme.shadows.sm,
1114
+ outline: "0.2vh solid rgba(255,255,255,0.1)"
1115
+ },
1116
+ justify: "center",
1117
+ align: "center",
1118
+ direction: "column",
1119
+ p: "sm",
1120
+ children: [
1121
+ /* @__PURE__ */ jsxRuntime.jsx(
1122
+ core.RingProgress,
1123
+ {
1124
+ size: 190,
1125
+ roundCaps: true,
1126
+ thickness: 10,
1127
+ sections: [{ value: props.progressToLevel, color: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9) }],
1128
+ label: /* @__PURE__ */ jsxRuntime.jsx(
1129
+ core.Flex,
1130
+ {
1131
+ justify: "center",
1132
+ align: "center",
1133
+ direction: "column",
1134
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1135
+ core.Text,
1136
+ {
1137
+ size: "6vh",
1138
+ c: core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.9),
1139
+ style: {
1140
+ fontFamily: "Akrobat Black",
1141
+ textShadow: `0 0 10px ${core.alpha(props.color || theme.colors[theme.primaryColor][theme.primaryShade], 0.7)}`
1142
+ },
1143
+ children: props.level
1144
+ }
1145
+ )
1146
+ }
1147
+ )
1148
+ }
1149
+ ),
1150
+ /* @__PURE__ */ jsxRuntime.jsx(
1151
+ core.Text,
1152
+ {
1153
+ size: "sm",
1154
+ style: {
1155
+ fontFamily: "Akrobat Black",
1156
+ letterSpacing: "0.05em",
1157
+ textTransform: "uppercase"
1158
+ },
1159
+ children: props.text || locale("Level")
1160
+ }
1161
+ ),
1162
+ /* @__PURE__ */ jsxRuntime.jsxs(
1163
+ core.Text,
1164
+ {
1165
+ size: "xs",
1166
+ c: "rgba(255,255,255,0.6)",
1167
+ children: [
1168
+ props.exp,
1169
+ "/",
1170
+ props.nextLevelXP,
1171
+ " ",
1172
+ locale("EXP")
1173
+ ]
1174
+ }
1175
+ )
1176
+ ]
1177
+ }
1178
+ );
1179
+ }
1180
+ var ModalContext = react.createContext(null);
1181
+ function useModal(selector) {
1182
+ const modal = react.useContext(ModalContext);
1183
+ if (!modal) {
1184
+ throw new Error("useModal must be used within a ModalProvider");
1185
+ }
1186
+ return zustand.useStore(modal, selector);
1187
+ }
1188
+ function ModalProvider({ children, defaultPage }) {
1189
+ const storeRef = react.useRef(
1190
+ zustand.create(() => ({
1191
+ active: null
1192
+ }))
1193
+ );
1194
+ return /* @__PURE__ */ jsxRuntime.jsxs(ModalContext.Provider, { value: storeRef.current, children: [
1195
+ /* @__PURE__ */ jsxRuntime.jsx(Modal, {}),
1196
+ children
1197
+ ] });
1198
+ }
1199
+ function useModalActions() {
1200
+ const modal = react.useContext(ModalContext);
1201
+ if (!modal) throw new Error("useModalActions must be used within a ModalProvider");
1202
+ const showModal = (openModal) => {
1203
+ modal.setState({ active: openModal });
1204
+ };
1205
+ const hideModal = () => {
1206
+ modal.setState({ active: null });
1207
+ };
1208
+ return { showModal, hideModal };
1209
+ }
1210
+ function Modal() {
1211
+ const active = useModal((state) => state.active);
1212
+ const { hideModal } = useModalActions();
1213
+ const ref = hooks.useClickOutside(() => {
1214
+ if (!active) return;
1215
+ if (active.clickOutside == false) return;
1216
+ if (active) {
1217
+ hideModal();
1218
+ }
1219
+ });
1220
+ const theme = core.useMantineTheme();
1221
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: active && /* @__PURE__ */ jsxRuntime.jsx(
1222
+ MotionFlex,
1223
+ {
1224
+ h: "100%",
1225
+ w: "100%",
1226
+ bg: "rgba(0, 0, 0, 0.3)",
1227
+ pos: "absolute",
1228
+ style: {
1229
+ zIndex: 2e3,
1230
+ filter: "drop-shadow(0 0 2vh black)"
1231
+ },
1232
+ initial: { opacity: 0 },
1233
+ animate: { opacity: 1 },
1234
+ exit: { opacity: 0 },
1235
+ align: "center",
1236
+ justify: "center",
1237
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1238
+ MotionFlex,
1239
+ {
1240
+ pos: "absolute",
1241
+ top: "50%",
1242
+ left: "50%",
1243
+ ref,
1244
+ w: active.width || "40%",
1245
+ style: {
1246
+ transform: "translate(-50%, -50%)",
1247
+ borderRadius: theme.radius.xs,
1248
+ boxShadow: theme.shadows.xl,
1249
+ zIndex: 2100
1250
+ },
1251
+ bg: "rgba(48, 48, 48, 0.84)",
1252
+ initial: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
1253
+ animate: { scale: 1, opacity: 1, transform: "translate(-50%, -50%)" },
1254
+ exit: { scale: 0.8, opacity: 0, transform: "translate(-50%, -50%)" },
1255
+ p: "sm",
1256
+ direction: "column",
1257
+ maw: "70%",
1258
+ gap: "xs",
1259
+ children: [
1260
+ /* @__PURE__ */ jsxRuntime.jsxs(
1261
+ core.Flex,
1262
+ {
1263
+ direction: "column",
1264
+ w: "100%",
1265
+ children: [
1266
+ /* @__PURE__ */ jsxRuntime.jsxs(
1267
+ core.Flex,
1268
+ {
1269
+ w: "100%",
1270
+ align: "center",
1271
+ gap: "xs",
1272
+ children: [
1273
+ active.icon && /* @__PURE__ */ jsxRuntime.jsx(
1274
+ reactFontawesome.FontAwesomeIcon,
1275
+ {
1276
+ icon: active.icon,
1277
+ style: {
1278
+ fontSize: theme.fontSizes.xs
1279
+ }
1280
+ }
1281
+ ),
1282
+ /* @__PURE__ */ jsxRuntime.jsx(
1283
+ core.Text,
1284
+ {
1285
+ size: "sm",
1286
+ children: active.title
1287
+ }
1288
+ ),
1289
+ /* @__PURE__ */ jsxRuntime.jsx(
1290
+ MotionIcon,
1291
+ {
1292
+ icon: "times",
1293
+ color: "rgba(255, 255, 255, 0.7)",
1294
+ whileHover: {
1295
+ scale: 1.1,
1296
+ filter: "brightness(1.2)"
1297
+ },
1298
+ style: {
1299
+ marginLeft: "auto",
1300
+ cursor: "pointer",
1301
+ fontSize: theme.fontSizes.sm
1302
+ },
1303
+ onClick: () => {
1304
+ hideModal();
1305
+ }
1306
+ }
1307
+ )
1308
+ ]
1309
+ }
1310
+ ),
1311
+ active.description && /* @__PURE__ */ jsxRuntime.jsx(
1312
+ core.Text,
1313
+ {
1314
+ size: "xs",
1315
+ c: "rgba(255, 255, 255, 0.7)",
1316
+ children: active.description
1317
+ }
1318
+ )
1319
+ ]
1320
+ }
1321
+ ),
1322
+ active.children
1323
+ ]
1324
+ }
1325
+ )
1326
+ }
1327
+ ) });
1328
+ }
1329
+ function PromptModal(props) {
1330
+ const theme = core.useMantineTheme();
1331
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1332
+ MotionFlex,
1333
+ {
1334
+ gap: "sm",
1335
+ direction: "column",
1336
+ flex: 1,
1337
+ children: [
1338
+ /* @__PURE__ */ jsxRuntime.jsx(
1339
+ core.Text,
1340
+ {
1341
+ size: "xs",
1342
+ c: "rgba(255, 255, 255, 0.8)",
1343
+ children: props.message
1344
+ }
1345
+ ),
1346
+ /* @__PURE__ */ jsxRuntime.jsx(
1347
+ core.Flex,
1348
+ {
1349
+ gap: "sm",
1350
+ children: props.buttons.map((button, index) => /* @__PURE__ */ jsxRuntime.jsx(
1351
+ core.Button,
1352
+ {
1353
+ variant: button.variant,
1354
+ color: button.color,
1355
+ flex: 0.5,
1356
+ onClick: button.onClick,
1357
+ leftSection: button.icon ? /* @__PURE__ */ jsxRuntime.jsx(
1358
+ reactFontawesome.FontAwesomeIcon,
1359
+ {
1360
+ icon: button.icon,
1361
+ style: {
1362
+ fontSize: theme.fontSizes.xs
1363
+ }
1364
+ }
1365
+ ) : void 0,
1366
+ children: button.text
1367
+ },
1368
+ index
1369
+ ))
1370
+ }
1371
+ )
1372
+ ]
1373
+ }
1374
+ );
1375
+ }
1376
+
1377
+ exports.BorderedIcon = BorderedIcon;
1378
+ exports.Counter = Counter;
1379
+ exports.FloatingParticles = FloatingParticles;
1380
+ exports.InfoBox = InfoBox;
1381
+ exports.InputContainer = InputContainer;
1382
+ exports.LevelBanner = LevelBanner;
1383
+ exports.LevelPanel = LevelPanel;
1384
+ exports.ModalContext = ModalContext;
1385
+ exports.ModalProvider = ModalProvider;
1386
+ exports.MotionFlex = MotionFlex;
1387
+ exports.MotionIcon = MotionIcon;
1388
+ exports.MotionImage = MotionImage;
1389
+ exports.MotionText = MotionText;
1390
+ exports.NavBar = NavBar;
1391
+ exports.NavigationContext = NavigationContext;
1392
+ exports.NavigationProvider = NavigationProvider;
1393
+ exports.PromptModal = PromptModal;
1394
+ exports.SegmentedControl = SegmentedControl;
1395
+ exports.SegmentedProgress = SegmentedProgress;
1396
+ exports.Title = Title;
1397
+ exports.useModal = useModal;
1398
+ exports.useModalActions = useModalActions;
1399
+ exports.useNavigation = useNavigation;
1400
+ exports.useNavigationStore = useNavigationStore;
1401
+ //# sourceMappingURL=index.cjs.map
1402
+ //# sourceMappingURL=index.cjs.map