@fctc/interface-logic 5.2.4 → 5.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/{chunk-Q5YXX4OR.js → chunk-CCTDGAMA.js} +52 -51
  2. package/dist/{chunk-WBGK2SHU.js → chunk-COC7NGXP.js} +20 -19
  3. package/dist/{chunk-6ARYI77N.mjs → chunk-F2VAAEVB.mjs} +12 -3
  4. package/dist/{chunk-OV7EKGYM.mjs → chunk-F4RE57FT.mjs} +1394 -640
  5. package/dist/{chunk-C5QQGBN4.js → chunk-FWBYTZIV.js} +23 -18
  6. package/dist/chunk-GGNOJ77I.js +1 -2
  7. package/dist/{chunk-BPJZ3QRN.mjs → chunk-HQVNK2EW.mjs} +128 -770
  8. package/dist/{chunk-VBYRP2P7.mjs → chunk-Q3Y6RCJ4.mjs} +19 -1
  9. package/dist/{chunk-5STZNSW4.js → chunk-U2COUTK5.js} +1663 -1087
  10. package/dist/{chunk-JDXUTKMX.js → chunk-U4Q3MW45.js} +170 -852
  11. package/dist/{chunk-QOXPJWSN.mjs → chunk-VBVNP77T.mjs} +6 -2
  12. package/dist/chunk-WAXGOBY2.mjs +0 -1
  13. package/dist/chunk-WTPKTZQC.js +118 -0
  14. package/dist/{chunk-ACSPOGTI.mjs → chunk-ZDXEWQQD.mjs} +14 -7
  15. package/dist/configs.js +4 -9
  16. package/dist/configs.mjs +7 -3
  17. package/dist/constants.d.mts +2 -1
  18. package/dist/constants.d.ts +2 -1
  19. package/dist/constants.js +36 -70
  20. package/dist/constants.mjs +36 -1
  21. package/dist/environment.d.mts +1 -1
  22. package/dist/environment.d.ts +1 -1
  23. package/dist/environment.js +8 -17
  24. package/dist/environment.mjs +12 -4
  25. package/dist/hooks.d.mts +7 -23
  26. package/dist/hooks.d.ts +7 -23
  27. package/dist/hooks.js +312 -635
  28. package/dist/hooks.mjs +312 -6
  29. package/dist/index.d.mts +4 -10
  30. package/dist/index.d.ts +4 -10
  31. package/dist/index.js +433 -1257
  32. package/dist/index.mjs +433 -8
  33. package/dist/{local-storage-BPvoMGYJ.d.mts → local-storage-AbiOQTLK.d.mts} +1 -1
  34. package/dist/{local-storage-BPvoMGYJ.d.ts → local-storage-AbiOQTLK.d.ts} +1 -1
  35. package/dist/models.js +4 -8
  36. package/dist/models.mjs +7 -2
  37. package/dist/provider.d.mts +4 -12
  38. package/dist/provider.d.ts +4 -12
  39. package/dist/provider.js +26 -51
  40. package/dist/provider.mjs +26 -6
  41. package/dist/services.d.mts +6 -10
  42. package/dist/services.d.ts +6 -10
  43. package/dist/services.js +30 -55
  44. package/dist/services.mjs +30 -6
  45. package/dist/types.js +1 -4
  46. package/dist/types.mjs +1 -1
  47. package/dist/utils.d.mts +33 -61
  48. package/dist/utils.d.ts +33 -61
  49. package/dist/utils.js +36 -139
  50. package/dist/utils.mjs +36 -2
  51. package/package.json +15 -29
  52. package/dist/chunk-6LSKTACC.js +0 -687
  53. package/dist/chunk-B432GFRR.mjs +0 -606
  54. package/dist/chunk-RPWKWEMA.js +0 -116
  55. package/dist/store.d.mts +0 -382
  56. package/dist/store.d.ts +0 -382
  57. package/dist/store.js +0 -326
  58. package/dist/store.mjs +0 -1
