injast-core 1.0.78

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.
Files changed (127) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +127 -0
  3. package/dist/components/index.js +3187 -0
  4. package/dist/constants/index.js +138 -0
  5. package/dist/context/index.js +308 -0
  6. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Black.woff +0 -0
  7. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Bold.woff +0 -0
  8. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-DemiBold.woff +0 -0
  9. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-ExtraBlack.woff +0 -0
  10. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-ExtraBold.woff +0 -0
  11. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Heavy.woff +0 -0
  12. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Light.woff +0 -0
  13. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Medium.woff +0 -0
  14. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Regular.woff +0 -0
  15. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-Thin.woff +0 -0
  16. package/dist/fonts/IranYekan/Woff/IRANYekanXFaNum-UltraLight.woff +0 -0
  17. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Black.woff2 +0 -0
  18. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Bold.woff2 +0 -0
  19. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-DemiBold.woff2 +0 -0
  20. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-ExtraBlack.woff2 +0 -0
  21. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-ExtraBold.woff2 +0 -0
  22. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Heavy.woff2 +0 -0
  23. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Light.woff2 +0 -0
  24. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Medium.woff2 +0 -0
  25. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Regular.woff2 +0 -0
  26. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-Thin.woff2 +0 -0
  27. package/dist/fonts/IranYekan/Woff2/IRANYekanXFaNum-UltraLight.woff2 +0 -0
  28. package/dist/fonts/fonts.css +245 -0
  29. package/dist/hooks/index.js +107 -0
  30. package/dist/index.js +3831 -0
  31. package/dist/libs/index.js +142 -0
  32. package/dist/providers/index.js +305 -0
  33. package/dist/types/components/Accordion.d.ts +4 -0
  34. package/dist/types/components/AccordionDetails.d.ts +4 -0
  35. package/dist/types/components/AccordionSummary.d.ts +4 -0
  36. package/dist/types/components/Autocomplete.d.ts +3 -0
  37. package/dist/types/components/Box.d.ts +4 -0
  38. package/dist/types/components/Button.d.ts +9 -0
  39. package/dist/types/components/CardNumberInput.d.ts +13 -0
  40. package/dist/types/components/Checkbox.d.ts +11 -0
  41. package/dist/types/components/CircularProgress.d.ts +4 -0
  42. package/dist/types/components/Container.d.ts +4 -0
  43. package/dist/types/components/CounterBoxInput.d.ts +23 -0
  44. package/dist/types/components/DataGrid.d.ts +57 -0
  45. package/dist/types/components/Dialog.d.ts +4 -0
  46. package/dist/types/components/Divider.d.ts +4 -0
  47. package/dist/types/components/Drawer.d.ts +9 -0
  48. package/dist/types/components/Fab.d.ts +4 -0
  49. package/dist/types/components/FormControl.d.ts +4 -0
  50. package/dist/types/components/FormControlLabel.d.ts +4 -0
  51. package/dist/types/components/Grid.d.ts +4 -0
  52. package/dist/types/components/IconButton.d.ts +4 -0
  53. package/dist/types/components/Image.d.ts +12 -0
  54. package/dist/types/components/InputLabel.d.ts +4 -0
  55. package/dist/types/components/InputPhoneNumber.d.ts +15 -0
  56. package/dist/types/components/IosHiddenOtpInput.d.ts +6 -0
  57. package/dist/types/components/List.d.ts +4 -0
  58. package/dist/types/components/ListItem.d.ts +4 -0
  59. package/dist/types/components/Loading.d.ts +7 -0
  60. package/dist/types/components/LoadingModal.d.ts +6 -0
  61. package/dist/types/components/MenuItem.d.ts +4 -0
  62. package/dist/types/components/MobileDatePicker.d.ts +19 -0
  63. package/dist/types/components/Modal.d.ts +9 -0
  64. package/dist/types/components/MultiSelect.d.ts +14 -0
  65. package/dist/types/components/NumberInput.d.ts +19 -0
  66. package/dist/types/components/OtpInput.d.ts +16 -0
  67. package/dist/types/components/Pagination.d.ts +4 -0
  68. package/dist/types/components/ProgressBar.d.ts +10 -0
  69. package/dist/types/components/Radio.d.ts +4 -0
  70. package/dist/types/components/RadioGroup.d.ts +4 -0
  71. package/dist/types/components/Select.d.ts +4 -0
  72. package/dist/types/components/Skeleton.d.ts +4 -0
  73. package/dist/types/components/Slider.d.ts +4 -0
  74. package/dist/types/components/Step.d.ts +4 -0
  75. package/dist/types/components/StepConnector.d.ts +4 -0
  76. package/dist/types/components/StepContent.d.ts +4 -0
  77. package/dist/types/components/StepLabel.d.ts +4 -0
  78. package/dist/types/components/Stepper.d.ts +4 -0
  79. package/dist/types/components/SvgIcon.d.ts +8 -0
  80. package/dist/types/components/Tab.d.ts +12 -0
  81. package/dist/types/components/TextField.d.ts +9 -0
  82. package/dist/types/components/Toast.d.ts +20 -0
  83. package/dist/types/components/Toggle.d.ts +10 -0
  84. package/dist/types/components/Typography.d.ts +8 -0
  85. package/dist/types/components/WheelDatePicker.d.ts +37 -0
  86. package/dist/types/components/index.d.ts +53 -0
  87. package/dist/types/constants/colors.d.ts +2 -0
  88. package/dist/types/constants/index.d.ts +2 -0
  89. package/dist/types/constants/stepConnectorClasses.d.ts +2 -0
  90. package/dist/types/constants/typography.d.ts +82 -0
  91. package/dist/types/context/MessageHandler.d.ts +15 -0
  92. package/dist/types/context/index.d.ts +1 -0
  93. package/dist/types/hooks/index.d.ts +8 -0
  94. package/dist/types/hooks/useErrorHandler.d.ts +10 -0
  95. package/dist/types/hooks/useMessage.d.ts +2 -0
  96. package/dist/types/hooks/useWebOtpListener.d.ts +1 -0
  97. package/dist/types/index.d.ts +8 -0
  98. package/dist/types/index.js +19 -0
  99. package/dist/types/libs/create-api-request.d.ts +10 -0
  100. package/dist/types/libs/create-logger.d.ts +9 -0
  101. package/dist/types/libs/create-sentry-instrument.d.ts +9 -0
  102. package/dist/types/libs/index.d.ts +10 -0
  103. package/dist/types/providers/SPAThemeProvider.d.ts +11 -0
  104. package/dist/types/providers/ThemeProvider.d.ts +9 -0
  105. package/dist/types/providers/index.d.ts +2 -0
  106. package/dist/types/stories/persian.d.ts +81 -0
  107. package/dist/types/types/axios.d.ts +8 -0
  108. package/dist/types/types/color.d.ts +38 -0
  109. package/dist/types/types/index.d.ts +7 -0
  110. package/dist/types/types/material-react-table-types.d.ts +2 -0
  111. package/dist/types/types/mui-types.d.ts +2 -0
  112. package/dist/types/types/services.d.ts +26 -0
  113. package/dist/types/types/typography.d.ts +62 -0
  114. package/dist/types/types/window.d.ts +135 -0
  115. package/dist/types/utils/checkUser.d.ts +1 -0
  116. package/dist/types/utils/convertRialToToman.d.ts +7 -0
  117. package/dist/types/utils/createQueryParams.d.ts +3 -0
  118. package/dist/types/utils/dateHelpers.d.ts +19 -0
  119. package/dist/types/utils/delay.d.ts +1 -0
  120. package/dist/types/utils/formatPersianNumber.d.ts +1 -0
  121. package/dist/types/utils/getClaims.d.ts +11 -0
  122. package/dist/types/utils/index.d.ts +17 -0
  123. package/dist/types/utils/injastStyled.d.ts +2 -0
  124. package/dist/types/utils/postToParent.d.ts +2 -0
  125. package/dist/types/utils/toLatinDigit.d.ts +1 -0
  126. package/dist/utils/index.js +256 -0
  127. package/package.json +159 -0
