@rzl-zone/utils-js 3.12.1-beta.0 → 3.12.1-beta.1

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 (239) hide show
  1. package/README.md +7 -7
  2. package/dist/.references/index.d.cts +1 -1
  3. package/dist/.references/index.d.ts +1 -1
  4. package/dist/{assertIsArray-BChqwPiP.cjs → assertIsArray-DJXkjHZs.cjs} +3 -3
  5. package/dist/{assertIsArray-BChqwPiP.cjs.map → assertIsArray-DJXkjHZs.cjs.map} +1 -1
  6. package/dist/{assertIsArray-BfAbIUfa.js → assertIsArray-bTA3XLjq.js} +3 -3
  7. package/dist/{assertIsArray-BfAbIUfa.js.map → assertIsArray-bTA3XLjq.js.map} +1 -1
  8. package/dist/{assertIsBoolean-DozdtbNi.cjs → assertIsBoolean-C8WEXVr2.cjs} +8 -8
  9. package/dist/assertIsBoolean-C8WEXVr2.cjs.map +1 -0
  10. package/dist/{assertIsBoolean-BlBct0Fc.js → assertIsBoolean-DR1SaXPD.js} +8 -8
  11. package/dist/assertIsBoolean-DR1SaXPD.js.map +1 -0
  12. package/dist/{assertIsString-Bvk7bUL7.cjs → assertIsString-BiHQSrB2.cjs} +3 -3
  13. package/dist/{assertIsString-Bvk7bUL7.cjs.map → assertIsString-BiHQSrB2.cjs.map} +1 -1
  14. package/dist/{assertIsString-DqV9NwbI.js → assertIsString-CEB07_83.js} +3 -3
  15. package/dist/{assertIsString-DqV9NwbI.js.map → assertIsString-CEB07_83.js.map} +1 -1
  16. package/dist/assertions/index.cjs +5 -5
  17. package/dist/assertions/index.d.cts +2 -2
  18. package/dist/assertions/index.d.ts +2 -2
  19. package/dist/assertions/index.js +5 -5
  20. package/dist/conversions/index.cjs +6 -6
  21. package/dist/conversions/index.d.cts +2 -2
  22. package/dist/conversions/index.d.ts +2 -2
  23. package/dist/conversions/index.js +6 -6
  24. package/dist/{conversions-EMJa3g-D.js → conversions-BNIh_tCH.js} +16 -18
  25. package/dist/conversions-BNIh_tCH.js.map +1 -0
  26. package/dist/{conversions-CBs8-REq.cjs → conversions-D_Kh0a_C.cjs} +16 -18
  27. package/dist/conversions-D_Kh0a_C.cjs.map +1 -0
  28. package/dist/events/index.cjs +4 -4
  29. package/dist/events/index.cjs.map +1 -1
  30. package/dist/events/index.d.cts +153 -151
  31. package/dist/events/index.d.ts +153 -151
  32. package/dist/events/index.js +4 -4
  33. package/dist/events/index.js.map +1 -1
  34. package/dist/{formatEnvPort-hHNvOim-.cjs → formatEnvPort-B3OLxQk9.cjs} +9 -9
  35. package/dist/formatEnvPort-B3OLxQk9.cjs.map +1 -0
  36. package/dist/{formatEnvPort-DpIXzPAZ.js → formatEnvPort-ByFVLjSV.js} +9 -9
  37. package/dist/formatEnvPort-ByFVLjSV.js.map +1 -0
  38. package/dist/formatters/index.cjs +2 -2
  39. package/dist/formatters/index.d.cts +2 -2
  40. package/dist/formatters/index.d.ts +2 -2
  41. package/dist/formatters/index.js +2 -2
  42. package/dist/{formatters-QcZO_Cpx.js → formatters--1m_vpE8.js} +17 -15
  43. package/dist/formatters--1m_vpE8.js.map +1 -0
  44. package/dist/{formatters-lAYgA11L.cjs → formatters-Cbij0XLU.cjs} +17 -15
  45. package/dist/formatters-Cbij0XLU.cjs.map +1 -0
  46. package/dist/generators/index.cjs +12 -8
  47. package/dist/generators/index.cjs.map +1 -1
  48. package/dist/generators/index.d.cts +2 -2
  49. package/dist/generators/index.d.ts +2 -2
  50. package/dist/generators/index.js +12 -8
  51. package/dist/generators/index.js.map +1 -1
  52. package/dist/index-59zbLcPr.d.ts +340 -0
  53. package/dist/index-B6tawc8L.d.cts +1716 -0
  54. package/dist/index-C267akkJ.d.ts +2158 -0
  55. package/dist/index-CeBC2Vvl.d.cts +2361 -0
  56. package/dist/index-CgRDTI6f.d.ts +822 -0
  57. package/dist/index-CoiUBVmr.d.ts +720 -0
  58. package/dist/index-D4fcasfZ.d.cts +720 -0
  59. package/dist/index-DDrSQKIc.d.ts +1716 -0
  60. package/dist/index-DsGxO31H.d.cts +765 -0
  61. package/dist/index-Hg1qJkjl.d.ts +765 -0
  62. package/dist/index-Qm3iFwd0.d.cts +2158 -0
  63. package/dist/index-UPp94Agr.d.ts +2361 -0
  64. package/dist/index-gBA_8SuF.d.cts +340 -0
  65. package/dist/index-jyDqzicx.d.cts +822 -0
  66. package/dist/{isBigInt-B1cijjqm.cjs → isBigInt-C4krUeAw.cjs} +2 -2
  67. package/dist/{isBigInt-B1cijjqm.cjs.map → isBigInt-C4krUeAw.cjs.map} +1 -1
  68. package/dist/{isBigInt-C0bN0Rhu.js → isBigInt-DKe0M6hp.js} +2 -2
  69. package/dist/{isBigInt-C0bN0Rhu.js.map → isBigInt-DKe0M6hp.js.map} +1 -1
  70. package/dist/{isEmptyObject-DeLVIJpl.js → isEmptyObject-DCipFwxJ.js} +3 -3
  71. package/dist/{isEmptyObject-DeLVIJpl.js.map → isEmptyObject-DCipFwxJ.js.map} +1 -1
  72. package/dist/{isEmptyObject-DI42NEo0.cjs → isEmptyObject-ZkSwRC_D.cjs} +3 -3
  73. package/dist/{isEmptyObject-DI42NEo0.cjs.map → isEmptyObject-ZkSwRC_D.cjs.map} +1 -1
  74. package/dist/{isEmptyString-BTUWYTbw.js → isEmptyString-BXzKAC2j.js} +3 -3
  75. package/dist/{isEmptyString-BTUWYTbw.js.map → isEmptyString-BXzKAC2j.js.map} +1 -1
  76. package/dist/{isEmptyString-CCK3bP74.cjs → isEmptyString-UiiUsSQj.cjs} +3 -3
  77. package/dist/{isEmptyString-CCK3bP74.cjs.map → isEmptyString-UiiUsSQj.cjs.map} +1 -1
  78. package/dist/{isEmptyValue-DMSMFTU8.cjs → isEmptyValue-BQzcjVaL.cjs} +5 -5
  79. package/dist/{isEmptyValue-DMSMFTU8.cjs.map → isEmptyValue-BQzcjVaL.cjs.map} +1 -1
  80. package/dist/{isEmptyValue-fjnfQnt5.js → isEmptyValue-jqOr7OHD.js} +5 -5
  81. package/dist/{isEmptyValue-fjnfQnt5.js.map → isEmptyValue-jqOr7OHD.js.map} +1 -1
  82. package/dist/{isEqual-DhyP8fB_.js → isEqual-BX49cF9m.js} +4 -4
  83. package/dist/{isEqual-DhyP8fB_.js.map → isEqual-BX49cF9m.js.map} +1 -1
  84. package/dist/{isEqual-B1fRgEuU.cjs → isEqual-BvumA3RA.cjs} +4 -4
  85. package/dist/{isEqual-B1fRgEuU.cjs.map → isEqual-BvumA3RA.cjs.map} +1 -1
  86. package/dist/{isFinite-BYMOo0os.js → isFinite-BCnaDpod.js} +3 -3
  87. package/dist/{isFinite-BYMOo0os.js.map → isFinite-BCnaDpod.js.map} +1 -1
  88. package/dist/{isFinite-sFkps2TY.cjs → isFinite-D24ZaE6c.cjs} +3 -3
  89. package/dist/{isFinite-sFkps2TY.cjs.map → isFinite-D24ZaE6c.cjs.map} +1 -1
  90. package/dist/{isInteger-FTCthMre.cjs → isInteger-Caeuz0rB.cjs} +2 -2
  91. package/dist/{isInteger-FTCthMre.cjs.map → isInteger-Caeuz0rB.cjs.map} +1 -1
  92. package/dist/{isInteger-DS9V7l_f.js → isInteger-naMbJsxJ.js} +2 -2
  93. package/dist/{isInteger-DS9V7l_f.js.map → isInteger-naMbJsxJ.js.map} +1 -1
  94. package/dist/isPlainObject-BF-2-phb.d.cts +339 -0
  95. package/dist/isPlainObject-DxNDL8XU.d.ts +339 -0
  96. package/dist/{isServer-q-QLFCqE.cjs → isServer-BJHVnixd.cjs} +2 -2
  97. package/dist/{isServer-q-QLFCqE.cjs.map → isServer-BJHVnixd.cjs.map} +1 -1
  98. package/dist/{isServer-D1TXfOs3.js → isServer-Da3o3XSs.js} +2 -2
  99. package/dist/{isServer-D1TXfOs3.js.map → isServer-Da3o3XSs.js.map} +1 -1
  100. package/dist/{isTypedArray-47R0wdrc.js → isTypedArray-DuNA8tK6.js} +3 -3
  101. package/dist/{isTypedArray-47R0wdrc.js.map → isTypedArray-DuNA8tK6.js.map} +1 -1
  102. package/dist/{isTypedArray-DiCoqffZ.cjs → isTypedArray-TJptiw2b.cjs} +3 -3
  103. package/dist/{isTypedArray-DiCoqffZ.cjs.map → isTypedArray-TJptiw2b.cjs.map} +1 -1
  104. package/dist/{isURL-CQiowFq2.js → isURL-C-kSk6KJ.js} +2 -2
  105. package/dist/{isURL-CQiowFq2.js.map → isURL-C-kSk6KJ.js.map} +1 -1
  106. package/dist/{isURL-WZypXsax.cjs → isURL-DeUPO_oR.cjs} +2 -2
  107. package/dist/{isURL-WZypXsax.cjs.map → isURL-DeUPO_oR.cjs.map} +1 -1
  108. package/dist/{isValidDomain-BSXshgkC.cjs → isValidDomain-BB9IGhJs.cjs} +65 -8
  109. package/dist/isValidDomain-BB9IGhJs.cjs.map +1 -0
  110. package/dist/{isValidDomain-DwA2EN79.js → isValidDomain-DoE98yhJ.js} +54 -9
  111. package/dist/isValidDomain-DoE98yhJ.js.map +1 -0
  112. package/dist/next/index.cjs +7 -7
  113. package/dist/next/index.cjs.map +1 -1
  114. package/dist/next/index.d.cts +185 -191
  115. package/dist/next/index.d.ts +185 -191
  116. package/dist/next/index.js +7 -7
  117. package/dist/next/index.js.map +1 -1
  118. package/dist/next/server/index.cjs +2 -2
  119. package/dist/next/server/index.d.cts +26 -26
  120. package/dist/next/server/index.d.ts +26 -26
  121. package/dist/next/server/index.js +2 -2
  122. package/dist/{noop-B2mTBhW-.cjs → noop-B13_ii35.cjs} +2 -2
  123. package/dist/{noop-B2mTBhW-.cjs.map → noop-B13_ii35.cjs.map} +1 -1
  124. package/dist/{noop-BzktGBVz.js → noop-ubqAIbHD.js} +2 -2
  125. package/dist/{noop-BzktGBVz.js.map → noop-ubqAIbHD.js.map} +1 -1
  126. package/dist/{normalizeSpaces-WS_iERJk.js → normalizeSpaces-Bg2IZW7W.js} +3 -3
  127. package/dist/{normalizeSpaces-WS_iERJk.js.map → normalizeSpaces-Bg2IZW7W.js.map} +1 -1
  128. package/dist/{normalizeSpaces-DQHR3Tlr.cjs → normalizeSpaces-ZXnR4Qzp.cjs} +3 -3
  129. package/dist/{normalizeSpaces-DQHR3Tlr.cjs.map → normalizeSpaces-ZXnR4Qzp.cjs.map} +1 -1
  130. package/dist/{normalizeString-2WLth_Gj.js → normalizeString-BDdkaXui.js} +3 -3
  131. package/dist/{normalizeString-2WLth_Gj.js.map → normalizeString-BDdkaXui.js.map} +1 -1
  132. package/dist/{normalizeString-D8euBcRD.cjs → normalizeString-BE6ELqEb.cjs} +3 -3
  133. package/dist/{normalizeString-D8euBcRD.cjs.map → normalizeString-BE6ELqEb.cjs.map} +1 -1
  134. package/dist/operations/index.cjs +10 -10
  135. package/dist/operations/index.cjs.map +1 -1
  136. package/dist/operations/index.d.cts +120 -120
  137. package/dist/operations/index.d.ts +120 -120
  138. package/dist/operations/index.js +10 -10
  139. package/dist/operations/index.js.map +1 -1
  140. package/dist/parsers/index.cjs +2 -2
  141. package/dist/parsers/index.d.cts +222 -222
  142. package/dist/parsers/index.d.ts +222 -222
  143. package/dist/parsers/index.js +2 -2
  144. package/dist/{parsers-Dpuq-V4u.js → parsers-BSBPgvsq.js} +4 -4
  145. package/dist/{parsers-Dpuq-V4u.js.map → parsers-BSBPgvsq.js.map} +1 -1
  146. package/dist/{parsers-DXtpsDyj.cjs → parsers-OqDeffqc.cjs} +4 -4
  147. package/dist/{parsers-DXtpsDyj.cjs.map → parsers-OqDeffqc.cjs.map} +1 -1
  148. package/dist/{parsing-B43x1sxn.js → parsing-Cao8b358.js} +3 -3
  149. package/dist/{parsing-B43x1sxn.js.map → parsing-Cao8b358.js.map} +1 -1
  150. package/dist/{parsing-lRoxn1Nz.cjs → parsing-DOGSCH6N.cjs} +3 -3
  151. package/dist/{parsing-lRoxn1Nz.cjs.map → parsing-DOGSCH6N.cjs.map} +1 -1
  152. package/dist/predicates/index.cjs +15 -15
  153. package/dist/predicates/index.d.cts +3 -3
  154. package/dist/predicates/index.d.ts +3 -3
  155. package/dist/predicates/index.js +15 -15
  156. package/dist/{predicates-gNepszvo.js → predicates-Bj6meyXV.js} +13 -14
  157. package/dist/{predicates-gNepszvo.js.map → predicates-Bj6meyXV.js.map} +1 -1
  158. package/dist/{predicates-DiaYA7Ps.cjs → predicates-D0ubqgqy.cjs} +13 -14
  159. package/dist/{predicates-DiaYA7Ps.cjs.map → predicates-D0ubqgqy.cjs.map} +1 -1
  160. package/dist/promises/index.cjs +4 -4
  161. package/dist/promises/index.d.cts +101 -101
  162. package/dist/promises/index.d.ts +101 -101
  163. package/dist/promises/index.js +4 -4
  164. package/dist/{punyCode-hmiFzLWT.js → punyCode-8SrbMWfM.js} +6 -6
  165. package/dist/punyCode-8SrbMWfM.js.map +1 -0
  166. package/dist/{punyCode-CTWXVVFo.cjs → punyCode-D-Qu6nj6.cjs} +6 -6
  167. package/dist/punyCode-D-Qu6nj6.cjs.map +1 -0
  168. package/dist/{removeSpaces-BE8lfh-4.js → removeSpaces-Bmc5DX4F.js} +3 -3
  169. package/dist/removeSpaces-Bmc5DX4F.js.map +1 -0
  170. package/dist/{removeSpaces-DRRxNWlb.cjs → removeSpaces-CWIvhZHg.cjs} +3 -3
  171. package/dist/removeSpaces-CWIvhZHg.cjs.map +1 -0
  172. package/dist/rzl-utils.global.js +21 -0
  173. package/dist/{safeJsonParse-CXruaP0p.js → safeJsonParse-BP38mwlj.js} +9 -9
  174. package/dist/safeJsonParse-BP38mwlj.js.map +1 -0
  175. package/dist/{safeJsonParse-BBnQElk8.cjs → safeJsonParse-Sms2CJf4.cjs} +9 -9
  176. package/dist/safeJsonParse-Sms2CJf4.cjs.map +1 -0
  177. package/dist/{safeStableStringify-Cc62pfRp.cjs → safeStableStringify-CJtP89qn.cjs} +4 -4
  178. package/dist/{safeStableStringify-Cc62pfRp.cjs.map → safeStableStringify-CJtP89qn.cjs.map} +1 -1
  179. package/dist/{safeStableStringify-BNh3D0K0.js → safeStableStringify-CXOZ9Ub8.js} +4 -4
  180. package/dist/{safeStableStringify-BNh3D0K0.js.map → safeStableStringify-CXOZ9Ub8.js.map} +1 -1
  181. package/dist/strings/index.cjs +12 -9
  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 +12 -9
  186. package/dist/strings/index.js.map +1 -1
  187. package/dist/tailwind/index.cjs +2 -2
  188. package/dist/tailwind/index.d.cts +2 -2
  189. package/dist/tailwind/index.d.ts +2 -2
  190. package/dist/tailwind/index.js +2 -2
  191. package/dist/{tailwind-IJvOdkZp.js → tailwind-B2ssevxq.js} +5 -5
  192. package/dist/tailwind-B2ssevxq.js.map +1 -0
  193. package/dist/{tailwind-DJ4cmLUw.cjs → tailwind-CHIx9uxu.cjs} +5 -5
  194. package/dist/tailwind-CHIx9uxu.cjs.map +1 -0
  195. package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs → toStringArrayUnRecursive-C4zYCja7.cjs} +6 -6
  196. package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs.map → toStringArrayUnRecursive-C4zYCja7.cjs.map} +1 -1
  197. package/dist/{toStringArrayUnRecursive-CFs0jTEg.js → toStringArrayUnRecursive-DJGtPsFb.js} +6 -6
  198. package/dist/{toStringArrayUnRecursive-CFs0jTEg.js.map → toStringArrayUnRecursive-DJGtPsFb.js.map} +1 -1
  199. package/dist/urls/index.cjs +15 -14
  200. package/dist/urls/index.cjs.map +1 -1
  201. package/dist/urls/index.d.cts +656 -659
  202. package/dist/urls/index.d.ts +656 -659
  203. package/dist/urls/index.js +15 -14
  204. package/dist/urls/index.js.map +1 -1
  205. package/package.json +2 -2
  206. package/dist/assertIsBoolean-BlBct0Fc.js.map +0 -1
  207. package/dist/assertIsBoolean-DozdtbNi.cjs.map +0 -1
  208. package/dist/conversions-CBs8-REq.cjs.map +0 -1
  209. package/dist/conversions-EMJa3g-D.js.map +0 -1
  210. package/dist/formatEnvPort-DpIXzPAZ.js.map +0 -1
  211. package/dist/formatEnvPort-hHNvOim-.cjs.map +0 -1
  212. package/dist/formatters-QcZO_Cpx.js.map +0 -1
  213. package/dist/formatters-lAYgA11L.cjs.map +0 -1
  214. package/dist/index-26W7ItWx.d.ts +0 -760
  215. package/dist/index-BPPQjAfs.d.cts +0 -2359
  216. package/dist/index-BXjlgBLz.d.cts +0 -2139
  217. package/dist/index-B_Wwo91H.d.ts +0 -2359
  218. package/dist/index-CpufydcI.d.cts +0 -704
  219. package/dist/index-Czc4O526.d.ts +0 -333
  220. package/dist/index-DPs1_p5G.d.cts +0 -760
  221. package/dist/index-DRpOyBSC.d.ts +0 -1703
  222. package/dist/index-DWWvtHUn.d.cts +0 -822
  223. package/dist/index-DnM0LD0n.d.cts +0 -333
  224. package/dist/index-GUZ9fK6T.d.ts +0 -2139
  225. package/dist/index-I4fAzwXV.d.ts +0 -704
  226. package/dist/index-JDrOl_19.d.ts +0 -822
  227. package/dist/index-b66P49Qe.d.cts +0 -1703
  228. package/dist/isPlainObject-DcFGh3_5.d.ts +0 -530
  229. package/dist/isPlainObject-doTI11Ib.d.cts +0 -530
  230. package/dist/isValidDomain-BSXshgkC.cjs.map +0 -1
  231. package/dist/isValidDomain-DwA2EN79.js.map +0 -1
  232. package/dist/punyCode-CTWXVVFo.cjs.map +0 -1
  233. package/dist/punyCode-hmiFzLWT.js.map +0 -1
  234. package/dist/removeSpaces-BE8lfh-4.js.map +0 -1
  235. package/dist/removeSpaces-DRRxNWlb.cjs.map +0 -1
  236. package/dist/safeJsonParse-BBnQElk8.cjs.map +0 -1
  237. package/dist/safeJsonParse-CXruaP0p.js.map +0 -1
  238. package/dist/tailwind-DJ4cmLUw.cjs.map +0 -1
  239. package/dist/tailwind-IJvOdkZp.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValidDomain-BB9IGhJs.cjs","names":["isString","isBoolean","getPreciseType","safeStableStringify","punycodeUtilsJS","ccTldMap","sldMap"],"sources":["../../build-tools/dist/formatter-BS3omf7k.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.ts"],"sourcesContent":["/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12-beta.0`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BS3omf7k.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings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;CAIvC,IAAI,CAAC,QAAQ;EACX,SAAS,OAAO,MAAM,IAAI;EAC1B,IAAI,OAAO,UAAU,GAAG,OAAO;EAE/B,MAAM,OAAO,KAAK;EAElB,IAAI,CAAC,+CAAS,KAAK,IAAI,EAAE,OAAO;;CAGlC,IAAI,cAAc,SAAS,OAAO,SAAS,GAAG,OAAO;CAErD,OAAO,OAAO,OAAO,OAAO,UAAU;EACpC,IAAI,YAAY,UAAU,KAAK,UAAU,OAAO,OAAO,SAAS,GAC9D,OAAO;EAGT,IAAI,kBAAkB;EACtB,IAAI,UAAU,OAAO,SAAS,GAC5B,kBAAkB;EAGpB,MAAM,mBAAmB,MAAM,MAAM,WAAW,IAAI,EAAE,EAAE;EACxD,MAAM,eAAe,MAAM,MAAM,QAAQ,IAAI,EAAE,EAAE;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,MAAM,IAC3B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,IAAI,IACtB,CAAC,MAAM,SAAS,IAAI;GAEtB"}
@@ -2,14 +2,58 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
- import { F as isBoolean, T as assertIsPlainObject, k as isString, r as getPreciseType } from "./assertIsBoolean-BlBct0Fc.js";
11
- import { t as safeStableStringify } from "./safeStableStringify-BNh3D0K0.js";
12
- import { t as punycodeUtilsJS } from "./punyCode-hmiFzLWT.js";
10
+ import { F as isBoolean, T as assertIsPlainObject, k as isString, r as getPreciseType } from "./assertIsBoolean-DR1SaXPD.js";
11
+ import { t as safeStableStringify } from "./safeStableStringify-CXOZ9Ub8.js";
12
+ import { t as punycodeUtilsJS } from "./punyCode-8SrbMWfM.js";
13
+ /*!
14
+ * ========================================================================
15
+ * @rzl-zone/build-tools
16
+ * ------------------------------------------------------------------------
17
+ * Version: `0.0.12-beta.0`
18
+ * Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
19
+ * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
20
+ * ========================================================================
21
+ */
22
+ function isArray(value) {
23
+ return Array.isArray(value);
24
+ }
25
+ function isObject(value) {
26
+ return typeof value === "object" && !isNil(value) && !isArray(value);
27
+ }
28
+ const isNil = (value) => {
29
+ return value == null;
30
+ };
31
+ const isFunction = (value) => {
32
+ return typeof value === "function";
33
+ };
34
+ const hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);
35
+ const getRuntimeRequire = () => {
36
+ if (!hasGlobalRequire(globalThis)) return void 0;
37
+ return globalThis.require;
38
+ };
39
+ const __runtimeRequire = ((x) => {
40
+ const r = getRuntimeRequire();
41
+ if (r) return r;
42
+ if (typeof Proxy !== "undefined") return new Proxy(x, { get(target, prop) {
43
+ const r2 = getRuntimeRequire();
44
+ return r2 ? r2[prop] : target[prop];
45
+ } });
46
+ return x;
47
+ })(function(id) {
48
+ const r = getRuntimeRequire();
49
+ if (r) return r.call(this, id);
50
+ throw new Error(`Calling \`require\` for "${id}" in an environment that doesn't expose the \`require\` function.`);
51
+ });
52
+ const NEWLINE = atob("Cg==");
53
+ const EOL = hasGlobalRequire(globalThis) ? __runtimeRequire("node:os").EOL : NEWLINE;
54
+ function joinLines(...text) {
55
+ return text.filter(Boolean).join(EOL);
56
+ }
13
57
  var sldMap_default = {
14
58
  "com.ac": true,
15
59
  "net.ac": true,
@@ -1718,9 +1762,10 @@ function isValidDomain(value, options = {}) {
1718
1762
  allowLocalhost
1719
1763
  }).filter(([, value]) => !isBoolean(value));