@@ -1,320 +1,80 @@
1
- 'use strict';
2
-
3
- var moment = require('moment');
4
- var react = require('react');
5
-
6
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
-
8
- var moment__default = /*#__PURE__*/_interopDefault(moment);
9
-
10
- // src/utils/error-handler.ts
11
- var WesapError = class extends Error {
12
- code;
13
- constructor(message, code) {
14
- super(message);
15
- this.code = code;
16
- }
17
- };
18
- function handleError(error, env) {
19
- if (error instanceof WesapError) {
20
- env.services.notification.error(error.message);
21
- } else {
22
- env.services.notification.error("An unexpected error occurred");
23
- }
24
- }
25
- var formatCurrency = (amount, currency = "USD") => {
26
- const formatter = new Intl.NumberFormat("vi-VN", {
27
- style: "currency",
28
- currency,
29
- minimumFractionDigits: 0
30
- });
31
- return formatter.format(amount).replaceAll(".", ",");
32
- };
33
- var formatDate = (date, locale = "en-US") => {
34
- return new Intl.DateTimeFormat(locale).format(new Date(date));
35
- };
36
- var validateAndParseDate = (input, isDateTime = false) => {
37
- if (!input || typeof input !== "string") return null;
38
- const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
39
- const dateFormat = "YYYY-MM-DD";
40
- const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
41
- const currentDay = moment__default.default().format("DD");
42
- const currentMonth = moment__default.default().format("MM");
43
- const currentYear = moment__default.default().format("YYYY");
44
- const defaultTime = "00:00:00";
45
- const maxYear = parseInt(currentYear) + 10;
46
- const isValidDate = (day, month, year) => {
47
- const date = moment__default.default(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
48
- return date.isValid();
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class2;// src/utils/storage/local-storage.ts
2
+ var localStorageUtils = () => {
3
+ const setToken = async (access_token) => {
4
+ localStorage.setItem("accessToken", access_token);
49
5
  };
50
- const isValidTime = (hour, minute = "00", second = "00") => {
51
- const h = parseInt(hour, 10);
52
- const m = parseInt(minute, 10);
53
- const s = parseInt(second, 10);
54
- return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
6
+ const setRefreshToken = async (refresh_token) => {
7
+ localStorage.setItem("refreshToken", refresh_token);
55
8
  };
56
- const formatOutput = (day, month, year, time = defaultTime) => {
57
- let result = moment__default.default(
58
- `${day}-${month}-${year} ${time}`,
59
- "DD-MM-YYYY HH:mm:ss"
60
- );
61
- if (!result.isValid()) return null;
62
- if (isDateTime) {
63
- result = result.subtract(7, "hours");
64
- return result.format(dateTimeFormat);
65
- }
66
- return result.format(dateFormat);
9
+ const getAccessToken = async () => {
10
+ return localStorage.getItem("accessToken");
11
+ };
12
+ const getRefreshToken = async () => {
13
+ return localStorage.getItem("refreshToken");
14
+ };
15
+ const clearToken = async () => {
16
+ localStorage.removeItem("accessToken");
17
+ localStorage.removeItem("refreshToken");
18
+ };
19
+ return {
20
+ setToken,
21
+ setRefreshToken,
22
+ getAccessToken,
23
+ getRefreshToken,
24
+ clearToken
67
25
  };
68
- if (isDateTime && input.match(
69
- /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
70
- )) {
71
- const [datePart, timePart] = input.split(/\s+/);
72
- const dateParts = datePart.split(/[\/-]/);
73
- const timeParts = timePart.split(":");
74
- const day = dateParts[0].padStart(2, "0");
75
- const month = dateParts[1].padStart(2, "0");
76
- const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
77
- const hour = timeParts[0].padStart(2, "0");
78
- const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
79
- const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
80
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
81
- let result = moment__default.default(
82
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
83
- "DD-MM-YYYY HH:mm:ss"
84
- );
85
- if (!result.isValid()) return null;
86
- result = result.subtract(7, "hours");
87
- return result.format(dateTimeFormat);
88
- }
89
- return null;
90
- }
91
- if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
92
- const [year, month, day] = cleanInput.split("-");
93
- if (isValidDate(day, month, year)) {
94
- return formatOutput(day, month, year);
95
- }
96
- return null;
97
- }
98
- if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
99
- const [day, month, year] = cleanInput.split("/");
100
- const paddedDay = day.padStart(2, "0");
101
- const paddedMonth = month.padStart(2, "0");
102
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
103
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
104
- return formatOutput(paddedDay, paddedMonth, fullYear);
105
- }
106
- return null;
107
- }
108
- if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
109
- const [day, month, year] = cleanInput.split("-");
110
- const paddedDay = day.padStart(2, "0");
111
- const paddedMonth = month.padStart(2, "0");
112
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
113
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
114
- return formatOutput(paddedDay, paddedMonth, fullYear);
115
- }
116
- return null;
117
- }
118
- if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
119
- const [day, month] = cleanInput.split(/[\/-]/);
120
- const paddedDay = day.padStart(2, "0");
121
- const paddedMonth = month.padStart(2, "0");
122
- if (isValidDate(paddedDay, paddedMonth, currentYear)) {
123
- return formatOutput(paddedDay, paddedMonth, currentYear);
124
- }
125
- return null;
126
- }
127
- if (cleanInput.match(/^\d{4}$/)) {
128
- const num = parseInt(cleanInput, 10);
129
- if (num >= 2e3 && num <= maxYear) {
130
- if (isValidDate(currentDay, currentMonth, num.toString())) {
131
- return formatOutput(currentDay, currentMonth, num.toString());
132
- }
133
- return null;
134
- }
135
- const day = cleanInput.slice(0, 2);
136
- const month = cleanInput.slice(2, 4);
137
- if (isValidDate(day, month, currentYear)) {
138
- return formatOutput(day, month, currentYear);
139
- }
140
- return null;
141
- }
142
- if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
143
- const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
144
- let result = moment__default.default().subtract(daysToSubtract, "days");
145
- if (isDateTime) {
146
- result = result.subtract(7, "hours");
147
- }
148
- if (result.isValid()) {
149
- return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
150
- }
151
- return null;
152
- }
153
- if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
154
- const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
155
- const day = parts[0].padStart(2, "0");
156
- const month = parts[1].padStart(2, "0");
157
- let year = parts[2];
158
- year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
159
- if (isValidDate(day, month, year)) {
160
- return formatOutput(day, month, year);
161
- }
162
- return null;
163
- }
164
- if (isDateTime) {
165
- if (cleanInput.length === 9) {
166
- const day = cleanInput.slice(0, 2);
167
- const month = cleanInput.slice(2, 4);
168
- const year = cleanInput.slice(4, 8);
169
- const hour = cleanInput.slice(8, 9).padStart(2, "0");
170
- if (isValidDate(day, month, year) && isValidTime(hour)) {
171
- let result = moment__default.default(
172
- `${day}-${month}-${year} ${hour}:00:00`,
173
- "DD-MM-YYYY HH:mm:ss"
174
- );
175
- if (!result.isValid()) return null;
176
- result = result.subtract(7, "hours");
177
- return result.format(dateTimeFormat);
178
- }
179
- return null;
180
- }
181
- if (cleanInput.length === 10) {
182
- const day = cleanInput.slice(0, 2);
183
- const month = cleanInput.slice(2, 4);
184
- const year = cleanInput.slice(4, 8);
185
- const hour = cleanInput.slice(8, 10);
186
- if (isValidDate(day, month, year) && isValidTime(hour)) {
187
- let result = moment__default.default(
188
- `${day}-${month}-${year} ${hour}:00:00`,
189
- "DD-MM-YYYY HH:mm:ss"
190
- );
191
- if (!result.isValid()) return null;
192
- result = result.subtract(7, "hours");
193
- return result.format(dateTimeFormat);
194
- }
195
- return null;
196
- }
197
- if (cleanInput.length === 11) {
198
- const day = cleanInput.slice(0, 2);
199
- const month = cleanInput.slice(2, 4);
200
- const year = cleanInput.slice(4, 8);
201
- const hour = cleanInput.slice(8, 10);
202
- const minute = cleanInput.slice(10, 11).padStart(2, "0");
203
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
204
- let result = moment__default.default(
205
- `${day}-${month}-${year} ${hour}:${minute}:00`,
206
- "DD-MM-YYYY HH:mm:ss"
207
- );
208
- if (!result.isValid()) return null;
209
- result = result.subtract(7, "hours");
210
- return result.format(dateTimeFormat);
211
- }
212
- return null;
213
- }
214
- if (cleanInput.length === 12) {
215
- const day = cleanInput.slice(0, 2);
216
- const month = cleanInput.slice(2, 4);
217
- const year = cleanInput.slice(4, 8);
218
- const hour = cleanInput.slice(8, 10);
219
- const minute = cleanInput.slice(10, 12);
220
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
221
- let result = moment__default.default(
222
- `${day}-${month}-${year} ${hour}:${minute}:00`,
223
- "DD-MM-YYYY HH:mm:ss"
224
- );
225
- if (!result.isValid()) return null;
226
- result = result.subtract(7, "hours");
227
- return result.format(dateTimeFormat);
228
- }
229
- return null;
230
- }
231
- if (cleanInput.length === 13) {
232
- const day = cleanInput.slice(0, 2);
233
- const month = cleanInput.slice(2, 4);
234
- const year = cleanInput.slice(4, 8);
235
- const hour = cleanInput.slice(8, 10);
236
- const minute = cleanInput.slice(10, 12);
237
- const second = cleanInput.slice(12, 13).padStart(2, "0");
238
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
239
- let result = moment__default.default(
240
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
241
- "DD-MM-YYYY HH:mm:ss"
242
- );
243
- if (!result.isValid()) return null;
244
- result = result.subtract(7, "hours");
245
- return result.format(dateTimeFormat);
246
- }
247
- return null;
248
- }
249
- if (cleanInput.length === 14) {
250
- const day = cleanInput.slice(0, 2);
251
- const month = cleanInput.slice(2, 4);
252
- const year = cleanInput.slice(4, 8);
253
- const hour = cleanInput.slice(8, 10);
254
- const minute = cleanInput.slice(10, 12);
255
- const second = cleanInput.slice(12, 14);
256
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
257
- let result = moment__default.default(
258
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
259
- "DD-MM-YYYY HH:mm:ss"
260
- );
261
- if (!result.isValid()) return null;
262
- result = result.subtract(7, "hours");
263
- return result.format(dateTimeFormat);
264
- }
265
- return null;
266
- }
267
- }
268
- const len = cleanInput.length;
269
- if (len === 1 || len === 2) {
270
- const paddedDay = cleanInput.padStart(2, "0");
271
- if (isValidDate(paddedDay, currentMonth, currentYear)) {
272
- return formatOutput(paddedDay, currentMonth, currentYear);
273
- }
274
- return null;
275
- }
276
- if (len === 3) {
277
- const day = cleanInput.slice(0, 2);
278
- const month = cleanInput.slice(2, 3).padStart(2, "0");
279
- if (isValidDate(day, month, currentYear)) {
280
- return formatOutput(day, month, currentYear);
281
- }
282
- return null;
283
- }
284
- if (len === 6) {
285
- const day = cleanInput.slice(0, 2);
286
- const month = cleanInput.slice(2, 4);
287
- let year = cleanInput.slice(4, 6);
288
- year = `20${year}`;
289
- if (parseInt(month) > 12) {
290
- if (isValidDate(day, currentMonth, currentYear)) {
291
- return formatOutput(day, currentMonth, currentYear);
292
- }
293
- return null;
294
- }
295
- if (isValidDate(day, month, year)) {
296
- return formatOutput(day, month, year);
297
- }
298
- return null;
299
- }
300
- if (len === 7) {
301
- return null;
302
- }
303
- if (len === 8) {
304
- const day = cleanInput.slice(0, 2);
305
- const month = cleanInput.slice(2, 4);
306
- const year = cleanInput.slice(4, 8);
307
- if (isValidDate(day, month, year)) {
308
- return formatOutput(day, month, year);
309
- }
310
- return null;
311
- }
312
- if (len > 8 && !isDateTime) {
313
- return null;
314
- }
315
- return null;
316
26
  };