@@ -0,0 +1,3187 @@
1
+ "use client";
2
+
3
+ // src/components/Accordion.tsx
4
+ import { Accordion as MuiAccordion } from "@mui/material";
5
+ import { jsx } from "react/jsx-runtime";
6
+ var Accordion = ({ children, ...props }) => {
7
+ return /* @__PURE__ */ jsx(MuiAccordion, { ...props, children });
8
+ };
9
+ var Accordion_default = Accordion;
10
+
11
+ // src/components/AccordionDetails.tsx
12
+ import {
13
+ AccordionDetails as MuiAccordionDetails
14
+ } from "@mui/material";
15
+ import { jsx as jsx2 } from "react/jsx-runtime";
16
+ var AccordionDetails = ({
17
+ children,
18
+ ...props
19
+ }) => {
20
+ return /* @__PURE__ */ jsx2(MuiAccordionDetails, { ...props, children });
21
+ };
22
+ var AccordionDetails_default = AccordionDetails;
23
+
24
+ // src/components/AccordionSummary.tsx
25
+ import {
26
+ AccordionSummary as MuiAccordionSummary
27
+ } from "@mui/material";
28
+ import { jsx as jsx3 } from "react/jsx-runtime";
29
+ var AccordionSummary = ({
30
+ children,
31
+ ...props
32
+ }) => {
33
+ return /* @__PURE__ */ jsx3(MuiAccordionSummary, { ...props, children });
34
+ };
35
+ var AccordionSummary_default = AccordionSummary;
36
+
37
+ // src/components/Autocomplete.tsx
38
+ import {
39
+ Autocomplete as MuiAutocomplete
40
+ } from "@mui/material";
41
+ import { jsx as jsx4 } from "react/jsx-runtime";
42
+ var Autocomplete = (props) => {
43
+ return /* @__PURE__ */ jsx4(MuiAutocomplete, { ...props });
44
+ };
45
+ var Autocomplete_default = Autocomplete;
46
+
47
+ // src/components/Box.tsx
48
+ import { Box as MuiBox } from "@mui/material";
49
+ import { jsx as jsx5 } from "react/jsx-runtime";
50
+ var Box = ({ children, ...props }) => {
51
+ return /* @__PURE__ */ jsx5(MuiBox, { ...props, children });
52
+ };
53
+ var Box_default = Box;
54
+
55
+ // src/components/Button.tsx
56
+ import {
57
+ Button as MuiButton,
58
+ CircularProgress
59
+ } from "@mui/material";
60
+
61
+ // src/constants/colors.ts
62
+ var defaultColors = {
63
+ neutral: {
64
+ 50: "#F8FAFD",
65
+ 100: "#F4F6FA",
66
+ 200: "#E8EAEE",
67
+ 300: "#D6D9DF",
68
+ 400: "#B1B7C2",
69
+ 500: "#91969F",
70
+ 600: "#6B7079",
71
+ 700: "#4F545E",
72
+ 800: "#363C46",
73
+ 900: "#242933",
74
+ main: "#4F545E",
75
+ light: "#91969F",
76
+ dark: "#242933",
77
+ contrastText: "#fff"
78
+ },
79
+ success: {
80
+ dark: "#0B8922",
81
+ main: "#18AB33",
82
+ light: "#EAF9EC"
83
+ },
84
+ danger: {
85
+ dark: "#B9141F",
86
+ main: "#ED2C3A",
87
+ light: "#FEEAEC"
88
+ },
89
+ warning: {
90
+ dark: "#CB620A",
91
+ main: "#FD7E14",
92
+ light: "#FFEFE1"
93
+ },
94
+ info: {
95
+ dark: "#168EA1",
96
+ main: "#24ADC2",
97
+ light: "#E5F8FB"
98
+ },
99
+ yellow: {
100
+ 100: "#FFF3CD",
101
+ 200: "#FFDA6A",
102
+ 300: "#FFC107",
103
+ 400: "#DCA000",
104
+ dark: "#DCA000",
105
+ main: "#FFC107",
106
+ light: "#FFF3CD",
107
+ transparent: "#FFC1071A"
108
+ },
109
+ red: {
110
+ 100: "#FDEAEB",
111
+ 200: "#FF606F",
112
+ 300: "#ED2C3A",
113
+ 400: "#AC2633",
114
+ dark: "#AC2633",
115
+ main: "#ED2C3A",
116
+ light: "#FDEAEB",
117
+ transparent: "#ED2C3A1A"
118
+ },
119
+ indigo: {
120
+ 100: "#EEE3FF",
121
+ 200: "#8540F5",
122
+ 300: "#6610F2",
123
+ 400: "#3D0A91",
124
+ dark: "#3D0A91",
125
+ main: "#6610F2",
126
+ light: "#EEE3FF",
127
+ transparent: "#6610F21A"
128
+ },
129
+ cyan: {
130
+ 100: "#E5F8FB",
131
+ 200: "#6EDFF6",
132
+ 300: "#0DCAF0",
133
+ 400: "#24ADC2",
134
+ dark: "#24ADC2",
135
+ main: "#0DCAF0",
136
+ light: "#E5F8FB",
137
+ transparent: "#0DCAF01A"
138
+ },
139
+ pink: {
140
+ 100: "#FDECF0",
141
+ 200: "#FF6C88",
142
+ 300: "#EF4465",
143
+ 400: "#CC2C4B",
144
+ dark: "#CC2C4B",
145
+ main: "#EF4465",
146
+ light: "#FDECF0",
147
+ transparent: "#EF44651A"
148
+ },
149
+ orange: {
150
+ 100: "#FFEFE1",
151
+ 200: "#FD9843",
152
+ 300: "#FD7E14",
153
+ 400: "#A34A00",
154
+ dark: "#A34A00",
155
+ main: "#FD7E14",
156
+ light: "#FFEFE1",
157
+ transparent: "#FFC1071A"
158
+ },
159
+ magenta: {
160
+ 100: "#FCE3EF",
161
+ 200: "#DE5C9D",
162
+ 300: "#D63384",
163
+ 400: "#801F4F",
164
+ dark: "#801F4F",
165
+ main: "#D63384",
166
+ light: "#FCE3EF",
167
+ transparent: "#D633841A"
168
+ },
169
+ blue: {
170
+ 100: "#E3F2FF",
171
+ 200: "#5A9DFF",
172
+ 300: "#0D6EFD",
173
+ 400: "#084298",
174
+ dark: "#084298",
175
+ main: "#0D6EFD",
176
+ light: "#E3F2FF",
177
+ transparent: "#0D6EFD1A"
178
+ },
179
+ teal: {
180
+ 100: "#E5FAF4",
181
+ 200: "#79DFC1",
182
+ 300: "#20C997",
183
+ 400: "#179D76",
184
+ dark: "#179D76",
185
+ main: "#20C997",
186
+ light: "#E5FAF4",
187
+ transparent: "#20C9971A"
188
+ }
189
+ };
190
+
191
+ // src/components/Button.tsx
192
+ import { jsx as jsx6 } from "react/jsx-runtime";
193
+ var Button = ({
194
+ loading = false,
195
+ buttonSize = "M",
196
+ loadingColor = defaultColors.neutral[50],
197
+ children,
198
+ ...props
199
+ }) => {
200
+ const { sx: sxProp, onClick, ...restProps } = props;
201
+ const sizeStyles = {
202
+ L: {
203
+ fontSize: "1rem",
204
+ height: "56px",
205
+ borderRadius: "12px"
206
+ },
207
+ M: {
208
+ fontSize: "1rem",
209
+ height: "48px",
210
+ borderRadius: "12px"
211
+ },
212
+ S: {
213
+ fontSize: "0.875rem",
214
+ height: "40px",
215
+ borderRadius: "8px"
216
+ },
217
+ XS: {
218
+ fontSize: "0.75rem",
219
+ height: "32px",
220
+ borderRadius: "8px"
221
+ }
222
+ };
223
+ return /* @__PURE__ */ jsx6(
224
+ MuiButton,
225
+ {
226
+ disableRipple: true,
227
+ disableFocusRipple: true,
228
+ disableElevation: true,
229
+ disableTouchRipple: true,
230
+ onClick: loading ? void 0 : onClick,
231
+ sx: {
232
+ ...sxProp,
233
+ ...sizeStyles[buttonSize],
234
+ display: "flex",
235
+ gap: "8px",
236
+ alignItems: "center",
237
+ boxShadow: "none",
238
+ justifyContent: "center",
239
+ textTransform: "none",
240
+ fontWeight: 700,
241
+ "& .MuiButton-endIcon": {
242
+ margin: 0,
243
+ right: 0,
244
+ left: 0
245
+ },
246
+ "& .MuiButton-startIcon": {
247
+ margin: 0,
248
+ right: 0,
249
+ left: 0
250
+ },
251
+ "&.Mui-disabled": {
252
+ color: "neutral.300",
253
+ "&.MuiButton-contained": {
254
+ color: "neutral.light",
255
+ backgroundColor: "neutral.400",
256
+ borderColor: "neutral.400"
257
+ },
258
+ "&.MuiButton-outlined": {
259
+ color: "neutral.300",
260
+ borderColor: "neutral.200"
261
+ },
262
+ "& .MuiButton-startIcon": {
263
+ filter: "grayscale(1)"
264
+ }
265
+ }
266
+ },
267
+ ...restProps,
268
+ children: loading ? /* @__PURE__ */ jsx6(CircularProgress, { sx: { color: loadingColor }, size: 24 }) : children
269
+ }
270
+ );
271
+ };
272
+ var Button_default = Button;
273
+
274
+ // src/components/Checkbox.tsx
275
+ import {
276
+ Checkbox as MuiCheckbox,
277
+ useTheme
278
+ } from "@mui/material";
279
+ import { jsx as jsx7 } from "react/jsx-runtime";
280
+ var Checkbox = ({
281
+ iconSize = 24,
282
+ borderColor,
283
+ checkedBorderColor,
284
+ backgroundColor,
285
+ tickColor,
286
+ ...props
287
+ }) => {
288
+ const theme = useTheme();
289
+ return /* @__PURE__ */ jsx7(
290
+ MuiCheckbox,
291
+ {
292
+ disableRipple: true,
293
+ ...props,
294
+ icon: /* @__PURE__ */ jsx7(
295
+ "div",
296
+ {
297
+ style: {
298
+ width: iconSize,
299
+ height: iconSize,
300
+ border: `1px solid ${borderColor ? borderColor : "#D6D9DF"}`,
301
+ borderRadius: 4
302
+ }
303
+ }
304
+ ),
305
+ checkedIcon: /* @__PURE__ */ jsx7(
306
+ "div",
307
+ {
308
+ style: {
309
+ width: iconSize,
310
+ height: iconSize,
311
+ border: `1px solid ${theme.palette.primary.main || checkedBorderColor}`,
312
+ borderRadius: 4,
313
+ backgroundColor,
314
+ display: "flex",
315
+ justifyContent: "center",
316
+ alignItems: "center"
317
+ },
318
+ children: /* @__PURE__ */ jsx7(
319
+ "svg",
320
+ {
321
+ width: iconSize / 1.2,
322
+ height: iconSize / 1.2,
323
+ viewBox: "0 0 24 24",
324
+ fill: "none",
325
+ xmlns: "http://www.w3.org/2000/svg",
326
+ children: /* @__PURE__ */ jsx7(
327
+ "path",
328
+ {
329
+ d: "M9 16.2L4.8 12L3.4 13.4L9 19L21 7L19.6 5.6L9 16.2Z",
330
+ fill: theme.palette.primary.main || tickColor
331
+ }
332
+ )
333
+ }
334
+ )
335
+ }
336
+ )
337
+ }
338
+ );
339
+ };
340
+ var Checkbox_default = Checkbox;
341
+
342
+ // src/components/Container.tsx
343
+ import { Container as MuiContainer } from "@mui/material";
344
+ import { jsx as jsx8 } from "react/jsx-runtime";
345
+ var Container = ({ children, ...props }) => {
346
+ return /* @__PURE__ */ jsx8(MuiContainer, { ...props, children });
347
+ };
348
+ var Container_default = Container;
349
+
350
+ // src/components/Drawer.tsx
351
+ import { Drawer as MuiDrawer } from "@mui/material";
352
+ import { jsx as jsx9 } from "react/jsx-runtime";
353
+ var Drawer = ({
354
+ children,
355
+ isDrawerOpen,
356
+ onClose,
357
+ ...props
358
+ }) => {
359
+ const { sx: sxProp, ...restProps } = props;
360
+ return /* @__PURE__ */ jsx9(
361
+ MuiDrawer,
362
+ {
363
+ anchor: "bottom",
364
+ open: isDrawerOpen,
365
+ onClose,
366
+ dir: "rtl",
367
+ ...restProps,
368
+ sx: {
369
+ ...sxProp,
370
+ backdropFilter: "blur(2px)",
371
+ backgroundColor: "rgba(0,0,30,0.4)",
372
+ "&.MuiDrawer-anchorBottom": {
373
+ "& .MuiPaper-root": {
374
+ borderRadius: "12px 12px 0 0"
375
+ }
376
+ }
377
+ },
378
+ children
379
+ }
380
+ );
381
+ };
382
+ var Drawer_default = Drawer;
383
+
384
+ // src/components/FormControl.tsx
385
+ import { FormControl as MuiFormControl } from "@mui/material";
386
+ import { jsx as jsx10 } from "react/jsx-runtime";
387
+ var FormControl = ({ children, ...props }) => {
388
+ return /* @__PURE__ */ jsx10(MuiFormControl, { ...props, children });
389
+ };
390
+ var FormControl_default = FormControl;
391
+
392
+ // src/components/Grid.tsx
393
+ import { Grid2 } from "@mui/material";
394
+ import { jsx as jsx11 } from "react/jsx-runtime";
395
+ var Grid = ({ children, ...props }) => {
396
+ return /* @__PURE__ */ jsx11(Grid2, { ...props, children });
397
+ };
398
+ var Grid_default = Grid;
399
+
400
+ // src/components/IconButton.tsx
401
+ import { IconButton as MuiIconButton } from "@mui/material";
402
+ import { jsx as jsx12 } from "react/jsx-runtime";
403
+ var IconButton = ({ children, ...props }) => {
404
+ return /* @__PURE__ */ jsx12(MuiIconButton, { disableRipple: true, ...props, children });
405
+ };
406
+ var IconButton_default = IconButton;
407
+
408
+ // src/components/InputLabel.tsx
409
+ import { InputLabel as MuiInputLabel } from "@mui/material";
410
+ import { jsx as jsx13 } from "react/jsx-runtime";
411
+ var InputLabel = ({ children, ...props }) => {
412
+ return /* @__PURE__ */ jsx13(MuiInputLabel, { ...props, children });
413
+ };
414
+ var InputLabel_default = InputLabel;
415
+
416
+ // src/components/Loading.tsx
417
+ import { CircularProgress as CircularProgress2, Container as Container2 } from "@mui/material";
418
+ import { jsx as jsx14 } from "react/jsx-runtime";
419
+ var Loading = ({ color, size = 50 }) => {
420
+ return /* @__PURE__ */ jsx14(
421
+ Container2,
422
+ {
423
+ sx: {
424
+ width: "100%",
425
+ display: "flex",
426
+ flexDirection: "row",
427
+ alignItems: "center",
428
+ justifyContent: "center"
429
+ },
430
+ children: /* @__PURE__ */ jsx14(CircularProgress2, { size, sx: { color } })
431
+ }
432
+ );
433
+ };
434
+ var Loading_default = Loading;
435
+
436
+ // src/components/MenuItem.tsx
437
+ import { MenuItem as MuiMenuItem } from "@mui/material";
438
+ import { jsx as jsx15 } from "react/jsx-runtime";
439
+ var MenuItem = ({ children, ...props }) => {
440
+ return /* @__PURE__ */ jsx15(MuiMenuItem, { ...props, children });
441
+ };
442
+ var MenuItem_default = MenuItem;
443
+
444
+ // src/components/Modal.tsx
445
+ import { Dialog, DialogContent } from "@mui/material";
446
+
447
+ // src/utils/injastStyled.ts
448
+ import { styled as muiStyled } from "@mui/material/styles";
449
+
450
+ // src/components/Modal.tsx
451
+ import { jsx as jsx16 } from "react/jsx-runtime";
452
+ var CustomBackdrop = muiStyled("div")(({}) => ({
453
+ position: "fixed",
454
+ top: 0,
455
+ left: 0,
456
+ width: "100vw",
457
+ height: "100vh",
458
+ backgroundColor: "rgba(0,0,20,0.65)",
459
+ backdropFilter: "blur(2px)",
460
+ zIndex: -1
461
+ }));
462
+ var Modal = ({ open, onClose, children, width }) => {
463
+ return /* @__PURE__ */ jsx16(
464
+ Dialog,
465
+ {
466
+ open,
467
+ onClose,
468
+ maxWidth: width ? false : void 0,
469
+ slots: {
470
+ backdrop: CustomBackdrop
471
+ },
472
+ PaperProps: {
473
+ sx: {
474
+ borderRadius: 3,
475
+ margin: 2
476
+ }
477
+ },
478
+ children: /* @__PURE__ */ jsx16(DialogContent, { sx: { width }, children })
479
+ }
480
+ );
481
+ };
482
+ var Modal_default = Modal;
483
+
484
+ // src/components/ProgressBar.tsx
485
+ import { Box as Box2, LinearProgress, Typography } from "@mui/material";
486
+ import { jsx as jsx17, jsxs } from "react/jsx-runtime";
487
+ var ProgressBar = ({
488
+ color,
489
+ progress,
490
+ height = 20,
491
+ disablePercentage,
492
+ isRtl
493
+ }) => {
494
+ return /* @__PURE__ */ jsxs(
495
+ Box2,
496
+ {
497
+ sx: { position: "relative", transform: `${isRtl && "rotateY(180deg)"}` },
498
+ children: [
499
+ /* @__PURE__ */ jsx17(Box2, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx17(
500
+ LinearProgress,
501
+ {
502
+ sx: {
503
+ height: height ? `${height}px` : "20px",
504
+ borderRadius: "9999px",
505
+ backgroundColor: progress > 0 ? `#E8EAEE` : `#F4F6FA`,
506
+ "& .MuiLinearProgress-bar1Determinate": {
507
+ borderRadius: "9999px",
508
+ backgroundColor: color
509
+ }
510
+ },
511
+ variant: "determinate",
512
+ value: progress
513
+ }
514
+ ) }),
515
+ !disablePercentage && /* @__PURE__ */ jsx17(
516
+ Typography,
517
+ {
518
+ variant: "label1",
519
+ sx: {
520
+ position: "absolute",
521
+ fontWeight: "500",
522
+ left: progress > 90 ? "50%" : "16px",
523
+ top: "60%",
524
+ transform: `translate(-50%,-50%) ${isRtl ? "rotateY(180deg)" : ""}`,
525
+ color: progress > 90 ? "white" : `#242933`
526
+ },
527
+ children: `${Math.round(progress)}%`
528
+ }
529
+ )
530
+ ]
531
+ }
532
+ );
533
+ };
534
+ var ProgressBar_default = ProgressBar;
535
+
536
+ // src/components/Radio.tsx
537
+ import { Radio as MuiRadio } from "@mui/material";
538
+ import { jsx as jsx18 } from "react/jsx-runtime";
539
+ var Radio = ({ ...props }) => {
540
+ return /* @__PURE__ */ jsx18(MuiRadio, { ...props });
541
+ };
542
+ var Radio_default = Radio;
543
+
544
+ // src/components/Select.tsx
545
+ import { Select as MuiSelect } from "@mui/material";
546
+ import { jsx as jsx19 } from "react/jsx-runtime";
547
+ var Select = ({ children, ...props }) => {
548
+ return /* @__PURE__ */ jsx19(MuiSelect, { ...props, children });
549
+ };
550
+ var Select_default = Select;
551
+
552
+ // src/components/Skeleton.tsx
553
+ import { Skeleton as MuiSkeleton } from "@mui/material";
554
+ import { jsx as jsx20 } from "react/jsx-runtime";
555
+ var Skeleton = ({ ...props }) => {
556
+ return /* @__PURE__ */ jsx20(MuiSkeleton, { ...props });
557
+ };
558
+ var Skeleton_default = Skeleton;
559
+
560
+ // src/components/Step.tsx
561
+ import { Step as MuiStep } from "@mui/material";
562
+ import { jsx as jsx21 } from "react/jsx-runtime";
563
+ var Step = ({ children, ...props }) => {
564
+ return /* @__PURE__ */ jsx21(MuiStep, { ...props, children });
565
+ };
566
+ var Step_default = Step;
567
+
568
+ // src/components/StepConnector.tsx
569
+ import {
570
+ StepConnector as MuiStepConnector
571
+ } from "@mui/material";
572
+ import { jsx as jsx22 } from "react/jsx-runtime";
573
+ var StepConnector = ({ ...props }) => {
574
+ return /* @__PURE__ */ jsx22(MuiStepConnector, { ...props });
575
+ };
576
+ var StepConnector_default = StepConnector;
577
+
578
+ // src/components/StepContent.tsx
579
+ import { StepContent as MuiStepContent } from "@mui/material";
580
+ import { jsx as jsx23 } from "react/jsx-runtime";
581
+ var StepContent = ({ children, ...props }) => {
582
+ return /* @__PURE__ */ jsx23(MuiStepContent, { ...props, children });
583
+ };
584
+ var StepContent_default = StepContent;
585
+
586
+ // src/components/StepLabel.tsx
587
+ import { StepLabel as MuiStepLabel } from "@mui/material";
588
+ import { jsx as jsx24 } from "react/jsx-runtime";
589
+ var StepLabel = ({ children, ...props }) => {
590
+ return /* @__PURE__ */ jsx24(MuiStepLabel, { ...props, children });
591
+ };
592
+ var StepLabel_default = StepLabel;
593
+
594
+ // src/components/Stepper.tsx
595
+ import { Stepper as MuiStepper } from "@mui/material";
596
+ import { jsx as jsx25 } from "react/jsx-runtime";
597
+ var Stepper = ({ children, ...props }) => {
598
+ return /* @__PURE__ */ jsx25(MuiStepper, { ...props, children });
599
+ };
600
+ var Stepper_default = Stepper;
601
+
602
+ // src/components/TextField.tsx
603
+ import {
604
+ InputAdornment,
605
+ TextField as MuiTextField
606
+ } from "@mui/material";
607
+ import { mergeSlotProps } from "@mui/material/utils";
608
+ import { jsx as jsx26 } from "react/jsx-runtime";
609
+ var TextField = ({
610
+ startAdornment,
611
+ endAdornment,
612
+ height,
613
+ ...props
614
+ }) => {
615
+ const { sx: sxProp, slotProps: slotPropsProp, ...restProps } = props;
616
+ const defaultInputSlotProps = {
617
+ startAdornment: startAdornment && /* @__PURE__ */ jsx26(InputAdornment, { position: "start", children: startAdornment }),
618
+ endAdornment: endAdornment && /* @__PURE__ */ jsx26(InputAdornment, { position: "end", children: endAdornment })
619
+ };
620
+ const mergedSlotProps = {
621
+ ...slotPropsProp,
622
+ input: mergeSlotProps(slotPropsProp?.input, defaultInputSlotProps)
623
+ };
624
+ return /* @__PURE__ */ jsx26(
625
+ MuiTextField,
626
+ {
627
+ ...restProps,
628
+ slotProps: mergedSlotProps,
629
+ sx: {
630
+ ...sxProp,
631
+ height,
632
+ "& .MuiInputBase-root": { height },
633
+ "& .MuiOutlinedInput-root": {
634
+ borderRadius: 2,
635
+ height
636
+ },
637
+ "& .MuiFormHelperText-root": {
638
+ mx: 0
639
+ }
640
+ }
641
+ }
642
+ );
643
+ };
644
+ var TextField_default = TextField;
645
+
646
+ // src/components/Toast.tsx
647
+ import { Alert, Snackbar } from "@mui/material";
648
+ import { CloseCircle, Danger, InfoCircle, TickCircle } from "iconsax-react";
649
+ import { Fragment, jsx as jsx27 } from "react/jsx-runtime";
650
+ var Toast = ({
651
+ message,
652
+ open,
653
+ duration,
654
+ width = "90%",
655
+ handleClose,
656
+ anchorOrigin = { vertical: "top", horizontal: "left" },
657
+ isWide = false
658
+ }) => {
659
+ const getStyles = (severity) => {
660
+ const styles = {
661
+ error: {
662
+ backgroundColor: defaultColors.danger.light,
663
+ color: defaultColors.danger.main,
664
+ borderColor: defaultColors.danger.main
665
+ },
666
+ warning: {
667
+ backgroundColor: defaultColors.warning.light,
668
+ color: defaultColors.warning.main,
669
+ borderColor: defaultColors.warning.main
670
+ },
671
+ info: {
672
+ backgroundColor: defaultColors.info.light,
673
+ color: defaultColors.info.main,
674
+ borderColor: defaultColors.info.main
675
+ },
676
+ success: {
677
+ backgroundColor: defaultColors.success.light,
678
+ color: defaultColors.success.main,
679
+ borderColor: defaultColors.success.main
680
+ }
681
+ };
682
+ return styles[severity] || {};
683
+ };
684
+ const getIconForSeverity = (severity) => {
685
+ const icons = {
686
+ error: /* @__PURE__ */ jsx27(
687
+ CloseCircle,
688
+ {
689
+ color: defaultColors.danger.main,
690
+ size: 28,
691
+ variant: "Bold"
692
+ }
693
+ ),
694
+ warning: /* @__PURE__ */ jsx27(Danger, { color: defaultColors.warning.main, size: 28, variant: "Bold" }),
695
+ info: /* @__PURE__ */ jsx27(InfoCircle, { color: defaultColors.info.main, size: 28, variant: "Bold" }),
696
+ success: /* @__PURE__ */ jsx27(
697
+ TickCircle,
698
+ {
699
+ color: defaultColors.success.main,
700
+ size: 28,
701
+ variant: "Bold"
702
+ }
703
+ )
704
+ };
705
+ return icons[severity];
706
+ };
707
+ return /* @__PURE__ */ jsx27(
708
+ Snackbar,
709
+ {
710
+ open,
711
+ autoHideDuration: duration,
712
+ onClose: handleClose,
713
+ onClick: handleClose,
714
+ anchorOrigin,
715
+ sx: {
716
+ margin: "8px",
717
+ ...!isWide && anchorOrigin.horizontal === "center" && {
718
+ left: "50% !important",
719
+ right: "auto !important",
720
+ transform: "translateX(-50%)",
721
+ "@media (min-width: 600px)": {
722
+ left: "50% !important",
723
+ right: "auto !important",
724
+ transform: "translateX(-50%)"
725
+ }
726
+ },
727
+ ...!isWide && anchorOrigin.horizontal === "left" && {
728
+ "@media (min-width: 600px)": {
729
+ left: "50% !important",
730
+ right: "auto !important",
731
+ transform: "translateX(-50%)",
732
+ marginLeft: "-60px"
733
+ // نصف عرض container (550px / 2)
734
+ }
735
+ },
736
+ ...!isWide && anchorOrigin.horizontal === "right" && {
737
+ "@media (min-width: 600px)": {
738
+ left: "50% !important",
739
+ right: "auto !important",
740
+ transform: "translateX(-50%)",
741
+ marginLeft: "-60px"
742
+ // نصف عرض container (550px / 2)
743
+ }
744
+ }
745
+ },
746
+ children: message ? /* @__PURE__ */ jsx27(
747
+ Alert,
748
+ {
749
+ variant: "outlined",
750
+ icon: getIconForSeverity(message.severity),
751
+ severity: message.severity,
752
+ sx: {
753
+ width,
754
+ maxWidth: 450,
755
+ minWidth: isWide ? 350 : "auto",
756
+ borderRadius: "8px",
757
+ px: 3.5,
758
+ py: 4,
759
+ display: "flex",
760
+ alignItems: "center",
761
+ fontSize: "16px",
762
+ fontWeight: 500,
763
+ gap: 1,
764
+ ...getStyles(message.severity)
765
+ },
766
+ children: message.text
767
+ }
768
+ ) : /* @__PURE__ */ jsx27(Fragment, {})
769
+ }
770
+ );
771
+ };
772
+ var Toast_default = Toast;
773
+
774
+ // src/components/Toggle.tsx
775
+ import { styled, Switch } from "@mui/material";
776
+ import { jsx as jsx28 } from "react/jsx-runtime";
777
+ var Toggle = ({
778
+ size = "small",
779
+ color,
780
+ checked,
781
+ disabled,
782
+ onChange
783
+ }) => {
784
+ const InjastSwitch = styled((props) => /* @__PURE__ */ jsx28(
785
+ Switch,
786
+ {
787
+ focusVisibleClassName: ".Mui-focusVisible",
788
+ disableRipple: true,
789
+ size,
790
+ checked,
791
+ disabled,
792
+ onChange,
793
+ ...props
794
+ }
795
+ ))(({ theme }) => ({
796
+ width: size === "small" ? 48 : 59,
797
+ height: size === "small" ? 26 : 32,
798
+ padding: 0,
799
+ "& .MuiSwitch-switchBase": {
800
+ padding: 0,
801
+ margin: 2,
802
+ transitionDuration: "300ms",
803
+ "&.Mui-checked": {
804
+ transform: `translateX(${size === "small" ? 22 : 27}px)`,
805
+ color: "#fff",
806
+ "& + .MuiSwitch-track": {
807
+ backgroundColor: `${theme.palette.primary.main || color}`,
808
+ opacity: 1,
809
+ border: 0,
810
+ ...theme.applyStyles("dark", {
811
+ backgroundColor: `${theme.palette.primary.light || color}`
812
+ })
813
+ },
814
+ "&.Mui-disabled + .MuiSwitch-track": {
815
+ opacity: 0.5
816
+ }
817
+ },
818
+ "&.Mui-focusVisible .MuiSwitch-thumb": {
819
+ color: "#33cf4d",
820
+ border: "6px solid #fff"
821
+ },
822
+ "&.Mui-disabled .MuiSwitch-thumb": {
823
+ color: "#F4F6FA",
824
+ ...theme.applyStyles("dark", {
825
+ color: "#6B7079"
826
+ })
827
+ },
828
+ "&.Mui-disabled + .MuiSwitch-track": {
829
+ opacity: 0.7,
830
+ ...theme.applyStyles("dark", {
831
+ opacity: 0.3
832
+ })
833
+ }
834
+ },
835
+ "& .MuiSwitch-thumb": {
836
+ boxSizing: "border-box",
837
+ width: size === "small" ? 22 : 28,
838
+ height: size === "small" ? 22 : 28
839
+ },
840
+ "& .MuiSwitch-track": {
841
+ borderRadius: size === "small" ? 26 : 32 / 2,
842
+ backgroundColor: "#B1B7C2",
843
+ // bg color
844
+ opacity: 1,
845
+ transition: theme.transitions.create(["background-color"], {
846
+ duration: 500
847
+ }),
848
+ ...theme.applyStyles("dark", {
849
+ backgroundColor: "#39393D"
850
+ })
851
+ }
852
+ }));
853
+ return /* @__PURE__ */ jsx28(InjastSwitch, { sx: { m: 1 } });
854
+ };
855
+ var Toggle_default = Toggle;
856
+
857
+ // src/components/Typography.tsx
858
+ import {
859
+ Typography as MuiTypography
860
+ } from "@mui/material";
861
+ import { jsx as jsx29 } from "react/jsx-runtime";
862
+ var Typography2 = ({ children, ...props }) => {
863
+ return /* @__PURE__ */ jsx29(MuiTypography, { ...props, children });
864
+ };
865
+ var Typography_default = Typography2;
866
+
867
+ // src/components/OtpInput.tsx
868
+ import * as React from "react";
869
+ import { Box as Box3, styled as styled2 } from "@mui/system";
870
+ import { TextField as TextField2 } from "@mui/material";
871
+ import { jsx as jsx30, jsxs as jsxs2 } from "react/jsx-runtime";
872
+ var normalizeDigits = (str) => str.replace(/[\u06F0-\u06F9]/g, (d) => String(d.charCodeAt(0) - 1776)).replace(/[\u0660-\u0669]/g, (d) => String(d.charCodeAt(0) - 1632));
873
+ var onlyDigits = (str) => normalizeDigits(str).replace(/[^0-9]/g, "");
874
+ var InputElement = styled2("input")(
875
+ ({
876
+ theme,
877
+ width = "54px",
878
+ height = "54px",
879
+ backgroundColor,
880
+ focusedBorderColor,
881
+ error
882
+ }) => `
883
+ width: ${width};
884
+ height: ${height};
885
+ font-family: inherit;
886
+ font-size: 0.875rem;
887
+ font-weight: 400;
888
+ padding: 8px 0;
889
+ border-radius: 8px;
890
+ text-align: center;
891
+ color: ${defaultColors.neutral[900]};
892
+ background: ${backgroundColor};
893
+ border: 1px solid ${error ? defaultColors.danger.main : defaultColors.neutral[300]};
894
+ direction: ltr;
895
+
896
+ -moz-appearance: textfield;
897
+
898
+ &::-webkit-outer-spin-button,
899
+ &::-webkit-inner-spin-button {
900
+ -webkit-appearance: none;
901
+ margin: 0;
902
+ }
903
+
904
+ &:focus {
905
+ border-color: ${focusedBorderColor || defaultColors.neutral[300]};
906
+ box-shadow: 0 0 0 1px ${backgroundColor};
907
+ }
908
+
909
+ &:focus-visible {
910
+ outline: 0;
911
+ }
912
+ `
913
+ );
914
+ function OTP({
915
+ separator,
916
+ length: length2,
917
+ value,
918
+ onChange,
919
+ inputProps
920
+ }) {
921
+ const inputRefs = React.useRef(
922
+ new Array(length2).fill(null)
923
+ );
924
+ const focusInput = (targetIndex) => {
925
+ const targetInput = inputRefs.current[targetIndex];
926
+ targetInput?.focus();
927
+ };
928
+ const selectInput = (targetIndex) => {
929
+ const targetInput = inputRefs.current[targetIndex];
930
+ targetInput?.select();
931
+ };
932
+ const handleKeyDown2 = (event, currentIndex) => {
933
+ switch (event.key) {
934
+ case "ArrowUp":
935
+ case "ArrowDown":
936
+ case " ":
937
+ event.preventDefault();
938
+ break;
939
+ case "ArrowLeft":
940
+ event.preventDefault();
941
+ if (currentIndex > 0) {
942
+ focusInput(currentIndex - 1);
943
+ selectInput(currentIndex - 1);
944
+ }
945
+ break;
946
+ case "ArrowRight":
947
+ event.preventDefault();
948
+ if (currentIndex < length2 - 1) {
949
+ focusInput(currentIndex + 1);
950
+ selectInput(currentIndex + 1);
951
+ }
952
+ break;
953
+ case "Delete":
954
+ event.preventDefault();
955
+ onChange((prevOtp) => {
956
+ const otp = prevOtp.slice(0, currentIndex) + prevOtp.slice(currentIndex + 1);
957
+ return otp;
958
+ });
959
+ break;
960
+ case "Backspace":
961
+ event.preventDefault();
962
+ if (currentIndex > 0) {
963
+ focusInput(currentIndex - 1);
964
+ selectInput(currentIndex - 1);
965
+ }
966
+ onChange((prevOtp) => {
967
+ const otp = prevOtp.slice(0, currentIndex) + prevOtp.slice(currentIndex + 1);
968
+ return otp;
969
+ });
970
+ break;
971
+ default:
972
+ break;
973
+ }
974
+ };
975
+ const handleChange = (event, currentIndex) => {
976
+ const currentValue = onlyDigits(event.target.value);
977
+ let indexToEnter = 0;
978
+ while (indexToEnter <= currentIndex) {
979
+ if (inputRefs.current[indexToEnter]?.value && indexToEnter < currentIndex) {
980
+ indexToEnter += 1;
981
+ } else {
982
+ break;
983
+ }
984
+ }
985
+ onChange((prev) => {
986
+ const otpArray = prev.split("");
987
+ const lastValue = currentValue.slice(-1);
988
+ if (lastValue) otpArray[indexToEnter] = lastValue;
989
+ return otpArray.join("");
990
+ });
991
+ if (currentValue !== "" && currentIndex < length2 - 1) {
992
+ focusInput(currentIndex + 1);
993
+ }
994
+ };
995
+ const handleClick = (event, currentIndex) => {
996
+ selectInput(currentIndex);
997
+ };
998
+ const handlePaste = (event, currentIndex) => {
999
+ event.preventDefault();
1000
+ const clipboardData = event.clipboardData;
1001
+ if (clipboardData.types.includes("text/plain")) {
1002
+ let pastedText = onlyDigits(clipboardData.getData("text/plain")).slice(
1003
+ 0,
1004
+ length2
1005
+ );
1006
+ let indexToEnter = 0;
1007
+ while (indexToEnter <= currentIndex) {
1008
+ if (inputRefs.current[indexToEnter]?.value && indexToEnter < currentIndex) {
1009
+ indexToEnter += 1;
1010
+ } else {
1011
+ break;
1012
+ }
1013
+ }
1014
+ const otpArray = value.split("");
1015
+ for (let i = indexToEnter; i < length2; i += 1) {
1016
+ const next = pastedText[i - indexToEnter];
1017
+ if (!next) break;
1018
+ otpArray[i] = next;
1019
+ }
1020
+ onChange(otpArray.join(""));
1021
+ }
1022
+ };
1023
+ return /* @__PURE__ */ jsx30(
1024
+ Box3,
1025
+ {
1026
+ sx: {
1027
+ display: "flex",
1028
+ alignItems: "center",
1029
+ justifyContent: "space-between",
1030
+ width: "100%",
1031
+ gap: 0.5
1032
+ },
1033
+ children: new Array(length2).fill(null).map((_, index) => /* @__PURE__ */ jsxs2(React.Fragment, { children: [
1034
+ /* @__PURE__ */ jsx30(
1035
+ TextField2,
1036
+ {
1037
+ type: "tel",
1038
+ inputMode: "tel",
1039
+ autoComplete: "one-time-code",
1040
+ slotProps: {
1041
+ htmlInput: {
1042
+ pattern: "[0-9\u06F0-\u06F9\u0660-\u0669]*",
1043
+ inputMode: "tel",
1044
+ dir: "ltr",
1045
+ "aria-label": `Digit ${index + 1} of OTP`
1046
+ },
1047
+ input: {
1048
+ ref: (ele) => {
1049
+ inputRefs.current[index] = ele;
1050
+ },
1051
+ onKeyDown: (event) => handleKeyDown2(event, index),
1052
+ onChange: (event) => handleChange(event, index),
1053
+ onClick: (event) => handleClick(event, index),
1054
+ onPaste: (event) => handlePaste(event, index),
1055
+ value: value[index] ?? "",
1056
+ ...inputProps
1057
+ }
1058
+ },
1059
+ slots: {
1060
+ input: InputElement
1061
+ }
1062
+ }
1063
+ ),
1064
+ index === length2 - 1 ? null : separator
1065
+ ] }, index))
1066
+ }
1067
+ );
1068
+ }
1069
+ function OtpInput({
1070
+ separator = /* @__PURE__ */ jsx30("span", {}),
1071
+ length: length2,
1072
+ value,
1073
+ onChange,
1074
+ inputProps
1075
+ }) {
1076
+ return /* @__PURE__ */ jsx30(Box3, { sx: { display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ jsx30(
1077
+ OTP,
1078
+ {
1079
+ separator,
1080
+ value,
1081
+ onChange,
1082
+ length: length2,
1083
+ inputProps
1084
+ }
1085
+ ) });
1086
+ }
1087
+
1088
+ // src/components/Divider.tsx
1089
+ import { Divider as MuiDivider } from "@mui/material";
1090
+ import { jsx as jsx31 } from "react/jsx-runtime";
1091
+ var Divider = ({ ...props }) => {
1092
+ return /* @__PURE__ */ jsx31(MuiDivider, { ...props });
1093
+ };
1094
+ var Divider_default = Divider;
1095
+
1096
+ // src/components/FormControlLabel.tsx
1097
+ import {
1098
+ FormControlLabel as MuiFormControlLabel
1099
+ } from "@mui/material";
1100
+ import { jsx as jsx32 } from "react/jsx-runtime";
1101
+ var FormControlLabel = ({ ...props }) => {
1102
+ return /* @__PURE__ */ jsx32(MuiFormControlLabel, { ...props });
1103
+ };
1104
+ var FormControlLabel_default = FormControlLabel;
1105
+
1106
+ // src/components/RadioGroup.tsx
1107
+ import { RadioGroup as MuiRadioGroup } from "@mui/material";
1108
+ import { jsx as jsx33 } from "react/jsx-runtime";
1109
+ var RadioGroup = ({ children, ...props }) => {
1110
+ return /* @__PURE__ */ jsx33(MuiRadioGroup, { ...props, children });
1111
+ };
1112
+ var RadioGroup_default = RadioGroup;
1113
+
1114
+ // src/components/Slider.tsx
1115
+ import { Slider as MuiSlider } from "@mui/material";
1116
+ import { jsx as jsx34 } from "react/jsx-runtime";
1117
+ var Slider = ({ ...props }) => {
1118
+ return /* @__PURE__ */ jsx34(MuiSlider, { ...props });
1119
+ };
1120
+ var Slider_default = Slider;
1121
+
1122
+ // src/components/List.tsx
1123
+ import { List as MuiList } from "@mui/material";
1124
+ import { jsx as jsx35 } from "react/jsx-runtime";
1125
+ var List = ({ children, ...props }) => {
1126
+ return /* @__PURE__ */ jsx35(MuiList, { ...props, children });
1127
+ };
1128
+ var List_default = List;
1129
+
1130
+ // src/components/ListItem.tsx
1131
+ import { ListItem as MuiListItem } from "@mui/material";
1132
+ import { jsx as jsx36 } from "react/jsx-runtime";
1133
+ var ListItem = ({ children, ...props }) => {
1134
+ return /* @__PURE__ */ jsx36(MuiListItem, { ...props, children });
1135
+ };
1136
+ var ListItem_default = ListItem;
1137
+
1138
+ // src/components/MobileDatePicker.tsx
1139
+ import { useState, useRef as useRef2, useEffect } from "react";
1140
+ import { Calendar } from "react-multi-date-picker";
1141
+ import persian from "react-date-object/calendars/persian";
1142
+ import persian_fa from "react-date-object/locales/persian_fa";
1143
+ import "react-multi-date-picker/styles/layouts/mobile.css";
1144
+ import { Calendar as CalendarIcon } from "iconsax-react";
1145
+
1146
+ // src/utils/dateHelpers.ts
1147
+ import PN from "persian-number";
1148
+ import { toJalaali, toGregorian } from "jalaali-js";
1149
+ function gregorianToJalali(dateString) {
1150
+ const [year, month, day] = dateString.split("-").map(Number);
1151
+ const jalaliDate = toJalaali(year, month, day);
1152
+ const formattedMonth = String(jalaliDate.jm).padStart(2, "0");
1153
+ const formattedDay = String(jalaliDate.jd).padStart(2, "0");
1154
+ return `${jalaliDate.jy}/${formattedMonth}/${formattedDay}`;
1155
+ }
1156
+ function jalaliToGregorian(dateString) {
1157
+ const [year, month, day] = dateString.split("/").map(Number);
1158
+ const gregorianDate = toGregorian(year, month, day);
1159
+ const formattedMonth = String(gregorianDate.gm).padStart(2, "0");
1160
+ const formattedDay = String(gregorianDate.gd).padStart(2, "0");
1161
+ return `${gregorianDate.gy}-${formattedMonth}-${formattedDay}`;
1162
+ }
1163
+ var persianDateFormatter = new Intl.DateTimeFormat("en-US-u-ca-persian", {
1164
+ year: "numeric",
1165
+ month: "numeric",
1166
+ day: "numeric",
1167
+ timeZone: "UTC"
1168
+ });
1169
+ function getPersianYMD(date) {
1170
+ const parts = persianDateFormatter.formatToParts(date);
1171
+ const year = Number(parts.find((p) => p.type === "year")?.value);
1172
+ const month = Number(parts.find((p) => p.type === "month")?.value);
1173
+ const day = Number(parts.find((p) => p.type === "day")?.value);
1174
+ if (!year || !month || !day) throw new Error("Failed to parse Persian date");
1175
+ return { year, month, day };
1176
+ }
1177
+ function jalaliToDateUTC(jy, jm, jd) {
1178
+ const DAY_MS = 24 * 60 * 60 * 1e3;
1179
+ const approxYear = jy + 621;
1180
+ let lowDay = Math.floor(Date.UTC(approxYear - 2, 0, 1) / DAY_MS);
1181
+ let highDay = Math.floor(Date.UTC(approxYear + 2, 11, 31) / DAY_MS);
1182
+ while (lowDay <= highDay) {
1183
+ const midDay = Math.floor((lowDay + highDay) / 2);
1184
+ const midDate = new Date(midDay * DAY_MS);
1185
+ const { year, month, day } = getPersianYMD(midDate);
1186
+ if (year === jy && month === jm && day === jd) return midDate;
1187
+ const isBefore = year < jy || year === jy && month < jm || year === jy && month === jm && day < jd;
1188
+ if (isBefore) lowDay = midDay + 1;
1189
+ else highDay = midDay - 1;
1190
+ }
1191
+ throw new Error("Invalid Jalali date");
1192
+ }
1193
+
1194
+ // src/components/MobileDatePicker.tsx
1195
+ import { Fragment as Fragment3, jsx as jsx37, jsxs as jsxs3 } from "react/jsx-runtime";
1196
+ var MobileDatePicker = ({
1197
+ width = "100%",
1198
+ height = 48,
1199
+ label,
1200
+ value,
1201
+ onChange,
1202
+ disabled = false,
1203
+ error,
1204
+ helperText,
1205
+ textFieldSxProps,
1206
+ placeholder,
1207
+ minDate,
1208
+ maxDate
1209
+ }) => {
1210
+ const [dateValue, setDateValue] = useState(value && gregorianToJalali(value));
1211
+ const [selectedDate, setSelectedDate] = useState(null);
1212
+ const [isModalOpen, setIsModalOpen] = useState(false);
1213
+ const [defaultCalenderValue, setDefaultCalenderValue] = useState("");
1214
+ const calendarRef = useRef2(null);
1215
+ const openCalendar = () => {
1216
+ if (disabled) return;
1217
+ setIsModalOpen(true);
1218
+ };
1219
+ const closeCalendar = () => {
1220
+ setIsModalOpen(false);
1221
+ setSelectedDate(null);
1222
+ };
1223
+ const handleDateChange = (date) => {
1224
+ setSelectedDate(`${date.year}/${date.month}/${date.day}`);
1225
+ };
1226
+ const handleSubmit = () => {
1227
+ if (selectedDate) {
1228
+ setDateValue(selectedDate);
1229
+ onChange(jalaliToGregorian(selectedDate));
1230
+ }
1231
+ closeCalendar();
1232
+ };
1233
+ const handleCancel = () => {
1234
+ closeCalendar();
1235
+ };
1236
+ useEffect(() => {
1237
+ if (!value) {
1238
+ setDateValue("");
1239
+ setSelectedDate(null);
1240
+ }
1241
+ }, [value]);
1242
+ useEffect(() => {
1243
+ if (selectedDate || dateValue) {
1244
+ setDefaultCalenderValue(`${selectedDate || dateValue}`);
1245
+ } else {
1246
+ if (maxDate) {
1247
+ setDefaultCalenderValue(maxDate);
1248
+ } else {
1249
+ setDefaultCalenderValue("");
1250
+ }
1251
+ }
1252
+ }, [maxDate, selectedDate, dateValue]);
1253
+ const mergedSx = { width, ...textFieldSxProps };
1254
+ return /* @__PURE__ */ jsxs3(Fragment3, { children: [
1255
+ /* @__PURE__ */ jsx37("style", { children: ` .rmdp-day.rmdp-today span {
1256
+ background-color: #ACEED6 !important;
1257
+ }
1258
+
1259
+ .rmdp-day span {
1260
+ border-radius: 6px !important;
1261
+ }
1262
+
1263
+ .rmdp-day.rmdp-selected span:not(.highlight) {
1264
+ background-color: #1DBF98 !important;
1265
+ box-shadow: 0 0 1px #8798ad;
1266
+ color: #fff;
1267
+ }
1268
+
1269
+ @media (max-height: 450px), (max-width: 450px) {
1270
+ .rmdp-day span {
1271
+ font-size: 14px !important;
1272
+ padding-left: 0.5px;
1273
+ }
1274
+ }
1275
+
1276
+ @media (max-height: 450px), (max-width: 450px) {
1277
+ .rmdp-header, .rmdp-month-name {
1278
+ font-size: 14px !important;
1279
+ }
1280
+ }
1281
+
1282
+ .rmdp-week-day {
1283
+ color: #1DBF98 !important;
1284
+ font-size: 14 !important;
1285
+ }
1286
+
1287
+ .rmdp-arrow {
1288
+ border: solid #1DBF98 !important;
1289
+ border-width: 0 2px 2px 0 !important;
1290
+ }
1291
+
1292
+ .rmdp-action-button {
1293
+ color: #1DBF98 !important;
1294
+ }
1295
+
1296
+ .rmdp-wrapper {
1297
+ border-radius: 12px !important;
1298
+ box-shadow: none !important;
1299
+ }
1300
+
1301
+ .rmdp-week,
1302
+ .rmdp-ym {
1303
+ display: flex;
1304
+ justify-content: space-between;
1305
+ gap: 10px !important;
1306
+ }
1307
+ .rmdp-day-picker {
1308
+ padding-top: 24px !important;
1309
+ }` }),
1310
+ /* @__PURE__ */ jsxs3(Modal_default, { open: isModalOpen, onClose: closeCalendar, children: [
1311
+ /* @__PURE__ */ jsx37(Box_default, { sx: { marginBottom: "20px" }, children: /* @__PURE__ */ jsx37(
1312
+ Calendar,
1313
+ {
1314
+ ref: calendarRef,
1315
+ monthYearSeparator: "|",
1316
+ calendar: persian,
1317
+ locale: persian_fa,
1318
+ value: defaultCalenderValue,
1319
+ onChange: handleDateChange,
1320
+ minDate,
1321
+ maxDate
1322
+ }
1323
+ ) }),
1324
+ /* @__PURE__ */ jsxs3(Box_default, { sx: { display: "flex", gap: 2, justifyContent: "end" }, children: [
1325
+ /* @__PURE__ */ jsx37(
1326
+ Button_default,
1327
+ {
1328
+ variant: "outlined",
1329
+ buttonSize: "XS",
1330
+ onClick: handleCancel,
1331
+ sx: {
1332
+ color: defaultColors.neutral.light,
1333
+ borderColor: defaultColors.neutral[300]
1334
+ },
1335
+ children: "\u0644\u063A\u0648"
1336
+ }
1337
+ ),
1338
+ /* @__PURE__ */ jsx37(Button_default, { variant: "contained", buttonSize: "XS", onClick: handleSubmit, children: "\u062A\u0627\u06CC\u06CC\u062F" })
1339
+ ] })
1340
+ ] }),
1341
+ /* @__PURE__ */ jsx37(
1342
+ TextField_default,
1343
+ {
1344
+ disabled,
1345
+ onClick: openCalendar,
1346
+ endAdornment: /* @__PURE__ */ jsx37(
1347
+ CalendarIcon,
1348
+ {
1349
+ color: disabled ? defaultColors.neutral[300] : defaultColors.neutral.dark,
1350
+ size: 20
1351
+ }
1352
+ ),
1353
+ slotProps: { input: { readOnly: true }, inputLabel: { shrink: true } },
1354
+ placeholder,
1355
+ value: dateValue,
1356
+ height,
1357
+ label,
1358
+ variant: "outlined",
1359
+ sx: mergedSx,
1360
+ error,
1361
+ helperText
1362
+ }
1363
+ )
1364
+ ] });
1365
+ };
1366
+ var MobileDatePicker_default = MobileDatePicker;
1367
+
1368
+ // src/components/Fab.tsx
1369
+ import { Fab as MuiFab } from "@mui/material";
1370
+ import { jsx as jsx38 } from "react/jsx-runtime";
1371
+ var Fab = ({ children, ...props }) => {
1372
+ return /* @__PURE__ */ jsx38(MuiFab, { ...props, children });
1373
+ };
1374
+ var Fab_default = Fab;
1375
+
1376
+ // src/components/Tab.tsx
1377
+ import { Fragment as Fragment4, useEffect as useEffect2, useState as useState2 } from "react";
1378
+ import { jsx as jsx39, jsxs as jsxs4 } from "react/jsx-runtime";
1379
+ var Tab = ({ tabs, onChange, activeTab, fontSize = 14 }) => {
1380
+ const [tabValue, setTabValue] = useState2(activeTab ? activeTab : "");
1381
+ useEffect2(() => {
1382
+ tabValue && onChange(tabValue);
1383
+ }, [tabValue]);
1384
+ return /* @__PURE__ */ jsx39(
1385
+ Box_default,
1386
+ {
1387
+ sx: {
1388
+ display: "flex",
1389
+ width: "100%",
1390
+ justifyContent: "space-between",
1391
+ alignItems: "end",
1392
+ bgcolor: "white",
1393
+ px: 2,
1394
+ borderRadius: 3,
1395
+ height: 48
1396
+ },
1397
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsxs4(Fragment4, { children: [
1398
+ /* @__PURE__ */ jsx39(Box_default, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx39(
1399
+ Typography_default,
1400
+ {
1401
+ onClick: () => {
1402
+ setTabValue(tab.value);
1403
+ },
1404
+ color: `${tab.value == tabValue ? "neutral.dark" : "neutral.light"}`,
1405
+ fontSize,
1406
+ fontWeight: `${tab.value == tabValue ? 700 : 500}`,
1407
+ sx: {
1408
+ p: 3.5,
1409
+ cursor: "pointer",
1410
+ textAlign: "center",
1411
+ position: "relative",
1412
+ WebkitTapHighlightColor: "transparent",
1413
+ "&:focus, &:active": {
1414
+ backgroundColor: "transparent",
1415
+ outline: "none"
1416
+ },
1417
+ "&::after": tab.value == tabValue ? {
1418
+ content: '""',
1419
+ position: "absolute",
1420
+ bottom: 0,
1421
+ left: "35%",
1422
+ right: "35%",
1423
+ borderBottom: "2px solid currentColor"
1424
+ } : {}
1425
+ },
1426
+ children: tab.label
1427
+ }
1428
+ ) }),
1429
+ index !== tabs.length - 1 && /* @__PURE__ */ jsx39(Divider_default, { sx: { my: 3 }, orientation: "vertical", flexItem: true })
1430
+ ] }, index))
1431
+ }
1432
+ );
1433
+ };
1434
+ var Tab_default = Tab;
1435
+
1436
+ // src/constants/stepConnectorClasses.ts
1437
+ import { stepConnectorClasses as MuiStepConnectorClasses } from "@mui/material";
1438
+
1439
+ // src/components/CounterBoxInput.tsx
1440
+ import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
1441
+ import { Add, Minus } from "iconsax-react";
1442
+ import { jsx as jsx40, jsxs as jsxs5 } from "react/jsx-runtime";
1443
+ function countDecimalDigits(num) {
1444
+ let str = num.toString();
1445
+ if (str.includes("e")) {
1446
+ const [, exponent] = str.split("e");
1447
+ const precision = Math.abs(parseInt(exponent));
1448
+ str = Number(num).toFixed(precision);
1449
+ }
1450
+ const parts = str.split(".");
1451
+ return parts[1] ? parts[1].length : 0;
1452
+ }
1453
+ var CounterBoxInput = ({
1454
+ min = 0,
1455
+ max = 1e5,
1456
+ mb = 0,
1457
+ error: propError = false,
1458
+ helperText: propHelperText = "",
1459
+ step = 1,
1460
+ fullWidth = false,
1461
+ unit = "\u0631\u06CC\u0627\u0644",
1462
+ iconColor = defaultColors.neutral.light,
1463
+ iconBackgroundColor = defaultColors.neutral[200],
1464
+ onChange,
1465
+ allowFloat = false,
1466
+ value: controlledValue = 0,
1467
+ maxAvailable,
1468
+ minErrText,
1469
+ disabledInput = false,
1470
+ maxErrText
1471
+ }) => {
1472
+ const fixRate = countDecimalDigits(step);
1473
+ const convertPersianToEnglish = (str) => str.replace(/[۰-۹]/g, (d) => String.fromCharCode(d.charCodeAt(0) - 1728));
1474
+ const formatNumber = (numStr) => {
1475
+ if (numStr === "" || isNaN(Number(numStr))) return numStr;
1476
+ return Number(numStr).toLocaleString("en-US");
1477
+ };
1478
+ const [draft, setDraft] = useState3(
1479
+ () => allowFloat ? String(controlledValue ?? 0) : (controlledValue ?? 0).toFixed(0)
1480
+ );
1481
+ useEffect3(() => {
1482
+ if (allowFloat) {
1483
+ const next = String(controlledValue ?? 0);
1484
+ const draftNum = Number(draft);
1485
+ const nextNum = Number(next);
1486
+ if (Number.isNaN(draftNum) || draftNum !== nextNum) setDraft(next);
1487
+ } else {
1488
+ setDraft((controlledValue ?? 0).toFixed(0));
1489
+ }
1490
+ }, [controlledValue, allowFloat]);
1491
+ const numericFromDraft = useMemo(() => {
1492
+ const raw = allowFloat ? draft : String(controlledValue ?? 0);
1493
+ const cleaned = raw.replace(/,/g, "");
1494
+ const n = Number(cleaned);
1495
+ return Number.isFinite(n) ? n : NaN;
1496
+ }, [draft, allowFloat, controlledValue]);
1497
+ const emitChangeFromString = (nextStr) => {
1498
+ const english = convertPersianToEnglish(nextStr);
1499
+ let cleaned;
1500
+ if (allowFloat) {
1501
+ cleaned = english.replace(/,/g, "").replace(/[^0-9.]/g, "");
1502
+ const parts = cleaned.split(".");
1503
+ if (parts.length > 2) cleaned = parts[0] + "." + parts.slice(1).join("");
1504
+ setDraft(cleaned);
1505
+ if (cleaned !== "" && cleaned !== "." && Number.isFinite(Number(cleaned))) {
1506
+ onChange(Number(cleaned));
1507
+ }
1508
+ } else {
1509
+ cleaned = english.replace(/,/g, "").replace(/[^0-9]/g, "");
1510
+ const n = cleaned === "" ? 0 : parseInt(cleaned, 10);
1511
+ onChange(n);
1512
+ }
1513
+ };
1514
+ const handleIncrement = () => {
1515
+ const base = Number.isFinite(numericFromDraft) ? numericFromDraft : Number(controlledValue) || 0;
1516
+ const next = allowFloat && fixRate ? parseFloat((base + step).toFixed(fixRate)) : base + step;
1517
+ onChange(next);
1518
+ if (allowFloat) setDraft(String(next));
1519
+ };
1520
+ const handleDecrement = () => {
1521
+ const base = Number.isFinite(numericFromDraft) ? numericFromDraft : Number(controlledValue) || 0;
1522
+ const next = allowFloat && fixRate ? parseFloat((base - step).toFixed(fixRate)) : base - step;
1523
+ onChange(next);
1524
+ if (allowFloat) setDraft(String(next));
1525
+ };
1526
+ const currentForBounds = Number.isFinite(numericFromDraft) ? numericFromDraft : Number(controlledValue) || 0;
1527
+ const disableInc = currentForBounds >= max || !!maxAvailable && currentForBounds >= maxAvailable;
1528
+ const disableDec = currentForBounds <= min;
1529
+ const autoErrorText = useMemo(() => {
1530
+ if (!Number.isFinite(currentForBounds)) return "";
1531
+ if (currentForBounds < min) {
1532
+ return minErrText ?? `\u062D\u062F\u0627\u0642\u0644 \u0645\u0642\u062F\u0627\u0631 ${min.toLocaleString()} ${unit}`;
1533
+ }
1534
+ if (currentForBounds > max) {
1535
+ return maxErrText ?? `\u062D\u062F\u0627\u06A9\u062B\u0631 \u0645\u0642\u062F\u0627\u0631 ${max.toLocaleString()} ${unit}`;
1536
+ }
1537
+ if (maxAvailable !== void 0 && currentForBounds > maxAvailable) {
1538
+ return maxErrText ?? `\u062D\u062F\u0627\u06A9\u062B\u0631 \u0645\u0648\u062C\u0648\u062F\u06CC ${maxAvailable.toLocaleString()} ${unit}`;
1539
+ }
1540
+ return "";
1541
+ }, [currentForBounds, min, max, maxAvailable, unit, minErrText, maxErrText]);
1542
+ const isEmptyOrZero = currentForBounds === 0 || draft === "" || draft === ".";
1543
+ const effectiveError = isEmptyOrZero ? false : propError || !!autoErrorText;
1544
+ const resolvedErrorText = autoErrorText || propHelperText;
1545
+ const effectiveHelper = isEmptyOrZero ? propHelperText : effectiveError ? resolvedErrorText : propHelperText;
1546
+ const displayValue = allowFloat ? draft : formatNumber((controlledValue ?? 0).toFixed(0));
1547
+ return /* @__PURE__ */ jsx40(
1548
+ TextField_default,
1549
+ {
1550
+ dir: "ltr",
1551
+ type: "text",
1552
+ height: 48,
1553
+ value: displayValue,
1554
+ error: effectiveError,
1555
+ fullWidth,
1556
+ helperText: !isEmptyOrZero && effectiveHelper,
1557
+ disabled: disabledInput,
1558
+ onChange: (e) => emitChangeFromString(e.target.value),
1559
+ inputProps: {
1560
+ inputMode: "decimal",
1561
+ pattern: allowFloat ? "[0-9.]*" : "[0-9]*"
1562
+ },
1563
+ sx: {
1564
+ mb: effectiveHelper ? mb : 0,
1565
+ "& .MuiInputBase-input": { textAlign: "center" },
1566
+ "& .MuiInputBase-root.MuiOutlinedInput-root": {
1567
+ px: 0,
1568
+ "&.Mui-disabled": {
1569
+ "& .MuiInputBase-input": {
1570
+ WebkitTextFillColor: defaultColors.neutral.main
1571
+ }
1572
+ }
1573
+ },
1574
+ "&.MuiFormControl-root.MuiTextField-root .MuiFormHelperText-root": {
1575
+ textAlign: "center",
1576
+ "&.Mui-disabled": {
1577
+ color: propError ? defaultColors.red.main : defaultColors.neutral.main
1578
+ }
1579
+ }
1580
+ },
1581
+ endAdornment: /* @__PURE__ */ jsx40(
1582
+ IconButton_default,
1583
+ {
1584
+ sx: {
1585
+ width: 32,
1586
+ height: 32,
1587
+ bgcolor: iconBackgroundColor,
1588
+ p: 1,
1589
+ borderRadius: 2,
1590
+ color: iconColor,
1591
+ "&.Mui-disabled": {
1592
+ color: defaultColors.neutral.light,
1593
+ bgcolor: defaultColors.neutral[200]
1594
+ }
1595
+ },
1596
+ onClick: handleIncrement,
1597
+ disabled: disableInc,
1598
+ children: /* @__PURE__ */ jsx40(
1599
+ Add,
1600
+ {
1601
+ size: 22,
1602
+ color: disableInc ? defaultColors.neutral.light : iconColor
1603
+ }
1604
+ )
1605
+ }
1606
+ ),
1607
+ startAdornment: /* @__PURE__ */ jsxs5(
1608
+ Box_default,
1609
+ {
1610
+ sx: {
1611
+ display: "flex",
1612
+ justifyContent: "center",
1613
+ alignItems: "center",
1614
+ gap: 3
1615
+ },
1616
+ children: [
1617
+ /* @__PURE__ */ jsx40(
1618
+ IconButton_default,
1619
+ {
1620
+ sx: {
1621
+ width: 32,
1622
+ height: 32,
1623
+ bgcolor: iconBackgroundColor,
1624
+ p: 1,
1625
+ borderRadius: 2,
1626
+ color: iconColor,
1627
+ "&.Mui-disabled": {
1628
+ color: defaultColors.neutral.light,
1629
+ bgcolor: defaultColors.neutral[200]
1630
+ }
1631
+ },
1632
+ onClick: handleDecrement,
1633
+ disabled: disableDec,
1634
+ children: /* @__PURE__ */ jsx40(
1635
+ Minus,
1636
+ {
1637
+ size: 16,
1638
+ color: disableDec ? defaultColors.neutral.light : iconColor
1639
+ }
1640
+ )
1641
+ }
1642
+ ),
1643
+ /* @__PURE__ */ jsx40(Typography_default, { variant: "body2", color: "neutral.main", children: unit })
1644
+ ]
1645
+ }
1646
+ )
1647
+ }
1648
+ );
1649
+ };
1650
+ var CounterBoxInput_default = CounterBoxInput;
1651
+
1652
+ // src/components/SvgIcon.tsx
1653
+ import { jsx as jsx41 } from "react/jsx-runtime";
1654
+ var SvgIcon = ({
1655
+ src,
1656
+ color = "black",
1657
+ size = 24
1658
+ }) => {
1659
+ const style = {
1660
+ width: size,
1661
+ height: size,
1662
+ backgroundColor: color,
1663
+ maskImage: `url(${src})`,
1664
+ WebkitMaskImage: `url(${src})`,
1665
+ maskRepeat: "no-repeat",
1666
+ WebkitMaskRepeat: "no-repeat",
1667
+ maskSize: "contain",
1668
+ WebkitMaskSize: "contain",
1669
+ maskPosition: "center",
1670
+ WebkitMaskPosition: "center"
1671
+ };
1672
+ return /* @__PURE__ */ jsx41("div", { style });
1673
+ };
1674
+ var SvgIcon_default = SvgIcon;
1675
+
1676
+ // src/components/Dialog.tsx
1677
+ import { Dialog as MuiDialog } from "@mui/material";
1678
+ import { jsx as jsx42 } from "react/jsx-runtime";
1679
+ var Dialog2 = ({ children, ...props }) => {
1680
+ return /* @__PURE__ */ jsx42(MuiDialog, { ...props, children });
1681
+ };
1682
+ var Dialog_default = Dialog2;
1683
+
1684
+ // src/components/LoadingModal.tsx
1685
+ import { Typography as Typography3 } from "@mui/material";
1686
+ import { jsx as jsx43, jsxs as jsxs6 } from "react/jsx-runtime";
1687
+ var LoadingModal = ({ isOpen }) => {
1688
+ return /* @__PURE__ */ jsx43(Modal_default, { open: isOpen, children: /* @__PURE__ */ jsxs6(
1689
+ Box_default,
1690
+ {
1691
+ sx: {
1692
+ display: "flex",
1693
+ flexDirection: "column",
1694
+ alignItems: "center",
1695
+ gap: 4,
1696
+ width: "150px"
1697
+ },
1698
+ children: [
1699
+ /* @__PURE__ */ jsx43(Loading_default, { size: 40 }),
1700
+ /* @__PURE__ */ jsx43(Typography3, { children: "\u0686\u0646\u062F \u0644\u062D\u0638\u0647 \u0635\u0628\u0631 \u06A9\u0646 ..." })
1701
+ ]
1702
+ }
1703
+ ) });
1704
+ };
1705
+ var LoadingModal_default = LoadingModal;
1706
+
1707
+ // src/components/Image.tsx
1708
+ import { jsx as jsx44 } from "react/jsx-runtime";
1709
+ var Image = ({
1710
+ src,
1711
+ alt = "",
1712
+ width,
1713
+ height,
1714
+ objectFit = "cover",
1715
+ style = {},
1716
+ fallbackSrc,
1717
+ ...props
1718
+ }) => {
1719
+ const combinedStyle = {
1720
+ width,
1721
+ height,
1722
+ objectFit,
1723
+ ...style
1724
+ };
1725
+ return /* @__PURE__ */ jsx44("img", { src, alt, style: combinedStyle, loading: "lazy", ...props });
1726
+ };
1727
+ var Image_default = Image;
1728
+
1729
+ // src/components/Pagination.tsx
1730
+ import { Pagination as MuiPagination } from "@mui/material";
1731
+ import { jsx as jsx45 } from "react/jsx-runtime";
1732
+ var Pagination = ({ ...props }) => {
1733
+ return /* @__PURE__ */ jsx45(MuiPagination, { ...props });
1734
+ };
1735
+ var Pagination_default = Pagination;
1736
+
1737
+ // src/components/CircularProgress.tsx
1738
+ import { CircularProgress as MuiCircularProgress } from "@mui/material";
1739
+ import { jsx as jsx46 } from "react/jsx-runtime";
1740
+ var CircularProgress3 = ({ ...props }) => {
1741
+ return /* @__PURE__ */ jsx46(MuiCircularProgress, { ...props });
1742
+ };
1743
+ var CircularProgress_default = CircularProgress3;
1744
+
1745
+ // src/components/IosHiddenOtpInput.tsx
1746
+ import { useEffect as useEffect4 } from "react";
1747
+ import { jsx as jsx47 } from "react/jsx-runtime";
1748
+ var IosHiddenOtpInput = ({ onOtpChange }) => {
1749
+ useEffect4(() => {
1750
+ const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
1751
+ if (isIOS) {
1752
+ document.getElementById("ios-one-time-code")?.focus();
1753
+ }
1754
+ }, []);
1755
+ const normalize = (raw) => {
1756
+ const v = (raw || "").replace(/[^\d\u06F0-\u06F9\u0660-\u0669]/g, "");
1757
+ const normalized = v.replace(/[\u06F0-\u06F9]/g, (d) => String(d.charCodeAt(0) - 1776)).replace(/[\u0660-\u0669]/g, (d) => String(d.charCodeAt(0) - 1632)).slice(0, length);
1758
+ return normalized;
1759
+ };
1760
+ return /* @__PURE__ */ jsx47(
1761
+ "input",
1762
+ {
1763
+ id: "ios-one-time-code",
1764
+ name: "one-time-code",
1765
+ type: "text",
1766
+ inputMode: "numeric",
1767
+ autoComplete: "one-time-code",
1768
+ style: {
1769
+ position: "absolute",
1770
+ top: "-9999px",
1771
+ width: "1px",
1772
+ height: "1px",
1773
+ opacity: 0
1774
+ },
1775
+ onChange: (e) => {
1776
+ const otp = normalize(e.currentTarget.value);
1777
+ onOtpChange(otp);
1778
+ }
1779
+ }
1780
+ );
1781
+ };
1782
+ var IosHiddenOtpInput_default = IosHiddenOtpInput;
1783
+
1784
+ // src/components/CardNumberInput.tsx
1785
+ import { useState as useState4, useEffect as useEffect5 } from "react";
1786
+ import { Add as Add2 } from "iconsax-react";
1787
+
1788
+ // src/utils/toLatinDigit.ts
1789
+ var toLatinDigits = (input) => {
1790
+ if (!input) return "";
1791
+ const s = String(input);
1792
+ return s.replace(/[\u06F0-\u06F9]/g, (d) => String(d.charCodeAt(0) - 1776)).replace(/[\u0660-\u0669]/g, (d) => String(d.charCodeAt(0) - 1632));
1793
+ };
1794
+
1795
+ // src/components/CardNumberInput.tsx
1796
+ import { jsx as jsx48 } from "react/jsx-runtime";
1797
+ var getPanNumber = (pan) => {
1798
+ const latin = toLatinDigits(pan);
1799
+ return latin.replace(/\D/g, "").trim();
1800
+ };
1801
+ var formatCardNumber = (value) => {
1802
+ const latin = toLatinDigits(value);
1803
+ const cleaned = latin.replace(/\D/g, "");
1804
+ return cleaned.replace(/(\d{4})/g, "$1-").replace(/-$/, "").substring(0, 19);
1805
+ };
1806
+ var handleBeforeInput = (e) => {
1807
+ const data = e.data;
1808
+ if (data && !/^[0-9\u06F0-\u06F9\u0660-\u0669]+$/.test(data)) {
1809
+ e.preventDefault();
1810
+ }
1811
+ };
1812
+ var CardNumberInput = ({
1813
+ value,
1814
+ onChange,
1815
+ error = false,
1816
+ helperText = "",
1817
+ hasClearButton,
1818
+ onReset,
1819
+ bankLogo
1820
+ }) => {
1821
+ const [displayValue, setDisplayValue] = useState4("");
1822
+ useEffect5(() => {
1823
+ if (value) {
1824
+ setDisplayValue(formatCardNumber(value));
1825
+ } else {
1826
+ setDisplayValue("");
1827
+ }
1828
+ }, [value]);
1829
+ return /* @__PURE__ */ jsx48(
1830
+ TextField_default,
1831
+ {
1832
+ value: displayValue,
1833
+ label: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A",
1834
+ placeholder: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A",
1835
+ variant: "outlined",
1836
+ fullWidth: true,
1837
+ type: "text",
1838
+ error,
1839
+ helperText,
1840
+ inputProps: {
1841
+ inputMode: "numeric",
1842
+ autoComplete: "tel",
1843
+ onBeforeInput: handleBeforeInput
1844
+ },
1845
+ startAdornment: bankLogo ? /* @__PURE__ */ jsx48(Box_default, { display: "flex", alignItems: "center", gap: "8px", children: /* @__PURE__ */ jsx48(Image_default, { src: bankLogo, alt: "Bank Logo", width: 20, height: 20 }) }) : void 0,
1846
+ endAdornment: hasClearButton ? /* @__PURE__ */ jsx48(
1847
+ IconButton_default,
1848
+ {
1849
+ onClick: () => {
1850
+ if (onReset) onReset();
1851
+ },
1852
+ children: /* @__PURE__ */ jsx48(
1853
+ Add2,
1854
+ {
1855
+ size: "24",
1856
+ color: defaultColors.neutral[500],
1857
+ style: { transform: "rotate(45deg)" }
1858
+ }
1859
+ )
1860
+ }
1861
+ ) : void 0,
1862
+ onChange: (e) => {
1863
+ const formatted = formatCardNumber(e.target.value);
1864
+ setDisplayValue(formatted);
1865
+ const cleaned = getPanNumber(formatted);
1866
+ onChange(cleaned);
1867
+ }
1868
+ }
1869
+ );
1870
+ };
1871
+ var CardNumberInput_default = CardNumberInput;
1872
+
1873
+ // src/components/NumberInput.tsx
1874
+ import { useState as useState5, useEffect as useEffect6 } from "react";
1875
+ import { Add as Add3 } from "iconsax-react";
1876
+ import { jsx as jsx49, jsxs as jsxs7 } from "react/jsx-runtime";
1877
+ var getCleanNumber = (value, fungible = false) => {
1878
+ const latin = toLatinDigits(value);
1879
+ if (fungible) {
1880
+ if (latin === ".") {
1881
+ return ".";
1882
+ }
1883
+ const endsWithDot = latin.endsWith(".") && latin.length > 1;
1884
+ const parts = latin.split(".");
1885
+ if (parts.length > 2) {
1886
+ const integerPart2 = parts[0].replace(/\D/g, "");
1887
+ const decimalPart2 = parts.slice(1).join("").replace(/\D/g, "");
1888
+ return integerPart2 + (decimalPart2 ? "." + decimalPart2 : endsWithDot ? "." : "");
1889
+ }
1890
+ const integerPart = parts[0].replace(/\D/g, "");
1891
+ const decimalPart = parts[1]?.replace(/\D/g, "") || "";
1892
+ const startsWithDot = latin.startsWith(".");
1893
+ if (startsWithDot && !integerPart && decimalPart) {
1894
+ return "0." + decimalPart;
1895
+ }
1896
+ if (startsWithDot && !integerPart && !decimalPart) {
1897
+ return ".";
1898
+ }
1899
+ if (endsWithDot && !decimalPart && integerPart) {
1900
+ return integerPart + ".";
1901
+ }
1902
+ if (decimalPart) {
1903
+ return integerPart + "." + decimalPart;
1904
+ }
1905
+ return integerPart;
1906
+ }
1907
+ return latin.replace(/\D/g, "").trim();
1908
+ };
1909
+ var formatWithSeparator = (value) => {
1910
+ if (!value) return "";
1911
+ const parts = value.split(".");
1912
+ const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1913
+ return parts.length > 1 ? integerPart + "." + parts[1] : integerPart;
1914
+ };
1915
+ var handleBeforeInput2 = (e, fungible) => {
1916
+ const data = e.data;
1917
+ if (fungible) {
1918
+ if (data && !/^[0-9.\u06F0-\u06F9\u0660-\u0669]+$/.test(data)) {
1919
+ e.preventDefault();
1920
+ }
1921
+ } else {
1922
+ if (data && !/^[0-9\u06F0-\u06F9\u0660-\u0669]+$/.test(data)) {
1923
+ e.preventDefault();
1924
+ }
1925
+ }
1926
+ };
1927
+ var handleKeyDown = (e, fungible, currentValue) => {
1928
+ if (fungible) {
1929
+ if (e.key === "." || e.key === ",") {
1930
+ if (currentValue.includes(".")) {
1931
+ e.preventDefault();
1932
+ }
1933
+ return;
1934
+ }
1935
+ if (!/^[0-9\u06F0-\u06F9\u0660-\u0669]$/.test(e.key) && ![
1936
+ "Backspace",
1937
+ "Delete",
1938
+ "ArrowLeft",
1939
+ "ArrowRight",
1940
+ "Tab",
1941
+ "Enter",
1942
+ "Home",
1943
+ "End"
1944
+ ].includes(e.key) && !(e.ctrlKey || e.metaKey)) {
1945
+ e.preventDefault();
1946
+ }
1947
+ } else {
1948
+ if (!/^[0-9\u06F0-\u06F9\u0660-\u0669]$/.test(e.key) && ![
1949
+ "Backspace",
1950
+ "Delete",
1951
+ "ArrowLeft",
1952
+ "ArrowRight",
1953
+ "Tab",
1954
+ "Enter",
1955
+ "Home",
1956
+ "End"
1957
+ ].includes(e.key) && !(e.ctrlKey || e.metaKey)) {
1958
+ e.preventDefault();
1959
+ }
1960
+ }
1961
+ };
1962
+ var NumberInput = ({
1963
+ value,
1964
+ onChange,
1965
+ error = false,
1966
+ helperText = "",
1967
+ hasClearButton,
1968
+ onReset,
1969
+ label = "\u0634\u0645\u0627\u0631\u0647",
1970
+ placeholder = "\u0634\u0645\u0627\u0631\u0647 \u0631\u0627 \u0648\u0627\u0631\u062F \u06A9\u0646\u06CC\u062F",
1971
+ fungible = false,
1972
+ disabled = false,
1973
+ maxLength,
1974
+ minLength,
1975
+ unit
1976
+ }) => {
1977
+ const [displayValue, setDisplayValue] = useState5("");
1978
+ useEffect6(() => {
1979
+ if (value) {
1980
+ if (fungible) {
1981
+ setDisplayValue(value);
1982
+ } else {
1983
+ setDisplayValue(formatWithSeparator(value));
1984
+ }
1985
+ } else {
1986
+ setDisplayValue("");
1987
+ }
1988
+ }, [value, fungible]);
1989
+ return /* @__PURE__ */ jsx49(
1990
+ TextField_default,
1991
+ {
1992
+ value: displayValue,
1993
+ label,
1994
+ placeholder,
1995
+ variant: "outlined",
1996
+ fullWidth: true,
1997
+ type: "text",
1998
+ error,
1999
+ disabled,
2000
+ helperText,
2001
+ inputProps: {
2002
+ inputMode: fungible ? "decimal" : "numeric",
2003
+ maxLength,
2004
+ minLength,
2005
+ autoComplete: "off",
2006
+ onBeforeInput: (e) => handleBeforeInput2(e, fungible),
2007
+ onKeyDown: (e) => handleKeyDown(e, fungible, displayValue)
2008
+ },
2009
+ endAdornment: hasClearButton || unit ? /* @__PURE__ */ jsxs7(
2010
+ Box_default,
2011
+ {
2012
+ sx: {
2013
+ display: "flex",
2014
+ alignItems: "center",
2015
+ gap: 2,
2016
+ justifyContent: "end"
2017
+ },
2018
+ children: [
2019
+ unit && /* @__PURE__ */ jsx49(Typography_default, { variant: "body1", color: "neutral.light", children: unit }),
2020
+ hasClearButton && /* @__PURE__ */ jsx49(
2021
+ IconButton_default,
2022
+ {
2023
+ onClick: () => {
2024
+ if (onReset) onReset();
2025
+ },
2026
+ children: /* @__PURE__ */ jsx49(
2027
+ Add3,
2028
+ {
2029
+ size: "24",
2030
+ color: defaultColors.neutral[500],
2031
+ style: { transform: "rotate(45deg)" }
2032
+ }
2033
+ )
2034
+ }
2035
+ )
2036
+ ]
2037
+ }
2038
+ ) : void 0,
2039
+ onChange: (e) => {
2040
+ const inputValue = e.target.value;
2041
+ if (fungible) {
2042
+ const cleaned = getCleanNumber(inputValue, fungible);
2043
+ setDisplayValue(cleaned);
2044
+ onChange(cleaned);
2045
+ } else {
2046
+ const cleaned = getCleanNumber(inputValue, fungible);
2047
+ setDisplayValue(formatWithSeparator(cleaned));
2048
+ onChange(cleaned);
2049
+ }
2050
+ },
2051
+ sx: {
2052
+ "& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button": {
2053
+ display: "none"
2054
+ },
2055
+ "& input[type=number]": {
2056
+ MozAppearance: "textfield"
2057
+ }
2058
+ }
2059
+ }
2060
+ );
2061
+ };
2062
+ var NumberInput_default = NumberInput;
2063
+
2064
+ // src/components/InputPhoneNumber.tsx
2065
+ import { jsx as jsx50 } from "react/jsx-runtime";
2066
+ var normalizeDigits2 = (s) => s.replace(/[\u06F0-\u06F9]/g, (d) => String(d.charCodeAt(0) - 1776)).replace(/[\u0660-\u0669]/g, (d) => String(d.charCodeAt(0) - 1632));
2067
+ var asciiDigitsOnly = (s) => normalizeDigits2(s).replace(/\D/g, "");
2068
+ var normalizeIranPhone = (s, maxDigitLength = 11) => {
2069
+ const normalized = normalizeDigits2(s).trim();
2070
+ let cleaned = normalized.replace(/[^\d+]/g, "");
2071
+ const hasPlus = cleaned.startsWith("+");
2072
+ cleaned = cleaned.replace(/\+/g, "");
2073
+ let digits = cleaned;
2074
+ if (hasPlus && digits.startsWith("98")) {
2075
+ digits = "0" + digits.slice(2);
2076
+ }
2077
+ if (digits.startsWith("0098")) {
2078
+ digits = "0" + digits.slice(4);
2079
+ }
2080
+ if (digits.startsWith("98")) {
2081
+ digits = "0" + digits.slice(2);
2082
+ }
2083
+ if (digits.length === 10 && digits.startsWith("9")) {
2084
+ digits = "0" + digits;
2085
+ }
2086
+ return digits.slice(0, maxDigitLength);
2087
+ };
2088
+ var ALLOWED_INPUT = /^[0-9\u06F0-\u06F9\u0660-\u0669+\s]+$/;
2089
+ var InputPhoneNumber = ({
2090
+ value,
2091
+ onChange,
2092
+ onBlur,
2093
+ maxDigitLength = 11,
2094
+ inputRef,
2095
+ ref,
2096
+ inputProps: inputPropsProp,
2097
+ dir = "rtl",
2098
+ ...textFieldProps
2099
+ }) => {
2100
+ const refToUse = inputRef ?? ref;
2101
+ const handleBeforeInput3 = (e) => {
2102
+ const inputEvent = e.nativeEvent;
2103
+ const data = inputEvent.data;
2104
+ if (inputEvent.inputType === "insertFromPaste") return;
2105
+ if (data && !ALLOWED_INPUT.test(data)) {
2106
+ e.preventDefault();
2107
+ return;
2108
+ }
2109
+ if (data === "+") {
2110
+ const el = e.currentTarget;
2111
+ const nextValue = el.value.slice(0, el.selectionStart ?? el.value.length) + "+" + el.value.slice(el.selectionEnd ?? el.value.length);
2112
+ if (!nextValue.startsWith("+")) {
2113
+ e.preventDefault();
2114
+ }
2115
+ }
2116
+ };
2117
+ const handlePaste = (e) => {
2118
+ const pastedData = e.clipboardData.getData("text");
2119
+ const sanitized = normalizeIranPhone(pastedData, maxDigitLength);
2120
+ if (sanitized) {
2121
+ e.preventDefault();
2122
+ onChange(sanitized);
2123
+ }
2124
+ };
2125
+ const handleInput = (e) => {
2126
+ const input = e.currentTarget;
2127
+ let rawValue = input.value;
2128
+ const inputEvent = e.nativeEvent;
2129
+ const isAutofill = !inputEvent.inputType || inputEvent.inputType === "insertReplacementText";
2130
+ if (isAutofill && rawValue.length > 5) {
2131
+ const digitsOnly = asciiDigitsOnly(rawValue);
2132
+ if (digitsOnly.length > 5 && !digitsOnly.startsWith("0") && digitsOnly.endsWith("0")) {
2133
+ rawValue = digitsOnly.split("").reverse().join("");
2134
+ }
2135
+ }
2136
+ const sanitized = normalizeIranPhone(rawValue, maxDigitLength);
2137
+ if (value !== sanitized) {
2138
+ onChange(sanitized);
2139
+ }
2140
+ };
2141
+ return /* @__PURE__ */ jsx50(
2142
+ TextField_default,
2143
+ {
2144
+ ...textFieldProps,
2145
+ type: "tel",
2146
+ value,
2147
+ onChange: (e) => onChange(normalizeIranPhone(e.target.value, maxDigitLength)),
2148
+ onBlur,
2149
+ inputRef: refToUse,
2150
+ inputProps: {
2151
+ inputMode: "numeric",
2152
+ // Allow "+" in pattern so mobile keyboards don't fight the user.
2153
+ pattern: "[0-9\\u06F0-\\u06F9\\u0660-\\u0669+]*",
2154
+ autoComplete: "tel",
2155
+ dir,
2156
+ maxLength: Math.max(maxDigitLength + 4, 15),
2157
+ onBeforeInput: handleBeforeInput3,
2158
+ onInput: handleInput,
2159
+ onPaste: handlePaste,
2160
+ ...inputPropsProp
2161
+ }
2162
+ }
2163
+ );
2164
+ };
2165
+ var InputPhoneNumber_default = InputPhoneNumber;
2166
+
2167
+ // src/components/WheelDatePicker.tsx
2168
+ import {
2169
+ useEffect as useEffect7,
2170
+ useLayoutEffect,
2171
+ useMemo as useMemo2,
2172
+ useRef as useRef3,
2173
+ useState as useState6
2174
+ } from "react";
2175
+ import { flushSync } from "react-dom";
2176
+ import { Add as Add4 } from "iconsax-react";
2177
+ import { Calendar as Calendar2 } from "iconsax-react";
2178
+ import { jsx as jsx51, jsxs as jsxs8 } from "react/jsx-runtime";
2179
+ var PERSIAN_MONTHS = [
2180
+ { value: 1, label: "\u0641\u0631\u0648\u0631\u062F\u06CC\u0646" },
2181
+ { value: 2, label: "\u0627\u0631\u062F\u06CC\u0628\u0647\u0634\u062A" },
2182
+ { value: 3, label: "\u062E\u0631\u062F\u0627\u062F" },
2183
+ { value: 4, label: "\u062A\u06CC\u0631" },
2184
+ { value: 5, label: "\u0645\u0631\u062F\u0627\u062F" },
2185
+ { value: 6, label: "\u0634\u0647\u0631\u06CC\u0648\u0631" },
2186
+ { value: 7, label: "\u0645\u0647\u0631" },
2187
+ { value: 8, label: "\u0622\u0628\u0627\u0646" },
2188
+ { value: 9, label: "\u0622\u0630\u0631" },
2189
+ { value: 10, label: "\u062F\u06CC" },
2190
+ { value: 11, label: "\u0628\u0647\u0645\u0646" },
2191
+ { value: 12, label: "\u0627\u0633\u0641\u0646\u062F" }
2192
+ ];
2193
+ function isJalaliLeapYear(jy) {
2194
+ return (jy + 38) * 31 % 128 < 31;
2195
+ }
2196
+ function getDaysInJalaliMonth(jy, jm) {
2197
+ if (jm <= 6) return 31;
2198
+ if (jm <= 11) return 30;
2199
+ return isJalaliLeapYear(jy) ? 30 : 29;
2200
+ }
2201
+ var ITEM_HEIGHT = 44;
2202
+ var WHEEL_VISIBLE_ITEMS = 3;
2203
+ var TOTAL_VIRTUAL_SLOTS = 10001;
2204
+ var MIDDLE_SLOT_INDEX = Math.floor(TOTAL_VIRTUAL_SLOTS / 2);
2205
+ var VISIBLE_WINDOW_BUFFER = 8;
2206
+ var SCROLL_END_DEBOUNCE_MS = 120;
2207
+ var TOP_PADDING = ITEM_HEIGHT * (WHEEL_VISIBLE_ITEMS - 1) / 2;
2208
+ var SELECTED_ROW_INDEX = 1;
2209
+ var REST_SCROLL_TOP = TOP_PADDING + (MIDDLE_SLOT_INDEX - SELECTED_ROW_INDEX) * ITEM_HEIGHT;
2210
+ function mod(a, n) {
2211
+ if (n <= 0) return 0;
2212
+ return (a % n + n) % n;
2213
+ }
2214
+ function clampIndex(index, n) {
2215
+ return Math.max(0, Math.min(n - 1, index));
2216
+ }
2217
+ function FlatWheelColumn({
2218
+ items,
2219
+ value,
2220
+ getKey,
2221
+ getLabel,
2222
+ onSelect,
2223
+ wrap = true
2224
+ }) {
2225
+ const scrollRef = useRef3(null);
2226
+ const isProgrammaticScrollRef = useRef3(false);
2227
+ const scrollEndTimeoutRef = useRef3(
2228
+ null
2229
+ );
2230
+ const valueIndex = useMemo2(
2231
+ () => items.findIndex((i) => getKey(i) === getKey(value)),
2232
+ [items, value, getKey]
2233
+ );
2234
+ const safeValueIndex = valueIndex >= 0 ? valueIndex : 0;
2235
+ const N = items.length;
2236
+ const [currentIndex, setCurrentIndex] = useState6(safeValueIndex);
2237
+ const currentIndexRef = useRef3(currentIndex);
2238
+ currentIndexRef.current = currentIndex;
2239
+ useEffect7(() => {
2240
+ if (valueIndex >= 0 && valueIndex < N) {
2241
+ setCurrentIndex(valueIndex);
2242
+ } else if (N > 0) {
2243
+ setCurrentIndex(0);
2244
+ }
2245
+ }, [valueIndex, N]);
2246
+ const baseIndex = useMemo2(
2247
+ () => N > 0 ? mod(currentIndex - MIDDLE_SLOT_INDEX % N, N) : 0,
2248
+ [currentIndex, N]
2249
+ );
2250
+ const contentHeight = wrap ? TOP_PADDING + TOTAL_VIRTUAL_SLOTS * ITEM_HEIGHT + TOP_PADDING : TOP_PADDING + N * ITEM_HEIGHT + TOP_PADDING;
2251
+ const columnHeight = ITEM_HEIGHT * WHEEL_VISIBLE_ITEMS;
2252
+ const maxScrollLinear = Math.max(0, contentHeight - columnHeight);
2253
+ const restScrollTop = wrap ? REST_SCROLL_TOP : Math.min(
2254
+ maxScrollLinear,
2255
+ Math.max(
2256
+ 0,
2257
+ TOP_PADDING + (currentIndex - SELECTED_ROW_INDEX) * ITEM_HEIGHT
2258
+ )
2259
+ );
2260
+ const windowStart = wrap ? Math.max(0, MIDDLE_SLOT_INDEX - VISIBLE_WINDOW_BUFFER) : Math.max(
2261
+ 0,
2262
+ Math.floor((restScrollTop - TOP_PADDING) / ITEM_HEIGHT) - VISIBLE_WINDOW_BUFFER
2263
+ );
2264
+ const windowEnd = wrap ? Math.min(
2265
+ TOTAL_VIRTUAL_SLOTS - 1,
2266
+ MIDDLE_SLOT_INDEX + WHEEL_VISIBLE_ITEMS + VISIBLE_WINDOW_BUFFER
2267
+ ) : Math.min(
2268
+ N - 1,
2269
+ windowStart + WHEEL_VISIBLE_ITEMS + 2 * VISIBLE_WINDOW_BUFFER
2270
+ );
2271
+ const visibleItemCount = Math.max(0, windowEnd - windowStart + 1);
2272
+ const hasInitializedScroll = useRef3(false);
2273
+ useLayoutEffect(() => {
2274
+ const el = scrollRef.current;
2275
+ if (!el || N === 0 || hasInitializedScroll.current) return;
2276
+ hasInitializedScroll.current = true;
2277
+ isProgrammaticScrollRef.current = true;
2278
+ const initialTop = wrap ? REST_SCROLL_TOP : Math.min(
2279
+ maxScrollLinear,
2280
+ Math.max(
2281
+ 0,
2282
+ TOP_PADDING + (safeValueIndex - SELECTED_ROW_INDEX) * ITEM_HEIGHT
2283
+ )
2284
+ );
2285
+ el.scrollTop = initialTop;
2286
+ }, [N, wrap, safeValueIndex, maxScrollLinear]);
2287
+ const applyScrollDeltaAndSnap = () => {
2288
+ const el = scrollRef.current;
2289
+ if (!el || N === 0) return;
2290
+ const targetScrollTop = wrap ? REST_SCROLL_TOP : TOP_PADDING + (currentIndexRef.current - SELECTED_ROW_INDEX) * ITEM_HEIGHT;
2291
+ const scrollTop = el.scrollTop;
2292
+ const deltaItems = Math.round((scrollTop - targetScrollTop) / ITEM_HEIGHT);
2293
+ if (deltaItems === 0) return;
2294
+ const latestIndex = currentIndexRef.current;
2295
+ const newIndex = wrap ? mod(latestIndex + deltaItems, N) : clampIndex(latestIndex + deltaItems, N);
2296
+ flushSync(() => {
2297
+ setCurrentIndex(newIndex);
2298
+ });
2299
+ onSelect(items[newIndex]);
2300
+ isProgrammaticScrollRef.current = true;
2301
+ const targetTop = wrap ? REST_SCROLL_TOP : Math.min(
2302
+ maxScrollLinear,
2303
+ Math.max(
2304
+ 0,
2305
+ TOP_PADDING + (newIndex - SELECTED_ROW_INDEX) * ITEM_HEIGHT
2306
+ )
2307
+ );
2308
+ el.scrollTop = targetTop;
2309
+ };
2310
+ const handleScroll = () => {
2311
+ if (isProgrammaticScrollRef.current) {
2312
+ isProgrammaticScrollRef.current = false;
2313
+ return;
2314
+ }
2315
+ if (scrollEndTimeoutRef.current) clearTimeout(scrollEndTimeoutRef.current);
2316
+ scrollEndTimeoutRef.current = setTimeout(() => {
2317
+ scrollEndTimeoutRef.current = null;
2318
+ applyScrollDeltaAndSnap();
2319
+ }, SCROLL_END_DEBOUNCE_MS);
2320
+ };
2321
+ return /* @__PURE__ */ jsxs8(
2322
+ Box_default,
2323
+ {
2324
+ sx: {
2325
+ flex: 1,
2326
+ minWidth: 0,
2327
+ position: "relative",
2328
+ height: columnHeight
2329
+ },
2330
+ children: [
2331
+ /* @__PURE__ */ jsx51(
2332
+ Box_default,
2333
+ {
2334
+ ref: scrollRef,
2335
+ onScroll: handleScroll,
2336
+ sx: {
2337
+ height: "100%",
2338
+ overflowY: "auto",
2339
+ scrollSnapType: "y mandatory",
2340
+ scrollBehavior: "auto",
2341
+ "&::-webkit-scrollbar": { display: "none" },
2342
+ scrollbarWidth: "none"
2343
+ },
2344
+ children: /* @__PURE__ */ jsx51(
2345
+ Box_default,
2346
+ {
2347
+ sx: { position: "relative", height: contentHeight, width: "100%" },
2348
+ children: Array.from({ length: visibleItemCount }, (_, i) => {
2349
+ const slotIndex = windowStart + i;
2350
+ const logicalIndex = wrap ? mod(baseIndex + slotIndex, N) : slotIndex;
2351
+ const item = items[logicalIndex];
2352
+ if (!item) return null;
2353
+ const isSelected = logicalIndex === currentIndex;
2354
+ return /* @__PURE__ */ jsx51(
2355
+ Box_default,
2356
+ {
2357
+ sx: {
2358
+ position: "absolute",
2359
+ left: 0,
2360
+ right: 0,
2361
+ top: TOP_PADDING + slotIndex * ITEM_HEIGHT,
2362
+ height: ITEM_HEIGHT,
2363
+ display: "flex",
2364
+ alignItems: "center",
2365
+ justifyContent: "center",
2366
+ scrollSnapAlign: "center",
2367
+ pointerEvents: "none",
2368
+ borderRadius: 1,
2369
+ bgcolor: "transparent"
2370
+ },
2371
+ children: /* @__PURE__ */ jsx51(
2372
+ Typography_default,
2373
+ {
2374
+ variant: "body1",
2375
+ color: isSelected ? defaultColors.neutral.dark : defaultColors.neutral.light,
2376
+ fontWeight: isSelected ? 700 : 400,
2377
+ children: getLabel(item)
2378
+ }
2379
+ )
2380
+ },
2381
+ slotIndex
2382
+ );
2383
+ })
2384
+ }
2385
+ )
2386
+ }
2387
+ ),
2388
+ /* @__PURE__ */ jsx51(
2389
+ Box_default,
2390
+ {
2391
+ sx: {
2392
+ position: "absolute",
2393
+ top: 0,
2394
+ left: 0,
2395
+ right: 0,
2396
+ bottom: 0,
2397
+ pointerEvents: "none"
2398
+ },
2399
+ children: /* @__PURE__ */ jsx51(
2400
+ Box_default,
2401
+ {
2402
+ sx: {
2403
+ position: "absolute",
2404
+ top: SELECTED_ROW_INDEX * ITEM_HEIGHT,
2405
+ left: 0,
2406
+ right: 0,
2407
+ width: "100%",
2408
+ height: ITEM_HEIGHT,
2409
+ boxSizing: "border-box",
2410
+ borderTop: "1px solid",
2411
+ borderBottom: "1px solid",
2412
+ borderColor: defaultColors.neutral[300],
2413
+ bgcolor: "transparent"
2414
+ }
2415
+ }
2416
+ )
2417
+ }
2418
+ )
2419
+ ]
2420
+ }
2421
+ );
2422
+ }
2423
+ function valueToUnix(value, format) {
2424
+ if (value === null || value === void 0) return null;
2425
+ if (typeof value === "string" && value.trim() === "") return null;
2426
+ if (format === "unix") {
2427
+ const n = typeof value === "string" ? Number(value) : value;
2428
+ return Number.isFinite(n) ? n : null;
2429
+ }
2430
+ if (format === "jalali" && typeof value === "string") {
2431
+ const parts = value.split("/").map((p) => parseInt(p.trim(), 10));
2432
+ if (parts.length !== 3 || parts.some((p) => !Number.isFinite(p)))
2433
+ return null;
2434
+ try {
2435
+ const d = jalaliToDateUTC(parts[0], parts[1], parts[2]);
2436
+ return Math.floor(d.getTime() / 1e3);
2437
+ } catch {
2438
+ return null;
2439
+ }
2440
+ }
2441
+ if (format === "gregorian" && typeof value === "string") {
2442
+ const d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
2443
+ return Number.isFinite(d.getTime()) ? Math.floor(d.getTime() / 1e3) : null;
2444
+ }
2445
+ return null;
2446
+ }
2447
+ var DEFAULT_MIN_YEAR = 1300;
2448
+ var DEFAULT_MAX_YEAR = 1450;
2449
+ var WheelDatePicker = ({
2450
+ value,
2451
+ dateFormat,
2452
+ valueFormat,
2453
+ onChange,
2454
+ onChangeDateFormat,
2455
+ defaultDate,
2456
+ minDate,
2457
+ maxDate,
2458
+ placeholder = "\u062A\u0627\u0631\u06CC\u062E",
2459
+ title = "\u062A\u0627\u0631\u06CC\u062E",
2460
+ error,
2461
+ helperText,
2462
+ disabled
2463
+ }) => {
2464
+ const resolvedValueFormat = valueFormat ?? dateFormat ?? "unix";
2465
+ const resolvedOnChangeDateFormat = onChangeDateFormat ?? dateFormat ?? "unix";
2466
+ const [drawerOpen, setDrawerOpen] = useState6(false);
2467
+ const [day, setDay] = useState6(1);
2468
+ const [month, setMonth] = useState6(1);
2469
+ const [year, setYear] = useState6(DEFAULT_MIN_YEAR);
2470
+ const valueAsUnix = useMemo2(
2471
+ () => valueToUnix(value, resolvedValueFormat),
2472
+ [value, resolvedValueFormat]
2473
+ );
2474
+ const minYear = useMemo2(() => {
2475
+ if (minDate != null) {
2476
+ try {
2477
+ return getPersianYMD(new Date(minDate * 1e3)).year;
2478
+ } catch {
2479
+ return DEFAULT_MIN_YEAR;
2480
+ }
2481
+ }
2482
+ return DEFAULT_MIN_YEAR;
2483
+ }, [minDate]);
2484
+ const currentJalaliYear = useMemo2(() => {
2485
+ if (maxDate != null) {
2486
+ try {
2487
+ return getPersianYMD(new Date(maxDate * 1e3)).year;
2488
+ } catch {
2489
+ return DEFAULT_MAX_YEAR;
2490
+ }
2491
+ }
2492
+ return DEFAULT_MAX_YEAR;
2493
+ }, [maxDate]);
2494
+ const maxYear = Math.max(currentJalaliYear, minYear);
2495
+ const defaultYMD = useMemo2(() => {
2496
+ const ref = defaultDate != null ? new Date(defaultDate * 1e3) : /* @__PURE__ */ new Date();
2497
+ let ymd;
2498
+ try {
2499
+ ymd = getPersianYMD(ref);
2500
+ } catch {
2501
+ return { year: minYear, month: 1, day: 1 };
2502
+ }
2503
+ const year2 = Math.min(maxYear, Math.max(minYear, ymd.year));
2504
+ const month2 = ymd.month;
2505
+ const maxDay = getDaysInJalaliMonth(year2, month2);
2506
+ const day2 = Math.min(ymd.day, maxDay);
2507
+ return { year: year2, month: month2, day: day2 };
2508
+ }, [minYear, maxYear, defaultDate]);
2509
+ const yearItems = useMemo2(
2510
+ () => Array.from({ length: maxYear - minYear + 1 }, (_, i) => minYear + i).map(
2511
+ (y) => ({ value: y, label: String(y) })
2512
+ ),
2513
+ [maxYear, minYear]
2514
+ );
2515
+ const daysInMonth = getDaysInJalaliMonth(year, month);
2516
+ const dayItems = useMemo2(
2517
+ () => Array.from({ length: daysInMonth }, (_, i) => i + 1).map((d) => ({
2518
+ value: d,
2519
+ label: String(d)
2520
+ })),
2521
+ [daysInMonth]
2522
+ );
2523
+ const monthItems = useMemo2(() => [...PERSIAN_MONTHS], []);
2524
+ useEffect7(() => {
2525
+ const maxDay = getDaysInJalaliMonth(year, month);
2526
+ setDay((d) => d > maxDay ? maxDay : d);
2527
+ }, [year, month]);
2528
+ useEffect7(() => {
2529
+ if (valueAsUnix != null) {
2530
+ const date = new Date(valueAsUnix * 1e3);
2531
+ try {
2532
+ const ymd = getPersianYMD(date);
2533
+ setYear(Math.min(maxYear, Math.max(minYear, ymd.year)));
2534
+ setMonth(ymd.month);
2535
+ setDay(ymd.day);
2536
+ } catch {
2537
+ setYear(minYear);
2538
+ setMonth(1);
2539
+ setDay(1);
2540
+ }
2541
+ } else {
2542
+ setYear(defaultYMD.year);
2543
+ setMonth(defaultYMD.month);
2544
+ setDay(defaultYMD.day);
2545
+ }
2546
+ }, [valueAsUnix, minYear, maxYear, defaultYMD]);
2547
+ const displayText = useMemo2(() => {
2548
+ if (valueAsUnix == null) return "";
2549
+ try {
2550
+ const d = new Date(valueAsUnix * 1e3);
2551
+ const { year: y, month: m, day: dVal } = getPersianYMD(d);
2552
+ return `${y}/${m}/${dVal}`;
2553
+ } catch {
2554
+ return "";
2555
+ }
2556
+ }, [valueAsUnix]);
2557
+ const openDrawer = () => {
2558
+ if (disabled) return;
2559
+ if (valueAsUnix != null) {
2560
+ const date = new Date(valueAsUnix * 1e3);
2561
+ try {
2562
+ const ymd = getPersianYMD(date);
2563
+ setYear(Math.min(maxYear, Math.max(minYear, ymd.year)));
2564
+ setMonth(ymd.month);
2565
+ setDay(ymd.day);
2566
+ } catch {
2567
+ setYear(minYear);
2568
+ setMonth(1);
2569
+ setDay(1);
2570
+ }
2571
+ } else {
2572
+ setYear(defaultYMD.year);
2573
+ setMonth(defaultYMD.month);
2574
+ setDay(defaultYMD.day);
2575
+ }
2576
+ setDrawerOpen(true);
2577
+ };
2578
+ const closeDrawer = () => setDrawerOpen(false);
2579
+ const handleConfirm = () => {
2580
+ try {
2581
+ const jsDate = jalaliToDateUTC(year, month, day);
2582
+ const unixSeconds = Math.floor(jsDate.getTime() / 1e3);
2583
+ const jalaliDate = `${year}/${month}/${day}`;
2584
+ const gregorianDate = `${jsDate.getUTCFullYear()}-${String(jsDate.getUTCMonth() + 1).padStart(2, "0")}-${String(jsDate.getUTCDate()).padStart(2, "0")}`;
2585
+ const value2 = resolvedOnChangeDateFormat === "unix" ? unixSeconds : resolvedOnChangeDateFormat === "jalali" ? jalaliDate : gregorianDate;
2586
+ onChange?.(value2);
2587
+ closeDrawer();
2588
+ } catch {
2589
+ onChange?.(null);
2590
+ closeDrawer();
2591
+ }
2592
+ };
2593
+ return /* @__PURE__ */ jsxs8(Box_default, { children: [
2594
+ /* @__PURE__ */ jsx51(
2595
+ TextField_default,
2596
+ {
2597
+ fullWidth: true,
2598
+ value: displayText,
2599
+ label: title,
2600
+ onClick: openDrawer,
2601
+ error,
2602
+ helperText,
2603
+ disabled,
2604
+ endAdornment: /* @__PURE__ */ jsx51(Calendar2, { size: 20, color: defaultColors.neutral.main }),
2605
+ placeholder,
2606
+ InputProps: {
2607
+ readOnly: true,
2608
+ sx: {
2609
+ cursor: disabled ? "default" : "pointer",
2610
+ borderRadius: "8px",
2611
+ height: 48,
2612
+ "& fieldset": { borderRadius: "8px" }
2613
+ }
2614
+ }
2615
+ }
2616
+ ),
2617
+ /* @__PURE__ */ jsx51(
2618
+ Drawer_default,
2619
+ {
2620
+ isDrawerOpen: drawerOpen,
2621
+ onClose: closeDrawer,
2622
+ sx: {
2623
+ "&.MuiDrawer-root": { maxWidth: 550, mx: "auto" }
2624
+ },
2625
+ children: /* @__PURE__ */ jsxs8(
2626
+ Box_default,
2627
+ {
2628
+ sx: {
2629
+ display: "flex",
2630
+ flexDirection: "column",
2631
+ width: "100%",
2632
+ px: 3.5,
2633
+ py: 6
2634
+ },
2635
+ children: [
2636
+ /* @__PURE__ */ jsxs8(
2637
+ Box_default,
2638
+ {
2639
+ sx: {
2640
+ display: "flex",
2641
+ justifyContent: "space-between",
2642
+ alignItems: "center",
2643
+ width: "100%",
2644
+ mb: 6
2645
+ },
2646
+ children: [
2647
+ /* @__PURE__ */ jsx51(Typography_default, { variant: "h2", fontWeight: 700, children: title }),
2648
+ /* @__PURE__ */ jsx51(
2649
+ IconButton_default,
2650
+ {
2651
+ onClick: closeDrawer,
2652
+ sx: { bgcolor: defaultColors.neutral[100], borderRadius: "8px" },
2653
+ children: /* @__PURE__ */ jsx51(
2654
+ Add4,
2655
+ {
2656
+ size: 20,
2657
+ color: defaultColors.neutral.main,
2658
+ style: { transform: "rotate(45deg)" }
2659
+ }
2660
+ )
2661
+ }
2662
+ )
2663
+ ]
2664
+ }
2665
+ ),
2666
+ /* @__PURE__ */ jsxs8(
2667
+ Box_default,
2668
+ {
2669
+ sx: {
2670
+ display: "flex",
2671
+ width: "100%",
2672
+ px: 2,
2673
+ pb: 2,
2674
+ borderBottom: "1px solid"
2675
+ },
2676
+ children: [
2677
+ /* @__PURE__ */ jsx51(
2678
+ Typography_default,
2679
+ {
2680
+ variant: "subtitle2",
2681
+ fontWeight: 700,
2682
+ sx: { flex: 1, textAlign: "center" },
2683
+ children: "\u0631\u0648\u0632"
2684
+ }
2685
+ ),
2686
+ /* @__PURE__ */ jsx51(
2687
+ Typography_default,
2688
+ {
2689
+ variant: "subtitle2",
2690
+ fontWeight: 700,
2691
+ sx: { flex: 1, textAlign: "center" },
2692
+ children: "\u0645\u0627\u0647"
2693
+ }
2694
+ ),
2695
+ /* @__PURE__ */ jsx51(
2696
+ Typography_default,
2697
+ {
2698
+ variant: "subtitle2",
2699
+ fontWeight: 700,
2700
+ sx: { flex: 1, textAlign: "center" },
2701
+ children: "\u0633\u0627\u0644"
2702
+ }
2703
+ )
2704
+ ]
2705
+ }
2706
+ ),
2707
+ /* @__PURE__ */ jsxs8(
2708
+ Box_default,
2709
+ {
2710
+ sx: {
2711
+ display: "flex",
2712
+ alignItems: "stretch",
2713
+ width: "100%",
2714
+ borderRadius: 2,
2715
+ p: 2,
2716
+ mb: 4,
2717
+ pt: 1.5,
2718
+ minHeight: ITEM_HEIGHT * WHEEL_VISIBLE_ITEMS
2719
+ },
2720
+ children: [
2721
+ /* @__PURE__ */ jsx51(
2722
+ FlatWheelColumn,
2723
+ {
2724
+ items: dayItems,
2725
+ value: { value: day, label: String(day) },
2726
+ getKey: (i) => i.value,
2727
+ getLabel: (i) => i.label,
2728
+ onSelect: (i) => setDay(i.value)
2729
+ }
2730
+ ),
2731
+ /* @__PURE__ */ jsx51(
2732
+ FlatWheelColumn,
2733
+ {
2734
+ items: monthItems,
2735
+ value: monthItems.find((m) => m.value === month) ?? monthItems[0],
2736
+ getKey: (i) => i.value,
2737
+ getLabel: (i) => i.label,
2738
+ onSelect: (i) => setMonth(i.value)
2739
+ }
2740
+ ),
2741
+ /* @__PURE__ */ jsx51(
2742
+ FlatWheelColumn,
2743
+ {
2744
+ items: yearItems,
2745
+ value: yearItems.find((y) => y.value === year) ?? yearItems[0],
2746
+ getKey: (i) => i.value,
2747
+ getLabel: (i) => i.label,
2748
+ onSelect: (i) => setYear(i.value),
2749
+ wrap: yearItems.length >= 3
2750
+ }
2751
+ )
2752
+ ]
2753
+ }
2754
+ ),
2755
+ /* @__PURE__ */ jsx51(Button_default, { variant: "contained", fullWidth: true, onClick: handleConfirm, children: "\u062A\u0623\u06CC\u06CC\u062F" })
2756
+ ]
2757
+ }
2758
+ )
2759
+ }
2760
+ )
2761
+ ] });
2762
+ };
2763
+ var WheelDatePicker_default = WheelDatePicker;
2764
+
2765
+ // src/components/DataGrid.tsx
2766
+ import { useMemo as useMemo3, useCallback } from "react";
2767
+ import {
2768
+ MaterialReactTable,
2769
+ useMaterialReactTable
2770
+ } from "material-react-table";
2771
+ import { MRT_Localization_FA } from "material-react-table/locales/fa";
2772
+ import { useMaterialReactTable as useMaterialReactTable2 } from "material-react-table";
2773
+ import { jsx as jsx52 } from "react/jsx-runtime";
2774
+ var DataGrid = ({
2775
+ columns,
2776
+ data,
2777
+ localization,
2778
+ layoutMode = "grid",
2779
+ enableRowActions,
2780
+ // Extract MRT options to merge with defaults
2781
+ initialState,
2782
+ displayColumnDefOptions,
2783
+ muiTablePaperProps,
2784
+ muiTableContainerProps,
2785
+ muiTableHeadCellProps,
2786
+ muiTableBodyCellProps,
2787
+ muiTableBodyRowProps,
2788
+ muiSelectCheckboxProps,
2789
+ ...mrtOptions
2790
+ }) => {
2791
+ const mergedLocalization = useMemo3(
2792
+ () => ({ ...MRT_Localization_FA, ...localization }),
2793
+ [localization]
2794
+ );
2795
+ const columnOrder = useMemo3(() => {
2796
+ const dataColumnIds = columns.map((col) => {
2797
+ if ("accessorKey" in col && col.accessorKey)
2798
+ return String(col.accessorKey);
2799
+ if ("id" in col && col.id) return String(col.id);
2800
+ return void 0;
2801
+ }).filter((id) => Boolean(id));
2802
+ return [
2803
+ "mrt-row-expand",
2804
+ "mrt-row-select",
2805
+ "mrt-row-numbers",
2806
+ ...dataColumnIds,
2807
+ "mrt-row-actions"
2808
+ ];
2809
+ }, [columns]);
2810
+ const mergedInitialState = useMemo3(
2811
+ () => ({
2812
+ density: "compact",
2813
+ columnOrder,
2814
+ expanded: {},
2815
+ ...initialState
2816
+ }),
2817
+ [columnOrder, initialState]
2818
+ );
2819
+ const defaultPaperProps = useMemo3(
2820
+ () => ({
2821
+ elevation: 0,
2822
+ sx: {
2823
+ width: "100%",
2824
+ borderRadius: "12px",
2825
+ overflow: "hidden"
2826
+ }
2827
+ }),
2828
+ []
2829
+ );
2830
+ const defaultContainerProps = useMemo3(
2831
+ () => ({
2832
+ sx: {
2833
+ width: "100%",
2834
+ maxHeight: `calc(100vh - 300px)`
2835
+ }
2836
+ }),
2837
+ []
2838
+ );
2839
+ const defaultHeadCellProps = useMemo3(
2840
+ () => ({
2841
+ sx: {
2842
+ flexDirection: "row !important",
2843
+ backgroundColor: "#f4f6fa",
2844
+ fontWeight: 500,
2845
+ fontSize: "16px",
2846
+ color: "#4f545e",
2847
+ borderBottom: "1px solid #d6d9df",
2848
+ textAlign: "right",
2849
+ p: "0.35rem 0.5rem",
2850
+ "& .Mui-TableHeadCell-Content": {
2851
+ justifyContent: "flex-end",
2852
+ flexDirection: "row !important",
2853
+ gap: "2px"
2854
+ },
2855
+ "& .Mui-TableHeadCell-Content-Labels": {
2856
+ flexDirection: "row !important",
2857
+ gap: "2px"
2858
+ },
2859
+ "&.MuiTableCell-alignRight": {
2860
+ textAlign: "right"
2861
+ },
2862
+ "&.MuiTableCell-alignLeft": {
2863
+ textAlign: "left"
2864
+ },
2865
+ "&.MuiTableCell-alignCenter": {
2866
+ textAlign: "center"
2867
+ },
2868
+ "&.MuiTableCell-alignRight .Mui-TableHeadCell-Content, &.MuiTableCell-alignRight .Mui-TableHeadCell-Content-Labels": {
2869
+ flexDirection: "row-reverse !important"
2870
+ },
2871
+ "&.MuiTableCell-alignLeft .Mui-TableHeadCell-Content, &.MuiTableCell-alignLeft .Mui-TableHeadCell-Content-Labels": {
2872
+ flexDirection: "row !important"
2873
+ },
2874
+ "&.MuiTableCell-alignCenter .Mui-TableHeadCell-Content, &.MuiTableCell-alignCenter .Mui-TableHeadCell-Content-Labels": {
2875
+ flexDirection: "row !important"
2876
+ },
2877
+ "&.MuiTableCell-alignLeft .Mui-TableHeadCell-Content": {
2878
+ justifyContent: "flex-start"
2879
+ },
2880
+ "&.MuiTableCell-alignCenter .Mui-TableHeadCell-Content": {
2881
+ justifyContent: "center"
2882
+ },
2883
+ "& .Mui-TableHeadCell-Content-Actions": {
2884
+ gap: "0px",
2885
+ marginLeft: "-2px",
2886
+ marginRight: "-2px",
2887
+ "& .MuiIconButton-root": {
2888
+ width: 12,
2889
+ height: 12,
2890
+ minWidth: 12,
2891
+ minHeight: 12,
2892
+ padding: "2px"
2893
+ },
2894
+ "& .MuiIconButton-root svg": {
2895
+ fontSize: "0.875rem"
2896
+ }
2897
+ },
2898
+ "& .Mui-TableHeadCell-Content-Labels .MuiIconButton-root": {
2899
+ width: 12,
2900
+ height: 12,
2901
+ minWidth: 12,
2902
+ minHeight: 12,
2903
+ padding: "1px"
2904
+ },
2905
+ "& .MuiTableSortLabel-root": {
2906
+ width: "1.5ch",
2907
+ minWidth: "1.5ch"
2908
+ },
2909
+ "& .MuiTableSortLabel-icon": {
2910
+ fontSize: "0.875rem"
2911
+ }
2912
+ }
2913
+ }),
2914
+ []
2915
+ );
2916
+ const defaultBodyCellProps = useMemo3(
2917
+ () => ({
2918
+ sx: {
2919
+ flexDirection: "row !important"
2920
+ }
2921
+ }),
2922
+ []
2923
+ );
2924
+ const defaultCheckboxProps = useMemo3(
2925
+ () => ({
2926
+ sx: {
2927
+ color: "#d6d9df",
2928
+ "&.Mui-checked": {
2929
+ color: "#0C8CE9"
2930
+ }
2931
+ }
2932
+ }),
2933
+ []
2934
+ );
2935
+ const defaultBodyRowProps = useCallback(
2936
+ ({ row }) => ({
2937
+ sx: {
2938
+ backgroundColor: row.getIsSelected() ? "#E6F4FD" : void 0,
2939
+ "&:nth-of-type(odd)": {
2940
+ backgroundColor: row.getIsSelected() ? "#E6F4FD" : "white"
2941
+ },
2942
+ "&:nth-of-type(even)": {
2943
+ backgroundColor: row.getIsSelected() ? "#E6F4FD" : "#F4F6FA"
2944
+ },
2945
+ "&:hover": {
2946
+ backgroundColor: row.getIsSelected() ? "#E6F4FD" : "#f4f6fa"
2947
+ },
2948
+ "& .MuiTableCell-root": {
2949
+ textAlign: "right",
2950
+ fontSize: "14px",
2951
+ flexDirection: "row !important"
2952
+ }
2953
+ }
2954
+ }),
2955
+ []
2956
+ );
2957
+ const muiColumnActionsButtonPropsStable = useMemo3(
2958
+ () => ({
2959
+ sx: {
2960
+ height: 12,
2961
+ width: 12,
2962
+ minWidth: 12,
2963
+ minHeight: 12,
2964
+ m: "0 -1px",
2965
+ "& svg": { fontSize: "0.875rem" }
2966
+ }
2967
+ }),
2968
+ []
2969
+ );
2970
+ const muiColumnDragHandlePropsStable = useMemo3(
2971
+ () => ({
2972
+ sx: {
2973
+ width: 12,
2974
+ height: 12,
2975
+ minWidth: 12,
2976
+ minHeight: 12,
2977
+ m: "0 -1px",
2978
+ "& svg": { fontSize: "0.75rem" }
2979
+ }
2980
+ }),
2981
+ []
2982
+ );
2983
+ const mergedDisplayColumnDefOptions = useMemo3(() => {
2984
+ const baseOptions = displayColumnDefOptions ?? {};
2985
+ const baseRowActions = baseOptions["mrt-row-actions"] ?? {};
2986
+ if (!enableRowActions && Object.keys(baseRowActions).length === 0) {
2987
+ return baseOptions;
2988
+ }
2989
+ const minActionWidth = 160;
2990
+ const rawSize = Number(
2991
+ baseRowActions.size ?? baseRowActions.minSize ?? minActionWidth
2992
+ );
2993
+ const rawMin = Number(
2994
+ baseRowActions.minSize ?? baseRowActions.size ?? minActionWidth
2995
+ );
2996
+ const rawMax = Number(
2997
+ baseRowActions.maxSize ?? baseRowActions.size ?? minActionWidth
2998
+ );
2999
+ return {
3000
+ ...baseOptions,
3001
+ "mrt-row-actions": {
3002
+ ...baseRowActions,
3003
+ header: baseRowActions.header ?? "\u0639\u0645\u0644\u06CC\u0627\u062A",
3004
+ size: Math.max(rawSize, minActionWidth),
3005
+ minSize: Math.max(rawMin, minActionWidth),
3006
+ maxSize: Math.max(rawMax, minActionWidth)
3007
+ }
3008
+ };
3009
+ }, [displayColumnDefOptions, enableRowActions]);
3010
+ const table = useMaterialReactTable({
3011
+ columns,
3012
+ data,
3013
+ localization: mergedLocalization,
3014
+ layoutMode,
3015
+ enableRowActions,
3016
+ displayColumnDefOptions: mergedDisplayColumnDefOptions,
3017
+ columnResizeDirection: "rtl",
3018
+ initialState: mergedInitialState,
3019
+ // Use user props if provided, otherwise use defaults
3020
+ muiTablePaperProps: muiTablePaperProps ?? defaultPaperProps,
3021
+ muiTableContainerProps: muiTableContainerProps ?? defaultContainerProps,
3022
+ muiTableHeadCellProps: muiTableHeadCellProps ?? defaultHeadCellProps,
3023
+ muiTableBodyCellProps: muiTableBodyCellProps ?? defaultBodyCellProps,
3024
+ muiSelectCheckboxProps: muiSelectCheckboxProps ?? defaultCheckboxProps,
3025
+ muiTableBodyRowProps: muiTableBodyRowProps ?? defaultBodyRowProps,
3026
+ // Compact column header buttons (sort, drag, filter, column menu)
3027
+ muiColumnActionsButtonProps: muiColumnActionsButtonPropsStable,
3028
+ muiColumnDragHandleProps: muiColumnDragHandlePropsStable,
3029
+ // Spread all other MRT options (user can override anything)
3030
+ ...mrtOptions
3031
+ });
3032
+ return /* @__PURE__ */ jsx52("div", { style: { direction: "rtl", width: "100%" }, children: /* @__PURE__ */ jsx52(MaterialReactTable, { table }) });
3033
+ };
3034
+ var DataGrid_default = DataGrid;
3035
+
3036
+ // src/components/MultiSelect.tsx
3037
+ import { Add as Add5, ArrowDown2, ArrowUp2 } from "iconsax-react";
3038
+ import { useState as useState7 } from "react";
3039
+ import { jsx as jsx53, jsxs as jsxs9 } from "react/jsx-runtime";
3040
+ var MultiSelect = ({
3041
+ value,
3042
+ onChange,
3043
+ options,
3044
+ minWidth = "13rem",
3045
+ label = "\u0627\u0646\u062A\u062E\u0627\u0628 \u0645\u0648\u0627\u0631\u062F"
3046
+ }) => {
3047
+ const [isSelectOpen, setIsSelectOpen] = useState7(false);
3048
+ const handleChange = (event) => {
3049
+ const selectedValue = event.target.value;
3050
+ onChange(
3051
+ typeof selectedValue === "string" ? selectedValue.split(",") : selectedValue
3052
+ );
3053
+ };
3054
+ const handleRemoveSelectedItem = (item) => {
3055
+ onChange(value.filter((selected) => selected !== item));
3056
+ };
3057
+ return /* @__PURE__ */ jsxs9(FormControl_default, { sx: { minWidth }, children: [
3058
+ /* @__PURE__ */ jsx53(InputLabel_default, { id: "multi-select-label", children: label }),
3059
+ /* @__PURE__ */ jsx53(
3060
+ Select_default,
3061
+ {
3062
+ id: "multi-select",
3063
+ labelId: "multi-select-label",
3064
+ label,
3065
+ value,
3066
+ onChange: handleChange,
3067
+ onOpen: () => setIsSelectOpen(true),
3068
+ onClose: () => setIsSelectOpen(false),
3069
+ multiple: true,
3070
+ IconComponent: () => /* @__PURE__ */ jsx53(Box_default, { mr: 4, mt: 1.5, children: isSelectOpen ? /* @__PURE__ */ jsx53(ArrowUp2, { size: 18, color: defaultColors.neutral.dark }) : /* @__PURE__ */ jsx53(ArrowDown2, { size: 18, color: defaultColors.neutral.dark }) }),
3071
+ sx: {
3072
+ height: 48,
3073
+ borderRadius: 2,
3074
+ "& .MuiSelect-select": {
3075
+ display: "flex",
3076
+ alignItems: "center",
3077
+ height: "48px !important",
3078
+ minHeight: "48px !important",
3079
+ boxSizing: "border-box",
3080
+ overflowX: "auto",
3081
+ overflowY: "hidden",
3082
+ whiteSpace: "nowrap",
3083
+ py: 0
3084
+ }
3085
+ },
3086
+ renderValue: (selected) => {
3087
+ const selectedItems = selected;
3088
+ return /* @__PURE__ */ jsx53(Box_default, { sx: { display: "flex", flexWrap: "nowrap", gap: 1 }, children: selectedItems.map((item) => /* @__PURE__ */ jsxs9(
3089
+ Box_default,
3090
+ {
3091
+ sx: {
3092
+ display: "inline-flex",
3093
+ alignItems: "center",
3094
+ gap: 2,
3095
+ px: 3,
3096
+ py: 1.5,
3097
+ bgcolor: defaultColors.neutral[100],
3098
+ borderRadius: 999
3099
+ },
3100
+ children: [
3101
+ options.find((option) => option.value === item)?.label ?? item,
3102
+ /* @__PURE__ */ jsx53(
3103
+ IconButton_default,
3104
+ {
3105
+ onMouseDown: (event) => event.stopPropagation(),
3106
+ onClick: () => handleRemoveSelectedItem(item),
3107
+ sx: {
3108
+ p: 0,
3109
+ minWidth: "auto",
3110
+ color: defaultColors.neutral.main
3111
+ },
3112
+ children: /* @__PURE__ */ jsx53("div", { style: { width: 18, height: 18, marginBottom: 6 }, children: /* @__PURE__ */ jsx53(
3113
+ Add5,
3114
+ {
3115
+ size: 18,
3116
+ color: defaultColors.neutral.main,
3117
+ style: { transform: "rotate(45deg)" }
3118
+ }
3119
+ ) })
3120
+ }
3121
+ )
3122
+ ]
3123
+ },
3124
+ item
3125
+ )) });
3126
+ },
3127
+ children: options.map((option) => /* @__PURE__ */ jsx53(MenuItem_default, { value: option.value, children: option.label }, option.value))
3128
+ }
3129
+ )
3130
+ ] });
3131
+ };
3132
+ var MultiSelect_default = MultiSelect;
3133
+ export {
3134
+ Accordion_default as Accordion,
3135
+ AccordionDetails_default as AccordionDetails,
3136
+ AccordionSummary_default as AccordionSummary,
3137
+ Autocomplete_default as Autocomplete,
3138
+ Box_default as Box,
3139
+ Button_default as Button,
3140
+ CardNumberInput_default as CardNumberInput,
3141
+ Checkbox_default as Checkbox,
3142
+ CircularProgress_default as CircularProgress,
3143
+ Container_default as Container,
3144
+ CounterBoxInput_default as CounterBoxInput,
3145
+ DataGrid_default as DataGrid,
3146
+ Dialog_default as Dialog,
3147
+ Divider_default as Divider,
3148
+ Drawer_default as Drawer,
3149
+ Fab_default as Fab,
3150
+ FormControl_default as FormControl,
3151
+ FormControlLabel_default as FormControlLabel,
3152
+ Grid_default as Grid,
3153
+ IconButton_default as IconButton,
3154
+ Image_default as Image,
3155
+ InputLabel_default as InputLabel,
3156
+ InputPhoneNumber_default as InputPhoneNumber,
3157
+ IosHiddenOtpInput_default as IosHiddenOtpInput,
3158
+ List_default as List,
3159
+ ListItem_default as ListItem,
3160
+ Loading_default as Loading,
3161
+ LoadingModal_default as LoadingModal,
3162
+ MenuItem_default as MenuItem,
3163
+ MobileDatePicker_default as MobileDatePicker,
3164
+ Modal_default as Modal,
3165
+ MultiSelect_default as MultiSelect,
3166
+ NumberInput_default as NumberInput,
3167
+ OtpInput,
3168
+ Pagination_default as Pagination,
3169
+ ProgressBar_default as ProgressBar,
3170
+ Radio_default as Radio,
3171
+ RadioGroup_default as RadioGroup,
3172
+ Select_default as Select,
3173
+ Skeleton_default as Skeleton,
3174
+ Slider_default as Slider,
3175
+ Step_default as Step,
3176
+ StepConnector_default as StepConnector,
3177
+ StepContent_default as StepContent,
3178
+ StepLabel_default as StepLabel,
3179
+ Stepper_default as Stepper,
3180
+ SvgIcon_default as SvgIcon,
3181
+ Tab_default as Tab,
3182
+ TextField_default as TextField,
3183
+ Toast_default as Toast,
3184
+ Toggle_default as Toggle,
3185
+ Typography_default as Typography,
3186
+ WheelDatePicker_default as WheelDatePicker
3187
+ };