@rzl-zone/utils-js 3.13.1 → 3.14.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/.references/index.d.cts +2 -1
- package/dist/.references/index.d.ts +2 -1
- package/dist/AbortError-DK6kpzbu.cjs +26 -0
- package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
- package/dist/AbortError-DVT8lAKn.js +20 -0
- package/dist/AbortError-DVT8lAKn.js.map +1 -0
- package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-CG7L7vlt.js} +3 -3
- package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
- package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
- package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
- package/dist/{assertIsString-CY_WkCLr.js → assertIsString-CHIwE12y.js} +4 -4
- package/dist/assertIsString-CHIwE12y.js.map +1 -0
- package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
- package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
- package/dist/assertions/index.cjs +14 -12
- package/dist/assertions/index.cjs.map +1 -1
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +10 -8
- package/dist/assertions/index.js.map +1 -1
- package/dist/conversions/index.cjs +6 -6
- package/dist/conversions/index.d.cts +2 -2
- package/dist/conversions/index.d.ts +2 -2
- package/dist/conversions/index.js +6 -6
- package/dist/conversions-BFz6MKaV.cjs +449 -0
- package/dist/conversions-BFz6MKaV.cjs.map +1 -0
- package/dist/{conversions-1s7xMBe_.js → conversions-Ben5p5Ts.js} +43 -40
- package/dist/conversions-Ben5p5Ts.js.map +1 -0
- package/dist/errors/index.cjs +13 -0
- package/dist/errors/index.d.cts +180 -0
- package/dist/errors/index.d.ts +180 -0
- package/dist/errors/index.js +11 -0
- package/dist/events/index.cjs +10 -9
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +185 -100
- package/dist/events/index.d.ts +185 -100
- package/dist/events/index.js +9 -8
- package/dist/events/index.js.map +1 -1
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
- package/dist/formatters/index.cjs +2 -2
- package/dist/formatters/index.d.cts +2 -2
- package/dist/formatters/index.d.ts +2 -2
- package/dist/formatters/index.js +2 -2
- package/dist/{formatters-C6cVZBbG.js → formatters-BAbGsnYA.js} +78 -71
- package/dist/formatters-BAbGsnYA.js.map +1 -0
- package/dist/formatters-zd0Gs4Cs.cjs +436 -0
- package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
- package/dist/generators/index.cjs +37 -31
- package/dist/generators/index.cjs.map +1 -1
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +29 -23
- package/dist/generators/index.js.map +1 -1
- package/dist/hasOwnProp-CVIhlD1i.js +47 -0
- package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
- package/dist/{index-RNQBTK8A.d.cts → index-9JsU_wMu.d.ts} +1375 -937
- package/dist/{index-ORbo-7zA.d.cts → index-BP3sUrAx.d.ts} +242 -133
- package/dist/{index-BG8wdusZ.d.cts → index-BVovC-yK.d.cts} +229 -200
- package/dist/index-C1X6ha9s.d.cts +1041 -0
- package/dist/index-CcPQZ41G.d.cts +1103 -0
- package/dist/index-CjpbuJF4.d.ts +2424 -0
- package/dist/index-CssrQyHh.d.cts +2424 -0
- package/dist/index-DZHiYYR7.d.cts +2179 -0
- package/dist/index-DZHiYYR7.d.ts +2179 -0
- package/dist/index-DlyDmXUo.d.ts +1103 -0
- package/dist/index-Dm4a___O.d.ts +1041 -0
- package/dist/{index-CRz9rSZL.d.ts → index-Dwduk7ez.d.cts} +1375 -937
- package/dist/{index-DPJ-e2JZ.d.ts → index-I5V6RbZM.d.cts} +1592 -790
- package/dist/{index-B5EBAgmC.d.cts → index-hOqBIL7F.d.ts} +1592 -790
- package/dist/{index-B1VQ6USF.d.ts → index-jyuOZMX7.d.ts} +229 -200
- package/dist/{index-ORbo-7zA.d.ts → index-lI0b7iUz.d.cts} +242 -133
- package/dist/{isBigInt-y7s3rsKc.js → isBigInt-Cez32M69.js} +2 -2
- package/dist/isBigInt-Cez32M69.js.map +1 -0
- package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
- package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
- package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-C9QLWjx2.js} +4 -4
- package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
- package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
- package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
- package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
- package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
- package/dist/isEmptyValue-kCjnLjbN.js +36 -0
- package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
- package/dist/{isFinite-DeDaBDr2.cjs → isFinite-B_hHbDpa.cjs} +6 -6
- package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
- package/dist/{isFinite-BEJFOv6B.js → isFinite-ZvNhyHlF.js} +5 -5
- package/dist/isFinite-ZvNhyHlF.js.map +1 -0
- package/dist/{isInteger-DEDbBGez.js → isInteger-aZgzTTZG.js} +4 -4
- package/dist/isInteger-aZgzTTZG.js.map +1 -0
- package/dist/{isInteger-CQLThJOR.cjs → isInteger-dnc6W63Z.cjs} +4 -4
- package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
- package/dist/isNumber-BCWD4dW0.js +20 -0
- package/dist/isNumber-BCWD4dW0.js.map +1 -0
- package/dist/isNumber-BkzwAe50.cjs +26 -0
- package/dist/isNumber-BkzwAe50.cjs.map +1 -0
- package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
- package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
- package/dist/{isServer-q3o6cSwD.js → isServer-CQzrX5e0.js} +2 -2
- package/dist/isServer-CQzrX5e0.js.map +1 -0
- package/dist/{isServer-DmycqWsF.cjs → isServer-DhFaedeT.cjs} +2 -2
- package/dist/isServer-DhFaedeT.cjs.map +1 -0
- package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
- package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
- package/dist/{isEqual-DM4S_kWh.js → isTypedArray-DxsPKrLh.js} +29 -9
- package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
- package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-CDtNOhMc.js} +13 -54
- package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
- package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
- package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
- package/dist/{assertIsBoolean-CWUs-I5l.js → logger-CLWnKRKE.js} +657 -587
- package/dist/logger-CLWnKRKE.js.map +1 -0
- package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-CUacYy3D.cjs} +658 -612
- package/dist/logger-CUacYy3D.cjs.map +1 -0
- package/dist/{noop-BY43WaoU.cjs → noop-CjEbNsJL.cjs} +2 -2
- package/dist/noop-CjEbNsJL.cjs.map +1 -0
- package/dist/{noop-CjY8xVHv.js → noop-qxrcogt5.js} +2 -2
- package/dist/noop-qxrcogt5.js.map +1 -0
- package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
- package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
- package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
- package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
- package/dist/operations/index.cjs +152 -22
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.d.cts +257 -35
- package/dist/operations/index.d.ts +257 -35
- package/dist/operations/index.js +142 -13
- package/dist/operations/index.js.map +1 -1
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +238 -180
- package/dist/parsers/index.d.ts +238 -180
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-B8KYXIjE.js → parsers-BBAE_xVM.js} +9 -8
- package/dist/parsers-BBAE_xVM.js.map +1 -0
- package/dist/{parsers-B_FPX35n.cjs → parsers-i8WEeMJl.cjs} +10 -9
- package/dist/parsers-i8WEeMJl.cjs.map +1 -0
- package/dist/{parsing-Bfaw85Hd.js → parsing-D9tbKQ0v.js} +3 -3
- package/dist/parsing-D9tbKQ0v.js.map +1 -0
- package/dist/{parsing-BCZGco7n.cjs → parsing-DGjB8cwr.cjs} +4 -4
- package/dist/parsing-DGjB8cwr.cjs.map +1 -0
- package/dist/predicates/index.cjs +43 -43
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -14
- package/dist/{predicates-KlyOvBSC.js → predicates-C0dova7l.js} +45 -40
- package/dist/predicates-C0dova7l.js.map +1 -0
- package/dist/{predicates-8y28VrbT.cjs → predicates-Dd7To7B4.cjs} +89 -84
- package/dist/predicates-Dd7To7B4.cjs.map +1 -0
- package/dist/promises/index.cjs +27 -26
- package/dist/promises/index.cjs.map +1 -1
- package/dist/promises/index.d.cts +227 -75
- package/dist/promises/index.d.ts +227 -75
- package/dist/promises/index.js +27 -26
- package/dist/promises/index.js.map +1 -1
- package/dist/{punyCode-DnKi0qjS.cjs → punyCode-DHTLhGdD.cjs} +12 -12
- package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
- package/dist/{punyCode-Dwto1RpA.js → punyCode-Deb1Mrkc.js} +12 -12
- package/dist/punyCode-Deb1Mrkc.js.map +1 -0
- package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BPnsdRN0.js} +4 -4
- package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
- package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
- package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
- package/dist/rzl-utils.global.js +13 -13
- package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
- package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
- package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DEVKNDSn.js} +29 -28
- package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
- package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-DfwxmiWn.js} +20 -13
- package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
- package/dist/strings/index.cjs +26 -30
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +13 -17
- package/dist/strings/index.js.map +1 -1
- package/dist/tailwind/index.cjs +3 -3
- package/dist/tailwind/index.d.cts +3 -3
- package/dist/tailwind/index.d.ts +3 -3
- package/dist/tailwind/index.js +3 -3
- package/dist/{tailwind-DUuboq52.cjs → tailwind-BG7B0cDs.cjs} +59 -53
- package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
- package/dist/{tailwind-CUdmv-oO.js → tailwind-tJNnFPsF.js} +38 -32
- package/dist/tailwind-tJNnFPsF.js.map +1 -0
- package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
- package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
- package/dist/urls/index.cjs +3 -3
- package/dist/urls/index.d.cts +635 -443
- package/dist/urls/index.d.ts +635 -443
- package/dist/urls/index.js +3 -3
- package/dist/{urls-BXT4Krsq.js → urls-EoWslGgg.js} +50 -41
- package/dist/urls-EoWslGgg.js.map +1 -0
- package/dist/urls-NCzPepe2.cjs +308 -0
- package/dist/urls-NCzPepe2.cjs.map +1 -0
- package/package.json +6 -6
- package/dist/assertIsArray-CeXL4xv5.cjs.map +0 -1
- package/dist/assertIsArray-HgzPQIAM.js.map +0 -1
- package/dist/assertIsBoolean-CWUs-I5l.js.map +0 -1
- package/dist/assertIsBoolean-D41HrTB_.cjs.map +0 -1
- package/dist/assertIsString-CY_WkCLr.js.map +0 -1
- package/dist/assertIsString-DUrVt82d.cjs.map +0 -1
- package/dist/conversions-1s7xMBe_.js.map +0 -1
- package/dist/conversions-B3Rf8uId.cjs +0 -446
- package/dist/conversions-B3Rf8uId.cjs.map +0 -1
- package/dist/formatters-C6cVZBbG.js.map +0 -1
- package/dist/formatters-aEAAuzjx.cjs +0 -429
- package/dist/formatters-aEAAuzjx.cjs.map +0 -1
- package/dist/index-CPCt6_Wq.d.cts +0 -765
- package/dist/index-CPCt6_Wq.d.ts +0 -765
- package/dist/index-DBwNa1iO.d.ts +0 -947
- package/dist/index-DPTYOQkn.d.cts +0 -947
- package/dist/index-Dig1fIhZ.d.cts +0 -1716
- package/dist/index-Dig1fIhZ.d.ts +0 -1716
- package/dist/isBigInt-BVj0M5pq.cjs.map +0 -1
- package/dist/isBigInt-y7s3rsKc.js.map +0 -1
- package/dist/isEmptyObject-BsHngDz4.cjs +0 -37
- package/dist/isEmptyObject-BsHngDz4.cjs.map +0 -1
- package/dist/isEmptyObject-DPGR9iPj.js +0 -25
- package/dist/isEmptyObject-DPGR9iPj.js.map +0 -1
- package/dist/isEmptyString-BYMz_wt9.js.map +0 -1
- package/dist/isEmptyString-C8PYNPgw.cjs.map +0 -1
- package/dist/isEmptyValue-BXf7f1jz.cjs +0 -30
- package/dist/isEmptyValue-BXf7f1jz.cjs.map +0 -1
- package/dist/isEmptyValue-D4OHTB3u.js +0 -24
- package/dist/isEmptyValue-D4OHTB3u.js.map +0 -1
- package/dist/isEqual-DM4S_kWh.js.map +0 -1
- package/dist/isEqual-DaPDxMyw.cjs.map +0 -1
- package/dist/isFinite-BEJFOv6B.js.map +0 -1
- package/dist/isFinite-DeDaBDr2.cjs.map +0 -1
- package/dist/isInteger-CQLThJOR.cjs.map +0 -1
- package/dist/isInteger-DEDbBGez.js.map +0 -1
- package/dist/isPlainObject-BwTkj3G0.d.cts +0 -339
- package/dist/isPlainObject-BwTkj3G0.d.ts +0 -339
- package/dist/isServer-DmycqWsF.cjs.map +0 -1
- package/dist/isServer-q3o6cSwD.js.map +0 -1
- package/dist/isTypedArray-BQLbLXsU.cjs +0 -43
- package/dist/isTypedArray-BQLbLXsU.cjs.map +0 -1
- package/dist/isTypedArray-XiBnifLN.js +0 -31
- package/dist/isTypedArray-XiBnifLN.js.map +0 -1
- package/dist/isValidDomain-B8Nukgw0.js.map +0 -1
- package/dist/isValidDomain-ZbyeGOO9.cjs.map +0 -1
- package/dist/noop-BY43WaoU.cjs.map +0 -1
- package/dist/noop-CjY8xVHv.js.map +0 -1
- package/dist/normalizeSpaces-BhZp0U_6.cjs.map +0 -1
- package/dist/normalizeSpaces-BoUDtq5P.js.map +0 -1
- package/dist/parsers-B8KYXIjE.js.map +0 -1
- package/dist/parsers-B_FPX35n.cjs.map +0 -1
- package/dist/parsing-BCZGco7n.cjs.map +0 -1
- package/dist/parsing-Bfaw85Hd.js.map +0 -1
- package/dist/predicates-8y28VrbT.cjs.map +0 -1
- package/dist/predicates-KlyOvBSC.js.map +0 -1
- package/dist/punyCode-DnKi0qjS.cjs.map +0 -1
- package/dist/punyCode-Dwto1RpA.js.map +0 -1
- package/dist/removeSpaces--8NW-HSx.js.map +0 -1
- package/dist/removeSpaces-CmrrkeXz.cjs.map +0 -1
- package/dist/safeJsonParse-OnUwG2El.js.map +0 -1
- package/dist/safeJsonParse-sFqVXf-e.cjs +0 -208
- package/dist/safeJsonParse-sFqVXf-e.cjs.map +0 -1
- package/dist/safeStableStringify-B2KTTS3r.js.map +0 -1
- package/dist/safeStableStringify-Cmi6GyWj.cjs +0 -106
- package/dist/safeStableStringify-Cmi6GyWj.cjs.map +0 -1
- package/dist/tailwind-CUdmv-oO.js.map +0 -1
- package/dist/tailwind-DUuboq52.cjs.map +0 -1
- package/dist/toStringArrayUnRecursive-OOHGazks.js.map +0 -1
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs +0 -51
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs.map +0 -1
- package/dist/urls-BL9C_yU3.cjs +0 -299
- package/dist/urls-BL9C_yU3.cjs.map +0 -1
- package/dist/urls-BXT4Krsq.js.map +0 -1
package/dist/urls/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
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 { t as punycodeUtilsJS } from "../punyCode-
|
|
11
|
-
import { a as extractURLs, i as normalizePathname, n as getPrefixPathname, o as constructURL, r as getFirstPrefixPathname, t as formatEnvPort } from "../urls-
|
|
10
|
+
import { t as punycodeUtilsJS } from "../punyCode-Deb1Mrkc.js";
|
|
11
|
+
import { a as extractURLs, i as normalizePathname, n as getPrefixPathname, o as constructURL, r as getFirstPrefixPathname, t as formatEnvPort } from "../urls-EoWslGgg.js";
|
|
12
12
|
export { constructURL, extractURLs, formatEnvPort, getFirstPrefixPathname, getPrefixPathname, normalizePathname, punycodeUtilsJS };
|
|
@@ -2,38 +2,43 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
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 { A as
|
|
11
|
-
import { t as
|
|
12
|
-
import { t as
|
|
13
|
-
import { t as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import {
|
|
18
|
-
import { n as
|
|
10
|
+
import { A as isFunction, E as isPlainObject, O as isArray, T as isString, b as isError, i as getPreciseType, j as isBoolean, k as isNil, m as isNonEmptyArray, n as assertIsBoolean, p as isSet, t as createMessage, w as isNonEmptyString, x as isNull } from "./logger-CLWnKRKE.js";
|
|
11
|
+
import { t as isNumber } from "./isNumber-BCWD4dW0.js";
|
|
12
|
+
import { t as assertIsArray } from "./assertIsArray-CG7L7vlt.js";
|
|
13
|
+
import { t as assertIsPlainObject } from "./assertIsPlainObject-j9bDqNLo.js";
|
|
14
|
+
import { t as isEmptyValue } from "./isEmptyValue-kCjnLjbN.js";
|
|
15
|
+
import { t as toStringArrayUnRecursive } from "./toStringArrayUnRecursive-D0WbLIRz.js";
|
|
16
|
+
import { r as isUndefined, t as safeStableStringify } from "./safeStableStringify-DfwxmiWn.js";
|
|
17
|
+
import { t as isEmptyString } from "./isEmptyString-C9QLWjx2.js";
|
|
18
|
+
import { n as isURL, t as isValidDomain } from "./isValidDomain-CDtNOhMc.js";
|
|
19
|
+
import { t as isInteger } from "./isInteger-aZgzTTZG.js";
|
|
20
|
+
import { n as joinLines, t as EOL } from "./formatter-ekJQF_bA-xLD9mGk4.js";
|
|
21
|
+
import { n as normalizeString, t as removeSpaces } from "./removeSpaces-BPnsdRN0.js";
|
|
19
22
|
const constructURL = (baseUrl, queryParams, removeParams) => {
|
|
20
23
|
if (isString(baseUrl)) {
|
|
21
|
-
if (isEmptyString(baseUrl)) throw new TypeError("First parameter (`baseUrl`) cannot be an empty-string.");
|
|
24
|
+
if (isEmptyString(baseUrl)) throw new TypeError(errorMsg$4("First parameter (`baseUrl`) cannot be an empty-string."));
|
|
22
25
|
baseUrl = normalizeString(baseUrl);
|
|
23
|
-
} else if (!isURL(baseUrl)) throw new TypeError(`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${getPreciseType(baseUrl)}\`, with current value: \`${safeStableStringify(baseUrl, { keepUndefined: true })}\`.`);
|
|
26
|
+
} else if (!isURL(baseUrl)) throw new TypeError(errorMsg$4(`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${getPreciseType(baseUrl)}\`, with current value: \`${safeStableStringify(baseUrl, { keepUndefined: true })}\`.`));
|
|
24
27
|
if (!isUndefined(removeParams)) {
|
|
25
|
-
assertIsArray(removeParams, { message: ({ currentType, validType }) =>
|
|
26
|
-
|
|
28
|
+
assertIsArray(removeParams, { message: ({ currentType, validType }) => {
|
|
29
|
+
return errorMsg$4(`Third parameter (\`removeParams\`) must be of type \`${validType} of strings\`, but received: \`${currentType}\`.`);
|
|
30
|
+
} });
|
|
31
|
+
if (!removeParams.every((param) => isNonEmptyString(param))) throw new TypeError(errorMsg$4("Third parameter (`removeParams`) must be of type `array` and contains `string` only and non empty-string."));
|
|
27
32
|
}
|
|
28
33
|
try {
|
|
29
|
-
if (!isUndefined(queryParams) && !isFunction(queryParams[Symbol.iterator])) throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(queryParams)}\`, with value: \`${safeStableStringify(queryParams, { keepUndefined: true })}\`.`);
|
|
34
|
+
if (!isUndefined(queryParams) && !isFunction(queryParams[Symbol.iterator])) throw new TypeError(errorMsg$4(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(queryParams)}\`, with value: \`${safeStableStringify(queryParams, { keepUndefined: true })}\`.`));
|
|
30
35
|
const urlInstance = new URL(baseUrl);
|
|
31
36
|
if (!isUndefined(queryParams)) {
|
|
32
37
|
const paramObject = Object.fromEntries(queryParams);
|
|
33
38
|
if (!isEmptyValue(paramObject)) {
|
|
34
39
|
const mergedParams = new URLSearchParams(urlInstance.search);
|
|
35
40
|
for (const [key, value] of Object.entries(paramObject)) {
|
|
36
|
-
if (!isNonEmptyString(value) && !isNumber(value, { includeNaN: true })) throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(queryParams)}\`, with value: \`${safeStableStringify(queryParams, { keepUndefined: true })}\`.`);
|
|
41
|
+
if (!isNonEmptyString(value) && !isNumber(value, { includeNaN: true })) throw new TypeError(errorMsg$4(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(queryParams)}\`, with value: \`${safeStableStringify(queryParams, { keepUndefined: true })}\`.`));
|
|
37
42
|
mergedParams.set(key, String(value));
|
|
38
43
|
}
|
|
39
44
|
if (removeParams?.length) toStringArrayUnRecursive(removeParams).map((paramKey) => {
|
|
@@ -45,10 +50,11 @@ const constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
45
50
|
removeParams?.forEach((param) => urlInstance.searchParams.delete(param));
|
|
46
51
|
return urlInstance;
|
|
47
52
|
} catch (error) {
|
|
48
|
-
|
|
49
|
-
throw new Error(
|
|
53
|
+
const message = isError(error) ? error.message : String(error);
|
|
54
|
+
throw new Error(errorMsg$4(`Failed to construct a valid URL: ${message}`), { cause: error });
|
|
50
55
|
}
|
|
51
56
|
};
|
|
57
|
+
const errorMsg$4 = (msg) => createMessage("constructURL", msg);
|
|
52
58
|
const extractURLs = (url) => {
|
|
53
59
|
if (!isNonEmptyString(url)) return null;
|
|
54
60
|
let decoded;
|
|
@@ -91,32 +97,29 @@ var NormalizePathnameError = class NormalizePathnameError extends Error {
|
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
};
|
|
94
|
-
function normalizePathname(pathname, options = {
|
|
95
|
-
defaultPath: "/",
|
|
96
|
-
keepNullable: false
|
|
97
|
-
}) {
|
|
100
|
+
function normalizePathname(pathname, options = {}) {
|
|
98
101
|
assertIsPlainObject(options, { message({ currentType, validType }) {
|
|
99
|
-
return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}
|
|
102
|
+
return errorMsg$3(`Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`);
|
|
100
103
|
} });
|
|
101
|
-
|
|
102
|
-
if (!isNonEmptyString(defaultPath)) throw new TypeError(`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${getPreciseType(defaultPath)}\`, with value: \`${safeStableStringify(defaultPath, { keepUndefined: true })}\`.`);
|
|
104
|
+
let { defaultPath = "/", keepNullable = false, keepTrailingSlash = false, localhostDomain = false, ignoreDomainExtensions = void 0 } = options;
|
|
105
|
+
if (!isNonEmptyString(defaultPath)) throw new TypeError(errorMsg$3(`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${getPreciseType(defaultPath)}\`, with value: \`${safeStableStringify(defaultPath, { keepUndefined: true })}\`.`));
|
|
103
106
|
assertIsBoolean(keepNullable, { message({ currentType, validType }) {
|
|
104
|
-
return `Parameter \`keepNullable\` property of the \`options\` (second parameter)
|
|
107
|
+
return errorMsg$3(`Parameter \`keepNullable\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`);
|
|
105
108
|
} });
|
|
106
109
|
assertIsBoolean(keepTrailingSlash, { message({ currentType, validType }) {
|
|
107
|
-
return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter)
|
|
110
|
+
return errorMsg$3(`Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`);
|
|
108
111
|
} });
|
|
109
112
|
assertIsBoolean(localhostDomain, { message({ currentType, validType }) {
|
|
110
|
-
return `Parameter \`localhostDomain\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}
|
|
113
|
+
return errorMsg$3(`Parameter \`localhostDomain\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`);
|
|
111
114
|
} });
|
|
112
115
|
let ignoreDomainExtsSet;
|
|
113
116
|
if (!isUndefined(ignoreDomainExtensions)) {
|
|
114
|
-
if (!isSet(ignoreDomainExtensions) && !isArray(ignoreDomainExtensions)) throw new TypeError(`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${getPreciseType(ignoreDomainExtensions)}\`.`);
|
|
117
|
+
if (!isSet(ignoreDomainExtensions) && !isArray(ignoreDomainExtensions)) throw new TypeError(errorMsg$3(`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${getPreciseType(ignoreDomainExtensions)}\`.`));
|
|
115
118
|
ignoreDomainExtsSet = isSet(ignoreDomainExtensions) ? ignoreDomainExtensions : new Set(ignoreDomainExtensions);
|
|
116
119
|
let idx = 0;
|
|
117
120
|
for (const ext of ignoreDomainExtsSet) {
|
|
118
|
-
if (!isNonEmptyString(ext)) throw new TypeError(`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${safeStableStringify(ext, { keepUndefined: true })}\`.`);
|
|
119
|
-
if (!ext.startsWith(".")) throw new TypeError(`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${safeStableStringify(ext, { keepUndefined: true })}`);
|
|
121
|
+
if (!isNonEmptyString(ext)) throw new TypeError(errorMsg$3(`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${safeStableStringify(ext, { keepUndefined: true })}\`.`));
|
|
122
|
+
if (!ext.startsWith(".")) throw new TypeError(errorMsg$3(`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${safeStableStringify(ext, { keepUndefined: true })}`));
|
|
120
123
|
idx++;
|
|
121
124
|
}
|
|
122
125
|
}
|
|
@@ -151,6 +154,7 @@ function normalizePathname(pathname, options = {
|
|
|
151
154
|
throwError(error);
|
|
152
155
|
}
|
|
153
156
|
}
|
|
157
|
+
const errorMsg$3 = (msg) => createMessage("normalizePathname", msg);
|
|
154
158
|
const decodeUnicodeSequences = (str) => {
|
|
155
159
|
return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {
|
|
156
160
|
try {
|
|
@@ -200,13 +204,13 @@ const ensureLeadingSlash = (path) => {
|
|
|
200
204
|
return path;
|
|
201
205
|
};
|
|
202
206
|
const throwError = (error) => {
|
|
203
|
-
const
|
|
204
|
-
throw new NormalizePathnameError(`Failed to normalize pathname
|
|
207
|
+
const originalError = isError(error) ? error : new Error(String(error));
|
|
208
|
+
throw new NormalizePathnameError(errorMsg$3(`Failed to normalize pathname: ${originalError.message}`), originalError);
|
|
205
209
|
};
|
|
206
210
|
const getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
207
|
-
if (!isNonEmptyString(defaultValue)) throw new TypeError(`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${getPreciseType(defaultValue)}\`, with value: \`${safeStableStringify(defaultValue, { keepUndefined: true })}\`.`);
|
|
211
|
+
if (!isNonEmptyString(defaultValue)) throw new TypeError(errorMsg$2(`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${getPreciseType(defaultValue)}\`, with value: \`${safeStableStringify(defaultValue, { keepUndefined: true })}\`.`));
|
|
208
212
|
if (isArray(result)) {
|
|
209
|
-
if (!result.every((item) => isString(item))) throw new TypeError(`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${getPreciseType(result)}\`, with value: \`${safeStableStringify(result, { keepUndefined: true })}\`.`);
|
|
213
|
+
if (!result.every((item) => isString(item))) throw new TypeError(errorMsg$2(`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${getPreciseType(result)}\`, with value: \`${safeStableStringify(result, { keepUndefined: true })}\`.`));
|
|
210
214
|
for (const item of result) {
|
|
211
215
|
const normalized = normalizePathname(item);
|
|
212
216
|
if (normalized !== "/") return normalized;
|
|
@@ -217,9 +221,10 @@ const getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
|
217
221
|
const normalized = normalizePathname(result);
|
|
218
222
|
return normalized !== "/" ? normalized : normalizePathname(defaultValue);
|
|
219
223
|
}
|
|
220
|
-
if (!isNil(result)) throw new TypeError(`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${getPreciseType(result)}\`.`);
|
|
224
|
+
if (!isNil(result)) throw new TypeError(errorMsg$2(`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${getPreciseType(result)}\`.`));
|
|
221
225
|
return normalizePathname(defaultValue);
|
|
222
226
|
};
|
|
227
|
+
const errorMsg$2 = (msg) => createMessage("getFirstPrefixPathname", msg);
|
|
223
228
|
const getPrefixPathname = (url, base = null, options = {}) => {
|
|
224
229
|
const errors = [];
|
|
225
230
|
if (!isString(url) && !isArray(url)) errors.push(`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${getPreciseType(url)}\`.`);
|
|
@@ -228,7 +233,7 @@ const getPrefixPathname = (url, base = null, options = {}) => {
|
|
|
228
233
|
const { levels = 1, removeDuplicates = true } = options;
|
|
229
234
|
if (!isInteger(levels) || isInteger(levels) && levels < 0) errors.push(`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${getPreciseType(levels)}\`, with value: \`${safeStableStringify(levels, { keepUndefined: true })}\`.`);
|
|
230
235
|
if (!isBoolean(removeDuplicates)) errors.push(`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${getPreciseType(removeDuplicates)}\`.`);
|
|
231
|
-
if (isNonEmptyArray(errors)) throw new TypeError(joinLines("Invalid parameter(s)
|
|
236
|
+
if (isNonEmptyArray(errors)) throw new TypeError(errorMsg$1(joinLines("Invalid parameter(s) function:", `- ${errors.join(`${EOL}- `)}`)));
|
|
232
237
|
function getLevel(singleUrl) {
|
|
233
238
|
return `/${normalizePathname(singleUrl).split("/").filter(Boolean).slice(0, levels).join("/")}`;
|
|
234
239
|
}
|
|
@@ -250,14 +255,18 @@ const getPrefixPathname = (url, base = null, options = {}) => {
|
|
|
250
255
|
}
|
|
251
256
|
return processUrl(url);
|
|
252
257
|
};
|
|
258
|
+
const errorMsg$1 = (msg) => createMessage("getPrefixPathname", msg);
|
|
259
|
+
const errorMsg = (msg) => createMessage("formatEnvPort", msg);
|
|
253
260
|
const formatEnvPort = (envVar, options = {}) => {
|
|
254
261
|
if (!isNonEmptyString(envVar)) return "";
|
|
255
|
-
assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
256
|
-
const prefixColon =
|
|
257
|
-
|
|
262
|
+
assertIsPlainObject(options, { message: ({ currentType, validType }) => errorMsg(`Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
263
|
+
const { prefixColon = false } = options;
|
|
264
|
+
assertIsBoolean(prefixColon, { message({ currentType, validType }) {
|
|
265
|
+
return errorMsg(`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`);
|
|
266
|
+
} });
|
|
258
267
|
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
259
268
|
if (isEmptyString(digitsOnly)) return "";
|
|
260
269
|
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
261
270
|
};
|
|
262
271
|
export { extractURLs as a, normalizePathname as i, getPrefixPathname as n, constructURL as o, getFirstPrefixPathname as r, formatEnvPort as t };
|
|
263
|
-
//# sourceMappingURL=urls-
|
|
272
|
+
//# sourceMappingURL=urls-EoWslGgg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urls-EoWslGgg.js","names":["errorMsg","errorMsg","errorMsg","errorMsg"],"sources":["../src/urls/builders/constructURL.ts","../src/urls/extractors/extractURLs.ts","../src/urls/_private/NormalizePathnameError.ts","../src/urls/pathname/normalizePathname.ts","../src/urls/pathname/getFirstPrefixPathname.ts","../src/urls/pathname/getPrefixPathname.ts","../src/urls/utils/formatEnvPort.ts"],"sourcesContent":["import { createMessage } from \"@/_private/logger\";\n\nimport { isURL } from \"@/predicates/is/isURL\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isEmptyValue } from \"@/predicates/is/isEmptyValue\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nimport { normalizeString } from \"@/strings/sanitizations/normalizeString\";\n\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\nimport { toStringArrayUnRecursive } from \"@/conversions/arrays/casts/toStringArrayUnRecursive\";\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `QueryParamPairs`.***\n * ----------------------------------------------------------\n * **Represents a non-empty array of key–value pairs.**\n *\n * ---\n * @description\n * Type for `queryParams` parameter, the second parameter of ***`constructURL` utility function***.\n *\n * ---\n * - **Behavior:**\n * - Each inner tuple strictly follows the `[string, string | number]` shape.\n * - Ensures the outer array contains **at least one pair** (non-empty).\n * - Commonly used for URL construction parameters,\n * query string segments, or other key–value structured data.\n *\n * ---\n * @example\n * 1. #### Valid usage:\n * ```ts\n * const params: QueryParamPairs = [\n * [\"foo\", 1],\n * [\"bar\", \"baz\"]\n * ];\n * constructURL(\"https://example.com\", params);\n * ```\n * ---\n * 2. #### Invalid: must contain at least one item:\n * ```ts\n * const empty: QueryParamPairs = [];\n * ```\n * ---\n * 3. #### Invalid: key without value pairs:\n * ```ts\n * const empty2: QueryParamPairs = [[\"key\"]];\n * ```\n */\nexport type QueryParamPairs = [\n [string, string | number],\n ...[string, string | number][]\n];\n\n/** ---------------------------------------------------------------------------------------------------\n * * ***Utility: `constructURL`.***\n * ----------------------------------------------------------------------------------------------------\n * **Constructs a valid URL with optional query parameters and allows selective removal\n * of duplicate parameters.**\n *\n * ---\n * @param {string | URL} baseUrl\n * The base URL to build upon. Must include protocol (e.g., `\"https://\"`), `domain`, and may include port and existing query parameters.\n * @param {Iterable<[string, string]> | URLSearchParamsIterator<[string, string]> | QueryParamPairs} [queryParams]\n * Additional query parameters to append or overwrite on the URL.\n * - Accepts any iterable of key-value pairs (like `new URLSearchParams().entries()` and `[[string, string | number]...]`).\n * @param {string[]} [removeParams]\n * A list of query parameter keys to remove from the final URL, whether they were in the base URL or provided queryParams.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}** if `baseUrl` is not a valid non-empty string or URL object, or if `queryParams` is not iterable, or\n * if `removeParams` is not an array of strings.\n *\n * ---\n * @returns {URL} A new URL object representing the constructed URL with merged and cleaned query parameters.\n *\n * ---\n * @example\n * 1. #### Basic Usage:\n * ```ts\n * constructURL(\n * \"https://example.com/path\",\n * new URLSearchParams({ a: \"1\", b: \"2\" }).entries()\n * );\n * ```\n * #### Result ➔ `URL { href: \"https://example.com/path?a=1&b=2\", ... }`\n * ---\n * 2. #### Remove parameters from Base and Added:\n * - #### With `new URLSearchParams({ ... }).entries();`:\n * ```ts\n * constructURL(\n * \"https://example.com/path?foo=1&bar=2\",\n * new URLSearchParams({ bar: \"ignored\", baz: \"3\" }).entries(),\n * [\"bar\"]\n * );\n * ```\n * #### Result ➔ `URL { href: \"https://example.com/path?foo=1&baz=3\", ... }`\n * ---\n *\n * - #### With `[[string, string | number]...]`:\n * ```ts\n * constructURL(\n * \"https://example.com/path?foo=1&bar=2\",\n * [[\"bar\", \"ignored\"],[\"baz\", 3]],\n * [\"bar\"]\n * );\n * ```\n * #### Result ➔ `URL { href: \"https://example.com/path?foo=1&baz=3\", ... }`\n * ---\n *\n * - #### With separated variable and `[[string, number]...]` :\n * ```ts\n * const params: QueryParamPairs = [\n * [\"foo\", 1],\n * [\"bar\", 2],\n * [\"baz\", 3]\n * ];\n *\n * constructURL(\"https://example.com\", params, [\"bar\"]);\n * ```\n * #### Result ➔ `URL { href: \"https://example.com/?foo=1&baz=3\", ... }`\n */\nexport const constructURL = (\n baseUrl: string | URL,\n queryParams?:\n | URLSearchParamsIterator<[string, string | number]>\n | QueryParamPairs,\n removeParams?: string[]\n): URL => {\n if (isString(baseUrl)) {\n if (isEmptyString(baseUrl)) {\n throw new TypeError(\n errorMsg(\"First parameter (`baseUrl`) cannot be an empty-string.\")\n );\n }\n baseUrl = normalizeString(baseUrl);\n } else if (!isURL(baseUrl)) {\n throw new TypeError(\n errorMsg(\n `First parameter (\\`baseUrl\\`) must be of type an URL instance or a \\`string\\` and a non empty-string, but received: \\`${getPreciseType(\n baseUrl\n )}\\`, with current value: \\`${safeStableStringify(baseUrl, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n // Check removeParams\n if (!isUndefined(removeParams)) {\n assertIsArray(removeParams, {\n message: ({ currentType, validType }) => {\n return errorMsg(\n `Third parameter (\\`removeParams\\`) must be of type \\`${validType} of strings\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n if (!removeParams.every((param) => isNonEmptyString(param))) {\n throw new TypeError(\n errorMsg(\n \"Third parameter (`removeParams`) must be of type `array` and contains `string` only and non empty-string.\"\n )\n );\n }\n }\n\n try {\n // Check queryParams\n if (\n !isUndefined(queryParams) &&\n !isFunction(queryParams[Symbol.iterator])\n ) {\n throw new TypeError(\n errorMsg(\n `Second parameter (\\`queryParams\\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \\`${getPreciseType(\n queryParams\n )}\\`, with value: \\`${safeStableStringify(queryParams, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n const urlInstance = new URL(baseUrl);\n\n // Add query parameters if provided\n if (!isUndefined(queryParams)) {\n const paramObject = Object.fromEntries(queryParams);\n\n if (!isEmptyValue(paramObject)) {\n // existing params\n const mergedParams = new URLSearchParams(urlInstance.search);\n\n // add / overwrite from queryParams\n for (const [key, value] of Object.entries(paramObject)) {\n if (\n !isNonEmptyString(value) &&\n !isNumber(value, { includeNaN: true })\n ) {\n throw new TypeError(\n errorMsg(\n `Second parameter (\\`queryParams\\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \\`${getPreciseType(\n queryParams\n )}\\`, with value: \\`${safeStableStringify(queryParams, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n mergedParams.set(key, String(value));\n }\n\n // Remove specific query parameters if needed\n if (removeParams?.length) {\n toStringArrayUnRecursive(removeParams).map((paramKey) => {\n mergedParams.delete(paramKey);\n });\n }\n\n urlInstance.search = mergedParams.toString();\n }\n }\n\n // Remove query parameters directly from URL if needed\n removeParams?.forEach((param) => urlInstance.searchParams.delete(param));\n\n return urlInstance;\n } catch (error) {\n const message = isError(error) ? error.message : String(error);\n\n throw new Error(errorMsg(`Failed to construct a valid URL: ${message}`), {\n cause: error\n });\n }\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"constructURL\", msg);\n","import { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ---------------------------------\n * * ***Utility: `extractURLs`.***\n * ---------------------------------\n * **Extracts all valid URLs from a given string.**\n *\n * ---\n * @description\n * This function scans the input url and returns an array of URLs\n * that match a valid `http` or `https` format.\n *\n * ---\n * - #### *Behavior:*\n * - #### Supports:\n * - Internationalized domain names (IDN), e.g. `https://münich.de`.\n * - Unicode & emoji paths, e.g. `https://example.com/🎉/page`.\n * - Long URLs with multiple queries & fragments, e.g. `https://example.com/path?foo=1#hash`.\n * ---\n * - #### Ignores:\n * - Non-string inputs.\n * - Empty or whitespace-only strings.\n * - Non-HTTP(S) protocols (ftp, mailto, etc).\n *\n * ---\n * @param {string | null | undefined} url - The input string containing potential URLs.\n *\n * ---\n * @returns {string[] | null} An array of extracted URLs or `null` if no URLs are found.\n *\n * ---\n * @example\n * extractURLs(\"Visit https://example.com and https://例子.公司\");\n * // ➔ [\"https://example.com\", \"https://例子.公司\"]\n * extractURLs(\"Here: https://example.com/🎉/page\");\n * // ➔ [\"https://example.com/🎉/page\"]\n * extractURLs(\"ftp://example.com http://example.com\");\n * // ➔ [\"http://example.com\"]\n */\nexport const extractURLs = (\n url: string | null | undefined\n): string[] | null => {\n if (!isNonEmptyString(url)) return null;\n\n let decoded;\n try {\n decoded = decodeURIComponent(url);\n } catch {\n return null;\n }\n\n // Core regex with lookahead\n const urlPattern = /https?:\\/\\/.*?(?=https?:\\/\\/|\\s|$)/g;\n const matches = decoded.match(urlPattern);\n if (!matches) return null;\n\n // Cleanup trailing punctuation and validation protocol\n const cleaned = matches\n .map((url) => url.replace(/[.,;:!?)]*$/, \"\"))\n .filter((url) => {\n try {\n const u = new URL(url);\n return u.protocol === \"http:\" || u.protocol === \"https:\";\n } catch {\n return false;\n }\n });\n\n return cleaned.length ? cleaned : null;\n};\n","import { isFunction } from \"@/predicates/is/isFunction\";\n\n/** ---------------------------------\n * * ***Custom Error for Pathname Normalization Failures***\n * ---------------------------------\n */\nexport class NormalizePathnameError extends Error {\n /** ---------------------------------\n * * ***The original error that triggered this normalization failure.***\n * ---------------------------------\n *\n * **Always available for backward compatibility.**\n */\n public readonly originalError: Error;\n\n constructor(message: string, originalError: Error) {\n // Pass a `cause` option if the runtime supports it (ignored by older engines).\n super(message, isFunction(Error) ? { cause: originalError } : undefined);\n\n this.name = \"NormalizePathnameError\";\n this.originalError = originalError;\n\n // Preserve stack trace when available (Node.js & modern browsers).\n if (isFunction(Error.captureStackTrace)) {\n Error.captureStackTrace(this, NormalizePathnameError);\n } else {\n // Fallback for very old environments.\n this.stack = new Error(message).stack;\n }\n }\n\n /** ---------------------------------\n * * ***Safe JSON representation for logging or IPC.***\n * ---------------------------------\n */\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n stack: this.stack,\n originalError: {\n name: this.originalError.name,\n message: this.originalError.message,\n stack: this.originalError.stack\n }\n };\n }\n}\n","import type { OverrideTypes, Prettify } from \"@rzl-zone/ts-types-plus\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { isSet } from \"@/predicates/is/isSet\";\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isValidDomain } from \"@/predicates/is/isValidDomain\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { removeSpaces } from \"@/strings/sanitizations/removeSpaces\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport { NormalizePathnameError } from \"../_private/NormalizePathnameError\";\n\n/** --------------------------------------------------------\n * * ***Options when `keepNullable` is false (default).***\n * ---------------------------------------------------------\n * Returns `defaultPath` if `pathname` is empty or invalid.\n */\ntype UnKeepNullableOptions = {\n /** --------------------------------------------------------\n * * ***Fallback value returned if `pathname` is empty-string or invalid.***\n * ---------------------------------------------------------\n * Must be a **`non-empty string`**, defaultValue: `\"/\"`.\n *\n * ---\n * @default \"/\"\n */\n defaultPath?: string;\n\n /** --------------------------------------------------------\n * * ***Whether to preserve `null` or `undefined`, defaultValue: `false`.***\n * ---------------------------------------------------------\n *\n * - ***⚠️ Warning:***\n * - Non-boolean values will throw `TypeError`.\n * ---\n * @default false\n */\n keepNullable?: false;\n};\n\n/** --------------------------------------------------------\n * * ***Options when `keepNullable` is true.***\n * ---------------------------------------------------------\n *\n * Preserves `null` or `undefined` instead of returning `defaultPath`.\n */\ntype KeepNullableOptions = {\n /** --------------------------------------------------------\n * * ***Fallback path is ignored when `keepNullable` is true **(except if\n * `pathname` is empty-string or invalid, even this `true`)**,\n * defaultValue: `\"/\"`.***\n * --------------------------------------------------------\n *\n * @default \"/\"\n */\n defaultPath?: string;\n\n /** --------------------------------------------------------\n * * ***Preserve `null` or `undefined` as-is if `true` (defaultValue: `false`).***\n * --------------------------------------------------------\n *\n * - ***⚠️ Warning:***\n * - Keeps returning `defaultPath` when `pathname` is an empty string, even if enabled.\n * - Non-boolean values will throw `TypeError`.\n * ---\n * **Must be `true` in this type.**\n *\n * ---\n *\n * @default false\n */\n keepNullable?: true;\n};\n\ntype MainNormalizePathnameOptions = {\n /** --------------------------------------------------------\n * * ***Preserve trailing slash at the end of the normalized pathname, defaultValue: `false`.***\n * ---------------------------------------------------------\n *\n * - ***⚠️ Warning:***\n * - Non-boolean values will throw `TypeError`.\n * ---\n *\n * @default false\n *\n */\n keepTrailingSlash?: boolean;\n\n /** --------------------------------------------------------\n * * ***Allow special localhost domain at the beginning of the pathname.***\n * ---------------------------------------------------------\n * @description\n * If `true`, the first segment of the pathname that is `/localhost` or `localhost`\n * (with or without a port, e.g., `localhost:3000`) will be treated as a special domain\n * and **removed** from the normalized pathname.\n *\n * ---\n * - **Examples (`localhostDomain: true`)**:\n * - `\"/localhost/path\"` ➔ `\"/path\"`.\n * - `\"localhost:3000/path\"` ➔ `\"/path\"`.\n * - `\"localhost\"` ➔ `\"/\"` (**entire path removed**).\n * ---\n * - Only the **first path segment** is affected. Any subsequent occurrences of `\"localhost\"`\n * will remain intact.\n * ---\n * - ***⚠️ Warning:***\n * - Non-boolean values will throw `TypeError`.\n *\n * @default false\n */\n localhostDomain?: boolean;\n\n /** --------------------------------------------------------\n * * ***Custom list of file extensions that prevent the first path segment from being treated as a domain.***\n * --------------------------------------------------------\n *\n * - **Behavior:**\n * - The first segment of a pathname is often interpreted as a domain (e.g., `example.com`).\n * - If this first segment ends with any of the extensions listed here, it will **not** be considered a domain,\n * and will instead be preserved as part of the relative path.\n * - This is useful for cases where filenames appear at the start of a path and you want them treated as relative paths,\n * such as `\"image.png?version=2\"` or `\"archive.tar.gz#download\"`.\n * - Only the **first path segment** is affected; all other segments are processed normally.\n * - **Ignored** if:\n * 1. The pathname starts with a full URL protocol (`http://` or `https://`), e.g., `\"https://example.com/file.png\"`.\n * 2. The first path segment is already a valid domain, e.g., `\"example.com/image.png\"`.\n * ---\n * - **Type & Validation:**\n * - Must be a `Set<string>` or `string[]`.\n * - Each string **must include the leading dot**, e.g., `.png`, `.tar.gz`.\n * - Multi-part extensions (like `.tar.gz`, `.tar.bz`) are supported.\n * - Throws a **TypeError** if:\n * 1. The type is not a `Set<string>` or `string[]`.\n * 2. Any string in the array/set is empty.\n * 3. Any string does not start with a dot (`.`).\n * ---\n * - **Usage Notes:**\n * - Only applied when the first segment is otherwise domain-like **and** pathname is relative or domain-like without protocol.\n * - Query strings (`?x=1`) and hash fragments (`#section`) are preserved.\n *\n * ---\n * @example\n *\n * 1. #### Examples (relative paths, option active):\n * ```ts\n * normalizePathname(\"image.png?version=2\", {\n * ignoreDomainExtensions: [\".png\", \".jpg\"]\n * });\n * // ➔ \"/image.png?version=2\"\n *\n * normalizePathname(\"archive.tar.gz#download\", {\n * ignoreDomainExtensions: new Set([\".tar.gz\"])\n * });\n * // ➔ \"/archive.tar.gz#download\"\n *\n * normalizePathname(\"script.js?module=true#top\", {\n * ignoreDomainExtensions: [\".js\"]\n * });\n * // ➔ \"/script.js?module=true#top\"\n * ```\n * ---\n * 2. #### Examples (full URL or explicit domain - option ignored):\n * ```ts\n * normalizePathname(\"https://example.com/image.png?version=2\", {\n * ignoreDomainExtensions: [\".png\"]\n * });\n * // ➔ \"/image.png?version=2\" // URL is parsed normally; ignoreDomainExtensions has no effect\n *\n * normalizePathname(\"example.com/script.js?module=true#top\", {\n * ignoreDomainExtensions: [\".js\"]\n * });\n * // ➔ \"/script.js?module=true#top\" // domain recognized; option ignored\n * ```\n * ---\n * @notes\n * - Only the **first path segment** is checked.\n * - Prevents false-positive domain stripping for filenames that look like domains.\n * - Throws **TypeError** if invalid type or invalid string is provided.\n *\n * @default undefined // (feature inactive if not provided)\n */\n ignoreDomainExtensions?: Set<string> | string[];\n};\n\n/** --------------------------------------------------------\n * * ***Options for main `normalizePathname`.***\n * ---------------------------------------------------------\n *\n * *Combines `UnKeepNullableOptions` or `KeepNullableOptions` with trailing slash control.*\n */\ntype NormalizePathnameOptions = Prettify<\n MainNormalizePathnameOptions & (UnKeepNullableOptions | KeepNullableOptions)\n>;\n\ntype NormalizePathnameOptionsKeepNullableTrue = MainNormalizePathnameOptions &\n KeepNullableOptions;\ntype NormalizePathnameOptionsKeepNullableFalse = MainNormalizePathnameOptions &\n UnKeepNullableOptions;\n\ntype ResUnKeepNullable<T> = T extends undefined\n ? string\n : T extends null\n ? string\n : T extends null | undefined\n ? string\n : string;\n\ntype ResKeepNullable<T> = T extends string\n ? string\n : T extends undefined\n ? undefined\n : T extends null\n ? null\n : T extends null | undefined\n ? null | undefined\n : string | null | undefined;\n\n/** --------------------------------------------------------\n * * ***Utility: `normalizePathname`.***\n * --------------------------------------------------------\n *\n * **Normalizes any pathname or URL string to a clean, predictable format, useful for routing, file paths, and URL handling.**\n *\n * ---\n * - **Handles:**\n * - Leading/trailing spaces.\n * - Internal spaces in path segments.\n * - Redundant slashes (`//`).\n * - Full URLs vs relative paths.\n * - Query (`?`) and hash (`#`) preservation.\n * - Unicode & emoji characters.\n * - Optional nullable preservation (`keepNullable`).\n * - Optional trailing slash preservation (`keepTrailingSlash`).\n * - Optional removal of localhost first segment (`localhostDomain`).\n * - Prevention of false-positive domain stripping (`ignoreDomainExtensions`).\n * ---\n * - **Key Steps Internally:**\n * 1. Validate `options` (plain object, correct types).\n * 2. Validate `defaultPath` (non-empty string if `keepNullable` is false).\n * 3. Validate `ignoreDomainExtensions` (Set<string> | string[], each starts with `.`).\n * 4. Handle nullable:\n * - Returns `null` / `undefined` if `keepNullable: true`.\n * - Otherwise uses `defaultPath`.\n * 5. Trim spaces, remove internal spaces.\n * 6. If full URL: parse using `URL` constructor.\n * 7. If relative path or domain-like:\n * - Remove `localhost`/`localhost:port` if `localhostDomain`.\n * - Remove first segment if domain-like and **not** in `ignoreDomainExtensions`.\n * 8. Normalize slashes.\n * 9. Ensure leading slash.\n * 10. Handle trailing slash.\n * 11. Decode Unicode safely.\n * 12. Return normalized pathname + search + hash.\n * ---\n * - **Error Handling:**\n * - ***TypeError***:\n * - `defaultPath` invalid (non-string or empty) when `keepNullable: false`.\n * - `keepNullable`, `keepTrailingSlash`, `localhostDomain` not boolean.\n * - `ignoreDomainExtensions` invalid.\n * - ***NormalizePathnameError*** (extends ***Error***):\n * - Invalid URL parsing.\n * - Unexpected normalization errors.\n * ---\n * - **Options:**\n * ```ts\n * {\n * // fallback if invalid path, default: \"/\"\n * defaultPath?: string;\n * // preserve null/undefined, default: false\n * keepNullable?: boolean;\n * // preserve trailing slash, default: false\n * keepTrailingSlash?: boolean;\n * // remove localhost:port first segment, default: false\n * localhostDomain?: boolean;\n * // prevent domain stripping, default: undefined\n * ignoreDomainExtensions?: Set<string> | string[];\n * }\n * ```\n *\n * ---\n *\n * @example\n * 1. #### Basic path cleaning:\n * ```ts\n * normalizePathname(\" /foo//bar \");\n * // ➔ \"/foo/bar\"\n * ```\n * ---\n * 2. #### Trailing slash control:\n * ```ts\n * normalizePathname(\"/api//v1//user//\", { keepTrailingSlash: true });\n * // ➔ \"/api/v1/user/\"\n * normalizePathname(\"/api//v1//user//\", { keepTrailingSlash: false });\n * // ➔ \"/api/v1/user\"\n * ```\n * ---\n * 3. #### Full URL normalization:\n * ```ts\n * normalizePathname(\"https://example.com//path///to/resource?x=1#hash\");\n * // ➔ \"/path/to/resource?x=1#hash\"\n * ```\n * ---\n * 4. #### Null/undefined preservation:\n * ```ts\n * normalizePathname(null, { keepNullable: true });\n * // ➔ null\n * normalizePathname(undefined, { keepNullable: true });\n * // ➔ undefined\n * ```\n * ---\n * 5. #### Default fallback:\n * ```ts\n * normalizePathname(\"\", { defaultPath: \"/home\" });\n * // ➔ \"/home\"\n * ```\n * ---\n * 6. #### Localhost removal:\n * ```ts\n * normalizePathname(\"localhost:3000/path/to/resource\", { localhostDomain: true });\n * // ➔ \"/path/to/resource\"\n * ```\n * ---\n * 7. #### Prevent false-positive domain stripping:\n * ```ts\n * normalizePathname(\"archive.tar.gz#download\", { ignoreDomainExtensions: [\".tar.gz\"] });\n * // ➔ \"/archive.tar.gz#download\"\n * normalizePathname(\"image.png?version=2\", { ignoreDomainExtensions: [\".png\"] });\n * // ➔ \"/image.png?version=2\"\n * ```\n * ---\n * 8. #### Emojis and Unicode:\n * ```ts\n * normalizePathname(\"🔥//deep//path///🚀\");\n * // ➔ \"/🔥/deep/path/🚀\"\n * ```\n * ---\n * 9. #### Query-only or hash-only:\n * ```ts\n * normalizePathname(\"?page=2\");\n * // ➔ \"/?page=2\"\n * normalizePathname(\"#section3\");\n * // ➔ \"/#section3\"\n * ```\n * ---\n * 10. #### Complex nested paths:\n * ```ts\n * normalizePathname(\" //nested///folder//file.txt \");\n * // ➔ \"/nested/folder/file.txt\"\n * ```\n * ---\n * 11. #### Invalid URL triggers error:\n * ```ts\n * try {\n * normalizePathname(\"http://\");\n * } catch (e) {\n * // console.log(e);\n * }\n * ```\n * ---\n * 12. #### First segment is domain but ignored due to extension:\n * ```ts\n * normalizePathname(\"example.tar.bz/file\", { ignoreDomainExtensions: [\".tar.bz\"] });\n * // ➔ \"/example.tar.bz/file\"\n * ```\n */\nexport function normalizePathname<T>(\n pathname: T,\n options?: NormalizePathnameOptionsKeepNullableFalse\n): ResUnKeepNullable<T>;\nexport function normalizePathname<T>(\n pathname: T,\n options?: NormalizePathnameOptionsKeepNullableTrue\n): ResKeepNullable<T>;\nexport function normalizePathname(\n pathname: unknown,\n options: NormalizePathnameOptions = {}\n): string | null | undefined {\n assertIsPlainObject(options, {\n message({ currentType, validType }) {\n return errorMsg(\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n let {\n defaultPath = \"/\",\n keepNullable = false,\n keepTrailingSlash = false,\n localhostDomain = false,\n ignoreDomainExtensions = undefined\n } = options;\n\n // Validate defaultPath\n if (!isNonEmptyString(defaultPath)) {\n throw new TypeError(\n errorMsg(\n `Parameter \\`defaultPath\\` property of the \\`options\\` (second parameter) must be of type \\`string\\` and not empty-string, but received: \\`${getPreciseType(\n defaultPath\n )}\\`, with value: \\`${safeStableStringify(defaultPath, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n assertIsBoolean(keepNullable, {\n message({ currentType, validType }) {\n return errorMsg(\n `Parameter \\`keepNullable\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n assertIsBoolean(keepTrailingSlash, {\n message({ currentType, validType }) {\n return errorMsg(\n `Parameter \\`keepTrailingSlash\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n assertIsBoolean(localhostDomain, {\n message({ currentType, validType }) {\n return errorMsg(\n `Parameter \\`localhostDomain\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n let ignoreDomainExtsSet: Set<string> | undefined;\n\n if (!isUndefined(ignoreDomainExtensions)) {\n if (!isSet(ignoreDomainExtensions) && !isArray(ignoreDomainExtensions)) {\n throw new TypeError(\n errorMsg(\n `Parameter \\`ignoreDomainExtensions\\` must be of type a \\`Set<string>\\` or \\`string[]\\`, but received: \\`${getPreciseType(\n ignoreDomainExtensions\n )}\\`.`\n )\n );\n }\n\n ignoreDomainExtsSet = isSet(ignoreDomainExtensions)\n ? ignoreDomainExtensions\n : new Set(ignoreDomainExtensions);\n\n // validation every ext\n let idx = 0;\n for (const ext of ignoreDomainExtsSet) {\n if (!isNonEmptyString(ext)) {\n throw new TypeError(\n errorMsg(\n `Parameter \\`ignoreDomainExtensions[${idx}]\\` must be a \\`string\\` and \\`non-empty string\\`, but received: \\`${safeStableStringify(\n ext,\n { keepUndefined: true }\n )}\\`.`\n )\n );\n }\n if (!ext.startsWith(\".\")) {\n throw new TypeError(\n errorMsg(\n `Parameter \\`ignoreDomainExtensions[${idx}]\\` must start with a dot (.), but received: ${safeStableStringify(\n ext,\n { keepUndefined: true }\n )}`\n )\n );\n }\n idx++;\n }\n }\n\n try {\n if (keepNullable && (isNil(pathname) || !isString(pathname))) {\n if (isNull(pathname)) return null;\n return undefined;\n }\n\n // If the pathname is invalid (null, undefined, or an empty string), return the default value, only if `keepNullable` is false\n let currentPathName: string = isNonEmptyString(pathname)\n ? pathname\n : defaultPath;\n\n // Trim spaces from the string (only trim leading and trailing spaces)\n currentPathName = removeSpaces(currentPathName, { trimOnly: true }).replace(\n /\\s+/g,\n \"\"\n ); // remove all space\n\n currentPathName = stripLeadingDomain(currentPathName, {\n keepTrailingSlash,\n localhostDomain,\n ignoreDomainExtensions: ignoreDomainExtsSet\n });\n\n let _pathName: string = currentPathName;\n let search = \"\";\n let hash = \"\";\n\n // relative path: extract search/hash manually\n const searchIndex = currentPathName.indexOf(\"?\");\n const hashIndex = currentPathName.indexOf(\"#\");\n\n if (searchIndex !== -1) {\n search = currentPathName.slice(\n searchIndex,\n hashIndex !== -1 ? hashIndex : undefined\n );\n }\n if (hashIndex !== -1) {\n hash = currentPathName.slice(hashIndex);\n }\n\n const endIndex = Math.min(\n searchIndex !== -1 ? searchIndex : currentPathName.length,\n hashIndex !== -1 ? hashIndex : currentPathName.length\n );\n _pathName = currentPathName.slice(0, endIndex);\n\n // Normalize slashes\n _pathName = \"/\" + _pathName.replace(/^\\/+/, \"\").replace(/\\/{2,}/g, \"/\");\n\n // Trailing slash\n if (!keepTrailingSlash && _pathName !== \"/\") {\n _pathName = _pathName.replace(/\\/+$/, \"\");\n }\n\n // Decode Unicode safely\n _pathName = decodeUnicodeSequences(_pathName);\n search = decodeUnicodeSequences(search);\n hash = decodeUnicodeSequences(hash);\n\n return _pathName + search + hash;\n } catch (error) {\n // Handle any errors that occur during processing\n throwError(error);\n }\n}\n\n// --- Internal Helper Utils ----\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"normalizePathname\", msg);\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst decodeUnicodeSequences = (str: string): string => {\n return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {\n try {\n const decoded = decodeURIComponent(match);\n // eslint-disable-next-line no-control-regex\n if (/^[\\u0000-\\u007F]+$/.test(decoded)) return match;\n // eslint-enable-next-line no-control-regex\n return decoded;\n } catch {\n return match;\n }\n });\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst stripLeadingDomain = (\n path: string,\n options: OverrideTypes<\n MainNormalizePathnameOptions,\n { ignoreDomainExtensions?: Set<string> }\n >\n): string => {\n let currentPath = path;\n\n const { ignoreDomainExtensions, localhostDomain } = options;\n\n // Full URL (protocol) -> only normalize path, ignore ignoreDomainExtensions\n if (/^https?:\\/\\//i.test(currentPath)) {\n try {\n const url = new URL(currentPath);\n currentPath =\n url.pathname.replace(/^\\/+/, \"\").replace(/\\/{2,}/g, \"/\") +\n url.search +\n url.hash;\n\n return ensureLeadingSlash(currentPath);\n } catch (error) {\n // fallback: keep as-is\n // Handle any errors that occur during processing\n throwError(error);\n }\n }\n\n // relative path: remove leading slash\n if (currentPath.startsWith(\"/\")) {\n currentPath = currentPath.replace(/\\/{2,}/g, \"/\").slice(1);\n }\n\n // take first segment\n const segments = currentPath.split(\"/\");\n const firstPart = segments[0];\n const domainPart = firstPart?.split(\":\")[0];\n\n const isDomain = isValidDomain(domainPart, {\n subdomain: true,\n allowUnicode: true,\n wildcard: true,\n allowLocalhost: localhostDomain,\n allowPort: true,\n allowProtocol: true,\n topLevel: false\n });\n\n // ignoreDomainExtensions only applies for relative/non-protocol paths\n let hasIgnoredExtension = false;\n if (ignoreDomainExtensions) {\n for (const ext of ignoreDomainExtensions) {\n if (firstPart?.endsWith(ext)) {\n hasIgnoredExtension = true;\n break;\n }\n }\n }\n\n if (isDomain && !hasIgnoredExtension) {\n segments.shift(); // remove first segment\n }\n\n return ensureLeadingSlash(segments.join(\"/\"));\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst ensureLeadingSlash = (path: string): string => {\n if (!path.startsWith(\"/\")) path = \"/\" + path;\n return path;\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst throwError = (error: unknown): never => {\n // Handle any errors that occur during processing\n const originalError = isError(error) ? error : new Error(String(error));\n\n throw new NormalizePathnameError(\n errorMsg(`Failed to normalize pathname: ${originalError.message}`),\n originalError\n );\n};\n","import { createMessage } from \"@/_private/logger\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport { normalizePathname } from \"./normalizePathname\";\n\n/** --------------------------------------------------------\n * * ***Utility: `getFirstPrefixPathname`.***\n * --------------------------------------------------------\n * **Extract First Valid Prefix from Path Array or String.**\n *\n * ---\n * - **Main Purpose:**\n * - This function helps extract the first valid URL prefix from various possible inputs.\n * - It is especially useful in routing systems, middleware, or frontend apps that need to\n * decide layout, active navigation, or permissions based on the first segment (or prefix) of a pathname.\n *\n * ---\n * - **Typical uses include:**\n * - Determining which layout to render (e.g., `/admin` vs `/dashboard` vs `/`).\n * - Highlighting the active menu item in a sidebar based on the current URL.\n * - Enforcing route guards or access controls depending on the URL prefix.\n * - Parsing multi-level route prefixes and selecting the most relevant one.\n *\n * ---\n * - **Behavior:**\n * - It works as follows:\n * - If `result` is an array of strings, it normalizes each element and returns\n * the first non-root path (i.e., not just `\"/\"`).\n * - If all items normalize to `\"/\"`,\n * it returns the `defaultValue` (normalized).\n * - If `result` is a single string, it normalizes it and returns it if valid,\n * otherwise falls back to the normalized `defaultValue`.\n * - If `result` is `null` or `undefined`, it returns the normalized `defaultValue`.\n *\n * ---\n * - **Validation & Errors:**\n * - Throws a `TypeError` if:\n * - `defaultValue` is not a string or empty-string.\n * - `result` is an array that contains non-string elements.\n * - `result` is a value that is neither `string`, `string[]`, nor `null`.\n *\n * ---\n * @param {string | string[] | null | undefined} result\n * ***The pathname(s) to process, can be:***\n * - A string path (e.g. `\"/profile\"`),\n * - An array of string paths (e.g. `[\" \", \"/dashboard\"]`),\n * - Or `null`.\n * @param {string} [defaultValue=\"/\"]\n * ***A custom default path to use if `result` is null or no valid prefix is found, behavior:***\n * - Must be a string and non-empty string.\n * - Defaults to `\"/\"`.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}** ***if `result` is not a valid type, or `defaultValue` is not a string or empty-string.***\n *\n * ---\n * @returns {string} ***The first valid normalized pathname, or the normalized default.***\n *\n * ---\n * @example\n * 1. #### For React (*Determining layout*):\n * ```ts\n * const prefix = getFirstPrefixPathname(\n * getPrefixPathname(\n * \"/admin/settings\",\n * [\"/admin\", \"/dashboard\"]\n * )\n * );\n *\n * if (prefix === \"/admin\") {\n * renderAdminLayout();\n * }\n * ```\n * ---\n * 2. #### Setting active menu state:\n * ```ts\n * const activeSection = getFirstPrefixPathname([\"\", \"/dashboard\", \"/profile\"]);\n * // ➔ \"/dashboard\"\n * ```\n * ---\n * 3. #### Providing graceful fallback:\n * ```ts\n * const section = getFirstPrefixPathname([], \"/home\");\n * // ➔ \"/home\"\n * ```\n * ---\n * 4. #### Using with an Array of Pathnames:\n * ```ts\n * const result = getPrefixPathname([\" \", \"/dashboard\", \"/settings\"]);\n * console.log(getFirstPrefixPathname(result));\n * // ➔ \"/dashboard\"\n * ```\n * ---\n * 5. #### Using with Single String:\n * ```ts\n * console.log(getFirstPrefixPathname(\"/profile/settings\"));\n * // ➔ \"/profile/settings\"\n * console.log(getFirstPrefixPathname(\" \"));\n * // ➔ \"/\"\n * ```\n * ---\n * 6. #### Fallback to Custom Default:\n * ```ts\n * console.log(getFirstPrefixPathname([\" \", \"\"], \"/home\"));\n * // ➔ \"/home\"\n * console.log(getFirstPrefixPathname(null, \"/dashboard\"));\n * // ➔ \"/dashboard\"\n * ```\n * ---\n * 7. #### Throws on Invalid Input:\n * ```ts\n * getFirstPrefixPathname([1, 2] as any);\n * // ➔ ❌ throws TypeError\n * getFirstPrefixPathname({} as any);\n * // ➔ ❌ throws TypeError\n * getFirstPrefixPathname(null, \" \");\n * // ➔ ❌ throws TypeError\n * ```\n */\nexport const getFirstPrefixPathname = (\n result: string | string[] | null | undefined,\n defaultValue: string = \"/\"\n): string => {\n if (!isNonEmptyString(defaultValue)) {\n throw new TypeError(\n errorMsg(\n `Second parameter (\\`defaultValue\\`) must be of type \\`string\\` and not an \\`empty-string\\`, but received: \\`${getPreciseType(\n defaultValue\n )}\\`, with value: \\`${safeStableStringify(defaultValue, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n if (isArray(result)) {\n if (!result.every((item) => isString(item))) {\n throw new TypeError(\n errorMsg(\n `First parameter (\\`result\\`) must be of type \\`string\\` or \\`array of string\\`, but received: \\`${getPreciseType(\n result\n )}\\`, with value: \\`${safeStableStringify(result, {\n keepUndefined: true\n })}\\`.`\n )\n );\n }\n\n for (const item of result) {\n const normalized = normalizePathname(item);\n if (normalized !== \"/\") {\n return normalized;\n }\n }\n return normalizePathname(defaultValue);\n }\n\n if (isString(result)) {\n const normalized = normalizePathname(result);\n return normalized !== \"/\" ? normalized : normalizePathname(defaultValue);\n }\n\n if (!isNil(result)) {\n throw new TypeError(\n errorMsg(\n `First parameter (\\`result\\`) must be of type \\`string\\`, \\`array-string\\`, \\`null\\` or \\`undefined\\`, but received: \\`${getPreciseType(\n result\n )}\\`.`\n )\n );\n }\n\n return normalizePathname(defaultValue);\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"getFirstPrefixPathname\", msg);\n","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isInteger } from \"@/predicates/is/isInteger\";\nimport { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport { normalizePathname } from \"./normalizePathname\";\n\ntype GetPrefixPathnameOptions = {\n /** --------------------------------------------------------\n * * ***The number of levels to include in the prefix (default is `1`).***\n * ---------------------------------------------------------\n *\n * - For example, with `levels = 2`, the function will return the first two parts of the URL.\n * ---\n * @default 1\n */\n levels?: number;\n /** --------------------------------------------------------\n * * ***Whether to remove duplicates from the result if multiple URLs are passed (default is `true`).***\n * ---------------------------------------------------------\n *\n * - ***⚠️ Warning:***\n * - Non-boolean values will throw `TypeError`.\n * ---\n * @default true\n */\n removeDuplicates?: boolean;\n};\n\n/** --------------------------------------------------------\n * * ***Utility: `getPrefixPathname`.***\n * ---------------------------------------------------------\n * **Get Prefix from URL with Optional Base or Auto-detection (Supports String or Array of URLs).**\n *\n * ---\n * - **This function extracts the prefix from one or more URLs. It can either:**\n * - Use a provided `base` string or an array of strings to check and return the matching prefix.\n * - Automatically detect the prefix if no `base` is provided by analyzing the first part of the URL.\n * ---\n *\n * - **The function is flexible and can handle both scenarios:**\n * 1. **When the base is provided as a single string or an array of strings**:\n * - The function will check if the URL starts with one of the provided base(s) and return the matching base.\n * 2. **When the base is not provided**:\n * - The function will automatically detect the prefix by splitting the URL or using a regex.\n * ---\n * - **Important Notes**:\n * - If a base (or an array of bases) is provided, the URL must start with one of the given base(s).\n * - If no base is provided, the function will attempt to detect the prefix automatically.\n * - The `url` parameter can be either a string or an array of strings.\n * - Supports deduplication of results (enabled by default).\n * - Automatically returns a single string if only one unique result exists after processing.\n * ---\n *\n * @param {string|string[]} url\n * ***The full URL(s) from which the prefix should be extracted, can be a `string` or an `array of strings`.***\n * @param {string|string[]|null} [base=null]\n * ***The base URL(s) (e.g., `\"/settings\"`), behavior:***\n * - It can be a `string`, an `array of strings`, or `null`.\n * - If `provided`, it will be used to check the URL(s).\n * - If `not provided`, the prefix will be auto-detected.\n * @param {GetPrefixPathnameOptions} [options]\n * ***Additional options object:***\n * - `levels` (default `1`): The number of segments to include when auto-detecting the prefix (e.g. `/foo/bar` for `levels: 2`).\n * - `removeDuplicates` (default `true`): Whether to remove duplicate prefixes from the final array result.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}**\n * ***if:***\n * - `url` is `not a string` or `not an array of strings`.\n * - `base` is `not a string`, `array of strings`, or `null`.\n * - `options` is `not an object`.\n * - `levels` is `not a number`.\n * - `removeDuplicates` is `not a boolean`.\n *\n * ---\n * @returns {string|string[]|null}\n * ***Returns one of:***\n * - A single string if only one unique prefix/base is found.\n * - An array of strings if multiple different prefixes/bases are found.\n * - `null` if no matching base is found when using `base`.\n *\n * ---\n * @example\n * 1. #### Correct Usage (With an Array of URLs and Base):\n * ```ts\n * const routes = [\n * \"/settings/profile\",\n * \"/settings/password\",\n * \"/settings/other-path\",\n * \"/other-path/xyz\",\n * ];\n *\n * // With base provided as a string\n * routes.forEach(route => {\n * console.log(getPrefixPathname(route, '/settings'));\n * // ➔ \"/settings\"\n * });\n *\n * // With base provided as an array\n * routes.forEach(route => {\n * console.log(getPrefixPathname(route, ['/settings', '/admin']));\n * // ➔ \"/settings\" or \"/admin\" depending on the current URL.\n * });\n * ```\n * ---\n * 2. #### Correct Usage (With Single URL and Single Base):\n * ```ts\n * const result = getPrefixPathname(\"/settings/profile\", \"/settings\");\n * console.log(result);\n * // ➔ \"/settings\"\n * ```\n * ---\n * 3. #### Correct Usage (With Multiple URLs and Single Base):\n * ```ts\n * const result = getPrefixPathname(\n * [\"/settings/profile\", \"/settings/password\"],\n * \"/settings\"\n * );\n * console.log(result);\n * // ➔ \"/settings\"\n *\n * const result2 = getPrefixPathname(\n * [\"/settings/profile\", \"/other/password\"],\n * \"/other\"\n * );\n * console.log(result2);\n * // ➔ \"/other\"\n * ```\n * ---\n * 4. #### Correct Usage (With Multiple URLs and Multiple Bases):\n * ```ts\n * const result = getPrefixPathname(\n * [\"/settings/profile\", \"/admin/password\"],\n * [\"/settings\", \"/admin\"]\n * );\n * console.log(result);\n * // ➔ [\"/settings\", \"/admin\"]\n * ```\n * ---\n * 5. #### Auto-detection of Prefix:\n * ```ts\n * const result = getPrefixPathname(\"/settings/profile\");\n * console.log(result);\n * // ➔ \"/settings\"\n *\n * const result2 = getPrefixPathname(\n * \"/settings/profile/info\",\n * null,\n * { levels: 2 }\n * );\n * console.log(result2);\n * // ➔ \"/settings/profile\"\n * ```\n * ---\n * 6. #### Multiple URLs with Auto-detection:\n * ```ts\n * const result = getPrefixPathname([\"/admin/profile\", \"/settings/password\"]);\n * console.log(result);\n * // ➔ [\"/admin\", \"/settings\"]\n * ```\n * ---\n * 7. #### Handling Duplicates:\n * ```ts\n * const result = getPrefixPathname(\n * [\"/settings/profile\", \"/settings/password\"],\n * \"/settings\"\n * );\n * console.log(result);\n * // ➔ \"/settings\" (deduped to single string)\n *\n * const result2 = getPrefixPathname(\n * [\"/settings/profile\", \"/settings/profile\"],\n * \"/settings\",\n * { removeDuplicates: false }\n * );\n * console.log(result2);\n * // ➔ [\"/settings\", \"/settings\"]\n * ```\n * ---\n * 8. #### Incorrect Usage (URL Does Not Match Base):\n * ```ts\n * const result = getPrefixPathname(\"/other-path/profile\", \"/settings\");\n * console.log(result);\n * // ➔ null\n * ```\n */\nexport const getPrefixPathname = (\n url: string | string[],\n base: string | string[] | null = null,\n options: GetPrefixPathnameOptions = {}\n): string | string[] | null => {\n const errors: string[] = [];\n\n if (!isString(url) && !isArray(url)) {\n errors.push(\n `First parameter (\\`url\\`) must be of type \\`string\\` or \\`array-string\\`, but received: \\`${getPreciseType(\n url\n )}\\`.`\n );\n }\n if (!isString(base) && !isArray(base) && !isNull(base)) {\n errors.push(\n `Second parameter (\\`base\\`) must be of type \\`string\\`, \\`array-string\\` or \\`null\\`, but received: \\`${getPreciseType(\n base\n )}\\`.`\n );\n }\n if (!isPlainObject(options)) {\n errors.push(\n `Second parameter (\\`options\\`) must be of type \\`plain-object\\`, but received: \\`${getPreciseType(\n options\n )}\\`.`\n );\n }\n\n const { levels = 1, removeDuplicates = true } = options;\n\n if (!isInteger(levels) || (isInteger(levels) && levels < 0)) {\n errors.push(\n `Parameter \\`levels\\` property of the \\`options\\` (second parameter) must be of type \\`integer-number\\` and minimum is \\`0\\`, but received: \\`${getPreciseType(\n levels\n )}\\`, with value: \\`${safeStableStringify(levels, {\n keepUndefined: true\n })}\\`.`\n );\n }\n if (!isBoolean(removeDuplicates)) {\n errors.push(\n `Parameter \\`removeDuplicates\\` property of the \\`options\\` (second parameter) must be of type \\`boolean\\`, but received: \\`${getPreciseType(\n removeDuplicates\n )}\\`.`\n );\n }\n if (isNonEmptyArray(errors)) {\n throw new TypeError(\n errorMsg(\n joinLines(\n \"Invalid parameter(s) function:\",\n `- ${errors.join(`${EOL}- `)}`\n )\n )\n );\n }\n\n // Helper function to process a single URL\n function getLevel(singleUrl: string) {\n // If no base is provided, detect the base automatically\n const parts = normalizePathname(singleUrl).split(\"/\").filter(Boolean); // Split URL into parts\n\n // Return the first `levels` parts as the prefix\n return `/${parts.slice(0, levels).join(\"/\")}`;\n }\n\n // Helper function to process a single URL\n function processUrl(singleUrl: string): string | null {\n // If a base is provided, check if URL starts with one of the bases\n if (base) {\n singleUrl = normalizePathname(singleUrl);\n\n if (isArray(base)) {\n // Check if the URL starts with any of the base values in the array\n for (const b of base) {\n if (singleUrl.startsWith(normalizePathname(b))) {\n // return normalizePathname(b); // Return the matching base if URL starts with it\n return getLevel(singleUrl);\n }\n }\n } else if (\n isNonEmptyString(base) &&\n singleUrl.startsWith(normalizePathname(base))\n ) {\n // If base is a single string, check if URL starts with it\n // return normalizePathname(base); // Return the base if URL starts with it\n return getLevel(singleUrl);\n }\n return null; // Return null if the URL does not match any base\n }\n\n return getLevel(singleUrl);\n }\n\n // If url is an array, process each URL and return an array of results\n if (isArray(url)) {\n const result = url.map(processUrl).filter((r): r is string => !isNull(r));\n\n // Remove duplicates if required\n const uniqueResult = removeDuplicates ? [...new Set(result)] : result;\n\n // If all results are the same, return just the first one\n if (uniqueResult.length === 1) {\n return uniqueResult[0] ?? null;\n }\n\n return uniqueResult;\n }\n\n // If url is a single string, process it and return the result\n return processUrl(url);\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"getPrefixPathname\", msg);\n","import { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype FormatEnvPortOptions = {\n /** -----------------------------------------------\n * * ***Add prefix with a colon, defaultValue: `false`.***\n * ------------------------------------------------\n *\n * - ***⚠️ Warning***:\n * - Non-boolean values will throw `TypeError`.\n *\n * ---\n * @default false\n */\n prefixColon?: boolean;\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"formatEnvPort\", msg);\n\n/** -----------------------------------------------\n * * ***Utility: `formatEnvPort`.***\n * ------------------------------------------------\n * **Retrieves and formats an environment port variable.**\n *\n * ---\n * - **Behavior:**\n * - Extracts only digits from the input.\n * - If no digits found, returns an empty string.\n * - By default does NOT prefix with a colon.\n * - Use `{ prefixColon: true }` to prefix with a colon, invalid type `prefixColon` will throw **TypeError**.\n *\n * ---\n * @param {string | null | undefined} envVar The environment variable string.\n * @param {FormatEnvPortOptions} [options] Optional object: `{ prefixColon?: boolean }`.\n *\n * ---\n * @throws **{@link TypeError | `TypeError`}** if `options` is not an object or `prefixColon` is not boolean.\n *\n * ---\n * @returns {string} A string like `\":8080\"` or `\"8080\"`, or `\"\"` if no digits.\n *\n * ---\n * @example\n * formatEnvPort(\"port:8080\");\n * // ➔ \"8080\"\n * formatEnvPort(\"port:8080\", { prefixColon: true });\n * // ➔ \":8080\"\n */\nexport const formatEnvPort = (\n envVar: string | null | undefined,\n options: FormatEnvPortOptions = {}\n): string => {\n if (!isNonEmptyString(envVar)) return \"\";\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n const { prefixColon = false } = options;\n\n assertIsBoolean(prefixColon, {\n message({ currentType, validType }) {\n return errorMsg(\n `Parameter \\`prefixColon\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n );\n }\n });\n\n const digitsOnly = envVar.replace(/\\D+/g, \"\");\n if (isEmptyString(digitsOnly)) return \"\";\n\n return prefixColon ? `:${digitsOnly}` : digitsOnly;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,MAAa,gBACX,SACA,aAGA,iBACQ;CACR,IAAI,SAAS,OAAO,GAAG;EACrB,IAAI,cAAc,OAAO,GACvB,MAAM,IAAI,UACRA,WAAS,wDAAwD,CACnE;EAEF,UAAU,gBAAgB,OAAO;CACnC,OAAO,IAAI,CAAC,MAAM,OAAO,GACvB,MAAM,IAAI,UACRA,WACE,yHAAyH,eACvH,OACF,EAAE,4BAA4B,oBAAoB,SAAS,EACzD,eAAe,KACjB,CAAC,EAAE,IACL,CACF;CAIF,IAAI,CAAC,YAAY,YAAY,GAAG;EAC9B,cAAc,cAAc,EAC1B,UAAU,EAAE,aAAa,gBAAgB;GACvC,OAAOA,WACL,wDAAwD,UAAU,iCAAiC,YAAY,IACjH;EACF,EACF,CAAC;EAED,IAAI,CAAC,aAAa,OAAO,UAAU,iBAAiB,KAAK,CAAC,GACxD,MAAM,IAAI,UACRA,WACE,2GACF,CACF;CAEJ;CAEA,IAAI;EAEF,IACE,CAAC,YAAY,WAAW,KACxB,CAAC,WAAW,YAAY,OAAO,SAAS,GAExC,MAAM,IAAI,UACRA,WACE,uJAAuJ,eACrJ,WACF,EAAE,oBAAoB,oBAAoB,aAAa,EACrD,eAAe,KACjB,CAAC,EAAE,IACL,CACF;EAGF,MAAM,cAAc,IAAI,IAAI,OAAO;EAGnC,IAAI,CAAC,YAAY,WAAW,GAAG;GAC7B,MAAM,cAAc,OAAO,YAAY,W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