317
27
 
28
+ // src/utils/storage/session-storage.ts
29
+ var sessionStorageUtils = /* @__PURE__ */ (() => {
30
+ const getMenuFocus = () => {
31
+ const menuFocus = sessionStorage.getItem("menuFocus");
32
+ return menuFocus ? JSON.parse(menuFocus) : {
33
+ id: void 0,
34
+ service: ""
35
+ };
36
+ };
37
+ const setMenuFocus = (menuTree) => {
38
+ sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
39
+ };
40
+ const getActionData = () => {
41
+ const actionData = sessionStorage.getItem("actionData");
42
+ return actionData ? JSON.parse(actionData) : {};
43
+ };
44
+ const setActionData = (actData) => {
45
+ sessionStorage.setItem("actionData", JSON.stringify(actData));
46
+ };
47
+ const getViewData = () => {
48
+ const viewData = sessionStorage.getItem("viewData");
49
+ return viewData ? JSON.parse(viewData) : {};
50
+ };
51
+ const getBrowserSession = () => {
52
+ const actionData = sessionStorage.getItem("browserSession");
53
+ return actionData ? JSON.parse(actionData) : null;
54
+ };
55
+ const setViewData = (viewData) => {
56
+ sessionStorage.setItem("viewData", JSON.stringify(viewData));
57
+ };
58
+ const getXNode = () => {
59
+ const xNode = sessionStorage.getItem("xNode");
60
+ return xNode;
61
+ };
62
+ const setXNode = (xNode) => {
63
+ sessionStorage.setItem("xNode", xNode);
64
+ };
65
+ return {
66
+ getMenuFocus,
67
+ setMenuFocus,
68
+ setActionData,
69
+ getActionData,
70
+ getViewData,
71
+ setViewData,
72
+ getBrowserSession,
73
+ getXNode,
74
+ setXNode
75
+ };
76
+ })();
77
+
318
78
  // src/utils/domain/py_tokenizer.ts
319
79
  var TokenizerError = class extends Error {
320
80
  };
@@ -469,7 +229,7 @@ var IntNumber = DecNumber;
469
229
  var Exponent = "[eE][+-]?\\d+";
470
230
  var PointFloat = group(`\\d+\\.\\d*(${Exponent})?`, `\\.\\d+(${Exponent})?`);
471
231
  var FloatNumber = group(PointFloat, `\\d+${Exponent}`);
472
- var Number2 = group(FloatNumber, IntNumber);
232
+ var Number = group(FloatNumber, IntNumber);
473
233
  var Operator = group(
474
234
  "\\*\\*=?",
475
235
  ">>=?",
@@ -487,8 +247,8 @@ var ContStr = group(
487
247
  "([uU])?'([^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*)'",
488
248
  '([uU])?"([^\\n"\\\\]*(?:\\\\.[^\\n"\\\\]*)*)"'
489
249
  );
490
- var PseudoToken = Whitespace + group(Number2, Funny, ContStr, Name);
491
- var NumberPattern = new RegExp("^" + Number2 + "$");
250
+ var PseudoToken = Whitespace + group(Number, Funny, ContStr, Name);
251
+ var NumberPattern = new RegExp("^" + Number + "$");
492
252
  var StringPattern = new RegExp("^" + ContStr + "$");
493
253
  var NamePattern = new RegExp("^" + Name + "$");
494
254
  var strip = new RegExp("^" + Whitespace);
@@ -818,6 +578,8 @@ function parseInfix(left, current, tokens) {
818
578
  ifTrue: left,
819
579
  ifFalse
820
580
  };
581
+ default:
582
+ break;
821
583
  }
822
584
  }
823
585
  throw new ParserError("Token cannot be parsed");
