@rzl-zone/utils-js 3.13.1-beta.0 → 3.14.0-beta.0

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 (281) hide show
  1. package/README.md +7 -6
  2. package/dist/.references/index.d.cts +2 -1
  3. package/dist/.references/index.d.ts +2 -1
  4. package/dist/AbortError-DK6kpzbu.cjs +26 -0
  5. package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
  6. package/dist/AbortError-DVT8lAKn.js +20 -0
  7. package/dist/AbortError-DVT8lAKn.js.map +1 -0
  8. package/dist/{assertIsArray-DrLORH0Y.js → assertIsArray-CG7L7vlt.js} +3 -3
  9. package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
  10. package/dist/{assertIsArray-CqIFmlgj.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
  11. package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
  12. package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
  13. package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
  14. package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
  15. package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
  16. package/dist/{assertIsString-1iLqxrN0.js → assertIsString-CHIwE12y.js} +4 -4
  17. package/dist/assertIsString-CHIwE12y.js.map +1 -0
  18. package/dist/{assertIsString-DGDLC-XD.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
  19. package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
  20. package/dist/assertions/index.cjs +14 -12
  21. package/dist/assertions/index.cjs.map +1 -1
  22. package/dist/assertions/index.d.cts +2 -2
  23. package/dist/assertions/index.d.ts +2 -2
  24. package/dist/assertions/index.js +10 -8
  25. package/dist/assertions/index.js.map +1 -1
  26. package/dist/conversions/index.cjs +6 -6
  27. package/dist/conversions/index.d.cts +2 -2
  28. package/dist/conversions/index.d.ts +2 -2
  29. package/dist/conversions/index.js +6 -6
  30. package/dist/conversions-BFz6MKaV.cjs +449 -0
  31. package/dist/conversions-BFz6MKaV.cjs.map +1 -0
  32. package/dist/{conversions-CA_3PTAH.js → conversions-Ben5p5Ts.js} +43 -40
  33. package/dist/conversions-Ben5p5Ts.js.map +1 -0
  34. package/dist/errors/index.cjs +13 -0
  35. package/dist/errors/index.d.cts +180 -0
  36. package/dist/errors/index.d.ts +180 -0
  37. package/dist/errors/index.js +11 -0
  38. package/dist/events/index.cjs +10 -9
  39. package/dist/events/index.cjs.map +1 -1
  40. package/dist/events/index.d.cts +185 -100
  41. package/dist/events/index.d.ts +185 -100
  42. package/dist/events/index.js +9 -8
  43. package/dist/events/index.js.map +1 -1
  44. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
  45. package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
  46. package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
  47. package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
  48. package/dist/formatters/index.cjs +2 -2
  49. package/dist/formatters/index.d.cts +2 -2
  50. package/dist/formatters/index.d.ts +2 -2
  51. package/dist/formatters/index.js +2 -2
  52. package/dist/{formatters-Bm3a_akj.js → formatters-BAbGsnYA.js} +78 -71
  53. package/dist/formatters-BAbGsnYA.js.map +1 -0
  54. package/dist/formatters-zd0Gs4Cs.cjs +436 -0
  55. package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
  56. package/dist/generators/index.cjs +37 -31
  57. package/dist/generators/index.cjs.map +1 -1
  58. package/dist/generators/index.d.cts +2 -2
  59. package/dist/generators/index.d.ts +2 -2
  60. package/dist/generators/index.js +29 -23
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/hasOwnProp-CVIhlD1i.js +47 -0
  63. package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
  64. package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
  65. package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
  66. package/dist/{index-CakviK5E.d.cts → index-9JsU_wMu.d.ts} +1375 -937
  67. package/dist/{index-BqkYm8qT.d.ts → index-BP3sUrAx.d.ts} +242 -133
  68. package/dist/{index-CJx0EFQ4.d.cts → index-BVovC-yK.d.cts} +229 -200
  69. package/dist/index-C1X6ha9s.d.cts +1041 -0
  70. package/dist/index-CcPQZ41G.d.cts +1103 -0
  71. package/dist/index-CjpbuJF4.d.ts +2424 -0
  72. package/dist/index-CssrQyHh.d.cts +2424 -0
  73. package/dist/index-DZHiYYR7.d.cts +2179 -0
  74. package/dist/index-DZHiYYR7.d.ts +2179 -0
  75. package/dist/index-DlyDmXUo.d.ts +1103 -0
  76. package/dist/index-Dm4a___O.d.ts +1041 -0
  77. package/dist/{index-D5nTp1kV.d.ts → index-Dwduk7ez.d.cts} +1375 -937
  78. package/dist/{index-uaHl0X-r.d.cts → index-I5V6RbZM.d.cts} +1592 -790
  79. package/dist/{index-Bm5odgLW.d.ts → index-hOqBIL7F.d.ts} +1592 -790
  80. package/dist/{index-hOCUw-B9.d.ts → index-jyuOZMX7.d.ts} +229 -200
  81. package/dist/{index-BqkYm8qT.d.cts → index-lI0b7iUz.d.cts} +242 -133
  82. package/dist/{isBigInt-f6yY2fAV.js → isBigInt-Cez32M69.js} +2 -2
  83. package/dist/isBigInt-Cez32M69.js.map +1 -0
  84. package/dist/{isBigInt-CqZNWVtI.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
  85. package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
  86. package/dist/{isEmptyString-Ga77_3Q1.js → isEmptyString-C9QLWjx2.js} +4 -4
  87. package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
  88. package/dist/{isEmptyString-DNMPmS-H.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
  89. package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
  90. package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
  91. package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
  92. package/dist/isEmptyValue-kCjnLjbN.js +36 -0
  93. package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
  94. package/dist/{isFinite-Crw95XV8.cjs → isFinite-B_hHbDpa.cjs} +6 -6
  95. package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
  96. package/dist/{isFinite-BJO7Dt6B.js → isFinite-ZvNhyHlF.js} +5 -5
  97. package/dist/isFinite-ZvNhyHlF.js.map +1 -0
  98. package/dist/{isInteger-B75voxys.js → isInteger-aZgzTTZG.js} +4 -4
  99. package/dist/isInteger-aZgzTTZG.js.map +1 -0
  100. package/dist/{isInteger-CSMNm--9.cjs → isInteger-dnc6W63Z.cjs} +4 -4
  101. package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
  102. package/dist/isNumber-BCWD4dW0.js +20 -0
  103. package/dist/isNumber-BCWD4dW0.js.map +1 -0
  104. package/dist/isNumber-BkzwAe50.cjs +26 -0
  105. package/dist/isNumber-BkzwAe50.cjs.map +1 -0
  106. package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
  107. package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
  108. package/dist/{isServer-BHOSvBhV.js → isServer-CQzrX5e0.js} +2 -2
  109. package/dist/isServer-CQzrX5e0.js.map +1 -0
  110. package/dist/{isServer-HA13Dzo2.cjs → isServer-DhFaedeT.cjs} +2 -2
  111. package/dist/isServer-DhFaedeT.cjs.map +1 -0
  112. package/dist/{isEqual-D8W3Wizi.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
  113. package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
  114. package/dist/{isEqual-ekId-j5b.js → isTypedArray-DxsPKrLh.js} +29 -9
  115. package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
  116. package/dist/{isValidDomain-BqyLVi7S.js → isValidDomain-CDtNOhMc.js} +13 -54
  117. package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
  118. package/dist/{isValidDomain-ByrOfQsh.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
  119. package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
  120. package/dist/{assertIsBoolean-DDhQ2D-k.js → logger-CLWnKRKE.js} +657 -587
  121. package/dist/logger-CLWnKRKE.js.map +1 -0
  122. package/dist/{assertIsBoolean-CEx4KbHg.cjs → logger-CUacYy3D.cjs} +658 -612
  123. package/dist/logger-CUacYy3D.cjs.map +1 -0
  124. package/dist/{noop-CkwxErJ2.cjs → noop-CjEbNsJL.cjs} +2 -2
  125. package/dist/noop-CjEbNsJL.cjs.map +1 -0
  126. package/dist/{noop-D_Ots__Z.js → noop-qxrcogt5.js} +2 -2
  127. package/dist/noop-qxrcogt5.js.map +1 -0
  128. package/dist/{normalizeSpaces-88yaixiu.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
  129. package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
  130. package/dist/{normalizeSpaces-Cat8CHtt.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
  131. package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
  132. package/dist/operations/index.cjs +152 -22
  133. package/dist/operations/index.cjs.map +1 -1
  134. package/dist/operations/index.d.cts +257 -35
  135. package/dist/operations/index.d.ts +257 -35
  136. package/dist/operations/index.js +142 -13
  137. package/dist/operations/index.js.map +1 -1
  138. package/dist/parsers/index.cjs +2 -2
  139. package/dist/parsers/index.d.cts +238 -180
  140. package/dist/parsers/index.d.ts +238 -180
  141. package/dist/parsers/index.js +2 -2
  142. package/dist/{parsers-BLHzVoh-.js → parsers-BBAE_xVM.js} +9 -8
  143. package/dist/parsers-BBAE_xVM.js.map +1 -0
  144. package/dist/{parsers-xAQmKCgS.cjs → parsers-i8WEeMJl.cjs} +10 -9
  145. package/dist/parsers-i8WEeMJl.cjs.map +1 -0
  146. package/dist/{parsing-BYo6U0EG.js → parsing-D9tbKQ0v.js} +3 -3
  147. package/dist/parsing-D9tbKQ0v.js.map +1 -0
  148. package/dist/{parsing-CuezVd0e.cjs → parsing-DGjB8cwr.cjs} +4 -4
  149. package/dist/parsing-DGjB8cwr.cjs.map +1 -0
  150. package/dist/predicates/index.cjs +43 -43
  151. package/dist/predicates/index.d.cts +3 -3
  152. package/dist/predicates/index.d.ts +3 -3
  153. package/dist/predicates/index.js +14 -14
  154. package/dist/{predicates-BMTIIYx8.js → predicates-C0dova7l.js} +45 -40
  155. package/dist/predicates-C0dova7l.js.map +1 -0
  156. package/dist/{predicates-ZmZpelMh.cjs → predicates-Dd7To7B4.cjs} +89 -84
  157. package/dist/predicates-Dd7To7B4.cjs.map +1 -0
  158. package/dist/promises/index.cjs +27 -26
  159. package/dist/promises/index.cjs.map +1 -1
  160. package/dist/promises/index.d.cts +227 -75
  161. package/dist/promises/index.d.ts +227 -75
  162. package/dist/promises/index.js +27 -26
  163. package/dist/promises/index.js.map +1 -1
  164. package/dist/{punyCode-WZ6-GaTM.cjs → punyCode-DHTLhGdD.cjs} +12 -12
  165. package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
  166. package/dist/{punyCode-COTqgXMJ.js → punyCode-Deb1Mrkc.js} +12 -12
  167. package/dist/punyCode-Deb1Mrkc.js.map +1 -0
  168. package/dist/{removeSpaces-CQJvw1yU.js → removeSpaces-BPnsdRN0.js} +4 -4
  169. package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
  170. package/dist/{removeSpaces-BeGkktUl.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
  171. package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +13 -13
  173. package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
  174. package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
  175. package/dist/{safeJsonParse-D8H3wCv7.js → safeJsonParse-DEVKNDSn.js} +29 -28
  176. package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
  177. package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
  178. package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
  179. package/dist/{safeStableStringify-BLwA1VC-.js → safeStableStringify-DfwxmiWn.js} +20 -13
  180. package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
  181. package/dist/strings/index.cjs +26 -30
  182. package/dist/strings/index.cjs.map +1 -1
  183. package/dist/strings/index.d.cts +2 -2
  184. package/dist/strings/index.d.ts +2 -2
  185. package/dist/strings/index.js +13 -17
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +3 -3
  188. package/dist/tailwind/index.d.cts +3 -3
  189. package/dist/tailwind/index.d.ts +3 -3
  190. package/dist/tailwind/index.js +3 -3
  191. package/dist/{tailwind-CjxdO7aL.cjs → tailwind-BG7B0cDs.cjs} +59 -53
  192. package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
  193. package/dist/{tailwind-RSE3obLb.js → tailwind-tJNnFPsF.js} +38 -32
  194. package/dist/tailwind-tJNnFPsF.js.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-NreW1dyV.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
  196. package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
  197. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
  198. package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
  199. package/dist/urls/index.cjs +3 -3
  200. package/dist/urls/index.d.cts +635 -443
  201. package/dist/urls/index.d.ts +635 -443
  202. package/dist/urls/index.js +3 -3
  203. package/dist/{urls-CLVfEB7O.js → urls-EoWslGgg.js} +50 -41
  204. package/dist/urls-EoWslGgg.js.map +1 -0
  205. package/dist/urls-NCzPepe2.cjs +308 -0
  206. package/dist/urls-NCzPepe2.cjs.map +1 -0
  207. package/package.json +6 -6
  208. package/dist/assertIsArray-CqIFmlgj.cjs.map +0 -1
  209. package/dist/assertIsArray-DrLORH0Y.js.map +0 -1
  210. package/dist/assertIsBoolean-CEx4KbHg.cjs.map +0 -1
  211. package/dist/assertIsBoolean-DDhQ2D-k.js.map +0 -1
  212. package/dist/assertIsString-1iLqxrN0.js.map +0 -1
  213. package/dist/assertIsString-DGDLC-XD.cjs.map +0 -1
  214. package/dist/conversions-Bxa01uIl.cjs +0 -446
  215. package/dist/conversions-Bxa01uIl.cjs.map +0 -1
  216. package/dist/conversions-CA_3PTAH.js.map +0 -1
  217. package/dist/formatters-Bm3a_akj.js.map +0 -1
  218. package/dist/formatters-Bt6QuhxK.cjs +0 -429
  219. package/dist/formatters-Bt6QuhxK.cjs.map +0 -1
  220. package/dist/index--h04HuBE.d.cts +0 -765
  221. package/dist/index--h04HuBE.d.ts +0 -765
  222. package/dist/index-Ap8U-8Qx.d.cts +0 -947
  223. package/dist/index-BAeeggeh.d.cts +0 -1716
  224. package/dist/index-BAeeggeh.d.ts +0 -1716
  225. package/dist/index-CMglhpFG.d.ts +0 -947
  226. package/dist/isBigInt-CqZNWVtI.cjs.map +0 -1
  227. package/dist/isBigInt-f6yY2fAV.js.map +0 -1
  228. package/dist/isEmptyObject-BYNnSKzw.js +0 -25
  229. package/dist/isEmptyObject-BYNnSKzw.js.map +0 -1
  230. package/dist/isEmptyObject-C2lQyFZS.cjs +0 -37
  231. package/dist/isEmptyObject-C2lQyFZS.cjs.map +0 -1
  232. package/dist/isEmptyString-DNMPmS-H.cjs.map +0 -1
  233. package/dist/isEmptyString-Ga77_3Q1.js.map +0 -1
  234. package/dist/isEmptyValue-D7-6WWS9.js +0 -24
  235. package/dist/isEmptyValue-D7-6WWS9.js.map +0 -1
  236. package/dist/isEmptyValue-DZaDHEIw.cjs +0 -30
  237. package/dist/isEmptyValue-DZaDHEIw.cjs.map +0 -1
  238. package/dist/isEqual-D8W3Wizi.cjs.map +0 -1
  239. package/dist/isEqual-ekId-j5b.js.map +0 -1
  240. package/dist/isFinite-BJO7Dt6B.js.map +0 -1
  241. package/dist/isFinite-Crw95XV8.cjs.map +0 -1
  242. package/dist/isInteger-B75voxys.js.map +0 -1
  243. package/dist/isInteger-CSMNm--9.cjs.map +0 -1
  244. package/dist/isPlainObject-ByfuseCf.d.cts +0 -339
  245. package/dist/isPlainObject-ByfuseCf.d.ts +0 -339
  246. package/dist/isServer-BHOSvBhV.js.map +0 -1
  247. package/dist/isServer-HA13Dzo2.cjs.map +0 -1
  248. package/dist/isTypedArray-CWlHRz_O.cjs +0 -43
  249. package/dist/isTypedArray-CWlHRz_O.cjs.map +0 -1
  250. package/dist/isTypedArray-CmnQ7Yx9.js +0 -31
  251. package/dist/isTypedArray-CmnQ7Yx9.js.map +0 -1
  252. package/dist/isValidDomain-BqyLVi7S.js.map +0 -1
  253. package/dist/isValidDomain-ByrOfQsh.cjs.map +0 -1
  254. package/dist/noop-CkwxErJ2.cjs.map +0 -1
  255. package/dist/noop-D_Ots__Z.js.map +0 -1
  256. package/dist/normalizeSpaces-88yaixiu.cjs.map +0 -1
  257. package/dist/normalizeSpaces-Cat8CHtt.js.map +0 -1
  258. package/dist/parsers-BLHzVoh-.js.map +0 -1
  259. package/dist/parsers-xAQmKCgS.cjs.map +0 -1
  260. package/dist/parsing-BYo6U0EG.js.map +0 -1
  261. package/dist/parsing-CuezVd0e.cjs.map +0 -1
  262. package/dist/predicates-BMTIIYx8.js.map +0 -1
  263. package/dist/predicates-ZmZpelMh.cjs.map +0 -1
  264. package/dist/punyCode-COTqgXMJ.js.map +0 -1
  265. package/dist/punyCode-WZ6-GaTM.cjs.map +0 -1
  266. package/dist/removeSpaces-BeGkktUl.cjs.map +0 -1
  267. package/dist/removeSpaces-CQJvw1yU.js.map +0 -1
  268. package/dist/safeJsonParse-BznDD3fi.cjs +0 -208
  269. package/dist/safeJsonParse-BznDD3fi.cjs.map +0 -1
  270. package/dist/safeJsonParse-D8H3wCv7.js.map +0 -1
  271. package/dist/safeStableStringify-4b-E_UHM.cjs +0 -106
  272. package/dist/safeStableStringify-4b-E_UHM.cjs.map +0 -1
  273. package/dist/safeStableStringify-BLwA1VC-.js.map +0 -1
  274. package/dist/tailwind-CjxdO7aL.cjs.map +0 -1
  275. package/dist/tailwind-RSE3obLb.js.map +0 -1
  276. package/dist/toStringArrayUnRecursive-D-jHROts.cjs +0 -51
  277. package/dist/toStringArrayUnRecursive-D-jHROts.cjs.map +0 -1
  278. package/dist/toStringArrayUnRecursive-NreW1dyV.js.map +0 -1
  279. package/dist/urls-C6BvhrrV.cjs +0 -299
  280. package/dist/urls-C6BvhrrV.cjs.map +0 -1
  281. package/dist/urls-CLVfEB7O.js.map +0 -1
@@ -0,0 +1,436 @@
1
+ /*!
2
+ * ========================================================================
3
+ * @rzl-zone/utils-js
4
+ * ------------------------------------------------------------------------
5
+ * Version: `3.14.0-beta.0`
6
+ * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
+ * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
+ * ========================================================================
9
+ */
10
+ "use strict";
11
+ const require_logger = require('./logger-CUacYy3D.cjs');
12
+ const require_isNumber = require('./isNumber-BkzwAe50.cjs');
13
+ const require_assertIsString = require('./assertIsString-CjE9kbQ_.cjs');
14
+ const require_isFinite = require('./isFinite-B_hHbDpa.cjs');
15
+ const require_safeStableStringify = require('./safeStableStringify-C5HHKUdn.cjs');
16
+ const require_isEmptyString = require('./isEmptyString-O4TFe1Ao.cjs');
17
+ const require_parsing = require('./parsing-DGjB8cwr.cjs');
18
+ const require_hasOwnProp = require('./hasOwnProp-D9Tpgokd.cjs');
19
+ const require_isInteger = require('./isInteger-dnc6W63Z.cjs');
20
+ const require_normalizeSpaces = require('./normalizeSpaces-D0_Z4qnO.cjs');
21
+ let libphonenumber_js_max = require("libphonenumber-js/max");
22
+ let date_fns_locale = require("date-fns/locale");
23
+ let date_fns = require("date-fns");
24
+ const formatIndianNumber = ({ numStr, separator }) => {
25
+ const lastThree = numStr?.slice(-3);
26
+ const rest = numStr?.slice(0, -3);
27
+ if (!rest) return lastThree;
28
+ return rest.replace(/\B(?=(\d{2})+(?!\d))/g, separator) + separator + lastThree;
29
+ };
30
+ const formatCurrency = (value, options) => {
31
+ if (!require_logger.isString(value) && !require_isFinite.isFinite(value)) throw new TypeError(errorMsg$4(`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${require_logger.getPreciseType(value)}\`, with value: \`${require_safeStableStringify.safeStableStringify(value, { keepUndefined: true })}\`.`));
32
+ if (!require_logger.isPlainObject(options)) options = {};
33
+ const decimal = options.decimal ?? false;
34
+ const totalDecimal = options.totalDecimal ?? 2;
35
+ const endDecimal = options.endDecimal ?? true;
36
+ const indianFormat = options.indianFormat ?? false;
37
+ const suffixCurrency = options.suffixCurrency ?? "";
38
+ const suffixDecimal = options.suffixDecimal ?? "";
39
+ const roundedDecimal = options.roundedDecimal ?? "round";
40
+ const negativeFormat = options.negativeFormat ?? "dash";
41
+ let separatorDecimals = options.separatorDecimals ?? ",";
42
+ let separator = options.separator ?? ".";
43
+ if (!require_logger.isString(separator) || !require_logger.isString(separatorDecimals) || !require_logger.isString(suffixCurrency) || !require_logger.isString(suffixDecimal)) throw new TypeError(errorMsg$4(`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${require_logger.getPreciseType(separator)}\`, 'separatorDecimals': \`${require_logger.getPreciseType(separatorDecimals)}\`, 'suffixCurrency': \`${require_logger.getPreciseType(suffixCurrency)}\`, 'suffixDecimal': \`${require_logger.getPreciseType(suffixDecimal)}\`].`));
44
+ if (!require_logger.isBoolean(decimal) || !require_logger.isBoolean(endDecimal) || !require_logger.isBoolean(indianFormat)) throw new TypeError(errorMsg$4(`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${require_logger.getPreciseType(decimal)}\`, 'endDecimal': \`${require_logger.getPreciseType(endDecimal)}\`, 'indianFormat': \`${require_logger.getPreciseType(indianFormat)}\`].`));
45
+ if (!require_isInteger.isInteger(totalDecimal)) throw new TypeError(errorMsg$4(`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${require_logger.getPreciseType(totalDecimal)}\`, with value: \`${require_safeStableStringify.safeStableStringify(length, { keepUndefined: true })}\`.`));
46
+ if (!(roundedDecimal === false || roundedDecimal === "round" || roundedDecimal === "ceil" || roundedDecimal === "floor")) throw new TypeError(errorMsg$4(`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${require_logger.getPreciseType(roundedDecimal)}\`, with value: \`${require_safeStableStringify.safeStableStringify(roundedDecimal, { keepUndefined: true })}\`.`));
47
+ if (!(negativeFormat === "abs" || negativeFormat === "brackets" || negativeFormat === "dash" || require_logger.isPlainObject(negativeFormat))) throw new TypeError(errorMsg$4(`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${require_logger.getPreciseType(negativeFormat)}\`, with value: \`${require_safeStableStringify.safeStableStringify(negativeFormat, { keepUndefined: true })}\`.`));
48
+ const rawNum = require_logger.isString(value) ? require_parsing.parseCurrencyString(value) : value;
49
+ if (require_logger.isNaN(rawNum)) throw new TypeError("First parameter (`value`) could not be parsed into a valid `number`.");
50
+ let integerPart;
51
+ let decimalPartRaw;
52
+ let num = Math.abs(rawNum);
53
+ const factor = Math.pow(10, totalDecimal);
54
+ if (roundedDecimal) {
55
+ const scaled = num * factor;
56
+ switch (roundedDecimal) {
57
+ case "round":
58
+ num = Math.round(scaled) / factor;
59
+ break;
60
+ case "ceil":
61
+ num = Math.ceil(scaled) / factor;
62
+ break;
63
+ case "floor":
64
+ num = Math.floor(scaled) / factor;
65
+ break;
66
+ }
67
+ }
68
+ if (roundedDecimal) {
69
+ [integerPart, decimalPartRaw] = num.toFixed(totalDecimal).split(".");
70
+ decimalPartRaw = decimalPartRaw ?? "".padEnd(totalDecimal, "0");
71
+ } else {
72
+ const split = String(num).split(".");
73
+ integerPart = split[0];
74
+ decimalPartRaw = (split[1] || "").slice(0, totalDecimal).padEnd(totalDecimal, "0");
75
+ }
76
+ let formattedInteger;
77
+ if (indianFormat) {
78
+ separator = ",";
79
+ separatorDecimals = ".";
80
+ formattedInteger = (suffixCurrency.trim().length ? suffixCurrency : "") + formatIndianNumber({
81
+ numStr: integerPart,
82
+ separator
83
+ });
84
+ } else formattedInteger = (suffixCurrency.trim().length ? suffixCurrency : "") + integerPart?.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
85
+ if (decimal && !require_safeStableStringify.isUndefined(decimalPartRaw) && totalDecimal > 0) {
86
+ let formattedDecimal = separatorDecimals + decimalPartRaw;
87
+ if (endDecimal) formattedDecimal += suffixDecimal;
88
+ formattedInteger += formattedDecimal;
89
+ }
90
+ if (rawNum < 0) {
91
+ if (negativeFormat === "dash") formattedInteger = "-" + formattedInteger;
92
+ else if (negativeFormat === "brackets") formattedInteger = "(" + formattedInteger + ")";
93
+ else if (negativeFormat === "abs") {} else if (require_logger.isPlainObject(negativeFormat)) if (require_hasOwnProp.hasOwnProp(negativeFormat, "custom")) {
94
+ const formatCustomNegative = negativeFormat.custom;
95
+ if (!require_logger.isFunction(formatCustomNegative)) throw new TypeError(errorMsg$4(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${require_logger.getPreciseType(formatCustomNegative)}\`.`));
96
+ const result = formatCustomNegative(formattedInteger);
97
+ require_assertIsString.assertIsString(result, { message: ({ currentType, validType }) => errorMsg$4(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${validType}\` type value, but received: \`${currentType}\`.`) });
98
+ formattedInteger = result;
99
+ } else {
100
+ const formatStyleNegative = negativeFormat.style || "dash";
101
+ const formatSpaceNegative = !require_safeStableStringify.isUndefined(negativeFormat.space) ? negativeFormat.space : false;
102
+ require_logger.assertIsBoolean(formatSpaceNegative, { message: ({ currentType, validType }) => errorMsg$4(`Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${validType} or undefined\`, but received: \`${currentType}\`.`) });
103
+ if (!(formatStyleNegative === "abs" || formatStyleNegative === "brackets" || formatStyleNegative === "dash")) throw new TypeError(errorMsg$4(`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${require_logger.getPreciseType(formatStyleNegative)}\`, with value: \`${require_safeStableStringify.safeStableStringify(formatStyleNegative, { keepUndefined: true })}\`.`));
104
+ switch (formatStyleNegative) {
105
+ case "dash":
106
+ formattedInteger = "-" + (formatSpaceNegative ? " " : "") + formattedInteger;
107
+ break;
108
+ case "brackets":
109
+ formattedInteger = formatSpaceNegative ? `( ${formattedInteger} )` : `(${formattedInteger})`;
110
+ break;
111
+ case "abs": break;
112
+ }
113
+ }
114
+ }
115
+ return formattedInteger;
116
+ };
117
+ const errorMsg$4 = (msg) => require_logger.createMessage("formatCurrency", msg);
118
+ const formatNumber = (value, separator = ",") => {
119
+ if (!require_logger.isString(value) && !require_isFinite.isFinite(value)) throw new TypeError(errorMsg$3(`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${require_logger.getPreciseType(value)}\`.`));
120
+ if (!require_logger.isString(separator)) throw new TypeError(errorMsg$3(`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${require_logger.getPreciseType(separator)}\`.`));
121
+ separator = require_logger.isString(separator) ? separator : ",";
122
+ const decimalSeparator = separator === "." ? "," : separator === "," ? "." : ".";
123
+ const stringValue = value.toString().trim();
124
+ const lastDot = stringValue.lastIndexOf(".");
125
+ const lastComma = stringValue.lastIndexOf(",");
126
+ let actualDecimal = "";
127
+ if (lastDot > lastComma) actualDecimal = ".";
128
+ else if (lastComma > lastDot) actualDecimal = ",";
129
+ let integerPart = stringValue;
130
+ let decimalPart;
131
+ if (actualDecimal) {
132
+ const parts = stringValue.split(actualDecimal);
133
+ integerPart = parts.slice(0, -1).join(actualDecimal);
134
+ decimalPart = parts.slice(-1)[0];
135
+ }
136
+ integerPart = integerPart.replace(/[^\d]/g, "");
137
+ const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
138
+ return decimalPart ? `${formattedInteger}${decimalSeparator}${decimalPart}` : formattedInteger;
139
+ };
140
+ const errorMsg$3 = (msg) => require_logger.createMessage("formatNumber", msg);
141
+ const parsingAsYouType = (value, defaultCountry) => {
142
+ let parsed;
143
+ try {
144
+ parsed = new libphonenumber_js_max.AsYouType(defaultCountry);
145
+ parsed.input(value);
146
+ return parsed;
147
+ } catch {
148
+ parsed?.reset();
149
+ return;
150
+ }
151
+ };
152
+ const isValidParseAsYouType = (parsedAsYouType) => {
153
+ return !!parsedAsYouType?.isValid() && !!parsedAsYouType.getNumber();
154
+ };
155
+ function formatPhoneNumber(value, options) {
156
+ if (require_logger.isNil(value)) return "";
157
+ if (!require_logger.isString(value) && !require_isNumber.isNumber(value)) throw new TypeError(errorMsg$2(`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${require_logger.getPreciseType(value)}\`.`));
158
+ if (!require_logger.isPlainObject(options)) options = {};
159
+ const takeNumberOnly = options.takeNumberOnly ?? false;
160
+ const checkValidOnly = options.checkValidOnly ?? false;
161
+ const defaultCountry = options.defaultCountry ?? void 0;
162
+ const separator = options.separator ?? " ";
163
+ const prependPlusCountryCode = options.prependPlusCountryCode ?? true;
164
+ const outputFormat = options.outputFormat ?? "INTERNATIONAL";
165
+ const openingNumberCountry = options.openingNumberCountry ?? "";
166
+ const closingNumberCountry = options.closingNumberCountry ?? "";
167
+ if (!require_logger.isBoolean(takeNumberOnly) || !require_logger.isBoolean(checkValidOnly) || !require_logger.isBoolean(prependPlusCountryCode)) throw new TypeError(errorMsg$2(`Parameter \`takeNumberOnly\`, \`checkValidOnly\` and \`prependPlusCountryCode\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${require_logger.getPreciseType(takeNumberOnly)}\`, 'checkValidOnly': \`${require_logger.getPreciseType(checkValidOnly)}\`, 'prependPlusCountryCode': \`${require_logger.getPreciseType(prependPlusCountryCode)}\`].`));
168
+ if (!require_safeStableStringify.isUndefined(defaultCountry) && !(0, libphonenumber_js_max.isSupportedCountry)(defaultCountry)) throw new TypeError(errorMsg$2(`Parameter \`defaultCountry\` property of the \`options\` (second parameter) must be of type \`string\` as \`CountryCode\` (ISO-3166-1 alpha-2) or unset as \`undefined\` value, but received: \`${require_logger.getPreciseType(defaultCountry)}\`, with value: \`${require_safeStableStringify.safeStableStringify(defaultCountry, { keepUndefined: true })}\`.\n\nSee: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements, for all ISO 3166-1 alpha-2 code.`));
169
+ if (![
170
+ "INTERNATIONAL",
171
+ "NATIONAL",
172
+ "RFC3966",
173
+ "E.164"
174
+ ].includes(outputFormat)) throw new TypeError(errorMsg$2(`Parameter \`outputFormat\` property of the \`options\` (second parameter) must be of type \`string\` as \`OutputFormat\` ("NATIONAL" | "INTERNATIONAL" | "E.164" | "RFC3966") or unset as \`undefined\` (default value to: \`INTERNATIONAL\`) value, but received: \`${require_logger.getPreciseType(outputFormat)}\`, with value: ${require_safeStableStringify.safeStableStringify(outputFormat, { keepUndefined: true })}.`));
175
+ if (!require_logger.isString(separator) || !require_logger.isString(openingNumberCountry) || !require_logger.isString(closingNumberCountry)) throw new TypeError(errorMsg$2(`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${require_logger.getPreciseType(separator)}\`,'openingNumberCountry': \`${require_logger.getPreciseType(openingNumberCountry)}\`, 'closingNumberCountry': \`${require_logger.getPreciseType(closingNumberCountry)}\`].`));
176
+ if (!require_logger.isString(value)) value = String(value);
177
+ const parsedPhoneNumber = parsingAsYouType(value, defaultCountry);
178
+ const validPhoneNumber = isValidParseAsYouType(parsedPhoneNumber);
179
+ if (checkValidOnly) return validPhoneNumber;
180
+ if (!validPhoneNumber) return "";
181
+ if (takeNumberOnly) return parsedPhoneNumber.getNumber().formatNational().replace(/\D/g, "");
182
+ const intlNumb = parsedPhoneNumber.getNumber().format(outputFormat);
183
+ if (outputFormat === "INTERNATIONAL") {
184
+ const [cc, ...rest] = intlNumb.split(" ");
185
+ const countryCode = prependPlusCountryCode ? cc : cc?.replace(/^\++/, "");
186
+ const restWithSeparator = rest.join(separator);
187
+ if (!countryCode) return restWithSeparator;
188
+ if (require_logger.isNonEmptyString(openingNumberCountry) && require_logger.isNonEmptyString(closingNumberCountry)) return `${openingNumberCountry}${countryCode}${closingNumberCountry} ${restWithSeparator}`;
189
+ return `${countryCode} ${restWithSeparator}`;
190
+ }
191
+ if (outputFormat === "NATIONAL") return `${intlNumb.split(" ").join(separator)}`;
192
+ return intlNumb;
193
+ }
194
+ const errorMsg$2 = (msg) => require_logger.createMessage("formatPhoneNumber", msg);
195
+ const hashSeedGenerate = (mode, email) => {
196
+ const generateSeed = () => {
197
+ let hash = 0;
198
+ for (let i = 0; i < email.length; i++) {
199
+ hash = (hash << 5) - hash + email.charCodeAt(i);
200
+ hash |= 0;
201
+ }
202
+ return Math.abs(hash);
203
+ };
204
+ return mode === "fixed" ? generateSeed() : void 0;
205
+ };
206
+ const _censor = (str, minCensor, maxPercentage, hashSeed) => {
207
+ if (str.length <= minCensor) return "*".repeat(str.length);
208
+ const strArr = str.split("");
209
+ const totalCensor = Math.max(minCensor, Math.ceil(str.length * maxPercentage));
210
+ const indexes = /* @__PURE__ */ new Set();
211
+ let i = 0;
212
+ while (indexes.size < totalCensor) {
213
+ const idx = !require_safeStableStringify.isUndefined(hashSeed) ? (hashSeed + str.length + i * 31) % str.length : Math.floor(Math.random() * str.length);
214
+ indexes.add(idx);
215
+ i++;
216
+ }
217
+ for (const index of indexes) strArr[index] = "*";
218
+ return strArr.join("");
219
+ };
220
+ const censorEmail = (email, options) => {
221
+ if (!require_logger.isNonEmptyString(email)) return "";
222
+ if (!require_logger.isPlainObject(options)) options = {};
223
+ const mode = options.mode ?? "fixed";
224
+ if (mode !== "random" && mode !== "fixed") throw new TypeError(require_logger.createMessage("censorEmail", `Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${require_logger.getPreciseType(mode)}\`, with value: \`${require_safeStableStringify.safeStableStringify(mode, { keepUndefined: true })}\`.`));
225
+ if (!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(email)) return "";
226
+ const [local, domain] = email.split("@");
227
+ const domainParts = domain?.split(".");
228
+ if (!local || !domainParts || domainParts.length < 2) return "";
229
+ const [domainName, ...tldParts] = domainParts;
230
+ if (!domainName) return "";
231
+ const tld = tldParts.join(".");
232
+ const hashSeed = hashSeedGenerate(mode, email);
233
+ const localMinCensor = local.length < 4 ? 1 : 2;
234
+ const domainMinCensor = domainName.length < 4 ? 1 : 2;
235
+ return `${_censor(local, localMinCensor, .6, hashSeed)}@${_censor(domainName, domainMinCensor, .5, hashSeed)}.${tld.length <= 2 ? tld : _censor(tld, 1, .4, hashSeed)}`;
236
+ };
237
+ function chunkString(subject, limiter, options) {
238
+ if (require_logger.isNil(subject) || limiter <= 0) return subject;
239
+ require_assertIsString.assertIsString(subject, { message: ({ currentType, validType }) => errorMsg$1(`First parameter (\`subject\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
240
+ if (!require_isInteger.isInteger(limiter)) throw new TypeError(errorMsg$1(`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${require_logger.getPreciseType(limiter)}\`, with value: \`${require_safeStableStringify.safeStableStringify(limiter, { keepUndefined: true })}\`.`));
241
+ if (!require_logger.isPlainObject(options)) options = {};
242
+ const separator = options.separator ?? " ";
243
+ const reCountAfterSpace = options.reCountAfterSpace ?? false;
244
+ require_assertIsString.assertIsString(separator, { message: ({ currentType, validType }) => errorMsg$1(`Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
245
+ require_logger.assertIsBoolean(reCountAfterSpace, { message: ({ currentType, validType }) => errorMsg$1(`Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
246
+ subject = require_normalizeSpaces.normalizeSpaces(subject);
247
+ if (!reCountAfterSpace) {
248
+ let result = "";
249
+ let currentCount = 0;
250
+ for (let i = 0; i < subject.length; i++) {
251
+ const char = subject[i];
252
+ if (currentCount === limiter) {
253
+ result += separator;
254
+ currentCount = 0;
255
+ }
256
+ result += char;
257
+ currentCount++;
258
+ }
259
+ return result;
260
+ }
261
+ const words = subject.split(" ");
262
+ const finalSegments = [];
263
+ let currentGroup = [];
264
+ let wordsInCurrentGroupCount = 0;
265
+ for (let i = 0; i < words.length; i++) {
266
+ const word = words[i];
267
+ let processedWord = "";
268
+ let charCountInWord = 0;
269
+ if (word) for (let j = 0; j < word.length; j++) {
270
+ processedWord += word[j];
271
+ charCountInWord++;
272
+ if (charCountInWord === limiter && j < word.length - 1) {
273
+ processedWord += separator;
274
+ charCountInWord = 0;
275
+ }
276
+ }
277
+ currentGroup.push(processedWord);
278
+ wordsInCurrentGroupCount++;
279
+ if (wordsInCurrentGroupCount === limiter || i === words.length - 1) {
280
+ finalSegments.push(currentGroup.join(separator));
281
+ currentGroup = [];
282
+ wordsInCurrentGroupCount = 0;
283
+ }
284
+ }
285
+ return finalSegments.join(" ");
286
+ }
287
+ const errorMsg$1 = (msg) => require_logger.createMessage("chunkString", msg);
288
+ const truncateString = (text, options) => {
289
+ if (!require_logger.isNonEmptyString(text)) return "";
290
+ if (!require_logger.isPlainObject(options)) options = {};
291
+ const trim = options.trim ?? true;
292
+ const length = options.length ?? 10;
293
+ let ending = options.ending ?? "...";
294
+ if (!require_isInteger.isInteger(length)) throw new TypeError(errorMsg(`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${require_logger.getPreciseType(length)}\`, with value: \`${require_safeStableStringify.safeStableStringify(length, { keepUndefined: true })}\`.`));
295
+ if (length < 1) return "";
296
+ require_assertIsString.assertIsString(ending, { message: ({ currentType, validType }) => errorMsg(`Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
297
+ require_logger.assertIsBoolean(trim, { message: ({ currentType, validType }) => errorMsg(`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
298
+ if (require_isEmptyString.isEmptyString(ending)) ending = "...";
299
+ else ending = ending.trim();
300
+ const original = trim ? text.trim() : text;
301
+ if (original.length <= length) return original;
302
+ const sliced = original.slice(0, length);
303
+ return (trim ? sliced : sliced.trimEnd()) + ending;
304
+ };
305
+ const errorMsg = (msg) => require_logger.createMessage("truncateString", msg);
306
+ const formatDateFns = (date, options = {}) => {
307
+ if (require_logger.isNil(date) || !(require_safeStableStringify.isDate(date) || require_logger.isNonEmptyString(date))) return null;
308
+ if (!require_logger.isPlainObject(options)) options = {};
309
+ const { inputFormat, locale = "en", inputLocale = "en", ...restOptions } = options;
310
+ const format = options.format ?? "dd MMM yyyy - HH:mm:ss";
311
+ let parsedDate;
312
+ try {
313
+ if (require_logger.isNonEmptyString(date) && inputFormat && inputLocale) {
314
+ const valueOfInputLocale = require_logger.isNonEmptyString(inputLocale) ? inputLocale === "id" ? date_fns_locale.id : date_fns_locale.enUS : inputLocale;
315
+ parsedDate = (0, date_fns.parse)(date, inputFormat, /* @__PURE__ */ new Date(), { locale: valueOfInputLocale });
316
+ } else parsedDate = new Date(date);
317
+ if (require_logger.isNaN(parsedDate.getTime())) return null;
318
+ const valueOfLocale = require_logger.isNonEmptyString(locale) ? locale === "id" ? date_fns_locale.id : date_fns_locale.enUS : locale;
319
+ return (0, date_fns.format)(parsedDate, format, {
320
+ ...restOptions,
321
+ locale: valueOfLocale
322
+ });
323
+ } catch {
324
+ return null;
325
+ }
326
+ };
327
+ const formatDateIntl = (date, options) => {
328
+ if (require_logger.isNil(date) || !(require_safeStableStringify.isDate(date) || require_logger.isNonEmptyString(date))) return null;
329
+ const parsedDate = new Date(date);
330
+ if (require_logger.isNaN(parsedDate.getTime())) return null;
331
+ if (!require_logger.isPlainObject(options)) options = {};
332
+ const { locale = "en-US", ...restProps } = options;
333
+ try {
334
+ return new Intl.DateTimeFormat(require_logger.isNonEmptyString(locale) ? locale.trim() : "en-US", restProps).format(parsedDate);
335
+ } catch {
336
+ return null;
337
+ }
338
+ };
339
+ const formatDateTime = (date, format = "YYYY-MM-DD hh:mm:ss") => {
340
+ if (require_logger.isNil(format)) format = "YYYY-MM-DD hh:mm:ss";
341
+ if (!require_logger.isString(format)) return null;
342
+ if (require_logger.isNil(date) || !(require_safeStableStringify.isDate(date) || require_logger.isNonEmptyString(date))) return null;
343
+ try {
344
+ const parsedDate = new Date(date);
345
+ if (require_logger.isNaN(parsedDate.getTime())) return null;
346
+ const pad2 = (n) => n.toString().padStart(2, "0");
347
+ const map = {
348
+ YYYY: parsedDate.getFullYear().toString(),
349
+ MM: pad2(parsedDate.getMonth() + 1),
350
+ DD: pad2(parsedDate.getDate()),
351
+ hh: pad2(parsedDate.getHours()),
352
+ mm: pad2(parsedDate.getMinutes()),
353
+ ss: pad2(parsedDate.getSeconds())
354
+ };
355
+ const result = Object.entries(map).reduce((prev, [key, value]) => prev.split(key).join(value), format);
356
+ return !result.includes("NaN") ? result : null;
357
+ } catch {
358
+ return null;
359
+ }
360
+ };
361
+ const getGMTOffset = (date) => {
362
+ try {
363
+ if (require_logger.isNil(date) || require_logger.isString(date) && require_isEmptyString.isEmptyString(date)) date = /* @__PURE__ */ new Date();
364
+ else if (!(require_safeStableStringify.isDate(date) || require_logger.isNonEmptyString(date))) return "0";
365
+ const parsedDate = new Date(date);
366
+ if (require_logger.isNaN(parsedDate.getTime())) return "0";
367
+ const padZero = (num) => num.toString().padStart(2, "0");
368
+ let offset = parsedDate.getTimezoneOffset();
369
+ const sign = offset < 0 ? "+" : "-";
370
+ offset = Math.abs(offset);
371
+ return `${sign}${padZero(Math.floor(offset / 60))}${padZero(offset % 60)}`;
372
+ } catch {
373
+ return "0";
374
+ }
375
+ };
376
+ Object.defineProperty(exports, 'censorEmail', {
377
+ enumerable: true,
378
+ get: function () {
379
+ return censorEmail;
380
+ }
381
+ });
382
+ Object.defineProperty(exports, 'chunkString', {
383
+ enumerable: true,
384
+ get: function () {
385
+ return chunkString;
386
+ }
387
+ });
388
+ Object.defineProperty(exports, 'formatCurrency', {
389
+ enumerable: true,
390
+ get: function () {
391
+ return formatCurrency;
392
+ }
393
+ });
394
+ Object.defineProperty(exports, 'formatDateFns', {
395
+ enumerable: true,
396
+ get: function () {
397
+ return formatDateFns;
398
+ }
399
+ });
400
+ Object.defineProperty(exports, 'formatDateIntl', {
401
+ enumerable: true,
402
+ get: function () {
403
+ return formatDateIntl;
404
+ }
405
+ });
406
+ Object.defineProperty(exports, 'formatDateTime', {
407
+ enumerable: true,
408
+ get: function () {
409
+ return formatDateTime;
410
+ }
411
+ });
412
+ Object.defineProperty(exports, 'formatNumber', {
413
+ enumerable: true,
414
+ get: function () {
415
+ return formatNumber;
416
+ }
417
+ });
418
+ Object.defineProperty(exports, 'formatPhoneNumber', {
419
+ enumerable: true,
420
+ get: function () {
421
+ return formatPhoneNumber;
422
+ }
423
+ });
424
+ Object.defineProperty(exports, 'getGMTOffset', {
425
+ enumerable: true,
426
+ get: function () {
427
+ return getGMTOffset;
428
+ }
429
+ });
430
+ Object.defineProperty(exports, 'truncateString', {
431
+ enumerable: true,
432
+ get: function () {
433
+ return truncateString;
434
+ }
435
+ });
436
+ //# sourceMappingURL=formatters-zd0Gs4Cs.cjs.map