@libs-ui/utils 0.2.306-4 → 0.2.306-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,7 +90,7 @@ const highlightByKeyword = (value, search, ignoreHighlight, classHightLight) =>
90
90
  if (!classHightLight) {
91
91
  classHightLight = 'bg-[#19344a] text-white';
92
92
  }
93
- keysReplace.forEach(key => {
93
+ keysReplace.forEach((key) => {
94
94
  const regExp = new RegExp(key, 'gi');
95
95
  value = value?.replace(regExp, `<span class="${classHightLight}">$&</span>`);
96
96
  });
@@ -119,7 +119,7 @@ const formatTextCompare = (text, options) => {
119
119
  if (!text) {
120
120
  return text;
121
121
  }
122
- text = text.normalize("NFC");
122
+ text = text.normalize('NFC');
123
123
  return formatByOptions(text, options);
124
124
  };
125
125
  const fullNameFormat = (value) => {
@@ -133,7 +133,10 @@ const capitalize = (text, options) => {
133
133
  return text;
134
134
  }
135
135
  text = formatByOptions(text, options);
136
- return text.split(' ').map(word => firstLetterToUpperCase(word)).join(' ');
136
+ return text
137
+ .split(' ')
138
+ .map((word) => firstLetterToUpperCase(word))
139
+ .join(' ');
137
140
  };
138
141
  const firstLetterToUpperCase = (text, options) => {
139
142
  if (!text) {
@@ -159,7 +162,7 @@ const formatByOptions = (text, options) => {
159
162
  text = text.toLowerCase();
160
163
  }
161
164
  if (options?.removeMultipleSpace) {
162
- text = text.replace(/\u200B|\u00A0/g, "");
165
+ text = text.replace(/\u200B|\u00A0/g, '');
163
166
  text = text.replace(/\s+/g, ' ');
164
167
  }
165
168
  if (options?.removeEmoji) {
@@ -177,12 +180,7 @@ const escapeHtml = (str) => {
177
180
  if (!str || typeof str !== 'string') {
178
181
  return str;
179
182
  }
180
- return str
181
- .replace(/&/g, "&amp;")
182
- .replace(/</g, "&lt;")
183
- .replace(/>/g, "&gt;")
184
- .replace(/"/g, "&quot;")
185
- .replace(/'/g, "&#039;");
183
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
186
184
  };
187
185
  const decodeEscapeHtml = (str) => {
188
186
  const htmlTag = document.createElement('textarea');
@@ -213,9 +211,9 @@ const deleteUnicode = (str) => {
213
211
  str = str.replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, 'U');
214
212
  str = str.replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, 'Y');
215
213
  str = str.replace(/Đ/g, 'D');
216
- str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ""); // ̀ ́ ̃ ̉ ̣ huyền, sắc, ngã, hỏi, nặng
217
- str = str.replace(/\u02C6|\u0306|\u031B/g, ""); // ˆ ̆ ̛ Â, Ê, Ă, Ơ, Ư
218
- return str.normalize("NFC");
214
+ str = str.replace(/\u0300|\u0301|\u0303|\u0309|\u0323/g, ''); // ̀ ́ ̃ ̉ ̣ huyền, sắc, ngã, hỏi, nặng
215
+ str = str.replace(/\u02C6|\u0306|\u031B/g, ''); // ˆ ̆ ̛ Â, Ê, Ă, Ơ, Ư
216
+ return str.normalize('NFC');
219
217
  };
220
218
  const removeEmoji = (text) => {
221
219
  if (!text || !text.trim()) {
@@ -290,10 +288,7 @@ const checkViewInScreen = (container, element, elementScroll, maxTopLeft) => {
290
288
  const limitLeft = leftContainer + scrollLeftContainer + widthContainer;
291
289
  const maxTopItem = top + (maxTopLeft?.top || 0);
292
290
  const maxLeftItem = left + (maxTopLeft?.left || 0);
293
- if (topContainer <= maxTopItem &&
294
- maxTopItem <= limitTop &&
295
- leftContainer <= maxLeftItem &&
296
- maxLeftItem <= limitLeft) {
291
+ if (topContainer <= maxTopItem && maxTopItem <= limitTop && leftContainer <= maxLeftItem && maxLeftItem <= limitLeft) {
297
292
  return true;
298
293
  }
299
294
  return false;
@@ -307,10 +302,7 @@ const checkMouseOverInContainer = (mousePosition, element, rect) => {
307
302
  const limitLeft = left + width;
308
303
  const limitTop = top + height;
309
304
  const { clientX, clientY } = mousePosition;
310
- if (left <= clientX &&
311
- clientX <= limitLeft &&
312
- top <= clientY &&
313
- clientY <= limitTop) {
305
+ if (left <= clientX && clientX <= limitLeft && top <= clientY && clientY <= limitTop) {
314
306
  return true;
315
307
  }
316
308
  return false;
@@ -348,13 +340,11 @@ const getDragEventByElement = (config) => {
348
340
  e.stopPropagation();
349
341
  config.functionMouseMove?.(e);
350
342
  }), takeUntil(mouseup));
351
- return mouseDown.pipe(mergeMap((e) => config.isStartWithMouseDownEvent
352
- ? mousemove.pipe(startWith(e))
353
- : mousemove), takeUntil(config.onDestroy), finalize(removeClass));
343
+ return mouseDown.pipe(mergeMap((e) => (config.isStartWithMouseDownEvent ? mousemove.pipe(startWith(e)) : mousemove)), takeUntil(config.onDestroy), finalize(removeClass));
354
344
  };
355
345
  const getHTMLFromQuill = async (data, options) => {
356
346
  const { replaceNewLineTo = '<br>', replaceTagBRTo, replaceTags, replaceBrToDiv } = options || {};
357
- const delta = (typeof data === 'string') ? await getDeltaFromHTML(data) : data;
347
+ const delta = typeof data === 'string' ? await getDeltaFromHTML(data) : data;
358
348
  if (options?.functionReplaceDelta) {
359
349
  options.functionReplaceDelta(delta);
360
350
  }
@@ -498,17 +488,19 @@ class UtilsUrlSearchParams {
498
488
  return this.instance;
499
489
  }
500
490
  static toStringParamObject(params) {
501
- const paramsArr = Object.keys(params).map(key => {
491
+ const paramsArr = Object.keys(params).map((key) => {
502
492
  return {
503
493
  key,
504
- value: params[key]
494
+ value: params[key],
505
495
  };
506
496
  });
507
497
  return UtilsUrlSearchParams.ToString(paramsArr);
508
498
  }
509
499
  static ToString(params) {
510
500
  let paramsStr = '';
511
- params.sort((item1, item2) => item1.key.localeCompare(item2.key)).forEach((item) => {
501
+ params
502
+ .sort((item1, item2) => item1.key.localeCompare(item2.key))
503
+ .forEach((item) => {
512
504
  const { key, value } = item;
513
505
  paramsStr = `${paramsStr}${paramsStr ? '&' : ''}${key}=${value}`;
514
506
  });
@@ -525,14 +517,14 @@ class UtilsUrlSearchParams {
525
517
  }
526
518
  const params = paramString.replace(/\S+[?]/g, '').split('&');
527
519
  if (params) {
528
- params.forEach(param => {
520
+ params.forEach((param) => {
529
521
  if (param.indexOf('=') < 0) {
530
522
  return;
531
523
  }
532
524
  let [key, value] = param.split('=');
533
525
  key = key.replace(/[?&]+/g, '');
534
526
  value = decodeURIComponent(value.replace(/\+/g, ' '));
535
- if (!paramsBuild.some(param => param.key === key)) {
527
+ if (!paramsBuild.some((param) => param.key === key)) {
536
528
  paramsBuild.push({ key, value });
537
529
  }
538
530
  });
@@ -540,7 +532,7 @@ class UtilsUrlSearchParams {
540
532
  return paramsBuild;
541
533
  }
542
534
  set(key, value) {
543
- const paramByKey = this.params.find(param => param.key === key);
535
+ const paramByKey = this.params.find((param) => param.key === key);
544
536
  if (!paramByKey) {
545
537
  this.params.push({ key, value: decodeURIComponent(value.replace(/\+/g, ' ')) });
546
538
  return;
@@ -548,13 +540,13 @@ class UtilsUrlSearchParams {
548
540
  paramByKey['value'] = value;
549
541
  }
550
542
  get(key) {
551
- return this.params.find(param => param.key === key)?.value;
543
+ return this.params.find((param) => param.key === key)?.value;
552
544
  }
553
545
  has(key) {
554
- return this.params.some(param => param.key === key);
546
+ return this.params.some((param) => param.key === key);
555
547
  }
556
548
  delete(key) {
557
- const index = this.params.findIndex(param => param.key === key);
549
+ const index = this.params.findIndex((param) => param.key === key);
558
550
  if (index >= 0) {
559
551
  this.params.splice(index, 1);
560
552
  }
@@ -568,7 +560,7 @@ class UtilsUrlSearchParams {
568
560
  }
569
561
  getParamObject() {
570
562
  const params = {};
571
- this.params.forEach(item => {
563
+ this.params.forEach((item) => {
572
564
  params[item.key] = item.value;
573
565
  });
574
566
  return params;
@@ -596,7 +588,7 @@ const keyStore$1 = () => {
596
588
  };
597
589
  const encrypt = (plainData) => {
598
590
  if (!keyStore$1()) {
599
- throw Error("lỗi chưa setup key mã hóa");
591
+ throw Error('lỗi chưa setup key mã hóa');
600
592
  }
601
593
  const key = CryptoES.enc.Hex.parse(keyStore$1());
602
594
  const iv = CryptoES.enc.Hex.parse(keyStore$1());
@@ -607,7 +599,7 @@ const encrypt = (plainData) => {
607
599
  };
608
600
  const decrypt = (encryptedData) => {
609
601
  if (!keyStore$1()) {
610
- throw Error("lỗi chưa setup key mã hóa");
602
+ throw Error('lỗi chưa setup key mã hóa');
611
603
  }
612
604
  const key = CryptoES.enc.Hex.parse(keyStore$1());
613
605
  const iv = CryptoES.enc.Hex.parse(keyStore$1());
@@ -653,7 +645,7 @@ const keyStore = () => {
653
645
  };
654
646
  const encrypt3rd = (plainData) => {
655
647
  if (!keyStore()) {
656
- throw Error("lỗi chưa setup key mã hóa");
648
+ throw Error('lỗi chưa setup key mã hóa');
657
649
  }
658
650
  const key = CryptoES.enc.Hex.parse(keyStore());
659
651
  const iv = CryptoES.enc.Hex.parse(keyStore());
@@ -664,7 +656,7 @@ const encrypt3rd = (plainData) => {
664
656
  };
665
657
  const decrypt3rd = (encryptedData) => {
666
658
  if (!keyStore()) {
667
- throw Error("lỗi chưa setup key mã hóa");
659
+ throw Error('lỗi chưa setup key mã hóa');
668
660
  }
669
661
  const key = CryptoES.enc.Hex.parse(keyStore());
670
662
  const iv = CryptoES.enc.Hex.parse(keyStore());
@@ -711,7 +703,9 @@ class UtilsCommunicateMicro {
711
703
  if (!this.subs.get(COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE)) {
712
704
  this.subs.set(COMMUNICATE_MICRO_KEY_GET_ALL_MESSAGE, UtilsCommunicateMicro.allMessageSub);
713
705
  }
714
- fromEvent(currentWindow, 'message').pipe(takeUntil(onDestroy)).subscribe(e => {
706
+ fromEvent(currentWindow, 'message')
707
+ .pipe(takeUntil(onDestroy))
708
+ .subscribe((e) => {
715
709
  const event = { data: { ...e.data } };
716
710
  const data = event.data;
717
711
  const type = data.type;
@@ -739,7 +733,9 @@ class UtilsCommunicateMicro {
739
733
  this.allMessageSub.next(event);
740
734
  }
741
735
  });
742
- UtilsCommunicateMicro.GetMessage(UtilsCache.typeKeyClearLocalStorage).pipe(filter(e => e.data.response !== UtilsCache.idService), takeUntil(onDestroy)).subscribe(() => {
736
+ UtilsCommunicateMicro.GetMessage(UtilsCache.typeKeyClearLocalStorage)
737
+ .pipe(filter((e) => e.data.response !== UtilsCache.idService), takeUntil(onDestroy))
738
+ .subscribe(() => {
743
739
  console.log('clear all cache by event');
744
740
  UtilsCache.ClearAll();
745
741
  });
@@ -748,10 +744,10 @@ class UtilsCommunicateMicro {
748
744
  data = this.convertData(data);
749
745
  try {
750
746
  if (isEmbedFrame()) {
751
- window?.parent?.postMessage(data, "*");
747
+ window?.parent?.postMessage(data, '*');
752
748
  return;
753
749
  }
754
- window?.top?.postMessage(data, "*");
750
+ window?.top?.postMessage(data, '*');
755
751
  }
756
752
  catch (error) {
757
753
  console.log(error);
@@ -759,8 +755,8 @@ class UtilsCommunicateMicro {
759
755
  }
760
756
  static PostMessageToChildren(data) {
761
757
  data = this.convertData(data);
762
- const iframes = document.querySelectorAll("iframe");
763
- Array.from(iframes).forEach(iframe => {
758
+ const iframes = document.querySelectorAll('iframe');
759
+ Array.from(iframes).forEach((iframe) => {
764
760
  iframe?.contentWindow?.postMessage(data, '*');
765
761
  });
766
762
  }
@@ -798,7 +794,7 @@ class UtilsCommunicateMicro {
798
794
  }
799
795
  static GetMessage(messageType) {
800
796
  if (!this.initdEvent) {
801
- throw Error("chưa khơi tạo hàm lắng nghe sự kiện, gọi UtilsCommunicateMicro.initEvent(window) tại root component");
797
+ throw Error('chưa khơi tạo hàm lắng nghe sự kiện, gọi UtilsCommunicateMicro.initEvent(window) tại root component');
802
798
  }
803
799
  if (typeof messageType === 'string') {
804
800
  let sub = this.subs.get(messageType);
@@ -826,8 +822,8 @@ class UtilsCommunicateMicro {
826
822
  return sub;
827
823
  }
828
824
  static initSubject(subRoot, messageType) {
829
- messageType.forEach(key => {
830
- this.GetMessage(key).subscribe(e => {
825
+ messageType.forEach((key) => {
826
+ this.GetMessage(key).subscribe((e) => {
831
827
  subRoot.next(e);
832
828
  });
833
829
  });
@@ -835,33 +831,33 @@ class UtilsCommunicateMicro {
835
831
  }
836
832
 
837
833
  class UtilsLanguageConstants {
838
- static VI = "vi"; // Tiếng Việt
839
- static EN = "en"; // Tiếng Anh
840
- static FR = "fr"; // Tiếng Pháp
841
- static DE = "de"; // Tiếng Đức
842
- static ES = "es"; // Tiếng Tây Ban Nha
843
- static ZH = "zh"; // Tiếng Trung (Giản thể)
844
- static ZH_TW = "zh-TW"; // Tiếng Trung (Phồn thể)
845
- static JA = "ja"; // Tiếng Nhật
846
- static KO = "ko"; // Tiếng Hàn
847
- static RU = "ru"; // Tiếng Nga
848
- static IT = "it"; // Tiếng Ý
849
- static PT = "pt"; // Tiếng Bồ Đào Nha
850
- static TH = "th"; // Tiếng Thái
851
- static ID = "id"; // Tiếng Indonesia
852
- static MS = "ms"; // Tiếng Malaysia
853
- static AR = "ar"; // Tiếng Ả Rập
854
- static HI = "hi"; // Tiếng Hindi
855
- static BN = "bn"; // Tiếng Bengal
856
- static TR = "tr"; // Tiếng Thổ Nhĩ Kỳ
857
- static NL = "nl"; // Tiếng Hà Lan
858
- static KM = "km"; // Tiếng Khmer (Campuchia)
859
- static LO = "lo"; // Tiếng Lào
860
- static MY = "my"; // Tiếng Miến Điện (Myanmar)
861
- static TL = "tl"; // Tiếng Tagalog (Philippines)
862
- static CEB = "ceb"; // Tiếng Cebuano (Philippines)
863
- static JV = "jv"; // Tiếng Java (Indonesia)
864
- static SU = "su"; // Tiếng Sundanese (Indonesia)
834
+ static VI = 'vi'; // Tiếng Việt
835
+ static EN = 'en'; // Tiếng Anh
836
+ static FR = 'fr'; // Tiếng Pháp
837
+ static DE = 'de'; // Tiếng Đức
838
+ static ES = 'es'; // Tiếng Tây Ban Nha
839
+ static ZH = 'zh'; // Tiếng Trung (Giản thể)
840
+ static ZH_TW = 'zh-TW'; // Tiếng Trung (Phồn thể)
841
+ static JA = 'ja'; // Tiếng Nhật
842
+ static KO = 'ko'; // Tiếng Hàn
843
+ static RU = 'ru'; // Tiếng Nga
844
+ static IT = 'it'; // Tiếng Ý
845
+ static PT = 'pt'; // Tiếng Bồ Đào Nha
846
+ static TH = 'th'; // Tiếng Thái
847
+ static ID = 'id'; // Tiếng Indonesia
848
+ static MS = 'ms'; // Tiếng Malaysia
849
+ static AR = 'ar'; // Tiếng Ả Rập
850
+ static HI = 'hi'; // Tiếng Hindi
851
+ static BN = 'bn'; // Tiếng Bengal
852
+ static TR = 'tr'; // Tiếng Thổ Nhĩ Kỳ
853
+ static NL = 'nl'; // Tiếng Hà Lan
854
+ static KM = 'km'; // Tiếng Khmer (Campuchia)
855
+ static LO = 'lo'; // Tiếng Lào
856
+ static MY = 'my'; // Tiếng Miến Điện (Myanmar)
857
+ static TL = 'tl'; // Tiếng Tagalog (Philippines)
858
+ static CEB = 'ceb'; // Tiếng Cebuano (Philippines)
859
+ static JV = 'jv'; // Tiếng Java (Indonesia)
860
+ static SU = 'su'; // Tiếng Sundanese (Indonesia)
865
861
  // Ngôn ngữ mặc định
866
862
  static defaultLang = UtilsLanguageConstants.VI;
867
863
  // Danh sách các ngôn ngữ được hỗ trợ
@@ -947,7 +943,7 @@ class UtilsCache {
947
943
  return this.Get(this.languageKeyCache, UtilsLanguageConstants.defaultLang);
948
944
  }
949
945
  static openDB() {
950
- return new Promise(resolve => {
946
+ return new Promise((resolve) => {
951
947
  const request = indexedDB.open(this.dbName, this.dbVersion);
952
948
  request.onupgradeneeded = (event) => {
953
949
  const db = event.target.result;
@@ -1019,7 +1015,7 @@ class UtilsCache {
1019
1015
  clear: () => {
1020
1016
  this.storage = {};
1021
1017
  localStorage.clear();
1022
- }
1018
+ },
1023
1019
  };
1024
1020
  }
1025
1021
  static getLocalStorageFake() {
@@ -1038,7 +1034,7 @@ class UtilsCache {
1038
1034
  },
1039
1035
  clear: () => {
1040
1036
  this.storage = {};
1041
- }
1037
+ },
1042
1038
  };
1043
1039
  }
1044
1040
  static async GetAsync(key, default_value, isKeyMD5 = false) {
@@ -1057,7 +1053,7 @@ class UtilsCache {
1057
1053
  if (data.expire === this.CACHE_EXPIRE_NONE) {
1058
1054
  return resolve(data.json);
1059
1055
  }
1060
- const currentMillisecond = (new Date().valueOf() / 1000);
1056
+ const currentMillisecond = new Date().valueOf() / 1000;
1061
1057
  if (data.expire < currentMillisecond) {
1062
1058
  return resolve(default_value);
1063
1059
  }
@@ -1070,6 +1066,7 @@ class UtilsCache {
1070
1066
  });
1071
1067
  }
1072
1068
  static Get(key, default_value) {
1069
+ // support cho những file không thể inject UtilsCache
1073
1070
  if (!key) {
1074
1071
  return this.GetDefaultValueBySpecificKey(key, default_value);
1075
1072
  }
@@ -1082,7 +1079,7 @@ class UtilsCache {
1082
1079
  if (data.expire === this.CACHE_EXPIRE_NONE) {
1083
1080
  return data.value ?? default_value;
1084
1081
  }
1085
- const currentMillisecond = (new Date().valueOf() / 1000);
1082
+ const currentMillisecond = new Date().valueOf() / 1000;
1086
1083
  if (data.expire < currentMillisecond) {
1087
1084
  return this.GetDefaultValueBySpecificKey(key, default_value);
1088
1085
  }
@@ -1097,11 +1094,12 @@ class UtilsCache {
1097
1094
  return default_value;
1098
1095
  }
1099
1096
  static async SetAsync(key, value, expireTimeBySecond = this.CACHE_EXPIRE_TIME_DEFAULT, isKeyMD5 = false) {
1097
+ // support inject UtilsCache
1100
1098
  return new Promise(async (resolve) => {
1101
1099
  const objectStore = await this.getObjectStore();
1102
1100
  key = isKeyMD5 ? key : md5(key);
1103
1101
  try {
1104
- const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : (new Date().valueOf() / 1000) + expireTimeBySecond;
1102
+ const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : new Date().valueOf() / 1000 + expireTimeBySecond;
1105
1103
  const data = {
1106
1104
  value: encrypt(JSON.stringify({ json: value, expire: currentMillisecond })),
1107
1105
  };
@@ -1127,10 +1125,11 @@ class UtilsCache {
1127
1125
  });
1128
1126
  }
1129
1127
  static Set(key, value, expireTimeBySecond = this.CACHE_EXPIRE_TIME_DEFAULT) {
1130
- const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : (new Date().valueOf() / 1000) + expireTimeBySecond;
1128
+ // support cho những file không inject UtilsCache
1129
+ const currentMillisecond = expireTimeBySecond === this.CACHE_EXPIRE_NONE ? this.CACHE_EXPIRE_NONE : new Date().valueOf() / 1000 + expireTimeBySecond;
1131
1130
  const data = {
1132
1131
  value: value,
1133
- expire: currentMillisecond
1132
+ expire: currentMillisecond,
1134
1133
  };
1135
1134
  try {
1136
1135
  this.LocalStorage.setItem(key, encrypt(JSON.stringify(data)));
@@ -1185,13 +1184,13 @@ class UtilsCache {
1185
1184
  const data = {
1186
1185
  type: this.typeKeyClearLocalStorage,
1187
1186
  response: {
1188
- idEvent: this.idService
1189
- }
1187
+ idEvent: this.idService,
1188
+ },
1190
1189
  };
1191
1190
  UtilsCommunicateMicro.PostMessageToParent(data);
1192
1191
  }
1193
1192
  const keys = [...this.listKeyKeepWhenClearALll];
1194
- Object.keys(this.LocalStorage).forEach(key => {
1193
+ Object.keys(this.LocalStorage).forEach((key) => {
1195
1194
  if (key.includes('kc-callback-')) {
1196
1195
  keys.push(key);
1197
1196
  }
@@ -1237,7 +1236,7 @@ class UtilsCache {
1237
1236
  if (!Array.isArray(data)) {
1238
1237
  return resolve({});
1239
1238
  }
1240
- data.forEach(obj => {
1239
+ data.forEach((obj) => {
1241
1240
  if (obj[this.itemIndexByKey].startsWith(keyCacheStartWith)) {
1242
1241
  this.ClearAsync(obj[this.itemIndexByKey], true);
1243
1242
  }
@@ -1255,7 +1254,7 @@ class UtilsCache {
1255
1254
  if (!keys || !keys.length) {
1256
1255
  return;
1257
1256
  }
1258
- keys.forEach(key => {
1257
+ keys.forEach((key) => {
1259
1258
  if (key.startsWith(keyCache)) {
1260
1259
  this.Clear(key);
1261
1260
  }
@@ -1287,7 +1286,7 @@ dayjs.extend(updateLocale);
1287
1286
  dayjs.extend(utc);
1288
1287
  dayjs.extend(timezone);
1289
1288
  dayjs.extend(customParseFormat);
1290
- let timeZoneSetup = "Asia/Ho_Chi_Minh";
1289
+ let timeZoneSetup = 'Asia/Ho_Chi_Minh';
1291
1290
  const setDefaultTimeZone = (localeZone = timeZoneSetup) => {
1292
1291
  timeZoneSetup = localeZone;
1293
1292
  dayjs.tz.setDefault(localeZone);
@@ -1297,13 +1296,13 @@ const updateFunctionFormatDate = (functionCustom) => {
1297
1296
  functionFormatDate = functionCustom;
1298
1297
  };
1299
1298
  /**
1300
- * @description Lấy đối tượng dayjs theo config
1301
- * @param config nếu không có config sẽ trả về đối tượng dayjs là thời gian hiện tại
1302
- * @param config.date thời gian cần lấy
1303
- * @param config.returnDayjsIfConfigDateNotExist true nếu muốn trả về đối tượng dayjs nếu config.date không có
1304
- * @param config.utc true nếu muốn lấy thời gian UTC
1305
- * @param config.formatOfDate định dạng thời gian đang được truyền vào
1306
- */
1299
+ * @description Lấy đối tượng dayjs theo config
1300
+ * @param config nếu không có config sẽ trả về đối tượng dayjs là thời gian hiện tại
1301
+ * @param config.date thời gian cần lấy
1302
+ * @param config.returnDayjsIfConfigDateNotExist true nếu muốn trả về đối tượng dayjs nếu config.date không có
1303
+ * @param config.utc true nếu muốn lấy thời gian UTC
1304
+ * @param config.formatOfDate định dạng thời gian đang được truyền vào
1305
+ */
1307
1306
  const getDayjs = (config) => {
1308
1307
  if (!config) {
1309
1308
  return dayjs().tz();
@@ -1396,7 +1395,7 @@ const formatDate = (date, formatOutput = 'YYYY/MM/DD HH:mm', lang, formatInput)
1396
1395
  date = getDayjs({ date, formatOfDate: formatInput }).locale(lang);
1397
1396
  if (lang === 'vi') {
1398
1397
  dayjs.updateLocale('vi', {
1399
- monthsShort: 'Thg 1_Thg 2_Thg 3_Thg 4_Thg 5_Thg 6_Thg 7_Thg 8_Thg 9_Thg 10_Thg 11_Thg 12'.split('_')
1398
+ monthsShort: 'Thg 1_Thg 2_Thg 3_Thg 4_Thg 5_Thg 6_Thg 7_Thg 8_Thg 9_Thg 10_Thg 11_Thg 12'.split('_'),
1400
1399
  });
1401
1400
  }
1402
1401
  return date.format(getFormatData(getTypeByFormat(formatOutput), lang)) || '';
@@ -1660,20 +1659,22 @@ const omitBy = (objData, predicate) => {
1660
1659
  * get(undefined, 'any.path', 'fallback'); // 'fallback'
1661
1660
  */
1662
1661
  const get = (obj, path, defaultValue, keepLastValueIfSignal) => {
1662
+ // helper cast để tránh lặp lại kiểu điều kiện ở các return
1663
+ const out = (v) => v;
1663
1664
  if (isNil(obj)) {
1664
- return defaultValue;
1665
+ return out(defaultValue);
1665
1666
  }
1666
1667
  while (isSignal(obj)) {
1667
1668
  obj = obj();
1668
1669
  }
1669
1670
  if (path === '') {
1670
- return obj;
1671
+ return out(obj);
1671
1672
  }
1672
1673
  if (obj instanceof HttpParams) {
1673
- return (obj.get(`${path}`) ?? defaultValue);
1674
+ return out(obj.get(`${path}`) ?? defaultValue);
1674
1675
  }
1675
1676
  if (obj instanceof DOMRect) {
1676
- return obj[path];
1677
+ return out(obj[path]);
1677
1678
  }
1678
1679
  const paths = Array.isArray(path)
1679
1680
  ? path
@@ -1692,12 +1693,12 @@ const get = (obj, path, defaultValue, keepLastValueIfSignal) => {
1692
1693
  continue;
1693
1694
  }
1694
1695
  if (isNil(obj) || !Object.prototype.hasOwnProperty.call(obj, key)) {
1695
- return defaultValue;
1696
+ return out(defaultValue);
1696
1697
  }
1697
1698
  const val = isSignal(obj[key]) && !keepLastValueIfSignal ? obj[key]() : obj[key];
1698
1699
  obj = val;
1699
1700
  }
1700
- return obj;
1701
+ return out(obj);
1701
1702
  };
1702
1703
  /**
1703
1704
  * Thiết lập giá trị cho một thuộc tính trong đối tượng theo đường dẫn chỉ định
@@ -2101,11 +2102,10 @@ const generateInterface = (obj, interfaceName) => {
2101
2102
  return interfaceStr;
2102
2103
  };
2103
2104
 
2104
- ;
2105
2105
  const step = 20;
2106
2106
  const percent = 0.05;
2107
2107
  const colorStepContrastFromOrigin = (color, stepNumber) => {
2108
- return colorContrastFromOrigin(color).find(item => item.step === stepNumber);
2108
+ return colorContrastFromOrigin(color).find((item) => item.step === stepNumber);
2109
2109
  };
2110
2110
  const colorContrastFromOrigin = (color) => {
2111
2111
  const parsedColorsArray = parseColorValues(color);
@@ -2140,10 +2140,10 @@ const parseColorValues = (colorValues) => {
2140
2140
  return colorValuesArray;
2141
2141
  };
2142
2142
  const calculateShades = (colorValue) => {
2143
- return calculate(colorValue, rgbShade).concat("000000");
2143
+ return calculate(colorValue, rgbShade).concat('000000');
2144
2144
  };
2145
2145
  const calculateTints = (colorValue) => {
2146
- return calculate(colorValue, rgbTint).concat("ffffff");
2146
+ return calculate(colorValue, rgbTint).concat('ffffff');
2147
2147
  };
2148
2148
  const calculate = (colorValue, shadeOrTint) => {
2149
2149
  const color = hexToRGB(colorValue);
@@ -2153,11 +2153,21 @@ const calculate = (colorValue, shadeOrTint) => {
2153
2153
  }
2154
2154
  return shadeValues;
2155
2155
  };
2156
- const rgbShade = (rgb, i) => { return { red: rgb.red * (1 - percent * i), green: rgb.green * (1 - percent * i), blue: rgb.blue * (1 - percent * i) }; };
2157
- const rgbTint = (rgb, i) => { return { red: rgb.red + (255 - rgb.red) * i * percent, green: rgb.green + (255 - rgb.green) * i * percent, blue: rgb.blue + (255 - rgb.blue) * i * percent }; };
2158
- const rgbToHex = (rgb) => { return intToHex(rgb.red) + intToHex(rgb.green) + intToHex(rgb.blue); };
2159
- const hexToRGB = (colorValue) => { return { red: parseInt(colorValue.substr(0, 2), 16), green: parseInt(colorValue.substr(2, 2), 16), blue: parseInt(colorValue.substr(4, 2), 16) }; };
2160
- const intToHex = (rgbint) => { return pad(Math.min(Math.max(Math.round(rgbint), 0), 255).toString(16), 2); };
2156
+ const rgbShade = (rgb, i) => {
2157
+ return { red: rgb.red * (1 - percent * i), green: rgb.green * (1 - percent * i), blue: rgb.blue * (1 - percent * i) };
2158
+ };
2159
+ const rgbTint = (rgb, i) => {
2160
+ return { red: rgb.red + (255 - rgb.red) * i * percent, green: rgb.green + (255 - rgb.green) * i * percent, blue: rgb.blue + (255 - rgb.blue) * i * percent };
2161
+ };
2162
+ const rgbToHex = (rgb) => {
2163
+ return intToHex(rgb.red) + intToHex(rgb.green) + intToHex(rgb.blue);
2164
+ };
2165
+ const hexToRGB = (colorValue) => {
2166
+ return { red: parseInt(colorValue.substr(0, 2), 16), green: parseInt(colorValue.substr(2, 2), 16), blue: parseInt(colorValue.substr(4, 2), 16) };
2167
+ };
2168
+ const intToHex = (rgbint) => {
2169
+ return pad(Math.min(Math.max(Math.round(rgbint), 0), 255).toString(16), 2);
2170
+ };
2161
2171
  const pad = (number, length) => {
2162
2172
  let str = '' + number;
2163
2173
  while (str.length < length) {
@@ -2165,9 +2175,52 @@ const pad = (number, length) => {
2165
2175
  }
2166
2176
  return str;
2167
2177
  };
2168
- const listColorDefine = ['#E62222', '#B81B1B', '#EB4E4E', '#F97316', '#C75C12', '#FA8F45', '#FFB700', '#CC9200', '#FFC533', '#84CC16', '#6AA312', '#9dd645', '#00BC62', '#00A757', '#33DA8A', '#06B6D4', '#1B59C4', '#4E8CF7', '#0EA5E9',
2169
- '#1B59C4', '#4E8CF7', '#226FF5', '#1B59C4', '#4E8CF7', '#6366F1', '#4F52C1', '#8285F4', '#5B04B3', '#49038F', '#7C36C2', '#D946EF', '#AE38BF', '#E16BF2', '#EC4899', '#BD3A7A', '#F06DAD', '#F43F5E', '#C3324B', '#F6657E', '#757380', '#5E5C66', '#918F99',
2170
- '#202020', '#1A1A1A', '#4D4D4D'
2178
+ const listColorDefine = [
2179
+ '#E62222',
2180
+ '#B81B1B',
2181
+ '#EB4E4E',
2182
+ '#F97316',
2183
+ '#C75C12',
2184
+ '#FA8F45',
2185
+ '#FFB700',
2186
+ '#CC9200',
2187
+ '#FFC533',
2188
+ '#84CC16',
2189
+ '#6AA312',
2190
+ '#9dd645',
2191
+ '#00BC62',
2192
+ '#00A757',
2193
+ '#33DA8A',
2194
+ '#06B6D4',
2195
+ '#1B59C4',
2196
+ '#4E8CF7',
2197
+ '#0EA5E9',
2198
+ '#1B59C4',
2199
+ '#4E8CF7',
2200
+ '#226FF5',
2201
+ '#1B59C4',
2202
+ '#4E8CF7',
2203
+ '#6366F1',
2204
+ '#4F52C1',
2205
+ '#8285F4',
2206
+ '#5B04B3',
2207
+ '#49038F',
2208
+ '#7C36C2',
2209
+ '#D946EF',
2210
+ '#AE38BF',
2211
+ '#E16BF2',
2212
+ '#EC4899',
2213
+ '#BD3A7A',
2214
+ '#F06DAD',
2215
+ '#F43F5E',
2216
+ '#C3324B',
2217
+ '#F6657E',
2218
+ '#757380',
2219
+ '#5E5C66',
2220
+ '#918F99',
2221
+ '#202020',
2222
+ '#1A1A1A',
2223
+ '#4D4D4D',
2171
2224
  ];
2172
2225
  const getColorById = (str) => {
2173
2226
  let hashString = 0;
@@ -2176,7 +2229,7 @@ const getColorById = (str) => {
2176
2229
  }
2177
2230
  for (let i = 0; i < str.length; i++) {
2178
2231
  const char = str.charCodeAt(i);
2179
- hashString = ((hashString << 5) - hashString) + char;
2232
+ hashString = (hashString << 5) - hashString + char;
2180
2233
  hashString = hashString & hashString;
2181
2234
  }
2182
2235
  return listColorDefine[Math.abs(hashString) % listColorDefine.length];
@@ -2316,8 +2369,8 @@ const getKeyCacheByArrayObject = (keyCache, argumentsValue) => {
2316
2369
  keyBuild = `${keyBuild}${JSON.stringify(item)}`;
2317
2370
  return;
2318
2371
  }
2319
- const keys = (item instanceof HttpParams ? item.keys() : Object.keys(item)).sort(((str1, str2) => str1.localeCompare(str2)));
2320
- keys.forEach(key => {
2372
+ const keys = (item instanceof HttpParams ? item.keys() : Object.keys(item)).sort((str1, str2) => str1.localeCompare(str2));
2373
+ keys.forEach((key) => {
2321
2374
  if (key.toLocaleLowerCase() === 'pem') {
2322
2375
  return;
2323
2376
  }
@@ -2361,7 +2414,7 @@ const viewDataNumberByLanguage = (value, acceptNegativeValue, parseFixed = 1, ig
2361
2414
  return Math.round(value * fixed) / fixed;
2362
2415
  };
2363
2416
  if (parseFixed > (floatStr?.length || 0)) {
2364
- const maxParseFixed = (acceptNegativeValue && +value < 0) ? 17 : 16;
2417
+ const maxParseFixed = acceptNegativeValue && +value < 0 ? 17 : 16;
2365
2418
  const fixed = maxParseFixed - (intStr?.length || 0);
2366
2419
  parseFixed = parseFixed < fixed ? parseFixed : fixed;
2367
2420
  }
@@ -2388,7 +2441,10 @@ const viewDataNumberByLanguage = (value, acceptNegativeValue, parseFixed = 1, ig
2388
2441
  if (lang === UtilsLanguageConstants.EN) {
2389
2442
  return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
2390
2443
  }
2391
- return value.toString().replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, '.');
2444
+ return value
2445
+ .toString()
2446
+ .replace('.', ',')
2447
+ .replace(/\B(?=(\d{3})+(?!\d))/g, '.');
2392
2448
  }
2393
2449
  };
2394
2450
 
@@ -2430,12 +2486,12 @@ const convertObjectToSignal = (data, cloneDeepIfNotSignal = true, isSignalPrimit
2430
2486
  return seen.get(data);
2431
2487
  }
2432
2488
  if (Array.isArray(data)) {
2433
- seen.set(data, signal(data.map(item => convertObjectToSignal(item, cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal, seen))));
2489
+ seen.set(data, signal(data.map((item) => convertObjectToSignal(item, cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal, seen))));
2434
2490
  return seen.get(data);
2435
2491
  }
2436
2492
  if (data instanceof Map) {
2437
2493
  const mapCopy = new Map();
2438
- Array.from(data.keys()).forEach(key => {
2494
+ Array.from(data.keys()).forEach((key) => {
2439
2495
  mapCopy.set(key, convertObjectToSignal(data.get(key), cloneDeepIfNotSignal, isSignalPrimitiveType, acceptConvertObjectInnerWritableSignal));
2440
2496
  });
2441
2497
  seen.set(data, signal(mapCopy));
@@ -2448,7 +2504,19 @@ const convertObjectToSignal = (data, cloneDeepIfNotSignal = true, isSignalPrimit
2448
2504
  seen.set(data, data);
2449
2505
  for (const key in data()) {
2450
2506
  const value = data()[key];
2451
- if (value instanceof TemplateRef || value instanceof File || value instanceof Blob || Object.prototype.toString.call(value) === '[object File]' || value instanceof ElementRef || value instanceof Element || value instanceof Date || value instanceof RegExp || value instanceof Set || value instanceof Map || value instanceof Promise || value instanceof Observable || value instanceof HttpParams) {
2507
+ if (value instanceof TemplateRef ||
2508
+ value instanceof File ||
2509
+ value instanceof Blob ||
2510
+ Object.prototype.toString.call(value) === '[object File]' ||
2511
+ value instanceof ElementRef ||
2512
+ value instanceof Element ||
2513
+ value instanceof Date ||
2514
+ value instanceof RegExp ||
2515
+ value instanceof Set ||
2516
+ value instanceof Map ||
2517
+ value instanceof Promise ||
2518
+ value instanceof Observable ||
2519
+ value instanceof HttpParams) {
2452
2520
  continue;
2453
2521
  }
2454
2522
  if (Object.prototype.hasOwnProperty.call(data(), key)) {
@@ -2483,12 +2551,12 @@ const convertSignalToObject = (data, isCloneDeep = true, seen = new WeakMap()) =
2483
2551
  if (!isSignal(data[0])) {
2484
2552
  return data;
2485
2553
  }
2486
- seen.set(data, data.map(item => convertSignalToObject((isCloneDeep ? cloneDeep(item) : item), isCloneDeep, seen)));
2554
+ seen.set(data, data.map((item) => convertSignalToObject(isCloneDeep ? cloneDeep(item) : item, isCloneDeep, seen)));
2487
2555
  return seen.get(data);
2488
2556
  }
2489
2557
  if (data instanceof Map) {
2490
2558
  const mapCopy = new Map();
2491
- Array.from(data.keys()).forEach(key => {
2559
+ Array.from(data.keys()).forEach((key) => {
2492
2560
  mapCopy.set(key, convertSignalToObject(isCloneDeep ? cloneDeep(data.get(key)) : data.get(key), isCloneDeep));
2493
2561
  });
2494
2562
  seen.set(data, mapCopy);
@@ -2513,9 +2581,12 @@ const convertSignalToObject = (data, isCloneDeep = true, seen = new WeakMap()) =
2513
2581
 
2514
2582
  const ENCODE_URI_PATTERN = /%([0-9A-F]{2})/g;
2515
2583
  const decodeURI = (value) => {
2516
- return decodeURIComponent(value.split('').map((c) => {
2584
+ return decodeURIComponent(value
2585
+ .split('')
2586
+ .map((c) => {
2517
2587
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
2518
- }).join(''));
2588
+ })
2589
+ .join(''));
2519
2590
  };
2520
2591
  const encodeURI = (value) => {
2521
2592
  return encodeURIComponent(value).replace(ENCODE_URI_PATTERN, (match, p1) => {
@@ -2523,7 +2594,7 @@ const encodeURI = (value) => {
2523
2594
  });
2524
2595
  };
2525
2596
  const endCodeUrl = (params, isBody) => {
2526
- params = omitBy(params, param => param === '' || isNil(param));
2597
+ params = omitBy(params, (param) => param === '' || isNil(param));
2527
2598
  let res = '';
2528
2599
  for (const p in params) {
2529
2600
  res += `&${p}=${encodeURIComponent(params[p])}`;
@@ -2601,7 +2672,7 @@ const downloadFileByUrl = async (fileUrl, filename, onlyOpen) => {
2601
2672
  const downloadImageFromELement = (imageElement, typeFileDownload, nameFile) => {
2602
2673
  const parentElement = imageElement?.src;
2603
2674
  const blobData = convertBase64ToBlob(parentElement);
2604
- const blob = new Blob([blobData], { type: typeFileDownload || "image/png" });
2675
+ const blob = new Blob([blobData], { type: typeFileDownload || 'image/png' });
2605
2676
  const url = window.URL.createObjectURL(blob);
2606
2677
  const link = document.createElement('a');
2607
2678
  link.href = url;
@@ -2613,12 +2684,22 @@ const LINK_IMAGE_ERROR_TOKEN_INJECT = new InjectionToken('LINK_IMAGE_ERROR_TOKEN
2613
2684
  const PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT = new InjectionToken('PROCESS_BAR_STANDARD_CONFIG_DEFAULT_TOKEN_INJECT');
2614
2685
  const PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT = new InjectionToken('PROCESS_BAR_STEPS_CONFIG_DEFAULT_TOKEN_INJECT');
2615
2686
 
2616
- const isTypeImage = (file) => file.type.match(/image.*/) ? true : false;
2617
- const isTypeVideo = (file) => file.type.match(/video.*/) ? true : false;
2618
- const isTypeAudio = (file) => file.type.match(/audio.*/) ? true : false;
2619
- const isTypeFile = (file) => file instanceof File || Object.prototype.toString.call(file) === '[object File]' ? true : false;
2687
+ const isTypeImage = (file) => (file.type.match(/image.*/) ? true : false);
2688
+ const isTypeVideo = (file) => (file.type.match(/video.*/) ? true : false);
2689
+ const isTypeAudio = (file) => (file.type.match(/audio.*/) ? true : false);
2690
+ const isTypeFile = (file) => (file instanceof File || Object.prototype.toString.call(file) === '[object File]' ? true : false);
2620
2691
  const ExcelExtList = ['xls', 'xlsx', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
2621
- const DocumentExtList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'json', 'xml', 'application/msword',
2692
+ const DocumentExtList = [
2693
+ 'doc',
2694
+ 'docx',
2695
+ 'xls',
2696
+ 'xlsx',
2697
+ 'ppt',
2698
+ 'pptx',
2699
+ 'pdf',
2700
+ 'json',
2701
+ 'xml',
2702
+ 'application/msword',
2622
2703
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
2623
2704
  'application/vnd.ms-excel',
2624
2705
  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
@@ -2626,7 +2707,8 @@ const DocumentExtList = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'js
2626
2707
  'application/vnd.openxmlformats-officedocument.presentationml.presentation',
2627
2708
  'application/pdf',
2628
2709
  'application/json',
2629
- 'application/xml'];
2710
+ 'application/xml',
2711
+ ];
2630
2712
  const isIncludeDocumentExtList = (ext, listExt = DocumentExtList) => listExt.includes(ext) || listExt.includes(`application/${ext}`);
2631
2713
  const ImageExtList = ['gif', 'jpg', 'jpeg', 'png', 'image/gif', 'image/jpeg', 'image/jpeg', 'image/png'];
2632
2714
  const isIncludeImageExtList = (ext, listExt = ImageExtList) => listExt.includes(ext);
@@ -2651,7 +2733,7 @@ const getFileExtension = (file) => {
2651
2733
  fileName = url.split('/').pop() || '';
2652
2734
  set(file, 'name', fileName);
2653
2735
  }
2654
- const dots = fileName.split(".");
2736
+ const dots = fileName.split('.');
2655
2737
  if (!dots) {
2656
2738
  return;
2657
2739
  }
@@ -2755,12 +2837,12 @@ const getSmartAxisScale = (originalMaxData, options) => {
2755
2837
  }
2756
2838
  const maxValuePositive = maxValue - Math.abs(minValue);
2757
2839
  tickCount = maxValuePositive - originalMaxData > Math.abs(step) && tickCount - 1 >= minTickCount ? tickCount - 1 : tickCount;
2758
- maxValue = (step * tickCount * scaleDirection) - (minValue * scaleDirection);
2840
+ maxValue = step * tickCount * scaleDirection - minValue * scaleDirection;
2759
2841
  return {
2760
2842
  stepSize: Math.abs(step),
2761
2843
  max: maxValue,
2762
2844
  min: minValue,
2763
- tickAmount: tickCount
2845
+ tickAmount: tickCount,
2764
2846
  };
2765
2847
  }
2766
2848
  }
@@ -2775,7 +2857,7 @@ const getSmartAxisScale = (originalMaxData, options) => {
2775
2857
  stepSize: Math.abs(step),
2776
2858
  max: maxValue,
2777
2859
  min: 0,
2778
- tickAmount: minTickCount
2860
+ tickAmount: minTickCount,
2779
2861
  };
2780
2862
  };
2781
2863
  // Cache cho các giá trị lũy thừa 10 để tối ưu hiệu suất
@@ -2831,7 +2913,7 @@ const getStepCandidates = (maxData, minStep, minNegative, acceptStepIsTypeFloat
2831
2913
  const checkAndSetNegativeSteps = (stepCandidates, acceptNegative, minNegative) => {
2832
2914
  if (acceptNegative && minNegative < 0) {
2833
2915
  // Tạo các step âm và thêm vào đầu danh sách
2834
- const negativeSteps = [...stepCandidates].map(step => -step);
2916
+ const negativeSteps = [...stepCandidates].map((step) => -step);
2835
2917
  stepCandidates.unshift(...negativeSteps);
2836
2918
  }
2837
2919
  };
@@ -2844,20 +2926,20 @@ const checkAndSetNegativeSteps = (stepCandidates, acceptNegative, minNegative) =
2844
2926
  const validateInputs = (maxData, options) => {
2845
2927
  // Kiểm tra maxData âm khi không chấp nhận giá trị âm
2846
2928
  if (maxData < 0 && !options?.acceptNegative) {
2847
- throw new Error("maxData is less than 0 and acceptNegative is false");
2929
+ throw new Error('maxData is less than 0 and acceptNegative is false');
2848
2930
  }
2849
2931
  if (options?.acceptNegative) {
2850
2932
  // Kiểm tra minNegative có được cung cấp không
2851
2933
  if (isNil(options.minNegative)) {
2852
- throw new Error("minNegative is required when acceptNegative is true");
2934
+ throw new Error('minNegative is required when acceptNegative is true');
2853
2935
  }
2854
2936
  // Kiểm tra maxData phải >= minNegative
2855
2937
  if (maxData < options.minNegative) {
2856
- throw new Error("maxData is less than minNegative");
2938
+ throw new Error('maxData is less than minNegative');
2857
2939
  }
2858
2940
  // Kiểm tra minNegative phải là số âm
2859
2941
  if (options.minNegative >= 0) {
2860
- throw new Error("minNegative must be negative");
2942
+ throw new Error('minNegative must be negative');
2861
2943
  }
2862
2944
  }
2863
2945
  };
@@ -2877,7 +2959,7 @@ const revealString = (encoded) => {
2877
2959
  const decoded = base
2878
2960
  .split('')
2879
2961
  .reverse()
2880
- .map(c => String.fromCharCode(c.charCodeAt(0) ^ xorKey))
2962
+ .map((c) => String.fromCharCode(c.charCodeAt(0) ^ xorKey))
2881
2963
  .join('');
2882
2964
  return decoded;
2883
2965
  };