@@ -1391,22 +1153,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1391
1153
  this.microsecond = params.microsecond;
1392
1154
  this.weekday = params.weekday;
1393
1155
  }
1394
- years;
1395
- months;
1396
- days;
1397
- hours;
1398
- minutes;
1399
- seconds;
1400
- microseconds;
1401
- leapDays;
1402
- year;
1403
- month;
1404
- day;
1405
- hour;
1406
- minute;
1407
- second;
1408
- microsecond;
1409
- weekday;
1156
+
1157
+
1158
+
1159
+
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+
1171
+
1410
1172
  negate() {
1411
1173
  return new _PyRelativeDelta(this, -1);
1412
1174
  }
@@ -1521,7 +1283,7 @@ function execOnIterable(iterable, func) {
1521
1283
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1522
1284
  iterable = Object.keys(iterable);
1523
1285
  }
1524
- if (typeof iterable?.[Symbol.iterator] !== "function") {
1286
+ if (typeof _optionalChain([iterable, 'optionalAccess', _ => _[Symbol.iterator]]) !== "function") {
1525
1287
  throw new EvaluationError("value not iterable");
1526
1288
  }
1527
1289
  return func(iterable);
@@ -1966,7 +1728,7 @@ function evaluate(ast, context = {}) {
1966
1728
  const dicts = /* @__PURE__ */ new Set();
1967
1729
  let pyContext;
1968
1730
  const evalContext = Object.create(context);
1969
- if (!evalContext?.context) {
1731
+ if (!_optionalChain([evalContext, 'optionalAccess', _2 => _2.context])) {
1970
1732
  Object.defineProperty(evalContext, "context", {
1971
1733
  get() {
1972
1734
  if (!pyContext) {
@@ -1977,17 +1739,17 @@ function evaluate(ast, context = {}) {
1977
1739
  });
1978
1740
  }
1979
1741
  function _innerEvaluate(ast2) {
1980
- switch (ast2?.type) {
1742
+ switch (_optionalChain([ast2, 'optionalAccess', _3 => _3.type])) {
1981
1743
  case 0:
1982
1744
  // Number
1983
1745
  case 1:
1984
1746
  return ast2.value;
1985
1747
  case 5:
1986
1748
  if (ast2.value in evalContext) {
1987
- if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id && ast2?.value !== "parent") {
1988
- return evalContext[ast2.value]?.id;
1749
+ if (typeof evalContext[ast2.value] === "object" && _optionalChain([evalContext, 'access', _4 => _4[ast2.value], 'optionalAccess', _5 => _5.id]) && _optionalChain([ast2, 'optionalAccess', _6 => _6.value]) !== "parent") {
1750
+ return _optionalChain([evalContext, 'access', _7 => _7[ast2.value], 'optionalAccess', _8 => _8.id]);
1989
1751
  }
1990
- return evalContext[ast2.value] ?? false;
1752
+ return _nullishCoalesce(evalContext[ast2.value], () => ( false));
1991
1753
  } else if (ast2.value in BUILTINS) {
1992
1754
  return BUILTINS[ast2.value];
1993
1755
  } else {
@@ -2024,7 +1786,7 @@ function evaluate(ast, context = {}) {
2024
1786
  const args = ast2.args.map(_evaluate);
2025
1787
  const kwargs = {};
2026
1788
  for (const kwarg in ast2.kwargs) {
2027
- kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
1789
+ kwargs[kwarg] = _evaluate(_optionalChain([ast2, 'optionalAccess', _9 => _9.kwargs, 'access', _10 => _10[kwarg]]));
2028
1790
  }
2029
1791
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
2030
1792
  return fnValue.create(...args, kwargs);
@@ -2055,11 +1817,11 @@ function evaluate(ast, context = {}) {
2055
1817
  } else if (typeof leftVal === "number") {
2056
1818
  result = leftVal;
2057
1819
  } else if (Array.isArray(leftVal[ast2.key])) {
2058
- result = leftVal[ast2.key]?.map(
2059
- (value) => value?.id ?? value
2060
- );
1820
+ result = _optionalChain([leftVal, 'access', _11 => _11[ast2.key], 'optionalAccess', _12 => _12.map, 'call', _13 => _13(
1821
+ (value) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _14 => _14.id]), () => ( value))
1822
+ )]);
2061
1823
  } else {
2062
- result = leftVal[ast2.key]?.id ?? leftVal[ast2.key] ?? false;
1824
+ result = _nullishCoalesce(_nullishCoalesce(_optionalChain([leftVal, 'access', _15 => _15[ast2.key], 'optionalAccess', _16 => _16.id]), () => ( leftVal[ast2.key])), () => ( false));
2063
1825
  }
2064
1826
  if (typeof result === "function") {
2065
1827
  const bound = result.bind(leftVal);
@@ -2116,6 +1878,18 @@ function evaluateBooleanExpr(expr, context = {}) {
2116
1878
  }
2117
1879
 
2118
1880
  // src/utils/domain/context.ts
1881
+ function makeContext(contexts, initialEvaluationContext) {
1882
+ const evaluationContext = Object.assign({}, initialEvaluationContext);
1883
+ const context = {};
1884
+ for (let ctx of contexts) {
1885
+ if (ctx !== "") {
1886
+ ctx = typeof ctx === "string" ? evaluateExpr(ctx, evaluationContext) : ctx || {};
1887
+ Object.assign(context, ctx);
1888
+ Object.assign(evaluationContext, context);
1889
+ }
1890
+ }
1891
+ return context;
1892
+ }
2119
1893
  function evalPartialContext(_context, evaluationContext = {}) {
2120
1894
  const ast = parseExpr(_context);
2121
1895
  const context = {};
@@ -2123,7 +1897,7 @@ function evalPartialContext(_context, evaluationContext = {}) {
2123
1897
  const value = ast.value[key];
2124
1898
  try {
2125
1899
  context[key] = evaluate(value, evaluationContext);
2126
- } catch {
1900
+ } catch (e2) {
2127
1901
  }
2128
1902
  }
2129
1903
  return context;
@@ -2140,6 +1914,9 @@ function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
2140
1914
 
2141
1915
  // src/utils/domain/arrays.ts
2142
1916
  var shallowEqual2 = shallowEqual;
1917
+
1918
+ // src/utils/domain/strings.ts
1919
+ var escapeMethod = Symbol("html");
2143
1920
  function escapeRegExp(str) {
2144
1921
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2145
1922
  }
@@ -2147,10 +1924,10 @@ function escapeRegExp(str) {
2147
1924
  // src/utils/domain/domain.ts
2148
1925
  var InvalidDomainError = class extends Error {
2149
1926
  };
2150
- var Domain = class _Domain {
2151
- ast = { type: -1, value: null };
2152
- static TRUE;
2153
- static FALSE;
1927
+ var Domain = (_class2 = class _Domain {
1928
+ __init() {this.ast = { type: -1, value: null }}
1929
+
1930
+
2154
1931
  static combine(domains, operator) {
2155
1932
  if (domains.length === 0) {
2156
1933
  return new _Domain([]);
@@ -2229,7 +2006,7 @@ var Domain = class _Domain {
2229
2006
  processLeaf(d.ast.value, 0, "&", newDomain);
2230
2007
  return newDomain;
2231
2008
  }
2232
- constructor(descr = []) {
2009
+ constructor(descr = []) {;_class2.prototype.__init.call(this);
2233
2010
  if (descr instanceof _Domain) {
2234
2011
  return new _Domain(descr.toString());
2235
2012
  } else {
@@ -2265,11 +2042,17 @@ var Domain = class _Domain {
2265
2042
  return evaluatedAsList;
2266
2043
  }
2267
2044
  return this.toString();
2268
- } catch {
2045
+ } catch (e3) {
2269
2046
  return this.toString();
2270
2047
  }
2271
2048
  }
2272
- };
2049
+ }, _class2);
2050
+ function evalDomain(modifier, evalContext) {
2051
+ if (modifier && typeof modifier !== "boolean") {
2052
+ modifier = new Domain(modifier).contains(evalContext);
2053
+ }
2054
+ return Boolean(modifier);
2055
+ }
2273
2056
  var TRUE_LEAF = [1, "=", 1];
2274
2057
  var FALSE_LEAF = [0, "=", 1];
2275
2058
  var TRUE_DOMAIN = new Domain([TRUE_LEAF]);
@@ -2489,12 +2272,19 @@ var checkDomain = (context, domain) => {
2489
2272
  };
2490
2273
  var matchDomains = (context, domains) => {
2491
2274
  if (Array.isArray(domains)) {
2492
- if (domains?.length > 0) {
2275
+ if (_optionalChain([domains, 'optionalAccess', _17 => _17.length]) > 0) {
2493
2276
  return domains && domains.some((domain) => checkDomain(context, domain));
2494
2277
  }
2495
2278
  } else return checkDomain(context, domains);
2496
2279
  return false;
2497
2280
  };
2281
+
2282
+ // src/utils/function/index.ts
2283
+ var domainHelper = {
2284
+ checkDomain,
2285
+ matchDomains,
2286
+ Domain
2287
+ };
2498
2288
  var evalJSONContext = (_context, context = {}) => {
2499
2289
  try {
2500
2290
  return evalPartialContext(
@@ -2509,16 +2299,16 @@ var evalJSONDomain = (domain, context) => {
2509
2299
  const cloneContext = JSON.parse(JSON.stringify(context));
2510
2300
  try {
2511
2301
  if (cloneContext) {
2512
- Object.keys(cloneContext)?.forEach((key) => {
2302
+ _optionalChain([Object, 'access', _18 => _18.keys, 'call', _19 => _19(cloneContext), 'optionalAccess', _20 => _20.forEach, 'call', _21 => _21((key) => {
2513
2303
  if (Array.isArray(cloneContext[key])) {
2514
- const isTypeObject = cloneContext[key]?.every(
2515
- (item) => typeof item === "object" && item !== null && item?.id !== void 0
2516
- );
2304
+ const isTypeObject = _optionalChain([cloneContext, 'access', _22 => _22[key], 'optionalAccess', _23 => _23.every, 'call', _24 => _24(
2305
+ (item) => typeof item === "object" && item !== null && _optionalChain([item, 'optionalAccess', _25 => _25.id]) !== void 0
2306
+ )]);
2517
2307
  if (isTypeObject) {
2518
- cloneContext[key] = cloneContext[key]?.map((item) => item?.id);
2308
+ cloneContext[key] = _optionalChain([cloneContext, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.map, 'call', _28 => _28((item) => _optionalChain([item, 'optionalAccess', _29 => _29.id]))]);
2519
2309
  }
2520
2310
  }
2521
- });
2311
+ })]);
2522
2312
  }
2523
2313
  const value = evaluateExpr(domain, cloneContext);
2524
2314
  return value;
@@ -2535,320 +2325,24 @@ var formatSortingString = (input) => {
2535
2325
  if (!input) return null;
2536
2326
  return input.split(",").map((field) => {
2537
2327
  const [key, order] = field.trim().split(/\s+/);
2538
- const sortOrder = order?.toUpperCase() === "DESC" ? "DESC" : "ASC";
2328
+ const sortOrder = _optionalChain([order, 'optionalAccess', _30 => _30.toUpperCase, 'call', _31 => _31()]) === "DESC" ? "DESC" : "ASC";
2539
2329
  return `${key} ${sortOrder}`;
2540
2330
  }).join(", ");
2541
2331
  };
2542
- var domainHelper = {
2543
- checkDomain,
2544
- matchDomains,
2545
- Domain
2546
- };
2547
2332
  var toQueryString = (params) => {
2548
2333
  return Object.keys(params).map(
2549
2334
  (key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
2550
2335
  ).join("&");
2551
2336
  };
2552
- var convertFloatToTime = (floatValue) => {
2553
- const hours = Math.floor(floatValue);
2554
- const minutes = Math.round((floatValue - hours) * 60);
2555
- const formattedHours = String(hours).padStart(2, "0");
2556
- const formattedMinutes = String(minutes).padStart(2, "0");
2557
- return `${formattedHours}:${formattedMinutes}`;
2558
- };
2559
- var convertTimeToFloat = (timeString) => {
2560
- const [hours, minutes] = timeString.split(":").map(Number);
2561
- return hours + minutes / 60;
2562
- };
2563
- var stringToColor = (name, id) => {
2564
- const combined = name + id / 2;
2565
- let hash = 0;
2566
- for (let i = 0; i < combined.length; i++) {
2567
- hash = combined.charCodeAt(i) + ((hash << 5) - hash);
2568
- }
2569
- const r = hash >> 16 & 255;
2570
- const g = hash >> 8 & 255;
2571
- const b = hash & 255;
2572
- const rNorm = r / 255;
2573
- const gNorm = g / 255;
2574
- const bNorm = b / 255;
2575
- const max = Math.max(rNorm, gNorm, bNorm);
2576
- const min = Math.min(rNorm, gNorm, bNorm);
2577
- const delta = max - min;
2578
- let h = 0;
2579
- if (delta !== 0) {
2580
- if (max === rNorm) h = (gNorm - bNorm) / delta % 6;
2581
- else if (max === gNorm) h = (bNorm - rNorm) / delta + 2;
2582
- else h = (rNorm - gNorm) / delta + 4;
2583
- }
2584
- h = Math.round(h * 60);
2585
- if (h < 0) h += 360;
2586
- let l = (max + min) / 2;
2587
- let s = delta === 0 ? 0 : delta / (1 - Math.abs(2 * l - 1));
2588
- s = Math.min(1, s * 1.8);
2589
- l = Math.min(0.75, l * 1.05);
2590
- const c = (1 - Math.abs(2 * l - 1)) * s;
2591
- const x = c * (1 - Math.abs(h / 60 % 2 - 1));
2592
- const m = l - c / 2;
2593
- let r2 = 0, g2 = 0, b2 = 0;
2594
- if (0 <= h && h < 60) [r2, g2, b2] = [c, x, 0];
2595
- else if (60 <= h && h < 120) [r2, g2, b2] = [x, c, 0];
2596
- else if (120 <= h && h < 180) [r2, g2, b2] = [0, c, x];
2597
- else if (180 <= h && h < 240) [r2, g2, b2] = [0, x, c];
2598
- else if (240 <= h && h < 300) [r2, g2, b2] = [x, 0, c];
2599
- else [r2, g2, b2] = [c, 0, x];
2600
- const finalR = Math.round((r2 + m) * 255);
2601
- const finalG = Math.round((g2 + m) * 255);
2602
- const finalB = Math.round((b2 + m) * 255);
2603
- return `#${finalR.toString(16).padStart(2, "0")}${finalG.toString(16).padStart(2, "0")}${finalB.toString(16).padStart(2, "0")}`;
2604
- };
2605
- var getFieldsOnChange = (fields) => {
2606
- const result = [];
2607
- function traverse(items) {
2608
- for (const item of items) {
2609
- if (item) {
2610
- if (item?.type_co === "field" && matchDomains(fields, item?.on_change)) {
2611
- result.push(item.name);
2612
- }
2613
- if (item?.fields && Array.isArray(item?.fields)) {
2614
- traverse(item?.fields);
2615
- }
2616
- }
2337
+ function cleanObject(obj) {
2338
+ const result = {};
2339
+ for (const [k, v] of Object.entries(obj)) {
2340
+ if (v !== null && v !== void 0) {
2341
+ result[k] = v;
2617
2342
  }
2618
2343
  }
2619
- traverse(fields);
2620
2344
  return result;
2621
- };
2622
- var filterFieldDirty = ({
2623
- id,
2624
- viewData,
2625
- formValues,
2626
- dirtyFields,
2627
- model,
2628
- defaultData,
2629
- keepZeroValue = false
2630
- }) => {
2631
- const data = id ? { ...dirtyFields } : { ...formValues };
2632
- for (const key in data) {
2633
- if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */) {
2634
- const lineData = [];
2635
- (formValues[key] ?? []).forEach((itemData, index) => {
2636
- if (typeof itemData?.id === "string" && itemData?.id.includes("virtual")) {
2637
- delete itemData?.id;
2638
- }
2639
- if (!itemData?.id) {
2640
- lineData.push([
2641
- 0 /* CREATE */,
2642
- `virtual_${index}`,
2643
- filterFieldDirty({
2644
- id: itemData?.id,
2645
- viewData,
2646
- formValues: itemData,
2647
- dirtyFields: {},
2648
- model: viewData?.models?.[model]?.[key]?.relation,
2649
- defaultData,
2650
- keepZeroValue
2651
- })
2652
- ]);
2653
- } else if (dirtyFields[key]?.length) {
2654
- dirtyFields[key].forEach((itemDirty, indexDirty) => {
2655
- if (Object.values(itemDirty).includes(true) && indexDirty === index) {
2656
- lineData.push([
2657
- 1 /* UPDATE */,
2658
- itemData?.id,
2659
- filterFieldDirty({
2660
- id: itemData?.id,
2661
- viewData,
2662
- formValues: itemData,
2663
- dirtyFields: itemDirty,
2664
- model: viewData?.models?.[model]?.[key]?.relation,
2665
- defaultData: {},
2666
- keepZeroValue
2667
- })
2668
- ]);
2669
- }
2670
- });
2671
- }
2672
- });
2673
- (defaultData[key] ?? []).forEach((item) => {
2674
- if (!(formValues[key] ?? []).find(
2675
- (itemData) => itemData?.id === item?.id
2676
- )) {
2677
- lineData.push([2 /* DELETE */, item?.id, item]);
2678
- }
2679
- });
2680
- data[key] = lineData;
2681
- } else if (viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
2682
- const lineData = [];
2683
- (formValues[key] || []).forEach((itemData) => {
2684
- if (itemData?.id) {
2685
- lineData.push([4 /* NO_CHANGE */, itemData?.id]);
2686
- }
2687
- });
2688
- (defaultData[key] ?? []).forEach((item) => {
2689
- if (!(formValues[key] ?? []).find(
2690
- (itemData) => itemData?.id === item?.id
2691
- )) {
2692
- lineData.push([3 /* UNLINK */, item?.id]);
2693
- }
2694
- });
2695
- data[key] = lineData;
2696
- } else {
2697
- if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2698
- if (!(keepZeroValue && (formValues[key] === 0 || formValues[key] === "0"))) {
2699
- delete data[key];
2700
- }
2701
- } else {
2702
- if (!data[key] && !(keepZeroValue && (data[key] === 0 || data[key] === "0"))) {
2703
- delete data[key];
2704
- } else {
2705
- data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
2706
- }
2707
- }
2708
- }
2709
- }
2710
- return data;
2711
- };
2712
- var mergeObjects = (object1, object2) => {
2713
- if (!object1 || !object2) return void 0;
2714
- const mergedObject = { ...object2 };
2715
- Object.keys(object1).forEach((key) => {
2716
- if (Array.isArray(object1[key]) && Array.isArray(object2[key])) {
2717
- mergedObject[key] = object2[key].map((item, index) => {
2718
- if (object1[key][index]) {
2719
- return {
2720
- ...item,
2721
- ...object1[key][index]
2722
- };
2723
- }
2724
- return item;
2725
- });
2726
- } else if (typeof object1[key] === "object" && typeof object2[key] === "object" && object1[key] !== null && object2[key] !== null) {
2727
- mergedObject[key] = mergeObjects(object1[key], object2[key]);
2728
- } else {
2729
- mergedObject[key] = object1[key] !== void 0 ? object1[key] : object2[key];
2730
- }
2731
- });
2732
- if (object2) {
2733
- Object.keys(object2).forEach((key) => {
2734
- if (!mergedObject.hasOwnProperty(key)) {
2735
- mergedObject[key] = object2[key];
2736
- }
2737
- });
2738
- }
2739
- return mergedObject;
2740
- };
2741
- var formatUrlPath = ({
2742
- viewType,
2743
- aid,
2744
- model,
2745
- id,
2746
- actionPath
2747
- }) => {
2748
- let _url = `/${viewType}/${actionPath}?aid=${aid}&model=${model}`;
2749
- if (id) {
2750
- _url += `&id=${id}`;
2751
- }
2752
- return _url;
2753
- };
2754
- var removeUndefinedFields = (obj) => {
2755
- const newObj = {};
2756
- for (const key in obj) {
2757
- if (obj[key] !== void 0) {
2758
- newObj[key] = obj[key];
2759
- }
2760
- }
2761
- return newObj;
2762
- };
2763
- var useTabModel = (viewData, onchangeData) => {
2764
- const tabsData = viewData?.views?.form?.tabs?.filter((val) => {
2765
- if (!val) return null;
2766
- const hide = checkDomain(onchangeData, val.invisible);
2767
- if (!hide) {
2768
- return val;
2769
- }
2770
- return false;
2771
- }) || [];
2772
- return tabsData;
2773
- };
2774
- var isBase64File = (str) => {
2775
- try {
2776
- const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
2777
- if (dataUriPattern.test(str)) {
2778
- return true;
2779
- }
2780
- const base64Pattern = (
2781
- // eslint-disable-next-line no-useless-escape
2782
- /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)?$/
2783
- );
2784
- return base64Pattern.test(str);
2785
- } catch (e) {
2786
- return false;
2787
- }
2788
- };
2789
- var isBase64Image = (str) => {
2790
- const base64Regex = /^data:image\/(png|jpeg|jpg|gif|webp);base64,/;
2791
- if (!base64Regex.test(str)) {
2792
- return false;
2793
- }
2794
- try {
2795
- const base64Data = str.split(",")[1];
2796
- return !!base64Data && atob(base64Data).length > 0;
2797
- } catch (error) {
2798
- return false;
2799
- }
2800
- };
2801
- var checkIsImageLink = (url) => {
2802
- const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
2803
- return imageExtensions.test(url) || isBase64Image(url);
2804
- };
2805
- var formatFileSize = (size) => {
2806
- if (size < 1024) return `${size} B`;
2807
- const i = Math.floor(Math.log(size) / Math.log(1024));
2808
- const sizes = ["B", "KB", "MB", "GB", "TB"];
2809
- return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
2810
- };
2811
- var getSubdomain = (url = window.location.href) => {
2812
- const parts = url?.split(".");
2813
- if (parts.length > 2) {
2814
- return parts[0].replace("https://", "").replace("http://", "");
2815
- }
2816
- return null;
2817
- };
2818
- var resequence = (arr, start, end) => {
2819
- if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
2820
- return [];
2821
- }
2822
- const [element] = arr.splice(start, 1);
2823
- arr.splice(end, 0, element);
2824
- return arr.slice(Math.min(start, end), Math.max(start, end) + 1);
2825
- };
2826
- var getOffSet = (arr, start, end) => {
2827
- if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
2828
- return 0;
2829
- }
2830
- if (start > end) {
2831
- return end;
2832
- }
2833
- return arr.slice(0, start).length;
2834
- };
2835
- var copyTextToClipboard = async (text) => {
2836
- if ("clipboard" in navigator) {
2837
- return await navigator.clipboard.writeText(text);
2838
- } else {
2839
- const textArea = document.createElement("textarea");
2840
- textArea.value = text;
2841
- textArea.style.position = "fixed";
2842
- document.body.appendChild(textArea);
2843
- textArea.focus();
2844
- textArea.select();
2845
- try {
2846
- document.execCommand("copy");
2847
- } finally {
2848
- document.body.removeChild(textArea);
2849
- }
2850
- }
2851
- };
2345
+ }
2852
2346
  var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2853
2347
  if (!originalRequest.data) return originalRequest.data;
2854
2348
  if (typeof originalRequest.data === "string") {
@@ -2868,198 +2362,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2868
2362
  }
2869
2363
  return originalRequest.data;
2870
2364
  };
2871
- var isObjectEmpty = (obj) => {
2872
- return Object.keys(obj).length === 0;
2873
- };
2874
- var useField = (props) => {
2875
- const [invisible, setInvisible] = react.useState(true);
2876
- const [required, setRequired] = react.useState(false);
2877
- const [readonly, setReadOnly] = react.useState(false);
2878
- const {
2879
- invisible: inv,
2880
- required: req,
2881
- readonly: rea,
2882
- onchangeData,
2883
- rootField,
2884
- index,
2885
- name
2886
- } = props;
2887
- const nameField = rootField ? `${rootField?.name}.${index}.${name}` : null;
2888
- react.useEffect(() => {
2889
- if (onchangeData && Object.keys(onchangeData).length > 0) {
2890
- setRequired(
2891
- typeof req === "object" ? matchDomains(onchangeData, req) : checkDomain(onchangeData, req)
2892
- );
2893
- setInvisible(matchDomains(onchangeData, inv));
2894
- setReadOnly(
2895
- typeof req === "object" ? matchDomains(onchangeData, rea) : checkDomain(onchangeData, rea)
2896
- );
2897
- }
2898
- }, [onchangeData]);
2899
- return {
2900
- invisible,
2901
- required,
2902
- readonly,
2903
- nameField
2904
- };
2905
- };
2906
- var downloadFile = async (url, filename) => {
2907
- try {
2908
- const response = await fetch(url);
2909
- if (!response.ok) throw new Error(`Failed to fetch ${url}`);
2910
- const contentType = response.headers.get("Content-Type") || "";
2911
- let ext = "";
2912
- if (contentType.includes("pdf")) ext = ".pdf";
2913
- else if (contentType.includes("png")) ext = ".png";
2914
- else if (contentType.includes("jpeg") || contentType.includes("jpg"))
2915
- ext = ".jpg";
2916
- else if (contentType.includes("zip")) ext = ".zip";
2917
- else if (contentType.includes("msword")) ext = ".doc";
2918
- else if (contentType.includes("spreadsheet")) ext = ".xls";
2919
- else if (contentType.includes("json")) ext = ".json";
2920
- else if (contentType.includes("text")) ext = ".txt";
2921
- else {
2922
- ext = "";
2923
- }
2924
- const blob = await response.blob();
2925
- const urlBlob = window.URL.createObjectURL(blob);
2926
- const link = document.createElement("a");
2927
- link.href = urlBlob;
2928
- link.download = (filename || "file") + ext;
2929
- document.body.appendChild(link);
2930
- link.click();
2931
- document.body.removeChild(link);
2932
- window.URL.revokeObjectURL(urlBlob);
2933
- } catch (error) {
2934
- console.error("File download failed:", error);
2935
- }
2936
- };
2937
- function cleanObject(obj) {
2938
- const result = {};
2939
- for (const [k, v] of Object.entries(obj)) {
2940
- if (v !== null && v !== void 0) {
2941
- result[k] = v;
2942
- }
2943
- }
2944
- return result;
2945
- }
2946
- var extractIdFromDomain = (domain) => {
2947
- if (!domain || !Array.isArray(domain)) return null;
2948
- const idCond = domain.find(
2949
- ([field, operator]) => field === "id" && operator === "="
2950
- );
2951
- return idCond ? Number(idCond[2]) : null;
2952
- };
2953
2365
 
2954
- // src/utils/storage/local-storage.ts
2955
- var localStorageUtils = () => {
2956
- const setToken = async (access_token) => {
2957
- localStorage.setItem("accessToken", access_token);
2958
- };
2959
- const setRefreshToken = async (refresh_token) => {
2960
- localStorage.setItem("refreshToken", refresh_token);
2961
- };
2962
- const getAccessToken = async () => {
2963
- return localStorage.getItem("accessToken");
2964
- };
2965
- const getRefreshToken = async () => {
2966
- return localStorage.getItem("refreshToken");
2967
- };
2968
- const clearToken = async () => {
2969
- localStorage.removeItem("accessToken");
2970
- localStorage.removeItem("refreshToken");
2971
- };
2972
- return {
2973
- setToken,
2974
- setRefreshToken,
2975
- getAccessToken,
2976
- getRefreshToken,
2977
- clearToken
2978
- };
2979
- };
2980
2366
 
2981
- // src/utils/storage/session-storage.ts
2982
- var sessionStorageUtils = /* @__PURE__ */ (() => {
2983
- const getMenuFocus = () => {
2984
- const menuFocus = sessionStorage.getItem("menuFocus");
2985
- return menuFocus ? JSON.parse(menuFocus) : {
2986
- id: void 0,
2987
- service: ""
2988
- };
2989
- };
2990
- const setMenuFocus = (menuTree) => {
2991
- sessionStorage.setItem("menuFocus", JSON.stringify({ ...menuTree }));
2992
- };
2993
- const getActionData = () => {
2994
- const actionData = sessionStorage.getItem("actionData");
2995
- return actionData ? JSON.parse(actionData) : {};
2996
- };
2997
- const setActionData = (actData) => {
2998
- sessionStorage.setItem("actionData", JSON.stringify(actData));
2999
- };
3000
- const getViewData = () => {
3001
- const viewData = sessionStorage.getItem("viewData");
3002
- return viewData ? JSON.parse(viewData) : {};
3003
- };
3004
- const getBrowserSession = () => {
3005
- const actionData = sessionStorage.getItem("browserSession");
3006
- return actionData ? JSON.parse(actionData) : null;
3007
- };
3008
- const setViewData = (viewData) => {
3009
- sessionStorage.setItem("viewData", JSON.stringify(viewData));
3010
- };
3011
- const getXNode = () => {
3012
- const xNode = sessionStorage.getItem("xNode");
3013
- return xNode;
3014
- };
3015
- const setXNode = (xNode) => {
3016
- sessionStorage.setItem("xNode", xNode);
3017
- };
3018
- return {
3019
- getMenuFocus,
3020
- setMenuFocus,
3021
- setActionData,
3022
- getActionData,
3023
- getViewData,
3024
- setViewData,
3025
- getBrowserSession,
3026
- getXNode,
3027
- setXNode
3028
- };
3029
- })();
3030
2367
 
3031
- exports.WesapError = WesapError;
3032
- exports.checkIsImageLink = checkIsImageLink;
3033
- exports.cleanObject = cleanObject;
3034
- exports.convertFloatToTime = convertFloatToTime;
3035
- exports.convertTimeToFloat = convertTimeToFloat;
3036
- exports.copyTextToClipboard = copyTextToClipboard;
3037
- exports.domainHelper = domainHelper;
3038
- exports.downloadFile = downloadFile;
3039
- exports.evalJSONContext = evalJSONContext;
3040
- exports.evalJSONDomain = evalJSONDomain;
3041
- exports.extractIdFromDomain = extractIdFromDomain;
3042
- exports.filterFieldDirty = filterFieldDirty;
3043
- exports.formatCurrency = formatCurrency;
3044
- exports.formatDate = formatDate;
3045
- exports.formatFileSize = formatFileSize;
3046
- exports.formatSortingString = formatSortingString;
3047
- exports.formatUrlPath = formatUrlPath;
3048
- exports.getFieldsOnChange = getFieldsOnChange;
3049
- exports.getOffSet = getOffSet;
3050
- exports.getSubdomain = getSubdomain;
3051
- exports.handleError = handleError;
3052
- exports.isBase64File = isBase64File;
3053
- exports.isBase64Image = isBase64Image;
3054
- exports.isObjectEmpty = isObjectEmpty;
3055
- exports.localStorageUtils = localStorageUtils;
3056
- exports.mergeObjects = mergeObjects;
3057
- exports.removeUndefinedFields = removeUndefinedFields;
3058
- exports.resequence = resequence;
3059
- exports.sessionStorageUtils = sessionStorageUtils;
3060
- exports.stringToColor = stringToColor;
3061
- exports.toQueryString = toQueryString;
3062
- exports.updateTokenParamInOriginalRequest = updateTokenParamInOriginalRequest;
3063
- exports.useField = useField;
3064
- exports.useTabModel = useTabModel;
3065
- exports.validateAndParseDate = validateAndParseDate;
2368
+
2369
+
2370
+
2371
+
2372
+
2373
+
2374
+
2375
+
2376
+
2377
+
2378
+
2379
+
2380
+
2381
+
2382
+
2383
+ exports.localStorageUtils = localStorageUtils; exports.sessionStorageUtils = sessionStorageUtils; exports.makeContext = makeContext; exports.evalPartialContext = evalPartialContext; exports.InvalidDomainError = InvalidDomainError; exports.Domain = Domain; exports.evalDomain = evalDomain; exports.checkDomain = checkDomain; exports.matchDomains = matchDomains; exports.domainHelper = domainHelper; exports.evalJSONContext = evalJSONContext; exports.evalJSONDomain = evalJSONDomain; exports.formatSortingString = formatSortingString; exports.toQueryString = toQueryString; exports.cleanObject = cleanObject; exports.updateTokenParamInOriginalRequest = updateTokenParamInOriginalRequest;