1720
1764
  if (invalid.length) {
1721
- const msg = invalid.map(([key, value], i) => ` ${i + 1}. option: "${key}"\n expected: boolean
1722
- received: ${getPreciseType(value)} (${safeStableStringify(value, { keepUndefined: true })})`).join("\n");
1723
- throw new TypeError(`\n> Invalid options detected in second parameter of \`isValidDomain\`:\n${msg}`);
1765
+ const msg = invalid.map(([key, value], i) => {
1766
+ return joinLines(` ${i + 1}. option: "${key}"`, " expected: boolean", ` received: ${getPreciseType(value)} (${safeStableStringify(value, { keepUndefined: true })})`);
1767
+ }).join(EOL);
1768
+ throw new TypeError(joinLines("", "> Invalid options detected in second parameter of `isValidDomain`:", msg));
1724
1769
  }
1725
1770
  let _value = value.toLowerCase();
1726
1771
  if (allowProtocol) try {
@@ -1778,5 +1823,5 @@ function isValidDomain(value, options = {}) {
1778
1823
  return validLabelChars.test(label) && label.length < 64 && !label.startsWith("-") && !label.endsWith("-");
1779
1824
  });
1780
1825
  }
1781
- export { isValidDomain as t };
1782
- //# sourceMappingURL=isValidDomain-DwA2EN79.js.map
1826
+ export { EOL as n, joinLines as r, isValidDomain as t };
1827
+ //# sourceMappingURL=isValidDomain-DoE98yhJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValidDomain-DoE98yhJ.js","names":["ccTldMap","sldMap"],"sources":["../../build-tools/dist/formatter-BS3omf7k.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.ts"],"sourcesContent":["/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12-beta.0`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BS3omf7k.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,MAAM;;AAQ5B,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,MAAM;;AAKrE,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;;AAQjB,MAAM,cAAc,UAAU;CAC7B,OAAO,OAAO,UAAU;;AA2IzB,MAAM,oBAAoB,UAAU,SAAS,MAAM,IAAI,WAAW,MAAM,QAAQ;AAChF,MAAM,0BAA0B;CAC/B,IAAI,CAAC,iBAAiB,WAAW,EAAE,OAAO,KAAK;C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I,EAAE,EAAE;EACxD,MAAM,eAAe,MAAM,MAAM,QAAQ,IAAI,EAAE,EAAE;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,MAAM,IAC3B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,IAAI,IACtB,CAAC,MAAM,SAAS,IAAI;GAEtB"}
@@ -2,19 +2,19 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/utils-js
4
4
  * ------------------------------------------------------------------------
5
- * Version: `3.12.1-beta.0`
5
+ * Version: `3.12.1-beta.1`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
8
8
  * ========================================================================
9
9
  */
10
10
  "use strict";
11
11
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
12
- const require_assertIsBoolean = require('../assertIsBoolean-DozdtbNi.cjs');
13
- const require_assertIsString = require('../assertIsString-Bvk7bUL7.cjs');
14
- const require_safeStableStringify = require('../safeStableStringify-Cc62pfRp.cjs');
15
- const require_isEmptyString = require('../isEmptyString-CCK3bP74.cjs');
16
- const require_removeSpaces = require('../removeSpaces-DRRxNWlb.cjs');
17
- const require_formatEnvPort = require('../formatEnvPort-hHNvOim-.cjs');
12
+ const require_assertIsBoolean = require('../assertIsBoolean-C8WEXVr2.cjs');
13
+ const require_assertIsString = require('../assertIsString-BiHQSrB2.cjs');
14
+ const require_safeStableStringify = require('../safeStableStringify-CJtP89qn.cjs');
15
+ const require_isEmptyString = require('../isEmptyString-UiiUsSQj.cjs');
16
+ const require_removeSpaces = require('../removeSpaces-CWIvhZHg.cjs');
17
+ const require_formatEnvPort = require('../formatEnvPort-B3OLxQk9.cjs');
18
18
  function generateRoute(route, params) {
19
19
  if (!require_assertIsBoolean.isString(route) || require_isEmptyString.isEmptyString(route)) throw new TypeError(`❌ 'generateRoute' Failed:\n- Invalid 'route' value.\n- Must be of type \`string\` and non-empty string, but received: "${require_assertIsBoolean.getPreciseType(route)}": \`${require_safeStableStringify.safeStableStringify(route, { keepUndefined: true })}\`.`);
20
20
  if (!/[\\[\]]/.test(route)) return route;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["isString","isEmptyString","getPreciseType","safeStableStringify","isNil","isNonEmptyArray","isNonEmptyString","isNil","isPlainObject","isUndefined","isString","getPreciseType","normalizePathname","isError","isPlainObject","hasOwnProp","removeSpaces","formatEnvPort","removeSpaces","formatEnvPort"],"sources":["../../src/next/generateRoute.ts","../../src/next/createBeApiUrl.ts","../../src/next/getBeApiUrl.ts","../../src/next/getBaseUrl.ts"],"sourcesContent":["import type { IsAny } from \"@rzl-zone/ts-types-plus\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\n/** ---------------------------------------------------------\n * * ***Extracts dynamic route parameters from a given route string.***\n * ---------------------------------------------------------\n * **This utility type recursively searches for dynamic segments within a route,\n * extracting each parameter and constructing an object where each key represents\n * a dynamic segment and its value is of type `string`.**\n * - ***⚠️ Warning:***\n * - ***This types only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string containing potential dynamic segments.\n * @example\n * ```ts\n * type Params1 = ExtractRouteParams<\"/user/[id]\">;\n * // ➔ { id: string }\n * type Params2 = ExtractRouteParams<\"/post/[slug]/comment/[commentId]\">;\n * // ➔ { slug: string; commentId: string }\n * type Params3 = ExtractRouteParams<\"/dashboard\">;\n * // ➔ {} (no dynamic parameters)\n * ```\n */\nexport type ExtractRouteParams<T> = T extends string\n ? HasDynamicSegments<T> extends true\n ? T extends `${infer _Start}[${infer Param}]${infer Rest}`\n ? { [K in Param | keyof ExtractRouteParams<Rest>]: string }\n : unknown\n : unknown\n : unknown; // Ensures an empty object if no dynamic segments are found.\n\n/** ---------------------------------------------------------\n * * ***Determines whether a given route contains dynamic segments.***\n * ---------------------------------------------------------\n * **This type checks if the route includes at least one `[param]` pattern.\n * If it does, the result is `true`, otherwise `false`.**\n * - ***⚠️ Warning:***\n * - ***This types only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string to be evaluated.\n * @example\n * ```ts\n * type HasParams1 = HasDynamicSegments<\"/user/[id]\">;\n * // ➔ true\n * type HasParams2 = HasDynamicSegments<\"/settings/profile\">;\n * // ➔ false\n * type HasParams3 = HasDynamicSegments<\"/blog/[category]/[slug]\">;\n * // ➔ true\n * ```\n */\nexport type HasDynamicSegments<T> = T extends `${string}[${string}]${string}`\n ? true\n : false;\n\ntype GenerateRouteResult<T> =\n true extends IsAny<T> ? unknown : T extends string ? string : unknown;\n\n/** ---------------------------------\n * * ***Utility for NextJS: `generateRoute`.***\n * ---------------------------------\n * **Generates a URL by replacing dynamic route parameters with provided values.**\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string containing dynamic segments in the format `[param]`.\n * @param {T} route - The route string containing dynamic segments.\n * @param {ExtractRouteParams<T>} [params] - An object containing key-value pairs that match the dynamic segments in the route.\n * @returns {string} The formatted URL with all dynamic segments replaced.\n * @throws **{@link Error | `Error`}** if the route contains dynamic segments but no parameters object is provided.\n * @throws **{@link Error | `Error`}** if a required parameter is missing from the `params` object.\n * @throws **{@link Error | `Error`}** if a parameter value is an empty string.\n * @throws **{@link Error | `Error`}** if any parameter contains invalid characters like `?`, `&`, `=`, `#`, `/`, spaces, `'`, `\"`, `(`, `)`, `+`, `;`, `%`, `@`, or `:`, which can cause URL issues.\n * @example\n * // Basic usage\n * generateRoute(\"/user/[id]\", { id: \"123\" });\n * // ➔ \"/user/123\"\n *\n * // No dynamic segments, returns as-is\n * generateRoute(\"/dashboard\");\n * // ➔ \"/dashboard\"\n *\n * // Throws an error due to missing parameters object\n * generateRoute(\"/profile/[username]\");\n * // ➔ ❌ Error: ❌ Missing parameters object for route: \"/profile/[username]\"\n *\n * // Throws an error due to an empty parameter value\n * generateRoute(\"/post/[category]/[slug]\", { category: \"tech\", slug: \"\" });\n * // ➔ ❌ Error: ❌ Parameter \"slug\" cannot be empty in route: \"/post/[category]/[slug]\"\n *\n * // Throws an error due to parameter containing invalid characters\n * generateRoute(\"/search/[query]\", { query: \"how to?learn\" });\n * // ➔ ❌ Error: ❌ Parameter \"query\" contains invalid character \"?\" in route: \"/search/[query]\"\n *\n * // Handles leading/trailing slashes correctly\n * generateRoute(\"/blog/[category]/[slug]\", { category: \"/news/\", slug: \"/latest-update/\" });\n * // ➔ ❌ Error: ❌ Parameter \"category\" and \"slug\" contains slashes \"/\" which is not allowed.\n */\nexport function generateRoute<T extends string>(\n route: T extends string\n ? HasDynamicSegments<T> extends true\n ? T\n : never\n : never,\n params: T extends string ? ExtractRouteParams<T> : undefined\n): GenerateRouteResult<T>;\nexport function generateRoute<T extends string>(\n route: T extends string ? T : never,\n params?: Extract<ExtractRouteParams<T>, Record<string, unknown>>\n): GenerateRouteResult<T>;\nexport function generateRoute<T = unknown>(\n route: T extends string\n ? HasDynamicSegments<T> extends true\n ? T\n : unknown\n : unknown,\n params?: T extends string ? ExtractRouteParams<T> : undefined\n): unknown;\nexport function generateRoute<T>(\n route: T,\n params?: ExtractRouteParams<T>\n): string | unknown {\n //todo: Validate the route string\n if (!isString(route) || isEmptyString(route)) {\n throw new TypeError(\n `❌ 'generateRoute' Failed:\\n- Invalid 'route' value.\\n- Must be of type \\`string\\` and non-empty string, but received: \"${getPreciseType(\n route\n )}\": \\`${safeStableStringify(route, {\n keepUndefined: true\n })}\\`.`\n );\n }\n\n //todo: If no dynamic segments exist, return the route as-is immediately\n if (!/[\\\\[\\]]/.test(route)) {\n return route;\n }\n\n //todo: Validate that params is a plain object\n assertIsPlainObject(params, {\n message: ({ validType }) =>\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n- Missing or invalid parameters \\`${validType}\\` for route: \"${route}\", must be of type \\`${validType}\\` mapping parameters.`\n });\n\n //todo: Ensure parameters are provided for dynamic routes.\n if (isNil(params)) {\n throw new TypeError(\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n- Missing parameters \\`plain-object\\` for route: \"${route}\".`\n );\n }\n\n //todo: Check for invalid characters that can break the URL format\n const invalidChars = [\n \"?\",\n \"&\",\n \"#\",\n \"=\",\n \"/\",\n // \"`\",\n // \" \",\n // \".\",\n \"'\",\n // eslint-disable-next-line quotes\n '\"',\n \"(\",\n \")\",\n \"+\",\n \";\",\n \"%\",\n \"@\",\n \":\"\n ];\n\n const errors: string[] = [];\n\n const requiredKeys = Array.from(route.matchAll(/\\[(\\w+)\\]/g)).map(\n (m) => m[1] || \"\"\n );\n\n for (const key of requiredKeys) {\n const value = params[key];\n\n if (!isString(value)) {\n errors.push(\n `- Invalid parameter: \"${key}\" must be of type \\`string\\`, but received: \\`${getPreciseType(\n value\n )}\\`.`\n );\n continue;\n }\n\n if (isEmptyString(value)) {\n errors.push(`- Parameter \"${key}\" cannot be empty string.`);\n continue;\n }\n\n const foundInvalidChars = invalidChars.filter((char) =>\n value.includes(char)\n );\n\n if (/\\s/.test(value)) {\n foundInvalidChars.push(\"white-space(s)\");\n }\n\n if (foundInvalidChars.length > 0) {\n const formattedChars = foundInvalidChars.map((c) =>\n c === \"`\" ? \"backtick - (`)\" : `\\`${c}\\``\n );\n\n if (!invalidChars.includes(\"white-space(s)\"))\n invalidChars.push(\"white-space(s)\");\n\n const formattedInvalidChars = invalidChars.map((c) =>\n c === \"`\" ? \"backtick - (`)\" : `\\`${c}\\``\n );\n\n errors.push(\n `- Parameter \"${key}\" contains invalid characters (${formattedChars.join(\n \", \"\n )}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${formattedInvalidChars.join(\n \", \"\n )}).`\n );\n }\n }\n\n if (isNonEmptyArray(errors)) {\n throw new Error(\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n${errors.join(\"\\n\")}.`\n );\n }\n\n return route\n .replace(/\\[(\\w+)\\]/g, (_, key) => {\n const paramKey = isNonEmptyString(params[key]) ? params[key] : \"\";\n\n return paramKey.trim().replace(/^\\/+|\\/+$/g, \"\");\n })\n .replace(/\\/+/g, \"/\");\n}\n","import { getBeApiUrl } from \"@/next\";\nimport { normalizePathname } from \"@/urls/pathname/normalizePathname\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\ntype OptionsCreateBeApiUrl = {\n /** * The prefix pathname api url, e.g:`\"http://localhost.com/your-target-prefix-entri-point-api-is-here\"`, default: `\"/api\"`.\n *\n * @default \"/api\" */\n prefix?: string;\n /** * Option to getting `prefix` and `pathname` of api url only `(removing origin base api url)`, default: `true`.\n *\n * @default true */\n withOrigin?: boolean;\n};\n\n/** ---------------------------------\n * * ***Utility for NextJS: `createBeApiUrl`.***\n * ---------------------------------\n * **Constructs a backend API URL by appending a given pathname to the base API URL.**\n * - **ℹ️ Note:**\n * - This function builds on top of `getBeApiUrl()`.\n * - **Determines the base API URL from:**\n * - `NEXT_PUBLIC_BACKEND_API_URL` environment variable (or defaults to `\"http://localhost:8000\"`).\n * - Automatically appends `NEXT_PUBLIC_PORT_BE` if the base URL does not already include a port.\n * - **Features of this function:**\n * - Allows customizing the API path with an optional `prefix` (defaults to `\"/api\"`).\n * - Can include or exclude the origin (protocol + host) via `withOrigin`.\n * - Normalizes paths to avoid duplicate slashes.\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @param {string|null|undefined} pathname - The API endpoint path (e.g., `/users` or `/v1/posts`), defaultValue: `\"\"`.\n * @param {OptionsCreateBeApiUrl} [options] - Configuration options.\n * @param {OptionsCreateBeApiUrl[\"prefix\"]} [options.prefix=\"/api\"] - The prefix for the API path (default is `\"/api\"`).\n * @param {OptionsCreateBeApiUrl[\"withOrigin\"]} [options.withOrigin=true] - Whether to include the full base URL or return only the API path.\n * @returns {string} The formatted API URL.\n * @throws **{@link TypeError | `TypeError`}** if `withOrigin` is not a boolean.\n * @throws **{@link TypeError | `TypeError`}** if `prefix` and `pathname` is not a string.\n * @throws **{@link Error | `Error`}** if constructing the API URL fails due to an invalid base URL.\n * @example\n * createBeApiUrl(\"/users\")\n * // ➔ \"http://localhost:8000/api/users\"\n * createBeApiUrl(\"/api/users\")\n * // ➔ \"http://localhost:8000/api/users\"\n * createBeApiUrl(\"/v1\", { prefix: \"/v1\" })\n * // ➔ \"http://localhost:8000/v1\"\n * createBeApiUrl(\"/v1/users\")\n * // ➔ \"http://localhost:8000/api/v1/users\"\n * createBeApiUrl(\"/v1/users\", { prefix: \"/v1\" })\n * // ➔ \"http://localhost:8000/v1/users\"\n * createBeApiUrl(\"/users\", { withOrigin: false })\n * // ➔ \"/api/users\"\n * createBeApiUrl(null, { withOrigin: false })\n * // ➔ \"/api\"\n * createBeApiUrl(undefined, { withOrigin: false })\n * // ➔ \"/api\"\n */\nexport const createBeApiUrl = (\n /** * The pathname api url, e.g:`\"http://localhost.com/your-target-prefix-entri-point-api-is-here/your-target-pathname-is-here\"`.\n *\n * @default \"\"\n */\n pathname: string | null | undefined,\n options: OptionsCreateBeApiUrl = {}\n): string => {\n try {\n // ✅ Type checks\n assertIsString(isNil(pathname) ? \"\" : pathname, {\n message({ currentType, validType }) {\n return `First parameter (\\`pathname\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n let { prefix = \"/api\", withOrigin = true } = options;\n\n if (!isUndefined(prefix) && !isString(prefix)) {\n throw new TypeError(\n `Parameter \\`prefix\\` property of the \\`options\\` (second parameter) must be of type \\`string\\`, but received: \\`${getPreciseType(\n prefix\n )}\\`.`\n );\n }\n\n assertIsBoolean(withOrigin, {\n message: ({ currentType, validType }) =>\n `Parameter \\`withOrigin\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n // Normalize pathname\n pathname = normalizePathname(pathname);\n // Normalize prefix\n prefix = normalizePathname(prefix);\n\n const normalizedPrefix = prefix.endsWith(\"/\") ? prefix : prefix + \"/\";\n\n // Remove duplicate prefix in pathname\n if (\n pathname === prefix ||\n pathname === prefix + \"/\" ||\n pathname.startsWith(normalizedPrefix)\n ) {\n pathname = pathname.slice(prefix.length);\n pathname = normalizePathname(pathname);\n }\n\n // Get the base API URL\n const baseApiUrl = getBeApiUrl({ suffix: prefix });\n\n function joinPath(a: string, b: string) {\n return `${a.replace(/\\/+$/, \"\")}/${b.replace(/^\\/+/, \"\")}`;\n }\n\n const fullPath = withOrigin\n ? joinPath(baseApiUrl, pathname)\n : joinPath(new URL(baseApiUrl).pathname, pathname);\n\n return fullPath.replace(/\\/+$/, \"\");\n } catch (err) {\n if (isError(err)) {\n throw err;\n } else {\n throw new Error(\n \"Failed to generate backend API URL in `createBeApiUrl()`, Error: \" +\n String(err).trim(),\n { cause: err }\n );\n }\n\n // if (isError(err)) {\n // throw err;\n // } else\n // throw new Error(\n // \"Failed to generate backend API URL in `createBeApiUrl()`, Error: \" +\n // new Error(String(err)).message.trim()\n // );\n }\n};\n","import { formatEnvPort } from \"@/urls/utils/formatEnvPort\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\ntype OptionsGetBeApiUrl = {\n /** * ***The Suffix origin base api url, e.g:`http://localhost.com/api`, default: `\"/\"`.***\n *\n * @default \"/\" */\n suffix?: string;\n};\n\n/** ---------------------------------------------------\n * * ***Utility for NextJS: `getBeApiUrl`.***\n * ---------------------------------------------------\n * **This function determines the backend API base URL from the `NEXT_PUBLIC_BACKEND_API_URL` environment variable (retrieves the base API URL of the backend).**\n * - **Behavior:**\n * - If the variable is not set, it defaults to `\"http://localhost:8000\"`.\n * - It also allows adding an optional suffix to the returned URL.\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @description\n * This function determines the backend API base URL from the `NEXT_PUBLIC_BACKEND_API_URL` environment variable.\n * - If `NEXT_PUBLIC_BACKEND_API_URL` is not set, it defaults to `\"http://localhost:8000\"`.\n * - If `NEXT_PUBLIC_BACKEND_API_URL` does **not** contain a port, it appends one from `NEXT_PUBLIC_PORT_BE` if available.\n * - Supports appending optional suffix (like `\"/api\"`).\n * @param {OptionsGetBeApiUrl|undefined} options - Configuration options.\n * @param {OptionsGetBeApiUrl[\"suffix\"]} [options.suffix=\"/\"] - The suffix to append to the base API URL.\n * @returns {string} The formatted backend API base URL.\n * @throws **{@link TypeError | `TypeError`}** if `suffix` is not a `string`.\n * @throws **{@link Error | `Error`}** if `NEXT_PUBLIC_BACKEND_API_URL` is invalid.\n * @example\n * // With NEXT_PUBLIC_BACKEND_API_URL set at `*.env` file\n * NEXT_PUBLIC_BACKEND_API_URL = \"https://api.example.com\";\n * getBeApiUrl();\n * // ➔ \"https://api.example.com/\"\n *\n * // With NEXT_PUBLIC_BACKEND_API_URL but no port, using NEXT_PUBLIC_PORT_BE at `*.env` file\n * NEXT_PUBLIC_BACKEND_API_URL = \"http://localhost\";\n * NEXT_PUBLIC_PORT_BE = \"5000\";\n * getBeApiUrl({ suffix: \"/api\" });\n * // ➔ \"http://localhost:5000/api\"\n *\n * // Without NEXT_PUBLIC_BACKEND_API_URL at `*.env` file (defaults to localhost:8000)\n * delete NEXT_PUBLIC_BACKEND_API_URL;\n * getBeApiUrl({ suffix: \"/v1\" });\n * // ➔ \"http://localhost:8000/v1\"\n */\nexport const getBeApiUrl = (options: OptionsGetBeApiUrl = {}): string => {\n if (!isPlainObject(options)) options = {};\n\n let suffix = hasOwnProp(options, \"suffix\") ? options.suffix : \"/\";\n\n // Ensure suffix is a string\n assertIsString(suffix, {\n message({ currentType, validType }) {\n return `Parameter \\`suffix\\` property of the first parameter must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n try {\n let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();\n\n if (rawBaseUrl) {\n rawBaseUrl = removeSpaces(rawBaseUrl);\n // const hasPort = /:\\/\\/[^/]+:\\d+/.test(rawBaseUrl);\n const urlObj = new URL(rawBaseUrl);\n const hasPort = !!urlObj.port;\n\n if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {\n rawBaseUrl =\n urlObj.origin +\n formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {\n prefixColon: true\n });\n }\n } else {\n // fallback\n rawBaseUrl =\n \"http://localhost\" +\n formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || \"8000\", {\n prefixColon: true\n });\n }\n\n suffix = removeSpaces(suffix).length ? removeSpaces(suffix) : \"/\";\n const baseApiUrl = new URL(rawBaseUrl.replace(/\\/+$/, \"\")).origin;\n\n const finalSuffix =\n suffix === \"/\"\n ? \"/\"\n : `${suffix.startsWith(\"/\") ? \"\" : \"/\"}${suffix.replace(/\\/+$/, \"\")}`;\n\n return `${baseApiUrl}${finalSuffix}`;\n } catch (error) {\n throw new Error(\n \"Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:\" +\n error,\n { cause: error }\n );\n }\n};\n","import { formatEnvPort } from \"@/urls/utils/formatEnvPort\";\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\n\n/** ---------------------------------------------------\n * * ***Utility for NextJS: `getBaseUrl`.***\n * ---------------------------------------------------\n * **Retrieves the base URL of the application.**\n * - **Behavior:**\n * - It determines the base URL from the `NEXT_PUBLIC_BASE_URL` environment variable.\n * - If `NEXT_PUBLIC_BASE_URL` is not set, it defaults to `\"http://localhost:3000\"`.\n * - If `NEXT_PUBLIC_BASE_URL` does **not** contain a port, it appends one from `NEXT_PUBLIC_PORT_FE` if available.\n * - Ensures the final URL is valid and normalized (no trailing slashes).\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @returns {string} The resolved base URL of the application.\n * @throws **{@link Error | `Error`}** if the constructed URL is invalid or malformed.\n * @example\n * // With environment variable set at `*.env` file\n * NEXT_PUBLIC_BASE_URL = \"https://example.com\";\n * getBaseUrl();\n * // ➔ \"https://example.com\"\n *\n * // With custom port via NEXT_PUBLIC_PORT_FE at `*.env` file\n * NEXT_PUBLIC_BASE_URL = \"http://localhost\";\n * NEXT_PUBLIC_PORT_FE = \"4000\";\n * getBaseUrl();\n * // ➔ \"http://localhost:4000\"\n *\n * // Without environment variable at `*.env` file\n * delete NEXT_PUBLIC_BASE_URL;\n * getBaseUrl();\n * // ➔ \"http://localhost:3000\"\n */\nexport const getBaseUrl = (): string => {\n try {\n const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();\n const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();\n\n let baseUrl = baseEnv || \"http://localhost\";\n\n // Always clean trailing slashes first\n baseUrl = removeSpaces(baseUrl).replace(/\\/+$/, \"\");\n\n // Check if already contains port\n const hasPort = /:\\/\\/[^/]+:\\d+/.test(baseUrl);\n\n if (!hasPort && portEnv) {\n baseUrl += formatEnvPort(portEnv, { prefixColon: true });\n } else if (!hasPort && !baseEnv) {\n baseUrl += \":3000\";\n }\n\n const url = new URL(baseUrl);\n return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : \"\"}`;\n } catch (error) {\n throw new Error(\n \"Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:\" +\n error,\n { cause: error }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,cACd,OACA,QACkB;CAElB,IAAI,CAACA,iCAAS,MAAM,IAAIC,oCAAc,MAAM,EAC1C,MAAM,IAAI,UACR,0HAA0HC,uCACxH,MACD,CAAC,OAAOC,gDAAoB,OAAO,EAClC,eAAe,MAChB,CAAC,CAAC,KACJ;CAIH,IAAI,CAAC,UAAU,KAAK,MAAM,EACxB,OAAO;CAIT,4CAAoB,QAAQ,EAC1B,UAAU,EAAE,gBACV,4CAA4C,MAAM,wCAAwC,UAAU,iBAAiB,MAAM,uBAAuB,UAAU,yBAC/J,CAAC;CAGF,IAAIC,8BAAM,OAAO,EACf,MAAM,IAAI,UACR,4CAA4C,MAAM,wDAAwD,MAAM,IACjH;CAIH,MAAM,eAAe;EACnB;EACA;EACA;EACA;EACA;EAIA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CAED,MAAM,SAAmB,EAAE;CAE3B,MAAM,eAAe,MAAM,KAAK,MAAM,SAAS,aAAa,CAAC,CAAC,KAC3D,MAAM,EAAE,MAAM,GAChB;CAED,KAAK,MAAM,OAAO,cAAc;EAC9B,MAAM,QAAQ,OAAO;EAErB,IAAI,CAACJ,iCAAS,MAAM,EAAE;GACpB,OAAO,KACL,yBAAyB,IAAI,gDAAgDE,uCAC3E,MACD,CAAC,KACH;GACD;;EAGF,IAAID,oCAAc,MAAM,EAAE;GACxB,OAAO,KAAK,gBAAgB,IAAI,2BAA2B;GAC3D;;EAGF,MAAM,oBAAoB,aAAa,QAAQ,SAC7C,MAAM,SAAS,KAAK,CACrB;EAED,IAAI,KAAK,KAAK,MAAM,EAClB,kBAAkB,KAAK,iBAAiB;EAG1C,IAAI,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,CAAC;EAGN,SAASD,kCAAa,OAAO,CAAC,SAASA,kCAAa,OAAO,GAAG;EAQ9D,OAAO,GAPY,IAAI,IAAI,WAAW,QAAQ,QAAQ,GAAG,CAAC,CAAC,SAGzD,WAAW,MACP,MACA,GAAG,OAAO,WAAW,IAAI,GAAG,KAAK,MAAM,OAAO,QAAQ,QAAQ,GAAG;UAGhE,OAAO;EACd,MAAM,IAAI,MACR,2FACE,OACF,EAAE,OAAO,OAAO,CACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnEL,MAAa,mBAA2B;CACtC,IAAI;EACF,MAAM,UAAU,QAAQ,IAAI,sBAAsB,MAAM;EACxD,MAAM,UAAU,QAAQ,IAAI,qBAAqB,MAAM;EAEvD,IAAI,UAAU,WAAW;EAGzB,UAAUE,kCAAa,QAAQ,CAAC,QAAQ,QAAQ,GAAG;EAGnD,MAAM,UAAU,iBAAiB,KAAK,QAAQ;EAE9C,IAAI,CAAC,WAAW,SACd,WAAWC,oCAAc,SAAS,EAAE,aAAa,MAAM,CAAC;OACnD,IAAI,CAAC,WAAW,CAAC,SACtB,WAAW;EAGb,MAAM,MAAM,IAAI,IAAI,QAAQ;EAC5B,OAAO,GAAG,IAAI,SAAS,IAAI,IAAI,WAAW,IAAI,OAAO,IAAI,IAAI,SAAS;UAC/D,OAAO;EACd,MAAM,IAAI,MACR,mFACE,OACF,EAAE,OAAO,OAAO,CACjB"}
1
+ {"version":3,"file":"index.cjs","names":["isString","isEmptyString","getPreciseType","safeStableStringify","isNil","isNonEmptyArray","isNonEmptyString","isNil","isPlainObject","isUndefined","isString","getPreciseType","normalizePathname","isError","isPlainObject","hasOwnProp","removeSpaces","formatEnvPort","removeSpaces","formatEnvPort"],"sources":["../../src/next/generateRoute.ts","../../src/next/createBeApiUrl.ts","../../src/next/getBeApiUrl.ts","../../src/next/getBaseUrl.ts"],"sourcesContent":["import type { IsAny } from \"@rzl-zone/ts-types-plus\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\n/** ---------------------------------------------------------\n * * ***Extracts dynamic route parameters from a given route string.***\n * ---------------------------------------------------------\n * **This utility type recursively searches for dynamic segments within a route,\n * extracting each parameter and constructing an object where each key represents\n * a dynamic segment and its value is of type `string`.**\n * - ***⚠️ Warning:***\n * - ***This types only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string containing potential dynamic segments.\n * @example\n * ```ts\n * type Params1 = ExtractRouteParams<\"/user/[id]\">;\n * // ➔ { id: string }\n * type Params2 = ExtractRouteParams<\"/post/[slug]/comment/[commentId]\">;\n * // ➔ { slug: string; commentId: string }\n * type Params3 = ExtractRouteParams<\"/dashboard\">;\n * // ➔ {} (no dynamic parameters)\n * ```\n */\nexport type ExtractRouteParams<T> = T extends string\n ? HasDynamicSegments<T> extends true\n ? T extends `${infer _Start}[${infer Param}]${infer Rest}`\n ? { [K in Param | keyof ExtractRouteParams<Rest>]: string }\n : unknown\n : unknown\n : unknown; // Ensures an empty object if no dynamic segments are found.\n\n/** ---------------------------------------------------------\n * * ***Determines whether a given route contains dynamic segments.***\n * ---------------------------------------------------------\n * **This type checks if the route includes at least one `[param]` pattern.\n * If it does, the result is `true`, otherwise `false`.**\n * - ***⚠️ Warning:***\n * - ***This types only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string to be evaluated.\n * @example\n * ```ts\n * type HasParams1 = HasDynamicSegments<\"/user/[id]\">;\n * // ➔ true\n * type HasParams2 = HasDynamicSegments<\"/settings/profile\">;\n * // ➔ false\n * type HasParams3 = HasDynamicSegments<\"/blog/[category]/[slug]\">;\n * // ➔ true\n * ```\n */\nexport type HasDynamicSegments<T> = T extends `${string}[${string}]${string}`\n ? true\n : false;\n\ntype GenerateRouteResult<T> =\n true extends IsAny<T> ? unknown : T extends string ? string : unknown;\n\n/** ---------------------------------\n * * ***Utility for NextJS: `generateRoute`.***\n * ---------------------------------\n * **Generates a URL by replacing dynamic route parameters with provided values.**\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @template T - The route string containing dynamic segments in the format `[param]`.\n * @param {T} route - The route string containing dynamic segments.\n * @param {ExtractRouteParams<T>} [params] - An object containing key-value pairs that match the dynamic segments in the route.\n * @returns {string} The formatted URL with all dynamic segments replaced.\n * @throws **{@link Error | `Error`}** if the route contains dynamic segments but no parameters object is provided.\n * @throws **{@link Error | `Error`}** if a required parameter is missing from the `params` object.\n * @throws **{@link Error | `Error`}** if a parameter value is an empty string.\n * @throws **{@link Error | `Error`}** if any parameter contains invalid characters like `?`, `&`, `=`, `#`, `/`, spaces, `'`, `\"`, `(`, `)`, `+`, `;`, `%`, `@`, or `:`, which can cause URL issues.\n * @example\n * // Basic usage\n * generateRoute(\"/user/[id]\", { id: \"123\" });\n * // ➔ \"/user/123\"\n *\n * // No dynamic segments, returns as-is\n * generateRoute(\"/dashboard\");\n * // ➔ \"/dashboard\"\n *\n * // Throws an error due to missing parameters object\n * generateRoute(\"/profile/[username]\");\n * // ➔ ❌ Error: ❌ Missing parameters object for route: \"/profile/[username]\"\n *\n * // Throws an error due to an empty parameter value\n * generateRoute(\"/post/[category]/[slug]\", { category: \"tech\", slug: \"\" });\n * // ➔ ❌ Error: ❌ Parameter \"slug\" cannot be empty in route: \"/post/[category]/[slug]\"\n *\n * // Throws an error due to parameter containing invalid characters\n * generateRoute(\"/search/[query]\", { query: \"how to?learn\" });\n * // ➔ ❌ Error: ❌ Parameter \"query\" contains invalid character \"?\" in route: \"/search/[query]\"\n *\n * // Handles leading/trailing slashes correctly\n * generateRoute(\"/blog/[category]/[slug]\", { category: \"/news/\", slug: \"/latest-update/\" });\n * // ➔ ❌ Error: ❌ Parameter \"category\" and \"slug\" contains slashes \"/\" which is not allowed.\n */\nexport function generateRoute<T extends string>(\n route: T extends string\n ? HasDynamicSegments<T> extends true\n ? T\n : never\n : never,\n params: T extends string ? ExtractRouteParams<T> : undefined\n): GenerateRouteResult<T>;\nexport function generateRoute<T extends string>(\n route: T extends string ? T : never,\n params?: Extract<ExtractRouteParams<T>, Record<string, unknown>>\n): GenerateRouteResult<T>;\nexport function generateRoute<T = unknown>(\n route: T extends string\n ? HasDynamicSegments<T> extends true\n ? T\n : unknown\n : unknown,\n params?: T extends string ? ExtractRouteParams<T> : undefined\n): unknown;\nexport function generateRoute<T>(\n route: T,\n params?: ExtractRouteParams<T>\n): string | unknown {\n //todo: Validate the route string\n if (!isString(route) || isEmptyString(route)) {\n throw new TypeError(\n `❌ 'generateRoute' Failed:\\n- Invalid 'route' value.\\n- Must be of type \\`string\\` and non-empty string, but received: \"${getPreciseType(\n route\n )}\": \\`${safeStableStringify(route, {\n keepUndefined: true\n })}\\`.`\n );\n }\n\n //todo: If no dynamic segments exist, return the route as-is immediately\n if (!/[\\\\[\\]]/.test(route)) {\n return route;\n }\n\n //todo: Validate that params is a plain object\n assertIsPlainObject(params, {\n message: ({ validType }) =>\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n- Missing or invalid parameters \\`${validType}\\` for route: \"${route}\", must be of type \\`${validType}\\` mapping parameters.`\n });\n\n //todo: Ensure parameters are provided for dynamic routes.\n if (isNil(params)) {\n throw new TypeError(\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n- Missing parameters \\`plain-object\\` for route: \"${route}\".`\n );\n }\n\n //todo: Check for invalid characters that can break the URL format\n const invalidChars = [\n \"?\",\n \"&\",\n \"#\",\n \"=\",\n \"/\",\n \"'\",\n // eslint-disable-next-line quotes\n '\"',\n \"(\",\n \")\",\n \"+\",\n \";\",\n \"%\",\n \"@\",\n \":\"\n ];\n\n const errors: string[] = [];\n\n const requiredKeys = Array.from(route.matchAll(/\\[(\\w+)\\]/g)).map(\n (m) => m[1] || \"\"\n );\n\n for (const key of requiredKeys) {\n const value = params[key];\n\n if (!isString(value)) {\n errors.push(\n `- Invalid parameter: \"${key}\" must be of type \\`string\\`, but received: \\`${getPreciseType(\n value\n )}\\`.`\n );\n continue;\n }\n\n if (isEmptyString(value)) {\n errors.push(`- Parameter \"${key}\" cannot be empty string.`);\n continue;\n }\n\n const foundInvalidChars = invalidChars.filter((char) =>\n value.includes(char)\n );\n\n if (/\\s/.test(value)) {\n foundInvalidChars.push(\"white-space(s)\");\n }\n\n if (foundInvalidChars.length > 0) {\n const formattedChars = foundInvalidChars.map((c) =>\n c === \"`\" ? \"backtick - (`)\" : `\\`${c}\\``\n );\n\n if (!invalidChars.includes(\"white-space(s)\"))\n invalidChars.push(\"white-space(s)\");\n\n const formattedInvalidChars = invalidChars.map((c) =>\n c === \"`\" ? \"backtick - (`)\" : `\\`${c}\\``\n );\n\n errors.push(\n `- Parameter \"${key}\" contains invalid characters (${formattedChars.join(\n \", \"\n )}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${formattedInvalidChars.join(\n \", \"\n )}).`\n );\n }\n }\n\n if (isNonEmptyArray(errors)) {\n throw new Error(\n `❌ 'generateRoute' Failed cause in route \"${route}\":\\n${errors.join(\"\\n\")}.`\n );\n }\n\n return route\n .replace(/\\[(\\w+)\\]/g, (_, key) => {\n const paramKey = isNonEmptyString(params[key]) ? params[key] : \"\";\n\n return paramKey.trim().replace(/^\\/+|\\/+$/g, \"\");\n })\n .replace(/\\/+/g, \"/\");\n}\n","import { getBeApiUrl } from \"@/next\";\nimport { normalizePathname } from \"@/urls/pathname/normalizePathname\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\ntype OptionsCreateBeApiUrl = {\n /** * The prefix pathname api url, e.g:`\"http://localhost.com/your-target-prefix-entri-point-api-is-here\"`, default: `\"/api\"`.\n *\n * @default \"/api\" */\n prefix?: string;\n /** * Option to getting `prefix` and `pathname` of api url only `(removing origin base api url)`, default: `true`.\n *\n * @default true */\n withOrigin?: boolean;\n};\n\n/** ---------------------------------\n * * ***Utility for NextJS: `createBeApiUrl`.***\n * ---------------------------------\n * **Constructs a backend API URL by appending a given pathname to the base API URL.**\n * - **ℹ️ Note:**\n * - This function builds on top of `getBeApiUrl()`.\n * - **Determines the base API URL from:**\n * - `NEXT_PUBLIC_BACKEND_API_URL` environment variable (or defaults to `\"http://localhost:8000\"`).\n * - Automatically appends `NEXT_PUBLIC_PORT_BE` if the base URL does not already include a port.\n * - **Features of this function:**\n * - Allows customizing the API path with an optional `prefix` (defaults to `\"/api\"`).\n * - Can include or exclude the origin (protocol + host) via `withOrigin`.\n * - Normalizes paths to avoid duplicate slashes.\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @param {string|null|undefined} pathname - The API endpoint path (e.g., `/users` or `/v1/posts`), defaultValue: `\"\"`.\n * @param {OptionsCreateBeApiUrl} [options] - Configuration options.\n * @param {OptionsCreateBeApiUrl[\"prefix\"]} [options.prefix=\"/api\"] - The prefix for the API path (default is `\"/api\"`).\n * @param {OptionsCreateBeApiUrl[\"withOrigin\"]} [options.withOrigin=true] - Whether to include the full base URL or return only the API path.\n * @returns {string} The formatted API URL.\n * @throws **{@link TypeError | `TypeError`}** if `withOrigin` is not a boolean.\n * @throws **{@link TypeError | `TypeError`}** if `prefix` and `pathname` is not a string.\n * @throws **{@link Error | `Error`}** if constructing the API URL fails due to an invalid base URL.\n * @example\n * createBeApiUrl(\"/users\")\n * // ➔ \"http://localhost:8000/api/users\"\n * createBeApiUrl(\"/api/users\")\n * // ➔ \"http://localhost:8000/api/users\"\n * createBeApiUrl(\"/v1\", { prefix: \"/v1\" })\n * // ➔ \"http://localhost:8000/v1\"\n * createBeApiUrl(\"/v1/users\")\n * // ➔ \"http://localhost:8000/api/v1/users\"\n * createBeApiUrl(\"/v1/users\", { prefix: \"/v1\" })\n * // ➔ \"http://localhost:8000/v1/users\"\n * createBeApiUrl(\"/users\", { withOrigin: false })\n * // ➔ \"/api/users\"\n * createBeApiUrl(null, { withOrigin: false })\n * // ➔ \"/api\"\n * createBeApiUrl(undefined, { withOrigin: false })\n * // ➔ \"/api\"\n */\nexport const createBeApiUrl = (\n /** * The pathname api url, e.g:`\"http://localhost.com/your-target-prefix-entri-point-api-is-here/your-target-pathname-is-here\"`.\n *\n * @default \"\"\n */\n pathname: string | null | undefined,\n options: OptionsCreateBeApiUrl = {}\n): string => {\n try {\n // ✅ Type checks\n assertIsString(isNil(pathname) ? \"\" : pathname, {\n message({ currentType, validType }) {\n return `First parameter (\\`pathname\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n let { prefix = \"/api\", withOrigin = true } = options;\n\n if (!isUndefined(prefix) && !isString(prefix)) {\n throw new TypeError(\n `Parameter \\`prefix\\` property of the \\`options\\` (second parameter) must be of type \\`string\\`, but received: \\`${getPreciseType(\n prefix\n )}\\`.`\n );\n }\n\n assertIsBoolean(withOrigin, {\n message: ({ currentType, validType }) =>\n `Parameter \\`withOrigin\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n // Normalize pathname\n pathname = normalizePathname(pathname);\n // Normalize prefix\n prefix = normalizePathname(prefix);\n\n const normalizedPrefix = prefix.endsWith(\"/\") ? prefix : prefix + \"/\";\n\n // Remove duplicate prefix in pathname\n if (\n pathname === prefix ||\n pathname === prefix + \"/\" ||\n pathname.startsWith(normalizedPrefix)\n ) {\n pathname = pathname.slice(prefix.length);\n pathname = normalizePathname(pathname);\n }\n\n // Get the base API URL\n const baseApiUrl = getBeApiUrl({ suffix: prefix });\n\n function joinPath(a: string, b: string) {\n return `${a.replace(/\\/+$/, \"\")}/${b.replace(/^\\/+/, \"\")}`;\n }\n\n const fullPath = withOrigin\n ? joinPath(baseApiUrl, pathname)\n : joinPath(new URL(baseApiUrl).pathname, pathname);\n\n return fullPath.replace(/\\/+$/, \"\");\n } catch (err) {\n if (isError(err)) {\n throw err;\n } else {\n throw new Error(\n \"Failed to generate backend API URL in `createBeApiUrl()`, Error: \" +\n String(err).trim(),\n { cause: err }\n );\n }\n }\n};\n","import { formatEnvPort } from \"@/urls/utils/formatEnvPort\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\nimport { assertIsString } from \"@/assertions/strings/assertIsString\";\n\ntype OptionsGetBeApiUrl = {\n /** * ***The Suffix origin base api url, e.g:`http://localhost.com/api`, default: `\"/\"`.***\n *\n * @default \"/\" */\n suffix?: string;\n};\n\n/** ---------------------------------------------------\n * * ***Utility for NextJS: `getBeApiUrl`.***\n * ---------------------------------------------------\n * **This function determines the backend API base URL from the `NEXT_PUBLIC_BACKEND_API_URL` environment variable (retrieves the base API URL of the backend).**\n * - **Behavior:**\n * - If the variable is not set, it defaults to `\"http://localhost:8000\"`.\n * - It also allows adding an optional suffix to the returned URL.\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @description\n * This function determines the backend API base URL from the `NEXT_PUBLIC_BACKEND_API_URL` environment variable.\n * - If `NEXT_PUBLIC_BACKEND_API_URL` is not set, it defaults to `\"http://localhost:8000\"`.\n * - If `NEXT_PUBLIC_BACKEND_API_URL` does **not** contain a port, it appends one from `NEXT_PUBLIC_PORT_BE` if available.\n * - Supports appending optional suffix (like `\"/api\"`).\n * @param {OptionsGetBeApiUrl|undefined} options - Configuration options.\n * @param {OptionsGetBeApiUrl[\"suffix\"]} [options.suffix=\"/\"] - The suffix to append to the base API URL.\n * @returns {string} The formatted backend API base URL.\n * @throws **{@link TypeError | `TypeError`}** if `suffix` is not a `string`.\n * @throws **{@link Error | `Error`}** if `NEXT_PUBLIC_BACKEND_API_URL` is invalid.\n * @example\n * // With NEXT_PUBLIC_BACKEND_API_URL set at `*.env` file\n * NEXT_PUBLIC_BACKEND_API_URL = \"https://api.example.com\";\n * getBeApiUrl();\n * // ➔ \"https://api.example.com/\"\n *\n * // With NEXT_PUBLIC_BACKEND_API_URL but no port, using NEXT_PUBLIC_PORT_BE at `*.env` file\n * NEXT_PUBLIC_BACKEND_API_URL = \"http://localhost\";\n * NEXT_PUBLIC_PORT_BE = \"5000\";\n * getBeApiUrl({ suffix: \"/api\" });\n * // ➔ \"http://localhost:5000/api\"\n *\n * // Without NEXT_PUBLIC_BACKEND_API_URL at `*.env` file (defaults to localhost:8000)\n * delete NEXT_PUBLIC_BACKEND_API_URL;\n * getBeApiUrl({ suffix: \"/v1\" });\n * // ➔ \"http://localhost:8000/v1\"\n */\nexport const getBeApiUrl = (options: OptionsGetBeApiUrl = {}): string => {\n if (!isPlainObject(options)) options = {};\n\n let suffix = hasOwnProp(options, \"suffix\") ? options.suffix : \"/\";\n\n // Ensure suffix is a string\n assertIsString(suffix, {\n message({ currentType, validType }) {\n return `Parameter \\`suffix\\` property of the first parameter must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`;\n }\n });\n\n try {\n let rawBaseUrl = process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();\n\n if (rawBaseUrl) {\n rawBaseUrl = removeSpaces(rawBaseUrl);\n\n const urlObj = new URL(rawBaseUrl);\n const hasPort = !!urlObj.port;\n\n if (!hasPort && process.env.NEXT_PUBLIC_PORT_BE) {\n rawBaseUrl =\n urlObj.origin +\n formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE, {\n prefixColon: true\n });\n }\n } else {\n // fallback\n rawBaseUrl =\n \"http://localhost\" +\n formatEnvPort(process.env.NEXT_PUBLIC_PORT_BE || \"8000\", {\n prefixColon: true\n });\n }\n\n suffix = removeSpaces(suffix).length ? removeSpaces(suffix) : \"/\";\n const baseApiUrl = new URL(rawBaseUrl.replace(/\\/+$/, \"\")).origin;\n\n const finalSuffix =\n suffix === \"/\"\n ? \"/\"\n : `${suffix.startsWith(\"/\") ? \"\" : \"/\"}${suffix.replace(/\\/+$/, \"\")}`;\n\n return `${baseApiUrl}${finalSuffix}`;\n } catch (error) {\n throw new Error(\n \"Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:\" +\n error,\n { cause: error }\n );\n }\n};\n","import { formatEnvPort } from \"@/urls/utils/formatEnvPort\";\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\n\n/** ---------------------------------------------------\n * * ***Utility for NextJS: `getBaseUrl`.***\n * ---------------------------------------------------\n * **Retrieves the base URL of the application.**\n * - **Behavior:**\n * - It determines the base URL from the `NEXT_PUBLIC_BASE_URL` environment variable.\n * - If `NEXT_PUBLIC_BASE_URL` is not set, it defaults to `\"http://localhost:3000\"`.\n * - If `NEXT_PUBLIC_BASE_URL` does **not** contain a port, it appends one from `NEXT_PUBLIC_PORT_FE` if available.\n * - Ensures the final URL is valid and normalized (no trailing slashes).\n * - ***⚠️ Warning:***\n * - ***This function only support when using ***[`NextJS`](https://nextjs.org/)***.***\n * @returns {string} The resolved base URL of the application.\n * @throws **{@link Error | `Error`}** if the constructed URL is invalid or malformed.\n * @example\n * // With environment variable set at `*.env` file\n * NEXT_PUBLIC_BASE_URL = \"https://example.com\";\n * getBaseUrl();\n * // ➔ \"https://example.com\"\n *\n * // With custom port via NEXT_PUBLIC_PORT_FE at `*.env` file\n * NEXT_PUBLIC_BASE_URL = \"http://localhost\";\n * NEXT_PUBLIC_PORT_FE = \"4000\";\n * getBaseUrl();\n * // ➔ \"http://localhost:4000\"\n *\n * // Without environment variable at `*.env` file\n * delete NEXT_PUBLIC_BASE_URL;\n * getBaseUrl();\n * // ➔ \"http://localhost:3000\"\n */\nexport const getBaseUrl = (): string => {\n try {\n const baseEnv = process.env.NEXT_PUBLIC_BASE_URL?.trim();\n const portEnv = process.env.NEXT_PUBLIC_PORT_FE?.trim();\n\n let baseUrl = baseEnv || \"http://localhost\";\n\n // Always clean trailing slashes first\n baseUrl = removeSpaces(baseUrl).replace(/\\/+$/, \"\");\n\n // Check if already contains port\n const hasPort = /:\\/\\/[^/]+:\\d+/.test(baseUrl);\n\n if (!hasPort && portEnv) {\n baseUrl += formatEnvPort(portEnv, { prefixColon: true });\n } else if (!hasPort && !baseEnv) {\n baseUrl += \":3000\";\n }\n\n const url = new URL(baseUrl);\n return `${url.protocol}//${url.hostname}${url.port ? `:${url.port}` : \"\"}`;\n } catch (error) {\n throw new Error(\n \"Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:\" +\n error,\n { cause: error }\n );\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA0HA,SAAgB,cACd,OACA,QACkB;CAElB,IAAI,CAACA,iCAAS,MAAM,IAAIC,oCAAc,MAAM,EAC1C,MAAM,IAAI,UACR,0HAA0HC,uCACxH,MACD,CAAC,OAAOC,gDAAoB,OAAO,EAClC,eAAe,MAChB,CAAC,CAAC,KACJ;CAIH,IAAI,CAAC,UAAU,KAAK,MAAM,EACxB,OAAO;CAIT,4CAAoB,QAAQ,EAC1B,UAAU,EAAE,gBACV,4CAA4C,MAAM,wCAAwC,UAAU,iBAAiB,MAAM,uBAAuB,UAAU,yBAC/J,CAAC;CAGF,IAAIC,8BAAM,OAAO,EACf,MAAM,IAAI,UACR,4CAA4C,MAAM,wDAAwD,MAAM,IACjH;CAIH,MAAM,eAAe;EACnB;EACA;EACA;E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