@rzl-zone/utils-js 3.13.1 → 3.14.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-CgE6QNOR.js +20 -0
- package/dist/AbortError-CgE6QNOR.js.map +1 -0
- package/dist/AbortError-D54txsmn.cjs +26 -0
- package/dist/AbortError-D54txsmn.cjs.map +1 -0
- package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-DmlqnTiq.js} +3 -3
- package/dist/assertIsArray-DmlqnTiq.js.map +1 -0
- package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-Xx-zlo6O.cjs} +5 -5
- package/dist/assertIsArray-Xx-zlo6O.cjs.map +1 -0
- package/dist/assertIsPlainObject-CIzDchLs.js +20 -0
- package/dist/assertIsPlainObject-CIzDchLs.js.map +1 -0
- package/dist/assertIsPlainObject-DYoxHcW5.cjs +26 -0
- package/dist/assertIsPlainObject-DYoxHcW5.cjs.map +1 -0
- package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CuPbh3FB.cjs} +6 -6
- package/dist/assertIsString-CuPbh3FB.cjs.map +1 -0
- package/dist/{assertIsString-CY_WkCLr.js → assertIsString-sgY3ml5f.js} +4 -4
- package/dist/assertIsString-sgY3ml5f.js.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-1s7xMBe_.js → conversions-BkxqYXxy.js} +43 -40
- package/dist/conversions-BkxqYXxy.js.map +1 -0
- package/dist/conversions-UdMB90xR.cjs +449 -0
- package/dist/conversions-UdMB90xR.cjs.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-BFgV1HhV-BtIJs2H2.js +55 -0
- package/dist/formatter-BFgV1HhV-BtIJs2H2.js.map +1 -0
- package/dist/formatter-BFgV1HhV-DyybWSuj.cjs +67 -0
- package/dist/formatter-BFgV1HhV-DyybWSuj.cjs.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-Cjng28nY.cjs +436 -0
- package/dist/formatters-Cjng28nY.cjs.map +1 -0
- package/dist/{formatters-C6cVZBbG.js → formatters-Dqccnt-p.js} +78 -71
- package/dist/formatters-Dqccnt-p.js.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-DTWYqy7S.cjs +53 -0
- package/dist/hasOwnProp-DTWYqy7S.cjs.map +1 -0
- package/dist/hasOwnProp-yVVsxPin.js +47 -0
- package/dist/hasOwnProp-yVVsxPin.js.map +1 -0
- package/dist/{index-BG8wdusZ.d.cts → index-9Ql1W3gt.d.cts} +229 -200
- package/dist/{index-RNQBTK8A.d.cts → index-BD0J8wkE.d.cts} +1374 -936
- package/dist/index-BcoUy2oV.d.ts +2424 -0
- package/dist/{index-B5EBAgmC.d.cts → index-Bpk3YwGW.d.ts} +1592 -790
- package/dist/index-CTMG8cZV.d.ts +1041 -0
- package/dist/index-DUBCXPy4.d.cts +1041 -0
- package/dist/{index-CRz9rSZL.d.ts → index-DhUTzQ_o.d.ts} +1374 -936
- package/dist/{index-B1VQ6USF.d.ts → index-DqYMKSmd.d.ts} +229 -200
- package/dist/index-JfwSupYB.d.ts +1103 -0
- package/dist/{index-ORbo-7zA.d.cts → index-O2q2f-pu.d.cts} +242 -133
- package/dist/{index-DPJ-e2JZ.d.ts → index-VgNZ6ndx.d.cts} +1592 -790
- package/dist/{index-ORbo-7zA.d.ts → index-k_rjVRjU.d.ts} +242 -133
- package/dist/index-or0oP9i2.d.cts +2179 -0
- package/dist/index-or0oP9i2.d.ts +2179 -0
- package/dist/index-u4-Euidh.d.cts +1103 -0
- package/dist/index-zAqCZxGr.d.cts +2424 -0
- package/dist/{isBigInt-y7s3rsKc.js → isBigInt-DdFRCpeE.js} +2 -2
- package/dist/isBigInt-DdFRCpeE.js.map +1 -0
- package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-LkCpVJ3E.cjs} +2 -2
- package/dist/isBigInt-LkCpVJ3E.cjs.map +1 -0
- package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-B6ubItgT.js} +4 -4
- package/dist/isEmptyString-B6ubItgT.js.map +1 -0
- package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-Csc5Sf_W.cjs} +5 -5
- package/dist/isEmptyString-Csc5Sf_W.cjs.map +1 -0
- package/dist/isEmptyValue-h97JT4pD.js +36 -0
- package/dist/isEmptyValue-h97JT4pD.js.map +1 -0
- package/dist/isEmptyValue-qNOhUBFE.cjs +54 -0
- package/dist/isEmptyValue-qNOhUBFE.cjs.map +1 -0
- package/dist/{isFinite-DeDaBDr2.cjs → isFinite-CKeuVXbD.cjs} +6 -6
- package/dist/isFinite-CKeuVXbD.cjs.map +1 -0
- package/dist/{isFinite-BEJFOv6B.js → isFinite-CzYYv-mQ.js} +5 -5
- package/dist/isFinite-CzYYv-mQ.js.map +1 -0
- package/dist/{isInteger-DEDbBGez.js → isInteger-BtA3flbk.js} +4 -4
- package/dist/isInteger-BtA3flbk.js.map +1 -0
- package/dist/{isInteger-CQLThJOR.cjs → isInteger-iTok9NaH.cjs} +4 -4
- package/dist/isInteger-iTok9NaH.cjs.map +1 -0
- package/dist/isNumber-C1mOuBuA.js +20 -0
- package/dist/isNumber-C1mOuBuA.js.map +1 -0
- package/dist/isNumber-CM1vdNcW.cjs +26 -0
- package/dist/isNumber-CM1vdNcW.cjs.map +1 -0
- package/dist/isPlainObject-DQoM4DGQ.d.ts +331 -0
- package/dist/isPlainObject-Y__iykWN.d.cts +331 -0
- package/dist/{isServer-DmycqWsF.cjs → isServer-CWlp2R2N.cjs} +2 -2
- package/dist/isServer-CWlp2R2N.cjs.map +1 -0
- package/dist/{isServer-q3o6cSwD.js → isServer-Drgyboev.js} +2 -2
- package/dist/isServer-Drgyboev.js.map +1 -0
- package/dist/{isEqual-DM4S_kWh.js → isTypedArray-BY8CIj3k.js} +29 -9
- package/dist/isTypedArray-BY8CIj3k.js.map +1 -0
- package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DspIjxdk.cjs} +45 -13
- package/dist/isTypedArray-DspIjxdk.cjs.map +1 -0
- package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-BPfJEkFk.js} +13 -54
- package/dist/isValidDomain-BPfJEkFk.js.map +1 -0
- package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-DUUCoKtD.cjs} +16 -69
- package/dist/isValidDomain-DUUCoKtD.cjs.map +1 -0
- package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-BXg2xufj.cjs} +658 -612
- package/dist/logger-BXg2xufj.cjs.map +1 -0
- package/dist/{assertIsBoolean-CWUs-I5l.js → logger-Wxl_Krg6.js} +657 -587
- package/dist/logger-Wxl_Krg6.js.map +1 -0
- package/dist/{noop-BY43WaoU.cjs → noop-ByxeOveJ.cjs} +2 -2
- package/dist/noop-ByxeOveJ.cjs.map +1 -0
- package/dist/{noop-CjY8xVHv.js → noop-D8aGbjbP.js} +2 -2
- package/dist/noop-D8aGbjbP.js.map +1 -0
- package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-CQ7tZLNG.cjs} +6 -9
- package/dist/normalizeSpaces-CQ7tZLNG.cjs.map +1 -0
- package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DNUOxp_8.js} +4 -7
- package/dist/normalizeSpaces-DNUOxp_8.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-B_FPX35n.cjs → parsers-CJ5tHtqF.cjs} +10 -9
- package/dist/parsers-CJ5tHtqF.cjs.map +1 -0
- package/dist/{parsers-B8KYXIjE.js → parsers-DMlqliPw.js} +9 -8
- package/dist/parsers-DMlqliPw.js.map +1 -0
- package/dist/{parsing-BCZGco7n.cjs → parsing-DB_S0WFz.cjs} +4 -4
- package/dist/parsing-DB_S0WFz.cjs.map +1 -0
- package/dist/{parsing-Bfaw85Hd.js → parsing-DhIQhWpX.js} +3 -3
- package/dist/parsing-DhIQhWpX.js.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-BzYMbNrZ.js} +45 -40
- package/dist/predicates-BzYMbNrZ.js.map +1 -0
- package/dist/{predicates-8y28VrbT.cjs → predicates-DDW3etqF.cjs} +89 -84
- package/dist/predicates-DDW3etqF.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-B_VPjG0d.cjs} +12 -12
- package/dist/punyCode-B_VPjG0d.cjs.map +1 -0
- package/dist/{punyCode-Dwto1RpA.js → punyCode-DsuJbWCl.js} +12 -12
- package/dist/punyCode-DsuJbWCl.js.map +1 -0
- package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BF-T_1Yt.js} +4 -4
- package/dist/removeSpaces-BF-T_1Yt.js.map +1 -0
- package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-BJu-gKps.cjs} +7 -7
- package/dist/removeSpaces-BJu-gKps.cjs.map +1 -0
- package/dist/rzl-utils.global.js +13 -13
- package/dist/safeJsonParse-B5F8XtrZ.cjs +209 -0
- package/dist/safeJsonParse-B5F8XtrZ.cjs.map +1 -0
- package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DYSkUnhM.js} +29 -28
- package/dist/safeJsonParse-DYSkUnhM.js.map +1 -0
- package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-CDSYnLUz.js} +20 -13
- package/dist/safeStableStringify-CDSYnLUz.js.map +1 -0
- package/dist/safeStableStringify-MuBiT-4B.cjs +125 -0
- package/dist/safeStableStringify-MuBiT-4B.cjs.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-CUdmv-oO.js → tailwind-BhHULklj.js} +38 -32
- package/dist/tailwind-BhHULklj.js.map +1 -0
- package/dist/{tailwind-DUuboq52.cjs → tailwind-hx6TIFIL.cjs} +59 -53
- package/dist/tailwind-hx6TIFIL.cjs.map +1 -0
- package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-U-nkEIDs.js} +9 -9
- package/dist/toStringArrayUnRecursive-U-nkEIDs.js.map +1 -0
- package/dist/toStringArrayUnRecursive-_lJEmBlf.cjs +51 -0
- package/dist/toStringArrayUnRecursive-_lJEmBlf.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-BcGIFgfR.js} +50 -41
- package/dist/urls-BcGIFgfR.js.map +1 -0
- package/dist/urls-DGvZsMSN.cjs +308 -0
- package/dist/urls-DGvZsMSN.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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safeJsonParse-sFqVXf-e.cjs","names":["isNonEmptyString","getPreciseType","safeStableStringify","hasOwnProp","noop","isBoolean","isArray","isFunction","getPreciseType","isNull","isUndefined","isString","isArray","isEmptyArray","isObject","isEmptyObject","isString","isNumber","isNull","isNaN","isNonEmptyString","isNumber","isString","isError"],"sources":["../src/conversions/json/parseCustomDate.ts","../src/conversions/json/_private/utils/validateJsonParsingOptions.ts","../src/conversions/json/cleanParsedData.ts","../src/conversions/numerics/extractDigits.ts","../src/conversions/json/_private/utils/fixSingleQuotesEscapeBackslash.ts","../src/conversions/json/safeJsonParse.ts"],"sourcesContent":["import { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nimport { safeStableStringify } from \"../stringify/safeStableStringify\";\n\n/** --------------------------------------------------\n * * ***Utility: `parseCustomDate`.***\n * ---------------------------------------------\n * **Parses custom date formats like \"DD/MM/YYYY\" or \"MM/DD/YYYY\".**\n * @param {string} dateString - Date string to parse.\n * @param {string} format - Date format to match.\n * @returns {Date | null} Returns a `Date` object if valid, otherwise `null`.\n * @throws **{@link TypeError | `TypeError`}** if `dateString` **(first parameter)** and `format` **(second parameter)** is not a string or empty-string.\n * @example\n * // Valid: European format (DD/MM/YYYY)\n * const date1 = parseCustomDate(\"03/09/2025\", \"DD/MM/YYYY\");\n * console.log(date1); // ➔ Date { Wed Sep 03 2025 ... }\n *\n * // Valid: US format (MM/DD/YYYY)\n * const date2 = parseCustomDate(\"09/03/2025\", \"MM/DD/YYYY\");\n * console.log(date2); // ➔ Date { Wed Sep 03 2025 ... }\n *\n * // Invalid: wrong format\n * const date3 = parseCustomDate(\"2025-09-03\", \"DD/MM/YYYY\");\n * console.log(date3); // ➔ null\n *\n * // Invalid: non-date string\n * const date4 = parseCustomDate(\"hello\", \"DD/MM/YYYY\");\n * console.log(date4); // ➔ null\n *\n * // Throws: wrong parameter types or empty-string\n * parseCustomDate(123, \"DD/MM/YYYY\");\n * // ➔ TypeError: Parameter `dateString` and `format` must be of type `string`...\n */\nexport const parseCustomDate = (\n dateString: string,\n format: string\n): Date | null => {\n if (!isNonEmptyString(dateString) || !isNonEmptyString(format)) {\n throw new TypeError(\n `Parameter \\`dateString\\` and \\`format\\` must be of type \\`string\\` and not empty-string, but received: \"['dateString': \\`${getPreciseType(\n dateString\n )}\\` - (current value: \\`${safeStableStringify(dateString, {\n keepUndefined: true\n })}\\`), 'format': \\`${getPreciseType(\n format\n )}\\` - (current value: \\`${safeStableStringify(format, {\n keepUndefined: true\n })}\\`)]\".`\n );\n }\n\n const dateParts = dateString.split(/[-/]/).map(Number);\n if (dateParts.length !== 3 || dateParts.some(isNaN)) return null;\n\n let day: number | undefined,\n month: number | undefined,\n year: number | undefined;\n\n if (format === \"DD/MM/YYYY\") {\n [day, month, year] = dateParts;\n } else if (format === \"MM/DD/YYYY\") {\n [month, day, year] = dateParts;\n } else {\n return null;\n }\n\n if (month) month -= 1;\n const date = year && month && day ? new Date(year, month, day) : undefined;\n\n if (\n !date ||\n date.getFullYear() !== year ||\n date.getMonth() !== month ||\n date.getDate() !== day\n ) {\n return null;\n }\n\n return date;\n};\n","import type { Prettify } from \"@rzl-zone/ts-types-plus\";\n\nimport type { ParseParsedDataOptions } from \"../types/ParseParsedDataOptions\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { cleanParsedData } from \"../../cleanParsedData\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { parseCustomDate } from \"../../parseCustomDate\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { safeJsonParse } from \"../../safeJsonParse\";\n\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\n\nimport { noop } from \"@/generators/utils/noop\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype ValidatedParsedDataOptions = Prettify<Required<ParseParsedDataOptions>>;\n\n/** * ***Private Helper for Options Validation Function: {@link cleanParsedData | `cleanParsedData`}, {@link parseCustomDate | `parseCustomDate`} and {@link safeJsonParse | `safeJsonParse`}.***\n *\n * @internal\n */\nexport const validateJsonParsingOptions = (\n optionsValue: ParseParsedDataOptions = {}\n): ValidatedParsedDataOptions => {\n assertIsPlainObject(optionsValue, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const convertBooleans = hasOwnProp(optionsValue, \"convertBooleans\")\n ? optionsValue.convertBooleans\n : false;\n const convertDates = hasOwnProp(optionsValue, \"convertDates\")\n ? optionsValue.convertDates\n : false;\n const convertNumbers = hasOwnProp(optionsValue, \"convertNumbers\")\n ? optionsValue.convertNumbers\n : false;\n const loggingOnFail = hasOwnProp(optionsValue, \"loggingOnFail\")\n ? optionsValue.loggingOnFail\n : false;\n const removeEmptyArrays = hasOwnProp(optionsValue, \"removeEmptyArrays\")\n ? optionsValue.removeEmptyArrays\n : false;\n const removeEmptyObjects = hasOwnProp(optionsValue, \"removeEmptyObjects\")\n ? optionsValue.removeEmptyObjects\n : false;\n const removeNulls = hasOwnProp(optionsValue, \"removeNulls\")\n ? optionsValue.removeNulls\n : false;\n const removeUndefined = hasOwnProp(optionsValue, \"removeUndefined\")\n ? optionsValue.removeUndefined\n : false;\n const strictMode = hasOwnProp(optionsValue, \"strictMode\")\n ? optionsValue.strictMode\n : false;\n const checkSymbols = hasOwnProp(optionsValue, \"checkSymbols\")\n ? optionsValue.checkSymbols\n : false;\n const convertNaN = hasOwnProp(optionsValue, \"convertNaN\")\n ? optionsValue.convertNaN\n : false;\n\n const customDateFormats = hasOwnProp(optionsValue, \"customDateFormats\")\n ? optionsValue.customDateFormats\n : [];\n const onError = hasOwnProp(optionsValue, \"onError\")\n ? optionsValue.onError\n : noop;\n\n if (\n !(\n isBoolean(convertBooleans) &&\n isBoolean(convertDates) &&\n isBoolean(convertNumbers) &&\n isBoolean(convertNaN) &&\n isBoolean(checkSymbols) &&\n isBoolean(loggingOnFail) &&\n isBoolean(removeEmptyArrays) &&\n isBoolean(removeEmptyObjects) &&\n isBoolean(removeNulls) &&\n isBoolean(removeUndefined) &&\n isBoolean(strictMode) &&\n isArray(customDateFormats) &&\n isFunction(onError)\n )\n ) {\n throw new TypeError(\n `Invalid \\`options\\` parameter (second argument): \\`convertBooleans\\`, \\`convertDates\\`, \\`convertNumbers\\`, \\`loggingOnFail\\`, \\`removeEmptyArrays\\`, \\`removeEmptyObjects\\`, \\`removeNulls\\`, \\`removeUndefined\\`, \\`strictMode\\` expected to be a \\`boolean\\` type, \\`customDateFormats\\` expected to be a \\`array\\` type and \\`onError\\` expected to be a \\`void function\\` type. But received: ['convertBooleans': \\`${getPreciseType(\n convertBooleans\n )}\\`, 'convertDates': \\`${getPreciseType(\n convertDates\n )}\\`, 'convertNumbers': \\`${getPreciseType(\n convertNumbers\n )}\\`, 'loggingOnFail': \\`${getPreciseType(\n loggingOnFail\n )}\\`, 'removeEmptyArrays': \\`${getPreciseType(\n removeEmptyArrays\n )}\\`, 'removeEmptyObjects': \\`${getPreciseType(\n removeEmptyObjects\n )}\\`, 'removeNulls': \\`${getPreciseType(\n removeNulls\n )}\\`, 'removeUndefined': \\`${getPreciseType(\n removeUndefined\n )}\\`, 'strictMode': \\`${getPreciseType(\n strictMode\n )}\\`, 'customDateFormats': \\`${getPreciseType(\n customDateFormats\n )}\\`, 'onError': \\`${getPreciseType(onError)}\\`].`\n );\n }\n\n return {\n convertBooleans,\n convertDates,\n convertNumbers,\n convertNaN,\n loggingOnFail,\n removeEmptyArrays,\n removeEmptyObjects,\n removeNulls,\n removeUndefined,\n strictMode,\n customDateFormats,\n onError,\n checkSymbols\n };\n};\n","import type { ParseParsedDataOptions } from \"./_private/types/ParseParsedDataOptions\";\n\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isObject } from \"@/predicates/is/isObject\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isEmptyArray } from \"@/predicates/is/isEmptyArray\";\nimport { isEmptyObject } from \"@/predicates/is/isEmptyObject\";\n\nimport { parseCustomDate } from \"./parseCustomDate\";\nimport { validateJsonParsingOptions } from \"./_private/utils/validateJsonParsingOptions\";\n\n/** --------------------------------------------------\n * * ***Utility: `cleanParsedData`.***\n * ---------------------------------------------\n * **Cleans parsed JSON data based on provided options.**\n * @template T - Expected output type.\n * @param {*} data - The parsed JSON data.\n * @param {ParseParsedDataOptions} [options] - The cleaning options.\n * @returns {T | null | undefined} The cleaned data.\n * - ***⚠️ Notice:*** _If data is JSON string, we recommend use ***`safeJsonParse` utility function*** for more safe._\n * - ***⚠️ Note:*** _If using **`convertDates`** **options**, result may contain Date objects, you may need type assertions in strict TypeScript settings._\n * @example\n * ```ts\n * // 1: Convert numbers and remove nulls\n * const result = cleanParsedData({ age: \"25\", name: null }, {\n * convertNumbers: true,\n * removeNulls: true\n * });\n * console.log(result); // ➔ { age: 25 }\n * // 2: Convert boolean strings\n * const result = cleanParsedData({ isActive: \"true\" }, {\n * convertBooleans: true\n * });\n * console.log(result); // ➔ { isActive: true }\n * ```\n */\nexport const cleanParsedData = <T = unknown>(\n data: T,\n options: ParseParsedDataOptions = {}\n): T | undefined | null => {\n const validOptions = validateJsonParsingOptions(options);\n\n if (isNull(data)) return validOptions.removeNulls ? undefined : null;\n if (isUndefined(data))\n return validOptions.removeUndefined ? undefined : undefined;\n\n if (isString(data)) {\n const trimmed = data.trim();\n\n if (validOptions.convertNaN && trimmed === \"NaN\") return NaN as T;\n\n if (validOptions.convertNumbers && !isNaN(Number(trimmed))) {\n return Number(trimmed) as T;\n }\n\n if (validOptions.convertBooleans) {\n if (trimmed === \"true\") return true as T;\n if (trimmed === \"false\") return false as T;\n }\n\n if (validOptions.convertDates) {\n if (/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/.test(trimmed)) {\n return new Date(trimmed) as T;\n }\n\n if (validOptions.customDateFormats?.length) {\n for (const format of validOptions.customDateFormats) {\n const date = parseCustomDate(trimmed, format);\n if (date) return date as T;\n }\n }\n }\n\n return validOptions.strictMode ? undefined : (trimmed as T);\n }\n\n if (isArray(data)) {\n const cleanedArray = data\n .map((item) => cleanParsedData(item, validOptions))\n .filter((item) => !isUndefined(item));\n\n return validOptions.removeEmptyArrays && isEmptyArray(cleanedArray)\n ? undefined\n : (cleanedArray as T);\n }\n\n if (isObject(data)) {\n const cleanedObject: Record<string, unknown> = {};\n\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n const cleanedValue = cleanParsedData(data[key], validOptions);\n if (!isUndefined(cleanedValue)) {\n cleanedObject[key] = cleanedValue;\n }\n }\n }\n\n return validOptions.removeEmptyObjects &&\n isEmptyObject(cleanedObject, { checkSymbols: validOptions.checkSymbols })\n ? undefined\n : (cleanedObject as T);\n }\n\n return validOptions.strictMode ? undefined : data;\n};\n","import { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `extractDigits`.***\n * ---------------------------------------------\n * **Extracts digits from a string or number input.**\n * - **Behavior:**\n * - Converts the input to a string, trims whitespace, and removes any characters that are not digits (`0-9`).\n * - Returns the cleaned numeric value as a `number`.\n * - If the input is a `null`, `undefined`, results in no digits, or not a `string` (or empty-string) or `number`, it safely return `0`.\n * @param {*} [value]\n * **The value to process.**\n * - Accepts a string, number, `null`, or `undefined`.\n * @returns {number} The numeric value after extracting digits (returns `0` if input is invalid or contains no digits).\n * @example\n * extractDigits(12345); // ➔ 12345\n * extractDigits(\"9A8B7C6X1\"); // ➔ 98761\n * extractDigits(\"123abc456\"); // ➔ 123456\n * extractDigits(\"$1,234.56\"); // ➔ 123456\n * extractDigits(NaN); // ➔ 0\n * extractDigits(null); // ➔ 0\n * extractDigits(undefined); // ➔ 0\n * extractDigits(Infinity); // ➔ 0\n * extractDigits(-Infinity); // ➔ 0\n * extractDigits({}); // ➔ 0\n * extractDigits([]); // ➔ 0\n * extractDigits(\"\"); // ➔ 0\n * extractDigits(\" \"); // ➔ 0\n * extractDigits(\"abc\"); // ➔ 0\n * extractDigits(\" 00a \"); // ➔ 0\n */\nexport const extractDigits = (value: unknown): number => {\n if (!isString(value) && !isNumber(value)) return 0;\n\n const cleaned = String(value)\n .trim()\n .replace(/[^0-9]/g, \"\");\n\n return Number(cleaned) || 0;\n};\n","/* eslint-disable quotes */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { safeJsonParse } from \"../../safeJsonParse\";\n\n/** * ***Util Helper for {@link safeJsonParse | `safeJsonParse`}.***\n *\n * @internal\n */\nexport function fixSingleQuotesEscapeBackslash(input: string): string {\n const validEscapes = new Set([\"\\\\\", '\"', \"/\", \"b\", \"f\", \"n\", \"r\", \"t\", \"u\"]);\n\n let output = \"\";\n let inSingleQuote = false;\n let inDoubleQuote = false;\n let escapeNext = false;\n\n for (let i = 0; i < input.length; i++) {\n const c = input[i] || \"\";\n\n if (escapeNext) {\n if (inSingleQuote) {\n if (c === \"'\") {\n output += \"'\";\n } else if (validEscapes.has(c)) {\n if (c === \"\\\\\") {\n output += \"\\\\\\\\\";\n } else if (c === '\"') {\n output += '\\\\\"';\n } else {\n output += \"\\\\\" + c;\n }\n } else {\n output += \"\\\\\\\\\" + c;\n }\n } else if (inDoubleQuote) {\n if (c === '\"') {\n output += '\\\\\"';\n } else if (validEscapes.has(c)) {\n output += \"\\\\\" + c;\n } else {\n output += \"\\\\\\\\\" + c;\n }\n } else {\n output += \"\\\\\" + c;\n }\n escapeNext = false;\n continue;\n }\n\n if (c === \"\\\\\") {\n escapeNext = true;\n continue;\n }\n\n if (!inSingleQuote && !inDoubleQuote) {\n if (c === \"'\") {\n output += '\"';\n inSingleQuote = true;\n continue;\n }\n if (c === '\"') {\n output += '\"';\n inDoubleQuote = true;\n continue;\n }\n } else if (inSingleQuote) {\n if (c === \"'\") {\n output += '\"';\n inSingleQuote = false;\n continue;\n }\n } else if (inDoubleQuote) {\n if (c === '\"') {\n output += '\"';\n inDoubleQuote = false;\n continue;\n }\n }\n\n output += c;\n }\n\n return output;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { IsAny } from \"@rzl-zone/ts-types-plus\";\nimport type { ParseParsedDataOptions } from \"./_private/types/ParseParsedDataOptions\";\nimport type {\n SafeJsonParseResult,\n UnknownValue\n} from \"./_private/types/safeJsonParse\";\n\nimport { isNaN } from \"@/predicates/is/isNaN\";\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isError } from \"@/predicates/is/isError\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nimport { cleanParsedData } from \"./cleanParsedData\";\nimport { extractDigits } from \"../numerics/extractDigits\";\nimport { validateJsonParsingOptions } from \"./_private/utils/validateJsonParsingOptions\";\nimport { fixSingleQuotesEscapeBackslash } from \"./_private/utils/fixSingleQuotesEscapeBackslash\";\n\n/** --------------------------------------------------\n * * ***Utility: `safeJsonParse`.***\n * ---------------------------------------------\n * **Safely parses JSON while handling errors and applying transformations.**\n * - **Supports generics** to ensure accurate return type inference.\n * - Always provide both `<TData, TInput>` for best results.\n * - ℹ️ ***Scroll down for full generic behavior explanation.***\n * - Automatically parses valid JSON strings into `objects`, `arrays`, `numbers`, etc.\n * - Supports data transformation via options (e.g., convert strings to `numbers`, `booleans`, or `dates`).\n * - **Returns:**\n * 1. `null` ➔ if input is explicitly `null`.\n * 2. `undefined` ➔ if input is `undefined`, not a `string`, or if parsing fails.\n * 3. Parsed and cleaned result (`TData`) ➔ if input is a valid JSON string.\n * - ⚠️ **JSON.stringify note**:\n * - _If the input JSON string was created using `JSON.stringify()`, any properties with `undefined`\n * values would have been automatically removed or converted to `null` depending on the serializer, example:_\n * ```ts\n * JSON.stringify({ a: undefined, b: 1 }); // ➔ '{\"b\":1}'\n * JSON.parse('{\"a\": undefined, \"b\": 1}') // ❌ invalid JSON\n * ```\n * _Therefore, if you see `undefined` in raw input, it will likely throw unless pre-cleaned or replaced with `null`._\n *\n * ```ts\n * safeJsonParse('{\"name\": \"John\", \"score\": undefined}');\n * // result ➔ { name: \"John\", score: null } <- because `undefined` is not valid JSON, gets replaced to null.\n * ```\n * - ℹ️ **Additionally:**\n * - This function normalizes single quotes (`'`) to double quotes (`\"`) before parsing,\n * so JSON strings using single quotes will be converted to valid JSON format, example:\n * ```ts\n * safeJsonParse(\"{'name': 'John', 'age': 30}\");\n * // result ➔ { name: \"John\", age: 30 }\n *\n * safeJsonParse(\"{'string\\\\'s': 'abc', \\\"quote's\\\": 'It\\\\'s awesome!', 'aNumber\\\\'s': 123, 'keyWith\\\\'Backslash\\\\'s': 'value\\\\'s'}\");\n * // result ➔ { \"string's\": \"abc\", \"quote's\": \"It's awesome!\", \"aNumber's\": 123, \"keyWith'Backslash's\": \"value's\" }\n * ```\n * @template TData - The expected output type after parsing and cleaning.\n * @template TInput - The input value type, used for advanced type inference and return typing.\n * @param {TInput} [value] - The JSON string or value to parse.\n * @param {ParseParsedDataOptions} [options] - Options to clean, convert types, enable strict mode,\n * support custom date formats, enable logging, or handle errors via callback.\n * @returns {SafeJsonParseResult<TData, TInput>} Parsed and optionally cleaned result, or `null`/`undefined`.\n * @throws **{@link TypeError | `TypeError`}** if `options` is provided but not a valid object.\n * @example\n * 1. ***Basic parse with number & boolean conversion:***\n * ```ts\n * const result = safeJsonParse(30);\n * // result ➔ undefined\n * const result = safeJsonParse(30, {\n * convertNumbers: true\n * });\n * // result ➔ 30\n *\n * const result = safeJsonParse('{\"age\": \"30\", \"isActive\": \"true\"}', {\n * convertNumbers: true,\n * convertBooleans: true\n * });\n * // result ➔ { age: 30, isActive: true }\n * ```\n * 2. ***Handling `undefined` in input string (manually written, not JSON.stringify):***\n * ```ts\n * const result = safeJsonParse('{\"score\": undefined}');\n * // result ➔ { score: null } <- because `undefined` is not valid JSON, gets replaced\n * ```\n *\n * 3. ***Handling `NaN` in input string (manually written, not JSON.stringify):***\n * ```ts\n * const value = NaN; // <- value is NaN or \"NaN\";\n * const result = safeJsonParse(value);\n * // result ➔ undefined <- will return as undefined, because options `convertNaN` is false (default),\n * const result2 = safeJsonParse(value, { convertNaN: true });\n * // result2 ➔ NaN <- will return as undefined because options `convertNaN` is false,\n *\n * const result4 = safeJsonParse('{\"strNan\": \"NaN\", \"pureNan\": NaN}');\n * // NaN will convert to string (NaN ➔ \"NaN\") because options `convertNaN` is false (default),\n * // result4 ➔ { strNan: \"NaN\", pureNan: \"NaN\" }\n *\n * const result3 = safeJsonParse('{\"strNan\": \"NaN\", \"pureNan\": NaN}', {\n * convertNaN: true\n * });\n * // String \"NaN\" will convert to NaN (\"NaN\" ➔ NaN) because options `convertNaN` is true,\n * // result3 ➔ { strNan: NaN, pureNan: NaN }\n * ```\n *\n * 4. ***Strict mode (removes invalid values):***\n * ```ts\n * const result = safeJsonParse('{\"name\": \" \", \"score\": \"99abc\"}', {\n * convertNumbers: true,\n * strictMode: true\n * });\n * // result ➔ {}\n *\n * const result2 = safeJsonParse('{\"name\": \" \", \"score\": undefined}');\n * // result2 ➔ { name: \"\",score: null }\n * ```\n *\n * 5. ***Custom date format parsing:***\n * ```ts\n * const result = safeJsonParse('{\"birthday\": \"25/12/2000\"}', {\n * convertDates: true,\n * customDateFormats: [\"DD/MM/YYYY\"]\n * });\n * // result ➔ { birthday: new Date(\"2000-12-25T00:00:00.000Z\") }\n * ```\n *\n * 6. ***Invalid JSON with custom error handling:***\n * ```ts\n * safeJsonParse(\"{invalid}\", {\n * loggingOnFail: true,\n * onError: (err) => console.log(\"Custom handler:\", err.message)\n * });\n * // ➔ Logs parsing error and invokes handler\n * ```\n *\n * 7. ***Null or non-string input returns null/undefined (default options):***\n * ```ts\n * safeJsonParse(123); // ➔ undefined\n * safeJsonParse(null); // ➔ null\n * safeJsonParse(undefined); // ➔ undefined\n * ```\n *\n * 8. ***Generic usage: Provide both output and input type to ensure correct return typing:***\n * ```ts\n * type UserType = { name: string };\n *\n * const obj = JSON.stringify({\n * name: \"John\"\n * });\n *\n * const toParse = isAuth() ? obj : null;\n * const toParse2 = isAuth() ? obj : undefined;\n *\n * // * `Without Generic`:\n * const parsed = safeJsonParse(toParse);\n * //- runtime: { name: \"John\" } | undefined | null\n * //- type: Record<string, unknown> | undefined | null\n * const parsed2 = safeJsonParse(toParse);\n * //- runtime: { name: \"John\" } | undefined\n * //- type: Record<string, unknown> | undefined\n *\n * // * `With Generic`:\n * const parsed = safeJsonParse<UserType>(toParse);\n * //- runtime: { name: \"John\" } | undefined | null\n * //- type: undefined <- (⚠️ unexpected!)\n * const parsed2 = safeJsonParse<UserType>(toParse);\n * //- runtime: { name: \"John\" } | undefined\n * //- type: undefined <- (⚠️ unexpected!)\n * const parsed = safeJsonParse<UserType, typeof toParse>(toParse);\n * //- runtime: { name: \"John\" } | null | undefined\n * //- type: UserType | null | undefined\n * const parsed2 = safeJsonParse<UserType, typeof toParse>(toParse);\n * //- runtime: { name: \"John\" } | undefined\n * //- type: UserType | undefined\n * ```\n * @note\n * ⚠️ **Generic Behavior:**\n * - This function supports advanced generic inference for clean, type-safe return values.\n * - If only the first generic (`TData`) is provided and the second (`TInput`) is omitted,\n * then `TInput` defaults to `undefined`, resulting in a return type of `undefined`.\n * - To ensure correct return typing, **always pass both generics** when `value` is dynamic,\n * nullable, or unioned: `safeJsonParse<TData, typeof value>(value)`.\n * - This makes the returned type exactly match your expectation: `TData | null | undefined`.\n */\nexport function safeJsonParse<\n TData extends Record<string, any> = Record<string, unknown>,\n TInput extends UnknownValue = UnknownValue\n>(\n value: TInput,\n options?: ParseParsedDataOptions\n): IsAny<TInput> extends true ? TData | null | undefined : undefined;\nexport function safeJsonParse<\n TData extends Record<string, any> = Record<string, unknown>,\n TInput extends string | null | undefined | unknown = undefined\n>(\n value: TInput,\n options?: ParseParsedDataOptions\n): SafeJsonParseResult<TData, TInput>;\n//! implement main function\nexport function safeJsonParse<TData extends Record<string, unknown>>(\n value: unknown,\n options: ParseParsedDataOptions = {}\n) {\n if (isNull(value)) return null;\n const validOptions = validateJsonParsingOptions(options);\n\n if (\n validOptions.convertNaN &&\n (isNaN(value) || (isNonEmptyString(value) && value === \"NaN\"))\n ) {\n return NaN;\n }\n if (\n validOptions.convertNumbers &&\n !isNaN(Number(value)) &&\n isNumber(extractDigits(value))\n ) {\n return Number(value);\n }\n\n if (!isString(value)) return undefined;\n\n try {\n // First, normalize all single quotes to double quotes\n let normalized = fixSingleQuotesEscapeBackslash(value);\n\n if (validOptions.removeUndefined) {\n normalized = normalized\n .replace(/,\\s*\"[^\"]*\"\\s*:\\s*undefined(?=\\s*[},])/g, \"\")\n // ➔ remove , \"key\": undefined\n .replace(/\"[^\"]*\"\\s*:\\s*undefined\\s*(,)?/g, \"\");\n // ➔ remove \"key\": undefined\n } else {\n normalized = normalized.replace(/:\\s*undefined(?=\\s*[,}])/g, \":null\");\n // ➔ replace :undefined with :null\n }\n\n if (validOptions.convertNaN) {\n // eslint-disable-next-line quotes\n normalized = normalized.replace(/:\\s*NaN(?=\\s*[,}])/g, ':\"NaN\"');\n // ➔ convert :NaN to :\"NaN\"\n } else {\n normalized = normalized\n // eslint-disable-next-line quotes\n .replace(/:\\s*NaN(?=\\s*[,}])/g, ':\"NaN\"')\n // ➔ convert :NaN to :\"NaN\"\n .replace(/,\\s*\"[^\"]*\"\\s*:\\s*NaN(?=\\s*[},])/g, \"\")\n // ➔ remove , \"key\": NaN\n .replace(/\"[^\"]*\"\\s*:\\s*NaN\\s*(,)?/g, \"\");\n // ➔ remove \"key\": NaN\n }\n\n normalized = normalized.replace(/,(\\s*[}\\]])/g, \"$1\");\n // ➔ remove trailing comma before } or ]\n\n const parsed = JSON.parse(normalized);\n return cleanParsedData<TData>(parsed, validOptions);\n } catch (error) {\n if (validOptions.loggingOnFail) {\n console.error(\"Failed to parsing at `safeJsonParse`:\", error);\n }\n\n validOptions.onError(\n isError(error)\n ? new Error(error.message.replace(/^JSON\\.parse:/, \"Failed to parsing\"))\n : new Error(String(error))\n );\n\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,mBACX,YACA,WACgB;CAChB,IAAI,CAACA,yCAAiB,UAAU,KAAK,CAACA,yCAAiB,MAAM,GAC3D,MAAM,IAAI,UACR,4HAA4HC,uC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,OAAO;CAC1B,MAAM,eAAe,2BAA2B,OAAO;CAEvD,IACE,aAAa,eACZC,8BAAM,KAAK,KAAMC,yCAAiB,KAAK,KAAK,UAAU,QAEvD,OAAO;CAET,IACE,aAAa,kBACb,CAACD,8BAAM,OAAO,KAAK,CAAC,KACpBE,iCAAS,cAAc,KAAK,CAAC,GAE7B,OAAO,OAAO,KAAK;CAGrB,IAAI,CAACC,iCAAS,KAAK,GAAG,OAAO;CAE7B,IAAI;EAEF,IAAI,aAAa,+BAA+B,KAAK;EAErD,IAAI,aAAa,iBACf,aAAa,WACV,QAAQ,2CAA2C,EAAE,EAErD,QAAQ,mCAAmC,EAAE;OAGhD,aAAa,WAAW,QAAQ,6BAA6B,OAAO;EAItE,IAAI,aAAa,YAEf,aAAa,WAAW,QAAQ,uBAAuB,UAAQ;OAG/D,aAAa,WAEV,QAAQ,uBAAuB,UAAQ,EAEvC,QAAQ,qCAAqC,EAAE,EAE/C,QAAQ,6BAA6B,EAAE;EAI5C,aAAa,WAAW,QAAQ,gBAAgB,IAAI;EAIpD,OAAO,gBADQ,KAAK,MAAM,UACS,GAAG,YAAY;CACpD,SAAS,OAAO;EACd,IAAI,aAAa,eACf,QAAQ,MAAM,yCAAyC,KAAK;EAG9D,aAAa,QACXC,gCAAQ,KAAK,IACT,IAAI,MAAM,MAAM,QAAQ,QAAQ,iBAAiB,mBAAmB,CAAC,IACrE,IAAI,MAAM,OAAO,KAAK,CAAC,CAC7B;EAEA;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safeStableStringify-B2KTTS3r.js","names":[],"sources":["../src/predicates/is/isMap.ts","../src/predicates/is/isDate.ts","../src/conversions/stringify/safeStableStringify.ts"],"sourcesContent":["/** --------------------------------------------------\n * * ***Type guard: `isMap`.***\n * ----------------------------------------------------------\n * **Checks whether the given value is a **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object**.**\n * - **Behavior:**\n * - Ensures that the provided value is an instance of **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)**.\n * - Useful in TypeScript for narrowing types when working with collections.\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is instance of **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)**, else `false`.\n * @example\n * isMap(new Map());\n * // ➔ true\n * isMap(new WeakMap());\n * // ➔ false\n * isMap({});\n * // ➔ false\n */\nexport function isMap<K = unknown, V = unknown>(\n value: Map<K, V>\n): value is Map<K, V>;\nexport function isMap(value: unknown): value is Map<unknown, unknown>;\nexport function isMap(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Map]\" ||\n value instanceof Map\n );\n}\n","import { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { isNaN } from \"./isNaN\";\nimport { isPlainObject } from \"./isPlainObject\";\nimport { isBoolean } from \"./isBoolean\";\n\ntype isDateOptions = {\n /** * ***Skip the validity check (`!isNaN(date.getTime())`).***\n *\n * When `true`, the function only checks that the value is an\n * instance of `Date` without verifying that it represents a valid\n * date value, default: `false`.\n *\n * @default false\n */\n skipInvalidDate?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Type guard: `isDate`.***\n * ----------------------------------------------------------\n * **Determines whether the given `value` is a real, valid JavaScript\n * **[`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** object.**\n * - **Behavior:**\n * - Returns **true** only if:\n * - `value` is an instance of `Date`.\n * - and, unless `options.skipInvalidDate` is `true`,\n * the underlying time value is valid (`!isNaN(value.getTime())`).\n * - Returns **false** for:\n * - non-Date values (strings, numbers, etc.).\n * - `Date` instances that represent an invalid time value\n * (e.g. `new Date(\"bad\")`), unless skipping is enabled.\n * @param {*} value - The value to check.\n * @param {isDateOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if value is a valid Date object.\n * @example\n * isDate(new Date());\n * // ➜ true\n * isDate(new Date(\"invalid\"));\n * // ➜ false\n * isDate(\"2024-01-01\");\n * // ➜ false\n *\n * // Skipping validity check:\n * isDate(new Date(\"invalid\"), { skipInvalidDate: true });\n * // ➜ true\n */\nexport const isDate = (\n value: unknown,\n options: isDateOptions = {}\n): value is Date => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const skipInvalidDate =\n isPlainObject(options) && isBoolean(options.skipInvalidDate)\n ? options.skipInvalidDate\n : false;\n\n const instanceDate = value instanceof Date;\n\n if (skipInvalidDate) return instanceDate;\n return instanceDate && !isNaN(value.getTime());\n};\n","import { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { isSet } from \"@/predicates/is/isSet\";\nimport { isMap } from \"@/predicates/is/isMap\";\nimport { isNaN } from \"@/predicates/is/isNaN\";\nimport { isDate } from \"@/predicates/is/isDate\";\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isSymbol } from \"@/predicates/is/isSymbol\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isObject } from \"@/predicates/is/isObject\";\nimport { isBigInt } from \"@/predicates/is/isBigInt\";\nimport { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isNumberObject } from \"@/predicates/is/isNumberObject\";\nimport { isStringObject } from \"@/predicates/is/isStringObject\";\nimport { isBooleanObject } from \"@/predicates/is/isBooleanObject\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isInfinityNumber } from \"@/predicates/is/isInfinityNumber\";\n\n/** -------------------------------------------------\n * * ***Type Options for **{@link safeStableStringify | `safeStableStringify`}**.***\n * -------------------------------------------------\n */\ntype SafeStableStringifyOptions = {\n /** -------------------------------------------------\n * * ***Whether to sort **object keys** alphabetically (recursively).***\n * -------------------------------------------------\n *\n * - `true` (default): object keys are sorted to ensure stable output.\n * - `false`: preserves original insertion order of keys.\n *\n * @default true\n */\n sortKeys?: boolean;\n /** -------------------------------------------------\n * * ***Whether to sort **primitive values inside arrays**.***\n * -------------------------------------------------\n *\n * - `true`: primitive values in arrays are sorted to ensure stable output.\n * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.\n *\n * @default false\n */\n sortArray?: boolean;\n /** -------------------------------------------------\n * * ***Whether to pretty-print JSON output with 2-space indentation.***\n * -------------------------------------------------\n *\n * - `true`: output is formatted with indentation and newlines.\n * - `false` (default): produces compact single-line JSON.\n *\n * @default false\n */\n pretty?: boolean;\n /** -------------------------------------------------\n * * ***Preserve `undefined` values instead of converting them to `null`.***\n * -------------------------------------------------\n * **Controls how the internal `deepProcess` step rewrites values\n * **before** the final `JSON.stringify` call.**\n * - **Default (`false`):**\n * * Every `undefined` value (object properties **and** array elements)\n * is replaced with `null` **before** serialization, because this happens\n * first, the key is **not removed** by `JSON.stringify`.\n * - **`true`** – Leaves `undefined` untouched so the final\n * `JSON.stringify` call behaves natively:\n * * Object properties with `undefined` are **removed**.\n * * Array elements that are `undefined` become `null`.\n * @default false\n * @example\n * // ✅ keepUndefined = true: behaves like native JSON.stringify\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key removed\n *\n * // ✅ Default (false): convert undefined to null, key kept\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}' // key present, value null\n *\n * // Arrays\n * safeStableStringify([undefined]);\n * // ➔ '[null]' // same, but via pre-replacement\n * safeStableStringify([undefined], { keepUndefined: true });\n * // ➔ '[null]' // element becomes null\n */\n keepUndefined?: boolean;\n};\n\n/** --------------------------------------------\n * * ***Utility: `safeStableStringify`.***\n * ---------------------------------------------\n * **Safely converts a JavaScript value into a stable, JSON-compatible string.**\n * - **This function is an enhanced version of `JSON.stringify` with additional guarantees:**\n * - ***Features:***\n * - Recursively sorts object keys **only if** `sortKeys` is `true` (default: `true`), to ensure stable\n * key order.\n * - If `sortKeys` is `false`, preserves the original insertion order of object keys.\n * - Optionally sorts array primitive values **only if** `sortArray` is `true` (default: `false`).\n * - Only primitive values in arrays are sorted.\n * - Objects and nested arrays keep their original position and are appended after sorted primitives.\n * - If `sortArray` is `false`, arrays retain their original order.\n * - Converts JavaScript special values for JSON safety:\n * - `undefined`, `NaN`, `Infinity`, `-Infinity` ➔ `null`.\n * - `BigInt` ➔ string (JSON does not support BigInt).\n * - Converts boxed primitives box into their primitive equivalents:\n * - `new Number(42)` ➔ `Number(42)` ➔ `42`.\n * - `new String(\"hi\")` ➔ `String(\"hi\")` ➔ `\"hi\"`.\n * - `new Boolean(true)` ➔ `Boolean(true)` ➔ `true`.\n * - Functions and Symbols are removed.\n * - Circular references are replaced with the string `\"[Circular]\"`.\n * - Serializes:\n * - `Date` ➔ ISO string (`date.toISOString()`).\n * - `Set` ➔ `{ set: [values...] }` (values are recursively processed).\n * - `Map` ➔ `{ map: [ [key, value], ... ] }` (values are recursively processed).\n * - Compared to `JSON.stringify`, this ensures **stable output**:\n * - Same object structure always produces the same string.\n * - Useful for deep equality checks, hashing, caching keys, or snapshot tests.\n * - Controls how `undefined` is handled **before** the final `JSON.stringify` call, by `keepUndefined`\n * options, default: `false`.\n * - **false**: All `undefined` values (object properties and array elements) are replaced\n * with `null`, so object keys remain.\n * - **true**: Leaves `undefined` values as-is, and handling by native `JSON.stringify` then:\n * 1. Removes object properties that are `undefined`.\n * 2. Converts `undefined` array elements to `null`.\n * - Use `true` when you need native removal of keys or to preserve sparse arrays\n * exactly as `JSON.stringify` would.\n * @param {*} value\n * ***Any JavaScript value to serialize, can be:***\n * - Primitives (`number`, `string`, `boolean`, `bigint`, `null`, `undefined`).\n * - Boxed primitives (`new Number()`, `new String()`, `new Boolean()`).\n * - Arrays, plain objects, nested structures.\n * - Date, Map, Set.\n * - Circular structures.\n * @param {SafeStableStringifyOptions} [options]\n * ***Configuration options for `safeStableStringify`:***\n * - `keepUndefined` (boolean) – Control how `undefined` is handled **before** the final `JSON.stringify`\n * call, default: `false`.\n * - `sortKeys` (boolean) – Whether to sort object keys alphabetically (recursively), default: `true`.\n * - `sortArray` (boolean) – Whether to sort primitive values inside arrays, default: `false`.\n * - `pretty` (boolean) – Whether to pretty-print JSON output with 2-space indentation, default: `false`.\n * @returns {string}\n * A stable JSON string representation of the input value.\n * @throws **{@link TypeError | `TypeError`}** if `sortKeys`, `sortArray`, or `pretty` are not strictly boolean.\n * @example\n * ```ts\n * // Basic object key sorting\n * safeStableStringify({ b: 2, a: 1 });\n * // ➔ '{\"a\":1,\"b\":2}'\n *\n * // Disable key sorting (preserve insertion order)\n * safeStableStringify({ b: 2, a: 1 }, {\n * sortKeys:false\n * });\n * // ➔ '{\"b\":2,\"a\":1}'\n *\n * // Sorting arrays with sortArray\n * safeStableStringify([3, 1, 2], {\n * sortArray:true\n * });\n * // ➔ '[1,2,3]'\n *\n * // keepUndefined = true (native removal of keys)\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key `a` is removed, like native JSON.stringify\n *\n * // Default keepUndefined = false (convert to null, keep key)\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}'\n *\n * // Nested object + sortArray=true\n * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {\n * sortKeys:true,\n * sortArray:true\n * });\n * // ➔ '{\"x\":{\"c\":3,\"d\":4},\"z\":[1,2,3]}'\n *\n * // sortKeys=false and sortArray=true\n * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {\n * sortKeys:false,\n * sortArray:true\n * });\n * // ➔ '{\"z\":[1,2,3],\"x\":{\"d\":4,\"c\":3}}'\n *\n * // Pretty print output\n * safeStableStringify([3, 1, 2], {\n * sortArray:true,\n * pretty:true\n * });\n * // ➔ `[\n * // 1,\n * // 2,\n * // 3\n * // ]`\n *\n * // Boxed primitives converted to primitive\n * safeStableStringify({ n: new Number(42), s: new String(\"hi\"), b: new Boolean(true) });\n * // ➔ '{\"n\":42,\"s\":\"hi\",\"b\":true}'\n *\n * // Handles Date, BigInt, Map and Set\n * safeStableStringify({\n * time: new Date(\"2025-01-01\"),\n * big: BigInt(9007199254740991),\n * data: new Map([[\"key\", new Set([1, 2])]])\n * });\n * // ➔ '{\"big\":\"9007199254740991\",\"data\":{\"map\":[[\"key\",{\"set\":[1,2]}]]},\"time\":\"2025-01-01T00:00:00.000Z\"}'\n *\n * // Functions and symbols are removed\n * safeStableStringify({ f: () => {}, s: Symbol(\"wow\") });\n * // ➔ '{}'\n *\n * // undefined, NaN, Infinity convert to null (keepUndefined = false or keepUndefined = true)\n * safeStableStringify([undefined, NaN, Infinity, -Infinity]);\n * // ➔ '[null,null,null,null]'\n *\n * // Circular reference\n * const obj = { name: \"A\" };\n * obj.self = obj;\n * safeStableStringify(obj);\n * // ➔ '{\"name\":\"A\",\"self\":\"[Circular]\"}'\n *\n * // Complex nested sortArray with objects\n * const arr = [9, 7, [4, 2, 3], { z: [5, 1, 6] }];\n * safeStableStringify(arr, { sortArray: true, sortKeys: true });\n * // ➔ '[7,9,[2,3,4],{\"z\":[1,5,6]}]'\n * ```\n */\nexport const safeStableStringify = (\n value: unknown,\n options: SafeStableStringifyOptions = {}\n): string => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const pretty = hasOwnProp(options, \"pretty\") ? options.pretty : false;\n const sortKeys = hasOwnProp(options, \"sortKeys\") ? options.sortKeys : true;\n const sortArray = hasOwnProp(options, \"sortArray\")\n ? options.sortArray\n : false;\n const keepUndefined = hasOwnProp(options, \"keepUndefined\")\n ? options.keepUndefined\n : false;\n\n if (\n !isBoolean(sortKeys) ||\n !isBoolean(sortArray) ||\n !isBoolean(pretty) ||\n !isBoolean(keepUndefined)\n ) {\n throw new TypeError(\n `Parameters \\`sortKeys\\`, \\`sortArray\\`, \\`keepUndefined\\` and \\`pretty\\` property of the \\`options\\` (second parameter) must be of type \\`boolean\\`, but received: \"['sortKeys': \\`${getPreciseType(\n sortKeys\n )}\\`, 'sortArray': \\`${getPreciseType(\n sortArray\n )}\\`, 'keepUndefined': \\`${getPreciseType(\n keepUndefined\n )}\\`, 'pretty': \\`${getPreciseType(pretty)}\\`]\".`\n );\n }\n\n if (isUndefined(value)) {\n return keepUndefined ? \"undefined\" : \"null\";\n }\n\n const seen = new WeakSet();\n\n const isPrimitive = (val: unknown): boolean =>\n isNull(val) || (!isObjectOrArray(val) && !isFunction(val));\n\n const deepProcess = (val: unknown): unknown => {\n if (isNumberObject(val)) {\n const valOf = val.valueOf();\n return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n }\n if (isStringObject(val)) return val.valueOf();\n if (isBooleanObject(val)) return val.valueOf();\n if (isFunction(val) || isSymbol(val)) return undefined;\n if (isBigInt(val)) return val.toString();\n if (isNaN(val) || isInfinityNumber(val)) return null;\n if (isUndefined(val)) {\n return keepUndefined ? undefined : null;\n }\n\n if (isObjectOrArray(val)) {\n if (seen.has(val)) return \"[Circular]\";\n seen.add(val);\n\n if (isDate(val)) return val.toISOString();\n if (isMap(val)) {\n return {\n map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])\n };\n }\n if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\n if (isArray(val)) {\n const processedArr = val.map(deepProcess);\n if (sortArray) {\n const primitives: unknown[] = [];\n const nonPrimitives: unknown[] = [];\n\n for (const item of processedArr) {\n if (isPrimitive(item)) primitives.push(item);\n else nonPrimitives.push(item);\n }\n primitives.sort((a, b) => {\n if (isNumber(a) && isNumber(b)) return a - b;\n return String(a).localeCompare(String(b));\n });\n return [...primitives, ...nonPrimitives];\n }\n return processedArr;\n }\n\n const keys = Object.keys(val);\n if (sortKeys) {\n keys.sort((a, b) => {\n const na = Number(a);\n const nb = Number(b);\n if (!isNaN(na) && !isNaN(nb)) return na - nb;\n return a.localeCompare(b);\n });\n }\n\n const result: Record<string, unknown> = {};\n\n if (isObject(val)) {\n for (const k of keys) {\n const v = deepProcess(val[k]);\n if (!isUndefined(v)) result[k] = v;\n }\n }\n\n return result;\n }\n\n return val;\n };\n\n try {\n return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n } catch (err) {\n console.warn(\"Error in safeStableStringify:\", err);\n return \"{}\";\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,MAAM,OAAyB;CAC7C,OACE,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,kBAC1C,iBAAiB;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA,MAAa,UACX,OACA,UAAyB,CAAC,MACR;CAClB,oBAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,kBACJ,cAAc,OAAO,KAAK,UAAU,QAAQ,eAAe,IACvD,QAAQ,kBACR;CAEN,MAAM,eAAe,iBAAiB;CAEtC,IAAI,iBAAiB,OAAO;CAC5B,OAAO,gBAAgB,CAAC,MAAM,MAAM,QAAQ,CAAC;AAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmKA,MAAa,uBACX,OACA,UAAsC,CAAC,MAC5B;CACX,oBAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,SAAS,WAAW,SAAS,QAAQ,IAAI,QAAQ,SAAS;CAChE,MAAM,WAAW,WAAW,SAAS,UAAU,IAA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CACT;AACF"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ========================================================================
|
|
3
|
-
* @rzl-zone/utils-js
|
|
4
|
-
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.1`
|
|
6
|
-
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
-
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
-
* ========================================================================
|
|
9
|
-
*/
|
|
10
|
-
"use strict";
|
|
11
|
-
const require_assertIsBoolean = require('./assertIsBoolean-D41HrTB_.cjs');
|
|
12
|
-
const require_isBigInt = require('./isBigInt-BVj0M5pq.cjs');
|
|
13
|
-
function isMap(value) {
|
|
14
|
-
return Object.prototype.toString.call(value) === "[object Map]" || value instanceof Map;
|
|
15
|
-
}
|
|
16
|
-
const isDate = (value, options = {}) => {
|
|
17
|
-
require_assertIsBoolean.assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
18
|
-
const skipInvalidDate = require_assertIsBoolean.isPlainObject(options) && require_assertIsBoolean.isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;
|
|
19
|
-
const instanceDate = value instanceof Date;
|
|
20
|
-
if (skipInvalidDate) return instanceDate;
|
|
21
|
-
return instanceDate && !require_assertIsBoolean.isNaN(value.getTime());
|
|
22
|
-
};
|
|
23
|
-
const safeStableStringify = (value, options = {}) => {
|
|
24
|
-
require_assertIsBoolean.assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
25
|
-
const pretty = require_assertIsBoolean.hasOwnProp(options, "pretty") ? options.pretty : false;
|
|
26
|
-
const sortKeys = require_assertIsBoolean.hasOwnProp(options, "sortKeys") ? options.sortKeys : true;
|
|
27
|
-
const sortArray = require_assertIsBoolean.hasOwnProp(options, "sortArray") ? options.sortArray : false;
|
|
28
|
-
const keepUndefined = require_assertIsBoolean.hasOwnProp(options, "keepUndefined") ? options.keepUndefined : false;
|
|
29
|
-
if (!require_assertIsBoolean.isBoolean(sortKeys) || !require_assertIsBoolean.isBoolean(sortArray) || !require_assertIsBoolean.isBoolean(pretty) || !require_assertIsBoolean.isBoolean(keepUndefined)) throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${require_assertIsBoolean.getPreciseType(sortKeys)}\`, 'sortArray': \`${require_assertIsBoolean.getPreciseType(sortArray)}\`, 'keepUndefined': \`${require_assertIsBoolean.getPreciseType(keepUndefined)}\`, 'pretty': \`${require_assertIsBoolean.getPreciseType(pretty)}\`]".`);
|
|
30
|
-
if (require_assertIsBoolean.isUndefined(value)) return keepUndefined ? "undefined" : "null";
|
|
31
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
32
|
-
const isPrimitive = (val) => require_assertIsBoolean.isNull(val) || !require_assertIsBoolean.isObjectOrArray(val) && !require_assertIsBoolean.isFunction(val);
|
|
33
|
-
const deepProcess = (val) => {
|
|
34
|
-
if (require_assertIsBoolean.isNumberObject(val)) {
|
|
35
|
-
const valOf = val.valueOf();
|
|
36
|
-
return require_assertIsBoolean.isNaN(valOf) || require_assertIsBoolean.isInfinityNumber(valOf) ? null : valOf;
|
|
37
|
-
}
|
|
38
|
-
if (require_assertIsBoolean.isStringObject(val)) return val.valueOf();
|
|
39
|
-
if (require_assertIsBoolean.isBooleanObject(val)) return val.valueOf();
|
|
40
|
-
if (require_assertIsBoolean.isFunction(val) || require_assertIsBoolean.isSymbol(val)) return void 0;
|
|
41
|
-
if (require_isBigInt.isBigInt(val)) return val.toString();
|
|
42
|
-
if (require_assertIsBoolean.isNaN(val) || require_assertIsBoolean.isInfinityNumber(val)) return null;
|
|
43
|
-
if (require_assertIsBoolean.isUndefined(val)) return keepUndefined ? void 0 : null;
|
|
44
|
-
if (require_assertIsBoolean.isObjectOrArray(val)) {
|
|
45
|
-
if (seen.has(val)) return "[Circular]";
|
|
46
|
-
seen.add(val);
|
|
47
|
-
if (isDate(val)) return val.toISOString();
|
|
48
|
-
if (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };
|
|
49
|
-
if (require_assertIsBoolean.isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };
|
|
50
|
-
if (require_assertIsBoolean.isArray(val)) {
|
|
51
|
-
const processedArr = val.map(deepProcess);
|
|
52
|
-
if (sortArray) {
|
|
53
|
-
const primitives = [];
|
|
54
|
-
const nonPrimitives = [];
|
|
55
|
-
for (const item of processedArr) if (isPrimitive(item)) primitives.push(item);
|
|
56
|
-
else nonPrimitives.push(item);
|
|
57
|
-
primitives.sort((a, b) => {
|
|
58
|
-
if (require_assertIsBoolean.isNumber(a) && require_assertIsBoolean.isNumber(b)) return a - b;
|
|
59
|
-
return String(a).localeCompare(String(b));
|
|
60
|
-
});
|
|
61
|
-
return [...primitives, ...nonPrimitives];
|
|
62
|
-
}
|
|
63
|
-
return processedArr;
|
|
64
|
-
}
|
|
65
|
-
const keys = Object.keys(val);
|
|
66
|
-
if (sortKeys) keys.sort((a, b) => {
|
|
67
|
-
const na = Number(a);
|
|
68
|
-
const nb = Number(b);
|
|
69
|
-
if (!require_assertIsBoolean.isNaN(na) && !require_assertIsBoolean.isNaN(nb)) return na - nb;
|
|
70
|
-
return a.localeCompare(b);
|
|
71
|
-
});
|
|
72
|
-
const result = {};
|
|
73
|
-
if (require_assertIsBoolean.isObject(val)) for (const k of keys) {
|
|
74
|
-
const v = deepProcess(val[k]);
|
|
75
|
-
if (!require_assertIsBoolean.isUndefined(v)) result[k] = v;
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
return val;
|
|
80
|
-
};
|
|
81
|
-
try {
|
|
82
|
-
return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);
|
|
83
|
-
} catch (err) {
|
|
84
|
-
console.warn("Error in safeStableStringify:", err);
|
|
85
|
-
return "{}";
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
Object.defineProperty(exports, 'isDate', {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
get: function () {
|
|
91
|
-
return isDate;
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
Object.defineProperty(exports, 'isMap', {
|
|
95
|
-
enumerable: true,
|
|
96
|
-
get: function () {
|
|
97
|
-
return isMap;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
Object.defineProperty(exports, 'safeStableStringify', {
|
|
101
|
-
enumerable: true,
|
|
102
|
-
get: function () {
|
|
103
|
-
return safeStableStringify;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
//# sourceMappingURL=safeStableStringify-Cmi6GyWj.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safeStableStringify-Cmi6GyWj.cjs","names":["isPlainObject","isBoolean","isNaN","hasOwnProp","isBoolean","getPreciseType","isUndefined","isNull","isObjectOrArray","isFunction","isNumberObject","isNaN","isInfinityNumber","isStringObject","isBooleanObject","isSymbol","isBigInt","isSet","isArray","isNumber","isObject"],"sources":["../src/predicates/is/isMap.ts","../src/predicates/is/isDate.ts","../src/conversions/stringify/safeStableStringify.ts"],"sourcesContent":["/** --------------------------------------------------\n * * ***Type guard: `isMap`.***\n * ----------------------------------------------------------\n * **Checks whether the given value is a **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) object**.**\n * - **Behavior:**\n * - Ensures that the provided value is an instance of **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)**.\n * - Useful in TypeScript for narrowing types when working with collections.\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is instance of **[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)**, else `false`.\n * @example\n * isMap(new Map());\n * // ➔ true\n * isMap(new WeakMap());\n * // ➔ false\n * isMap({});\n * // ➔ false\n */\nexport function isMap<K = unknown, V = unknown>(\n value: Map<K, V>\n): value is Map<K, V>;\nexport function isMap(value: unknown): value is Map<unknown, unknown>;\nexport function isMap(value: unknown): boolean {\n return (\n Object.prototype.toString.call(value) === \"[object Map]\" ||\n value instanceof Map\n );\n}\n","import { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { isNaN } from \"./isNaN\";\nimport { isPlainObject } from \"./isPlainObject\";\nimport { isBoolean } from \"./isBoolean\";\n\ntype isDateOptions = {\n /** * ***Skip the validity check (`!isNaN(date.getTime())`).***\n *\n * When `true`, the function only checks that the value is an\n * instance of `Date` without verifying that it represents a valid\n * date value, default: `false`.\n *\n * @default false\n */\n skipInvalidDate?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Type guard: `isDate`.***\n * ----------------------------------------------------------\n * **Determines whether the given `value` is a real, valid JavaScript\n * **[`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)** object.**\n * - **Behavior:**\n * - Returns **true** only if:\n * - `value` is an instance of `Date`.\n * - and, unless `options.skipInvalidDate` is `true`,\n * the underlying time value is valid (`!isNaN(value.getTime())`).\n * - Returns **false** for:\n * - non-Date values (strings, numbers, etc.).\n * - `Date` instances that represent an invalid time value\n * (e.g. `new Date(\"bad\")`), unless skipping is enabled.\n * @param {*} value - The value to check.\n * @param {isDateOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if value is a valid Date object.\n * @example\n * isDate(new Date());\n * // ➜ true\n * isDate(new Date(\"invalid\"));\n * // ➜ false\n * isDate(\"2024-01-01\");\n * // ➜ false\n *\n * // Skipping validity check:\n * isDate(new Date(\"invalid\"), { skipInvalidDate: true });\n * // ➜ true\n */\nexport const isDate = (\n value: unknown,\n options: isDateOptions = {}\n): value is Date => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const skipInvalidDate =\n isPlainObject(options) && isBoolean(options.skipInvalidDate)\n ? options.skipInvalidDate\n : false;\n\n const instanceDate = value instanceof Date;\n\n if (skipInvalidDate) return instanceDate;\n return instanceDate && !isNaN(value.getTime());\n};\n","import { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { isSet } from \"@/predicates/is/isSet\";\nimport { isMap } from \"@/predicates/is/isMap\";\nimport { isNaN } from \"@/predicates/is/isNaN\";\nimport { isDate } from \"@/predicates/is/isDate\";\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isSymbol } from \"@/predicates/is/isSymbol\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isObject } from \"@/predicates/is/isObject\";\nimport { isBigInt } from \"@/predicates/is/isBigInt\";\nimport { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isNumberObject } from \"@/predicates/is/isNumberObject\";\nimport { isStringObject } from \"@/predicates/is/isStringObject\";\nimport { isBooleanObject } from \"@/predicates/is/isBooleanObject\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isInfinityNumber } from \"@/predicates/is/isInfinityNumber\";\n\n/** -------------------------------------------------\n * * ***Type Options for **{@link safeStableStringify | `safeStableStringify`}**.***\n * -------------------------------------------------\n */\ntype SafeStableStringifyOptions = {\n /** -------------------------------------------------\n * * ***Whether to sort **object keys** alphabetically (recursively).***\n * -------------------------------------------------\n *\n * - `true` (default): object keys are sorted to ensure stable output.\n * - `false`: preserves original insertion order of keys.\n *\n * @default true\n */\n sortKeys?: boolean;\n /** -------------------------------------------------\n * * ***Whether to sort **primitive values inside arrays**.***\n * -------------------------------------------------\n *\n * - `true`: primitive values in arrays are sorted to ensure stable output.\n * - `false` (default): arrays retain their original order; objects and nested arrays are not reordered.\n *\n * @default false\n */\n sortArray?: boolean;\n /** -------------------------------------------------\n * * ***Whether to pretty-print JSON output with 2-space indentation.***\n * -------------------------------------------------\n *\n * - `true`: output is formatted with indentation and newlines.\n * - `false` (default): produces compact single-line JSON.\n *\n * @default false\n */\n pretty?: boolean;\n /** -------------------------------------------------\n * * ***Preserve `undefined` values instead of converting them to `null`.***\n * -------------------------------------------------\n * **Controls how the internal `deepProcess` step rewrites values\n * **before** the final `JSON.stringify` call.**\n * - **Default (`false`):**\n * * Every `undefined` value (object properties **and** array elements)\n * is replaced with `null` **before** serialization, because this happens\n * first, the key is **not removed** by `JSON.stringify`.\n * - **`true`** – Leaves `undefined` untouched so the final\n * `JSON.stringify` call behaves natively:\n * * Object properties with `undefined` are **removed**.\n * * Array elements that are `undefined` become `null`.\n * @default false\n * @example\n * // ✅ keepUndefined = true: behaves like native JSON.stringify\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key removed\n *\n * // ✅ Default (false): convert undefined to null, key kept\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}' // key present, value null\n *\n * // Arrays\n * safeStableStringify([undefined]);\n * // ➔ '[null]' // same, but via pre-replacement\n * safeStableStringify([undefined], { keepUndefined: true });\n * // ➔ '[null]' // element becomes null\n */\n keepUndefined?: boolean;\n};\n\n/** --------------------------------------------\n * * ***Utility: `safeStableStringify`.***\n * ---------------------------------------------\n * **Safely converts a JavaScript value into a stable, JSON-compatible string.**\n * - **This function is an enhanced version of `JSON.stringify` with additional guarantees:**\n * - ***Features:***\n * - Recursively sorts object keys **only if** `sortKeys` is `true` (default: `true`), to ensure stable\n * key order.\n * - If `sortKeys` is `false`, preserves the original insertion order of object keys.\n * - Optionally sorts array primitive values **only if** `sortArray` is `true` (default: `false`).\n * - Only primitive values in arrays are sorted.\n * - Objects and nested arrays keep their original position and are appended after sorted primitives.\n * - If `sortArray` is `false`, arrays retain their original order.\n * - Converts JavaScript special values for JSON safety:\n * - `undefined`, `NaN`, `Infinity`, `-Infinity` ➔ `null`.\n * - `BigInt` ➔ string (JSON does not support BigInt).\n * - Converts boxed primitives box into their primitive equivalents:\n * - `new Number(42)` ➔ `Number(42)` ➔ `42`.\n * - `new String(\"hi\")` ➔ `String(\"hi\")` ➔ `\"hi\"`.\n * - `new Boolean(true)` ➔ `Boolean(true)` ➔ `true`.\n * - Functions and Symbols are removed.\n * - Circular references are replaced with the string `\"[Circular]\"`.\n * - Serializes:\n * - `Date` ➔ ISO string (`date.toISOString()`).\n * - `Set` ➔ `{ set: [values...] }` (values are recursively processed).\n * - `Map` ➔ `{ map: [ [key, value], ... ] }` (values are recursively processed).\n * - Compared to `JSON.stringify`, this ensures **stable output**:\n * - Same object structure always produces the same string.\n * - Useful for deep equality checks, hashing, caching keys, or snapshot tests.\n * - Controls how `undefined` is handled **before** the final `JSON.stringify` call, by `keepUndefined`\n * options, default: `false`.\n * - **false**: All `undefined` values (object properties and array elements) are replaced\n * with `null`, so object keys remain.\n * - **true**: Leaves `undefined` values as-is, and handling by native `JSON.stringify` then:\n * 1. Removes object properties that are `undefined`.\n * 2. Converts `undefined` array elements to `null`.\n * - Use `true` when you need native removal of keys or to preserve sparse arrays\n * exactly as `JSON.stringify` would.\n * @param {*} value\n * ***Any JavaScript value to serialize, can be:***\n * - Primitives (`number`, `string`, `boolean`, `bigint`, `null`, `undefined`).\n * - Boxed primitives (`new Number()`, `new String()`, `new Boolean()`).\n * - Arrays, plain objects, nested structures.\n * - Date, Map, Set.\n * - Circular structures.\n * @param {SafeStableStringifyOptions} [options]\n * ***Configuration options for `safeStableStringify`:***\n * - `keepUndefined` (boolean) – Control how `undefined` is handled **before** the final `JSON.stringify`\n * call, default: `false`.\n * - `sortKeys` (boolean) – Whether to sort object keys alphabetically (recursively), default: `true`.\n * - `sortArray` (boolean) – Whether to sort primitive values inside arrays, default: `false`.\n * - `pretty` (boolean) – Whether to pretty-print JSON output with 2-space indentation, default: `false`.\n * @returns {string}\n * A stable JSON string representation of the input value.\n * @throws **{@link TypeError | `TypeError`}** if `sortKeys`, `sortArray`, or `pretty` are not strictly boolean.\n * @example\n * ```ts\n * // Basic object key sorting\n * safeStableStringify({ b: 2, a: 1 });\n * // ➔ '{\"a\":1,\"b\":2}'\n *\n * // Disable key sorting (preserve insertion order)\n * safeStableStringify({ b: 2, a: 1 }, {\n * sortKeys:false\n * });\n * // ➔ '{\"b\":2,\"a\":1}'\n *\n * // Sorting arrays with sortArray\n * safeStableStringify([3, 1, 2], {\n * sortArray:true\n * });\n * // ➔ '[1,2,3]'\n *\n * // keepUndefined = true (native removal of keys)\n * safeStableStringify({ a: undefined }, { keepUndefined: true });\n * // ➔ '{}' // key `a` is removed, like native JSON.stringify\n *\n * // Default keepUndefined = false (convert to null, keep key)\n * safeStableStringify({ a: undefined });\n * // ➔ '{\"a\":null}'\n *\n * // Nested object + sortArray=true\n * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {\n * sortKeys:true,\n * sortArray:true\n * });\n * // ➔ '{\"x\":{\"c\":3,\"d\":4},\"z\":[1,2,3]}'\n *\n * // sortKeys=false and sortArray=true\n * safeStableStringify({ z: [3, 1, 2], x: { d: 4, c: 3 } }, {\n * sortKeys:false,\n * sortArray:true\n * });\n * // ➔ '{\"z\":[1,2,3],\"x\":{\"d\":4,\"c\":3}}'\n *\n * // Pretty print output\n * safeStableStringify([3, 1, 2], {\n * sortArray:true,\n * pretty:true\n * });\n * // ➔ `[\n * // 1,\n * // 2,\n * // 3\n * // ]`\n *\n * // Boxed primitives converted to primitive\n * safeStableStringify({ n: new Number(42), s: new String(\"hi\"), b: new Boolean(true) });\n * // ➔ '{\"n\":42,\"s\":\"hi\",\"b\":true}'\n *\n * // Handles Date, BigInt, Map and Set\n * safeStableStringify({\n * time: new Date(\"2025-01-01\"),\n * big: BigInt(9007199254740991),\n * data: new Map([[\"key\", new Set([1, 2])]])\n * });\n * // ➔ '{\"big\":\"9007199254740991\",\"data\":{\"map\":[[\"key\",{\"set\":[1,2]}]]},\"time\":\"2025-01-01T00:00:00.000Z\"}'\n *\n * // Functions and symbols are removed\n * safeStableStringify({ f: () => {}, s: Symbol(\"wow\") });\n * // ➔ '{}'\n *\n * // undefined, NaN, Infinity convert to null (keepUndefined = false or keepUndefined = true)\n * safeStableStringify([undefined, NaN, Infinity, -Infinity]);\n * // ➔ '[null,null,null,null]'\n *\n * // Circular reference\n * const obj = { name: \"A\" };\n * obj.self = obj;\n * safeStableStringify(obj);\n * // ➔ '{\"name\":\"A\",\"self\":\"[Circular]\"}'\n *\n * // Complex nested sortArray with objects\n * const arr = [9, 7, [4, 2, 3], { z: [5, 1, 6] }];\n * safeStableStringify(arr, { sortArray: true, sortKeys: true });\n * // ➔ '[7,9,[2,3,4],{\"z\":[1,5,6]}]'\n * ```\n */\nexport const safeStableStringify = (\n value: unknown,\n options: SafeStableStringifyOptions = {}\n): string => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const pretty = hasOwnProp(options, \"pretty\") ? options.pretty : false;\n const sortKeys = hasOwnProp(options, \"sortKeys\") ? options.sortKeys : true;\n const sortArray = hasOwnProp(options, \"sortArray\")\n ? options.sortArray\n : false;\n const keepUndefined = hasOwnProp(options, \"keepUndefined\")\n ? options.keepUndefined\n : false;\n\n if (\n !isBoolean(sortKeys) ||\n !isBoolean(sortArray) ||\n !isBoolean(pretty) ||\n !isBoolean(keepUndefined)\n ) {\n throw new TypeError(\n `Parameters \\`sortKeys\\`, \\`sortArray\\`, \\`keepUndefined\\` and \\`pretty\\` property of the \\`options\\` (second parameter) must be of type \\`boolean\\`, but received: \"['sortKeys': \\`${getPreciseType(\n sortKeys\n )}\\`, 'sortArray': \\`${getPreciseType(\n sortArray\n )}\\`, 'keepUndefined': \\`${getPreciseType(\n keepUndefined\n )}\\`, 'pretty': \\`${getPreciseType(pretty)}\\`]\".`\n );\n }\n\n if (isUndefined(value)) {\n return keepUndefined ? \"undefined\" : \"null\";\n }\n\n const seen = new WeakSet();\n\n const isPrimitive = (val: unknown): boolean =>\n isNull(val) || (!isObjectOrArray(val) && !isFunction(val));\n\n const deepProcess = (val: unknown): unknown => {\n if (isNumberObject(val)) {\n const valOf = val.valueOf();\n return isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n }\n if (isStringObject(val)) return val.valueOf();\n if (isBooleanObject(val)) return val.valueOf();\n if (isFunction(val) || isSymbol(val)) return undefined;\n if (isBigInt(val)) return val.toString();\n if (isNaN(val) || isInfinityNumber(val)) return null;\n if (isUndefined(val)) {\n return keepUndefined ? undefined : null;\n }\n\n if (isObjectOrArray(val)) {\n if (seen.has(val)) return \"[Circular]\";\n seen.add(val);\n\n if (isDate(val)) return val.toISOString();\n if (isMap(val)) {\n return {\n map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)])\n };\n }\n if (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\n if (isArray(val)) {\n const processedArr = val.map(deepProcess);\n if (sortArray) {\n const primitives: unknown[] = [];\n const nonPrimitives: unknown[] = [];\n\n for (const item of processedArr) {\n if (isPrimitive(item)) primitives.push(item);\n else nonPrimitives.push(item);\n }\n primitives.sort((a, b) => {\n if (isNumber(a) && isNumber(b)) return a - b;\n return String(a).localeCompare(String(b));\n });\n return [...primitives, ...nonPrimitives];\n }\n return processedArr;\n }\n\n const keys = Object.keys(val);\n if (sortKeys) {\n keys.sort((a, b) => {\n const na = Number(a);\n const nb = Number(b);\n if (!isNaN(na) && !isNaN(nb)) return na - nb;\n return a.localeCompare(b);\n });\n }\n\n const result: Record<string, unknown> = {};\n\n if (isObject(val)) {\n for (const k of keys) {\n const v = deepProcess(val[k]);\n if (!isUndefined(v)) result[k] = v;\n }\n }\n\n return result;\n }\n\n return val;\n };\n\n try {\n return JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n } catch (err) {\n console.warn(\"Error in safeStableStringify:\", err);\n return \"{}\";\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAgB,MAAM,OAAyB;CAC7C,OACE,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM,kBAC1C,iBAAiB;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA,MAAa,UACX,OACA,UAAyB,CAAC,MACR;CAClB,4CAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,kBACJA,sCAAc,OAAO,KAAKC,kCAAU,QAAQ,eAAe,IACvD,QAAQ,kBACR;CAEN,MAAM,eAAe,iBAAiB;CAEtC,IAAI,iBAAiB,OAAO;CAC5B,OAAO,gBAAgB,CAACC,8BAAM,MAAM,QAAQ,CAAC;AAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmKA,MAAa,uBACX,OACA,UAAsC,CAAC,MAC5B;CACX,4CAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,SAASC,mCAAW,SAAS,QAAQ,IAAI,QAAQ,SAAS;CAChE,MAAM,WAAWA,mCAAW,SAAS,UAAU,IAAI,QAAQ,WAAW;CACtE,MAAM,YAAYA,mCAAW,SAAS,WAAW,IAC7C,QAAQ,YACR;CACJ,MAAM,gBAAgBA,mCAAW,SAAS,eAAe,IACrD,QAAQ,gBACR;CAEJ,IACE,CAACC,kCAAU,QAAQ,KACnB,CAACA,kCAAU,SAAS,KACpB,CAACA,kCAAU,MAA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"sources":["../src/tailwind/class-names/cx.ts","../src/tailwind/tw-merge/_private/validate-props.ts","../src/tailwind/tw-merge/v3/twMergeDefault.ts","../src/tailwind/tw-merge/v4/twMergeDefault.ts","../src/tailwind/class-names/customCn.ts","../src/tailwind/class-names/cn.ts","../src/tailwind/tw-macro/shouldForwardProp.ts"],"sourcesContent":["import { isArray } from \"@/predicates/is/isArray\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isStringObject } from \"@/predicates/is/isStringObject\";\nimport { isNumberObject } from \"@/predicates/is/isNumberObject\";\nimport { isBooleanObject } from \"@/predicates/is/isBooleanObject\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValue`.***\n * ----------------------------------------------------------\n * **Represents a single valid value that can be converted to a CSS class string.**\n * @description\n * - Supports the following types:\n * - `string` → literal class names (non-empty only)\n * - `number | bigint` → numeric class names\n * - `boolean` → only `true` is considered in objects/arrays\n * - `null | undefined` → ignored\n * - `ClassObject` → objects where **keys with truthy values** are included\n * - `ClassValues` → arrays recursively flattened\n * - Used internally by ***`cx` utility function*** to process mixed input values.\n * @example\n * ```ts\n * const val1: ClassValue = \"button\"; // ➔ string\n * const val2: ClassValue = 0; // ➔ number\n * const val3: ClassValue = [\"a\", { b: true }]; // ➔ array with object\n * const val4: ClassValue = { d: true, e: false }; // ➔ object\n * const val5: ClassValue = new String(\"foo\"); // ➔ boxed string\n * const val6: ClassValue = new Number(\"123\"); // ➔ boxed number\n * const val7: ClassValue = new Boolean(\"true\"); // ➔ boxed boolean\n * ```\n */\nexport type ClassValue =\n | ClassValues\n | ClassObject\n | string\n | number\n | bigint\n | null\n | boolean\n | undefined;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassObject`.***\n * ----------------------------------------------------------\n * **Represents an object whose keys with truthy values are included in the final class string.**\n * @example\n * ```ts\n * const obj: ClassObject = { \"text-red\": true, \"hidden\": false };\n * // ➔ \"text-red\" when processed by cx\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ClassObject = Record<string, any>;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValues`.***\n * ----------------------------------------------------------\n * **Represents an array of {@link ClassValue | `ClassValue's`}, potentially nested.**\n * @example\n * ```ts\n * const arr: ClassValues = [\n * \"a\",\n * 1,\n * [\"b\", { c: true, d: false }],\n * { e: 2 }\n * ];\n * ```\n */\nexport type ClassValues = ClassValue[];\n\n/** ----------------------------------------------------------\n * * ***Utility: `toStringValue`.***\n * ----------------------------------------------------------\n * **Converts a `ClassValue` into a single space-separated string suitable for CSS class usage.**\n * @param {ClassValue} value The mixed value to process.\n * @returns {string} A string containing all valid class names.\n * @description\n * - Arrays are recursively flattened.\n * - Objects include only keys with truthy values.\n * - Skips `null`, `undefined`, and empty strings.\n * - Numbers, strings, and bigint are included as-is.\n * - Boolean `false` is ignored in objects/arrays.\n * - Boxed primitives (`new String()`, `new Number()`, `new Boolean()`) are supported.\n * - Preserves inherited object keys.\n * @example\n * ```ts\n * toStringValue(\"btn\"); // ➔ \"btn\"\n * toStringValue([\"a\", 0, \"b\"]); // ➔ \"a b\"\n * toStringValue({ a: true, b: false, c: 1 }); // ➔ \"a c\"\n * toStringValue([\"a\", [\"b\", { c: true, d: false }]]); // ➔ \"a b c\"\n * toStringValue(new String(\"foo\")); // ➔ \"foo\"\n * toStringValue(new Number(42)); // ➔ \"42\"\n * toStringValue(new Boolean(true)); // ➔ \"true\"\n * toStringValue(new Boolean(false));// ➔ \"\"\n * ```\n */\nfunction toStringValue(value: ClassValue): string {\n let str = \"\";\n\n if (isNonEmptyString(value) || isNumber(value)) {\n str += value;\n } else if (isObjectOrArray(value)) {\n if (\n isStringObject(value) ||\n isNumberObject(value) ||\n isBooleanObject(value)\n ) {\n const val = value.valueOf();\n if (val) str += val; // skip falsy\n } else if (isArray(value)) {\n for (const item of value) {\n if (!item) continue; // skip falsy\n const y = toStringValue(item);\n if (!y) continue;\n if (str) str += \" \";\n str += y;\n }\n } else {\n for (const key in value) {\n if (!value[key]) continue; // skip falsy\n if (str) str += \" \";\n str += key;\n }\n }\n }\n\n return str;\n}\n\n/** ----------------------------------------------------------\n * * ***Utility: `cx`.***\n * ----------------------------------------------------------\n * **Merge multiple class values into a single, space-separated string suitable for CSS usage.**\n * @description\n * - Supports **nested combinations** of arrays and objects, recursively.\n * - **Falsy values** are skipped:\n * - `false`, `null`, `undefined`, empty strings `\"\"` are ignored anywhere.\n * - Numbers `0` are ignored inside nested arrays/objects.\n * - **Boxed primitives** are correctly unwrapped to their primitive value.\n * - **Inherited object keys** are included in the final class string.\n * - Optimized for **CSS class merging** where conditional inclusion is common.\n * @param {ClassValues} values\n * A list of mixed class values, which can include:\n * - **Strings** → literal class names.\n * - **Numbers** → numeric class names.\n * - **BigInt** → numeric class names larger than JS safe integer limit.\n * - **Arrays** → recursively flattened, can contain nested arrays or objects.\n * - **Objects** → include keys whose values are truthy. Inherited keys are also included.\n * - **Boxed primitives** (`new String()`, `new Number()`, `new Boolean()`) → automatically unwrapped.\n * - **Falsy values** (`false`, `null`, `undefined`, `\"\"`, `0`) are ignored according to original behavior.\n * @returns {string}\n * A single space-separated string containing all valid class names.\n * @example\n * ```ts\n * // Basic string merge\n * cx(\"btn\", \"btn-primary\");\n * // ➔ \"btn btn-primary\"\n *\n * // Mixed arrays and objects\n * cx(\"a\", [\"b\", { c: true, d: false }], { e: 1, f: 0 }, null, 2);\n * // ➔ \"a b c e 2\"\n *\n * // Empty and falsy values are ignored\n * cx(\"\", null, undefined, false, 0);\n * // ➔ \"\"\n *\n * // Nested arrays with objects\n * cx([\"a\", [\"b\", { c: true, d: false }]]);\n * // ➔ \"a b c\"\n *\n * // Boxed primitives are unwrapped\n * cx(new String(\"foo\"), new Number(42), new Boolean(true), new Number(0), new Boolean(false));\n * // ➔ \"foo 42 true\"\n *\n * // Inherited keys from objects are included\n * const proto = { inherited: true };\n * const obj = Object.create(proto);\n * obj.own = true;\n * cx(obj);\n * // ➔ \"own inherited\"\n * ```\n */\nexport function cx(...values: ClassValues): string {\n let str = \"\";\n\n for (const value of values) {\n if (!value) continue; // skip falsy arguments\n const x = toStringValue(value);\n if (!x) continue;\n if (str) str += \" \";\n str += x;\n }\n\n return str;\n}\n","import type { Config as TwConfig } from \"tailwindcss\";\nimport type { ConfigExtension } from \"tailwind-merge-v4\";\n\nimport type { OptionsMergeTwClsV4 } from \"../v4/_private/types\";\n\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\n\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nexport type TailwindConfig = TwConfig;\n\n/**\n * @internal\n */\ntype TwMergeConfigExt = ConfigExtension<string, string>;\n\n/**\n * @internal\n */\ntype ValidatorTwMergeReturn = {\n config: TwConfig;\n override: TwMergeConfigExt[\"override\"];\n cacheSize: TwMergeConfigExt[\"cacheSize\"];\n prefix: TwMergeConfigExt[\"prefix\"];\n experimentalParseClassName?: TwMergeConfigExt[\"experimentalParseClassName\"];\n theme: NonNullable<NonNullable<TwMergeConfigExt[\"extend\"]>[\"theme\"]>;\n classGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"classGroups\"]\n >;\n conflictingClassGroupModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroupModifiers\"]\n >;\n conflictingClassGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroups\"]\n >;\n orderSensitiveModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"orderSensitiveModifiers\"]\n >;\n};\n\n/**\n * @internal\n */\nexport const validatorPropsTwMerge = (\n options: OptionsMergeTwClsV4\n): ValidatorTwMergeReturn => {\n if (!isPlainObject(options)) options = {};\n let {\n config,\n prefix,\n extend,\n override,\n cacheSize,\n experimentalParseClassName\n } = options;\n\n if (!isPlainObject(config)) config = {};\n if (!isPlainObject(extend)) extend = {};\n if (!isPlainObject(override)) override = {};\n if (!isNumber(cacheSize)) cacheSize = undefined;\n if (!isNonEmptyString(prefix)) prefix = undefined;\n if (!isFunction(experimentalParseClassName))\n experimentalParseClassName = undefined;\n\n const theme = hasOwnProp(extend, \"theme\") ? extend.theme : {};\n const classGroups = hasOwnProp(extend, \"classGroups\")\n ? extend.classGroups\n : {};\n const conflictingClassGroupModifiers = hasOwnProp(\n extend,\n \"conflictingClassGroupModifiers\"\n )\n ? extend.conflictingClassGroupModifiers\n : {};\n\n const conflictingClassGroups = hasOwnProp(extend, \"conflictingClassGroups\")\n ? extend.conflictingClassGroups\n : {};\n const orderSensitiveModifiers =\n hasOwnProp(extend, \"orderSensitiveModifiers\") &&\n isNonEmptyArray(extend.orderSensitiveModifiers)\n ? extend.orderSensitiveModifiers\n : [];\n\n return {\n config,\n override,\n cacheSize,\n prefix,\n experimentalParseClassName,\n theme,\n classGroups,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers\n };\n};\n","import type { OptionsMergeTwClsV3, TwMergeDefaultFnV3 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v3\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer3 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 3 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v3*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v3*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer3 | `customCnVer3`} for better performance, this utility may be removed in a future release.***\n *\n * @param {OptionsMergeTwClsV3} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV3}\n * Customized Tailwind class merge function version 3 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV3();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV3({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV3({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV3, twMergeDefaultV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV3({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV3 = (\n options: OptionsMergeTwClsV3 = {}\n): TwMergeDefaultFnV3 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix ?? config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { OptionsMergeTwClsV4, TwMergeDefaultFnV4 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v4\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer4 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 4 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v4*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v4*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer4 | `customCnVer4`} for better performance, this utility may be removed in a future release.***\n *\n * @deprecated ***Slower than the default `twMerge`, but still safe to use when custom merge behavior is needed.***\n *\n * @param {OptionsMergeTwClsV4} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV4}\n * Customized Tailwind class merge function version 4 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV4();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV4({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV4({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV4, twMergeDefaultV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV4({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV4 = (\n options: OptionsMergeTwClsV4 = {}\n): TwMergeDefaultFnV4 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix || config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n orderSensitiveModifiers: [\n ...defaultConfig.orderSensitiveModifiers,\n ...orderSensitiveModifiers\n ],\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { TwMergeDefaultFnV3 } from \"../tw-merge/v3/_private/types\";\nimport type { TwMergeDefaultFnV4 } from \"../tw-merge/v4/_private/types\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { cx, type ClassValues } from \"./cx\";\n\nexport type { ClassValues };\n\nimport { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v3`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV3 | `twMergeV3`} implementation\n * from `tailwind-merge` version 2 for `tailwind version 3`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v3**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV3` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeV3 | `twMergeV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV3 } from \"tailwind-merge\"; // tw-merge (v2) for tailwind version 3\n * import { customCnVer3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer3(twMergeV3, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer3 = (\n customTwMergeV3: TwMergeDefaultFnV3 = twMergeV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v4`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV4 | `twMergeV4`} implementation\n * from `tailwind-merge` version 3 for `tailwind version 4`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v4**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV4` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeV4 | `twMergeV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV4 } from \"tailwind-merge\"; // tw-merge (v3) for tailwind version 4\n * import { customCnVer4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer4(twMergeV4, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer4 = (\n customTwMergeV4: TwMergeDefaultFnV4 = twMergeV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v3`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV3 | `twMergeDefaultV3`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer3 | `customCnVer3`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeDefaultV3 | `twMergeDefaultV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV3`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(myCustomTwMerge, ...classes);\n * };\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV3 = (\n customTwMergeV3: TwMergeDefaultFnV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v4`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV4 | `twMergeDefaultV4`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer4 | `customCnVer4`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeDefaultV4 | `twMergeDefaultV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV4`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(myCustomTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV4 = (\n customTwMergeV4: TwMergeDefaultFnV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n","import { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\nimport { cx, type ClassValues } from \"./cx\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnV3, customCnV4 } from \"./customCn\";\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v3` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV3 | `twMerge`} version **2** for ***`tailwind version 3`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer3 = (...values: ClassValues): string =>\n twMergeV3(cx(...values));\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v4` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV4 | `twMerge`} version **3** for ***`tailwind version 4`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer4 = (...values: ClassValues): string =>\n twMergeV4(cx(...values));\n\nconst defaultTwMergeV3 = twMergeDefaultV3();\nconst defaultTwMergeV4 = twMergeDefaultV4();\n\n/** -------------------------------------------------------------\n * * ***Default `cnV3` utility (Tailwind v3).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV3 | `twMergeDefaultV3`}\n * with **Tailwind v3 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v3**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV3 | `twMergeDefaultV3`} +\n * {@link customCnV3 | `customCnV3`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer3 | `cnVer3`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v3).\n * ```ts\n * cnV3(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV3(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV3([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV3(\n * twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV3 = (...classes: ClassValues): string => {\n return defaultTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Default `cnV4` utility (Tailwind v4).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV4 | `twMergeDefaultV4`}\n * with **Tailwind v4 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v4**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV4 | `twMergeDefaultV4`} +\n * {@link customCnV4 | `customCnV4`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer4 | `cnVer4`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v4).\n * ```ts\n * cnV4(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV4(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV4([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV4(\n * twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV4 = (...classes: ClassValues): string => {\n return defaultTwMergeV4(cx(...classes));\n};\n","import type { Stringify } from \"@rzl-zone/ts-types-plus\";\n\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `shouldForwardProp`.***\n * ----------------------------------------------------------\n * **Creates a helper for styled-components `shouldForwardProp`.**\n *\n * @description\n * 1. Returns a **predicate function** that determines whether a given prop\n * should be forwarded to the DOM.\n * 2. Useful for filtering out internal props (e.g., `$size`, `$active`)\n * so they don't become invalid HTML attributes.\n *\n * - **Behavior:**\n * - Accepts a strict tuple of **string keys** to exclude from forwarding.\n * - Every key is validated as a **non-empty string** at runtime.\n * - Throws a `TypeError` if:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n * - Automatically coerces the tested prop name to string for matching.\n *\n * @template CustomProps\n * The component props type to validate against.\n *\n * @param {readonly Stringify<keyof CustomProps>[]}\n * props\n * The list of prop names (keys of `CustomProps`) to exclude from forwarding.\n *\n * @returns {(propName: keyof CustomProps | ({} & string)) => boolean}\n * A function that receives a prop name and returns:\n * - `true` ➔ the prop **will** be forwarded to the DOM.\n * - `false` ➔ the prop **will not** be forwarded.\n *\n * @throws **{@link TypeError | `TypeError`}**\n * when:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n *\n * @example\n * // Basic usage\n * type Props = { $size: string; color: string; visible: boolean };\n * const filter = shouldForwardProp<Props>([\"$size\"]);\n *\n * filter(\"$size\"); // ➔ false (blocked).\n * filter(\"color\"); // ➔ true (forwarded).\n * filter(\"visible\"); // ➔ true (forwarded).\n *\n * @example\n * // With styled-components\n * type CustomProps = { $internal: boolean; public: string; another: boolean };\n *\n * styled.div.withConfig({\n * shouldForwardProp: shouldForwardProp<CustomProps>([\"$internal\"])\n * });\n */\nexport const shouldForwardProp = <CustomProps extends Record<string, unknown>>(\n props: readonly Stringify<keyof CustomProps>[]\n // props: Partial<UnionToTupleStrict<keyof CustomProps>>\n): ((propName: keyof CustomProps | ({} & string)) => boolean) => {\n assertIsArray(props, {\n message: ({ currentType, validType }) =>\n `First parameter (\\`props\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const invalidItems: { index: number; reason: string }[] = [];\n\n props.forEach((p, idx) => {\n if (!isString(p)) {\n invalidItems.push({\n index: idx,\n reason: `Expected a non-empty string, but received ${getPreciseType(p, {\n formatCase: \"toPascalCaseSpace\"\n })}.`\n });\n } else if (isEmptyString(p)) {\n invalidItems.push({\n index: idx,\n reason: \"Expected a non-empty string, but received EmptyString.\"\n });\n }\n });\n\n if (isNonEmptyArray(invalidItems)) {\n const maxWidth = Math.max(\n ...invalidItems.map((item) => String(item.index).length)\n );\n\n const details = invalidItems\n .map(\n (item) =>\n `• [Index ${String(item.index).padStart(maxWidth, \"0\")}] ${item.reason}`\n )\n .join(\"\\n\");\n\n throw new TypeError(\n `First parameter (\\`props\\`) contains invalid entries:\\n${details}`\n );\n }\n\n return (propName): boolean => {\n return !props.map(String).includes(String(propName));\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,SAAS,cAAc,OAA2B;CAChD,IAAI,MAAM;CAEV,IAAI,iBAAiB,KAAK,KAAK,SAAS,KAAK,GAC3C,OAAO;MACF,IAAI,gBAAgB,KAAK,GAC9B,IACE,eAAe,KAAK,KACpB,eAAe,KAAK,KACpB,gBAAgB,KAAK,GACrB;EACA,MAAM,MAAM,MAAM,QAAQ;EAC1B,IAAI,KAAK,OAAO;CAClB,OAAO,IAAI,QAAQ,KAAK,GACtB,KAA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EACxB,IAAI,CAAC,SAAS,CAAC,GACb,aAAa,KAAK;GAChB,OAAO;GACP,QAAQ,6CAA6C,eAAe,GAAG,EACrE,YAAY,oBACd,CAAC,EAAE;EACL,CAAC;OACI,IAAI,cAAc,CAAC,GACxB,aAAa,KAAK;GAChB,OAAO;GACP,QAAQ;EACV,CAAC;CAEL,CAAC;CAED,IAAI,gBAAgB,YAAY,GAAG;EACjC,MAAM,WAAW,KAAK,IACpB,GAAG,aAAa,KAAK,SAAS,OAAO,KAAK,KAAK,EAAE,MAAM,CACzD;EAEA,MAAM,UAAU,aACb,KACE,SACC,YAAY,OAAO,KAAK,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,IAAI,KAAK,QACpE,EACC,KAAK,IAAI;EAEZ,MAAM,IAAI,UACR,0DAA0D,SAC5D;CACF;CAEA,QAAQ,aAAsB;EAC5B,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE,SAAS,OAAO,QAAQ,CAAC;CACrD;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind-DUuboq52.cjs","names":["isNonEmptyString","isNumber","isObjectOrArray","isStringObject","isNumberObject","isBooleanObject","isArray","isPlainObject","isNumber","isNonEmptyString","isFunction","hasOwnProp","isNonEmptyArray","defaultConfig","isPlainObject","isPlainObject","twMergeV3","isFunction","getPreciseType","twMergeV4","isString","getPreciseType","isEmptyString","isNonEmptyArray"],"sources":["../src/tailwind/class-names/cx.ts","../src/tailwind/tw-merge/_private/validate-props.ts","../src/tailwind/tw-merge/v3/twMergeDefault.ts","../src/tailwind/tw-merge/v4/twMergeDefault.ts","../src/tailwind/class-names/customCn.ts","../src/tailwind/class-names/cn.ts","../src/tailwind/tw-macro/shouldForwardProp.ts"],"sourcesContent":["import { isArray } from \"@/predicates/is/isArray\";\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isStringObject } from \"@/predicates/is/isStringObject\";\nimport { isNumberObject } from \"@/predicates/is/isNumberObject\";\nimport { isBooleanObject } from \"@/predicates/is/isBooleanObject\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValue`.***\n * ----------------------------------------------------------\n * **Represents a single valid value that can be converted to a CSS class string.**\n * @description\n * - Supports the following types:\n * - `string` → literal class names (non-empty only)\n * - `number | bigint` → numeric class names\n * - `boolean` → only `true` is considered in objects/arrays\n * - `null | undefined` → ignored\n * - `ClassObject` → objects where **keys with truthy values** are included\n * - `ClassValues` → arrays recursively flattened\n * - Used internally by ***`cx` utility function*** to process mixed input values.\n * @example\n * ```ts\n * const val1: ClassValue = \"button\"; // ➔ string\n * const val2: ClassValue = 0; // ➔ number\n * const val3: ClassValue = [\"a\", { b: true }]; // ➔ array with object\n * const val4: ClassValue = { d: true, e: false }; // ➔ object\n * const val5: ClassValue = new String(\"foo\"); // ➔ boxed string\n * const val6: ClassValue = new Number(\"123\"); // ➔ boxed number\n * const val7: ClassValue = new Boolean(\"true\"); // ➔ boxed boolean\n * ```\n */\nexport type ClassValue =\n | ClassValues\n | ClassObject\n | string\n | number\n | bigint\n | null\n | boolean\n | undefined;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassObject`.***\n * ----------------------------------------------------------\n * **Represents an object whose keys with truthy values are included in the final class string.**\n * @example\n * ```ts\n * const obj: ClassObject = { \"text-red\": true, \"hidden\": false };\n * // ➔ \"text-red\" when processed by cx\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ClassObject = Record<string, any>;\n\n/** ----------------------------------------------------------\n * * ***Type-Utility: `ClassValues`.***\n * ----------------------------------------------------------\n * **Represents an array of {@link ClassValue | `ClassValue's`}, potentially nested.**\n * @example\n * ```ts\n * const arr: ClassValues = [\n * \"a\",\n * 1,\n * [\"b\", { c: true, d: false }],\n * { e: 2 }\n * ];\n * ```\n */\nexport type ClassValues = ClassValue[];\n\n/** ----------------------------------------------------------\n * * ***Utility: `toStringValue`.***\n * ----------------------------------------------------------\n * **Converts a `ClassValue` into a single space-separated string suitable for CSS class usage.**\n * @param {ClassValue} value The mixed value to process.\n * @returns {string} A string containing all valid class names.\n * @description\n * - Arrays are recursively flattened.\n * - Objects include only keys with truthy values.\n * - Skips `null`, `undefined`, and empty strings.\n * - Numbers, strings, and bigint are included as-is.\n * - Boolean `false` is ignored in objects/arrays.\n * - Boxed primitives (`new String()`, `new Number()`, `new Boolean()`) are supported.\n * - Preserves inherited object keys.\n * @example\n * ```ts\n * toStringValue(\"btn\"); // ➔ \"btn\"\n * toStringValue([\"a\", 0, \"b\"]); // ➔ \"a b\"\n * toStringValue({ a: true, b: false, c: 1 }); // ➔ \"a c\"\n * toStringValue([\"a\", [\"b\", { c: true, d: false }]]); // ➔ \"a b c\"\n * toStringValue(new String(\"foo\")); // ➔ \"foo\"\n * toStringValue(new Number(42)); // ➔ \"42\"\n * toStringValue(new Boolean(true)); // ➔ \"true\"\n * toStringValue(new Boolean(false));// ➔ \"\"\n * ```\n */\nfunction toStringValue(value: ClassValue): string {\n let str = \"\";\n\n if (isNonEmptyString(value) || isNumber(value)) {\n str += value;\n } else if (isObjectOrArray(value)) {\n if (\n isStringObject(value) ||\n isNumberObject(value) ||\n isBooleanObject(value)\n ) {\n const val = value.valueOf();\n if (val) str += val; // skip falsy\n } else if (isArray(value)) {\n for (const item of value) {\n if (!item) continue; // skip falsy\n const y = toStringValue(item);\n if (!y) continue;\n if (str) str += \" \";\n str += y;\n }\n } else {\n for (const key in value) {\n if (!value[key]) continue; // skip falsy\n if (str) str += \" \";\n str += key;\n }\n }\n }\n\n return str;\n}\n\n/** ----------------------------------------------------------\n * * ***Utility: `cx`.***\n * ----------------------------------------------------------\n * **Merge multiple class values into a single, space-separated string suitable for CSS usage.**\n * @description\n * - Supports **nested combinations** of arrays and objects, recursively.\n * - **Falsy values** are skipped:\n * - `false`, `null`, `undefined`, empty strings `\"\"` are ignored anywhere.\n * - Numbers `0` are ignored inside nested arrays/objects.\n * - **Boxed primitives** are correctly unwrapped to their primitive value.\n * - **Inherited object keys** are included in the final class string.\n * - Optimized for **CSS class merging** where conditional inclusion is common.\n * @param {ClassValues} values\n * A list of mixed class values, which can include:\n * - **Strings** → literal class names.\n * - **Numbers** → numeric class names.\n * - **BigInt** → numeric class names larger than JS safe integer limit.\n * - **Arrays** → recursively flattened, can contain nested arrays or objects.\n * - **Objects** → include keys whose values are truthy. Inherited keys are also included.\n * - **Boxed primitives** (`new String()`, `new Number()`, `new Boolean()`) → automatically unwrapped.\n * - **Falsy values** (`false`, `null`, `undefined`, `\"\"`, `0`) are ignored according to original behavior.\n * @returns {string}\n * A single space-separated string containing all valid class names.\n * @example\n * ```ts\n * // Basic string merge\n * cx(\"btn\", \"btn-primary\");\n * // ➔ \"btn btn-primary\"\n *\n * // Mixed arrays and objects\n * cx(\"a\", [\"b\", { c: true, d: false }], { e: 1, f: 0 }, null, 2);\n * // ➔ \"a b c e 2\"\n *\n * // Empty and falsy values are ignored\n * cx(\"\", null, undefined, false, 0);\n * // ➔ \"\"\n *\n * // Nested arrays with objects\n * cx([\"a\", [\"b\", { c: true, d: false }]]);\n * // ➔ \"a b c\"\n *\n * // Boxed primitives are unwrapped\n * cx(new String(\"foo\"), new Number(42), new Boolean(true), new Number(0), new Boolean(false));\n * // ➔ \"foo 42 true\"\n *\n * // Inherited keys from objects are included\n * const proto = { inherited: true };\n * const obj = Object.create(proto);\n * obj.own = true;\n * cx(obj);\n * // ➔ \"own inherited\"\n * ```\n */\nexport function cx(...values: ClassValues): string {\n let str = \"\";\n\n for (const value of values) {\n if (!value) continue; // skip falsy arguments\n const x = toStringValue(value);\n if (!x) continue;\n if (str) str += \" \";\n str += x;\n }\n\n return str;\n}\n","import type { Config as TwConfig } from \"tailwindcss\";\nimport type { ConfigExtension } from \"tailwind-merge-v4\";\n\nimport type { OptionsMergeTwClsV4 } from \"../v4/_private/types\";\n\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\n\nimport { isNumber } from \"@/predicates/is/isNumber\";\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\nexport type TailwindConfig = TwConfig;\n\n/**\n * @internal\n */\ntype TwMergeConfigExt = ConfigExtension<string, string>;\n\n/**\n * @internal\n */\ntype ValidatorTwMergeReturn = {\n config: TwConfig;\n override: TwMergeConfigExt[\"override\"];\n cacheSize: TwMergeConfigExt[\"cacheSize\"];\n prefix: TwMergeConfigExt[\"prefix\"];\n experimentalParseClassName?: TwMergeConfigExt[\"experimentalParseClassName\"];\n theme: NonNullable<NonNullable<TwMergeConfigExt[\"extend\"]>[\"theme\"]>;\n classGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"classGroups\"]\n >;\n conflictingClassGroupModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroupModifiers\"]\n >;\n conflictingClassGroups: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"conflictingClassGroups\"]\n >;\n orderSensitiveModifiers: NonNullable<\n NonNullable<TwMergeConfigExt[\"extend\"]>[\"orderSensitiveModifiers\"]\n >;\n};\n\n/**\n * @internal\n */\nexport const validatorPropsTwMerge = (\n options: OptionsMergeTwClsV4\n): ValidatorTwMergeReturn => {\n if (!isPlainObject(options)) options = {};\n let {\n config,\n prefix,\n extend,\n override,\n cacheSize,\n experimentalParseClassName\n } = options;\n\n if (!isPlainObject(config)) config = {};\n if (!isPlainObject(extend)) extend = {};\n if (!isPlainObject(override)) override = {};\n if (!isNumber(cacheSize)) cacheSize = undefined;\n if (!isNonEmptyString(prefix)) prefix = undefined;\n if (!isFunction(experimentalParseClassName))\n experimentalParseClassName = undefined;\n\n const theme = hasOwnProp(extend, \"theme\") ? extend.theme : {};\n const classGroups = hasOwnProp(extend, \"classGroups\")\n ? extend.classGroups\n : {};\n const conflictingClassGroupModifiers = hasOwnProp(\n extend,\n \"conflictingClassGroupModifiers\"\n )\n ? extend.conflictingClassGroupModifiers\n : {};\n\n const conflictingClassGroups = hasOwnProp(extend, \"conflictingClassGroups\")\n ? extend.conflictingClassGroups\n : {};\n const orderSensitiveModifiers =\n hasOwnProp(extend, \"orderSensitiveModifiers\") &&\n isNonEmptyArray(extend.orderSensitiveModifiers)\n ? extend.orderSensitiveModifiers\n : [];\n\n return {\n config,\n override,\n cacheSize,\n prefix,\n experimentalParseClassName,\n theme,\n classGroups,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers\n };\n};\n","import type { OptionsMergeTwClsV3, TwMergeDefaultFnV3 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v3\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer3 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 3 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v3*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v3*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer3 | `customCnVer3`} for better performance, this utility may be removed in a future release.***\n *\n * @param {OptionsMergeTwClsV3} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV3}\n * Customized Tailwind class merge function version 3 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV3();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV3({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV3 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV3({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV3, twMergeDefaultV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV3({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV3 = (\n options: OptionsMergeTwClsV3 = {}\n): TwMergeDefaultFnV3 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix ?? config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { OptionsMergeTwClsV4, TwMergeDefaultFnV4 } from \"./_private/types\";\n\nimport { extendTailwindMerge, getDefaultConfig } from \"tailwind-merge-v4\";\n\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { validatorPropsTwMerge } from \"../_private/validate-props\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnVer4 } from \"../../class-names/customCn\";\n\n// Get default Tailwind merge configuration\nconst defaultConfig = getDefaultConfig();\n\n/** -------------------------------------------------------------\n * * ***Customized Tailwind class merger Version 4 with extended rules.***\n * -------------------------------------------------------------\n *\n * **Wraps ***`extendTailwindMerge` from tailwind-merge-v4*** with Tailwind’s default\n * config (_*`getDefaultConfig()` from tailwind-merge-v4*_) to create a **project-ready `twMerge`**.**\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - Extend **class groups** (e.g. add `text-shadow`).\n * - Respect your own **`tailwind.config.ts`** (colors, spacing, fontSize, etc).\n * - Override or fine-tune **merge behavior**.\n * - Create a **project-wide `cn` helper** that replaces raw `twMerge`.\n *\n * @deprecated ***Still supported for advanced Tailwind merge customization, but significantly slower than native `twMerge` during SSR and hydration because merge rules are extended at runtime, prefer `twMerge` + {@link customCnVer4 | `customCnVer4`} for better performance, this utility may be removed in a future release.***\n *\n * @deprecated ***Slower than the default `twMerge`, but still safe to use when custom merge behavior is needed.***\n *\n * @param {OptionsMergeTwClsV4} [options={}]\n * ***Merge options:***\n * - `config` – Your Tailwind config (from `tailwind.config.ts`).\n * - `prefix` - Utility prefix (e.g. `tw-` or `tw`).\n * - `extend` – Extra merge rules (classGroups, theme, etc).\n * - `override` – Fully replace rules.\n * - `cacheSize` – Parsed class cache size.\n * - `experimentalParseClassName` – Custom classname parser.\n *\n * @returns {TwMergeDefaultFnV4}\n * Customized Tailwind class merge function version 4 (same signature as `twMerge`).\n *\n * @example\n * #### Example 1: ***Default behavior (same as tailwind-merge).***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge = twMergeDefaultV4();\n * twMerge(\"p-2 p-4\");\n * // ➔ \"p-4\"\n * ```\n * #### Example 2: ***Extend class groups.***\n * ```ts\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge2 = twMergeDefaultV4({\n * extend: {\n * classGroups: {\n * shadow: [\"shadow-soft\", \"shadow-hard\"],\n * },\n * },\n * });\n * twMerge2(\"shadow-soft shadow-hard\");\n * // ➔ \"shadow-hard\"\n * ```\n * #### Example 3: ***Respect your Tailwind config.***\n * ```ts\n * import config from \"../tailwind.config\";\n * import { twMergeDefaultV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const twMerge3 = twMergeDefaultV4({ config });\n * twMerge3(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (resolved from config)\n * ```\n * #### Example 4: ***Project-wide helper (recommended).***\n * ```ts\n * import configTwCss from \"../tailwind.config\";\n * import { customCnV4, twMergeDefaultV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const customTwMerge = twMergeDefaultV4({\n * config: configTwCss,\n * extend: {\n * classGroups: { shadow: [\"shadow-soft\", \"shadow-hard\"] },\n * },\n * });\n *\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(customTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-soft shadow-hard\"); // ➔ \"shadow-hard\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (uses config)\n *\n * // ⚡ Difference with package-level `cn`\n * import { cnV3, cnV4 } from \"@rzl-zone/utils-js/tailwind\";\n *\n * cnV3(\"text-base text-xxs\");\n * // or\n * cnV4(\"text-base text-xxs\");\n * // ➔ \"text-base\" (❌ doesn't know about your config)\n *\n * cnApp(\"text-base text-xxs\");\n * // ➔ \"text-xxs\" (✅ respects config)\n * ```\n */\nexport const twMergeDefaultV4 = (\n options: OptionsMergeTwClsV4 = {}\n): TwMergeDefaultFnV4 => {\n if (!isPlainObject(options)) options = {};\n const {\n cacheSize,\n classGroups,\n config,\n conflictingClassGroupModifiers,\n conflictingClassGroups,\n orderSensitiveModifiers,\n override,\n prefix,\n theme,\n experimentalParseClassName\n } = validatorPropsTwMerge(options);\n\n return extendTailwindMerge<string, string>({\n prefix: prefix || config.prefix,\n cacheSize: cacheSize || defaultConfig.cacheSize,\n experimentalParseClassName,\n override,\n extend: {\n conflictingClassGroupModifiers: {\n ...defaultConfig.conflictingClassGroupModifiers,\n ...conflictingClassGroupModifiers\n },\n theme: { ...defaultConfig.theme, ...theme },\n conflictingClassGroups: {\n ...defaultConfig.conflictingClassGroups,\n ...conflictingClassGroups\n },\n orderSensitiveModifiers: [\n ...defaultConfig.orderSensitiveModifiers,\n ...orderSensitiveModifiers\n ],\n classGroups: {\n ...defaultConfig.classGroups,\n ...classGroups,\n\n \"text-shadow\": [\n \"\",\n \"-sm\",\n \"-md\",\n \"-lg\",\n \"-xl\",\n \"-xxl\",\n \"-none\",\n \"-default\"\n ].map((size) => `text-shadow${size}`),\n \"font-size\": Object.keys({\n ...(config.theme?.fontSize || {}),\n ...(config.theme?.extend?.fontSize || {})\n }).map((size) => `text-${size}`)\n }\n }\n });\n};\n","import type { TwMergeDefaultFnV3 } from \"../tw-merge/v3/_private/types\";\nimport type { TwMergeDefaultFnV4 } from \"../tw-merge/v4/_private/types\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\nimport { isFunction } from \"@/predicates/is/isFunction\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { cx, type ClassValues } from \"./cx\";\n\nexport type { ClassValues };\n\nimport { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v3`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV3 | `twMergeV3`} implementation\n * from `tailwind-merge` version 2 for `tailwind version 3`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v3**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV3` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeV3 | `twMergeV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV3 } from \"tailwind-merge\"; // tw-merge (v2) for tailwind version 3\n * import { customCnVer3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer3(twMergeV3, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer3 = (\n customTwMergeV3: TwMergeDefaultFnV3 = twMergeV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***High-performance `cn` factory utility (Tailwind `v4`).***\n * -------------------------------------------------------------\n * **Combines class-name values and applies the provided Tailwind merge\n * function using the native {@link twMergeV4 | `twMergeV4`} implementation\n * from `tailwind-merge` version 3 for `tailwind version 4`.**\n *\n * This utility is the recommended replacement for deprecated extended\n * runtime merge helpers because it provides significantly better hydration\n * and runtime performance.\n *\n * - ✅ **Recommended when:**\n * - Your project uses **Tailwind v4**.\n * - You want the fastest possible `cn` utility.\n * - You need reusable project-wide `cn*` helpers.\n * - You want predictable Tailwind conflict resolution with minimal overhead.\n *\n * - ⚡ **Performance note**\n * - Uses the native `twMergeV4` implementation directly.\n * - Faster than deprecated extended merge utilities.\n * - Better suited for SSR and hydration-heavy applications.\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeV4 | `twMergeV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import { twMerge as twMergeV4 } from \"tailwind-merge\"; // tw-merge (v3) for tailwind version 4\n * import { customCnVer4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create app-level helper\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnVer4(twMergeV4, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"text-sm text-lg\"); // ➔ \"text-lg\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * ```\n */\nexport const customCnVer4 = (\n customTwMergeV4: TwMergeDefaultFnV4 = twMergeV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v3`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV3 | `twMergeDefaultV3`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v3**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer3 | `customCnVer3`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV3} customTwMergeV3 - Merge function created via {@link twMergeDefaultV3 | `twMergeDefaultV3`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV3`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV3(myCustomTwMerge, ...classes);\n * };\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV3 = (\n customTwMergeV3: TwMergeDefaultFnV3,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV3)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV3\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV3\n )}\\`.`\n );\n }\n\n return customTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Factory utility for building a custom `cn` helper (Tailwind `v4`).***\n * -------------------------------------------------------------\n *\n * **Wraps internally function to combines class-name values and applies the provided\n * Tailwind merge function (from {@link twMergeDefaultV4 | `twMergeDefaultV4`}).**\n *\n * - 🔑 **When to use it?**\n * - Your project uses **Tailwind v4**.\n * - You extend Tailwind merge rules (`classGroups`, `tailwind.config`).\n * - You need multiple `cn*` variants across apps/packages.\n *\n * @deprecated ***Still supported, but slower during SSR and hydration because it relies on extended runtime merge logic,\n * prefer {@link customCnVer4 | `customCnVer4`}for better performance, this utility may be removed in a future release.***\n *\n * @param {TwMergeDefaultFnV4} customTwMergeV4 - Merge function created via {@link twMergeDefaultV4 | `twMergeDefaultV4`}.\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n *\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * // 1. Create a custom merge function\n * const myCustomTwMerge = twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\"text-shadow\", \"text-shadow-sm\", \"text-shadow-md\"],\n * },\n * },\n * });\n *\n * // 2. Build your helper using `customCnV4`\n * export const cnApp = (...classes: ClassValues) => {\n * return customCnV4(myCustomTwMerge, ...classes);\n * };\n *\n * // ✅ Usage\n * cnApp(\"p-2\", \"p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const customCnV4 = (\n customTwMergeV4: TwMergeDefaultFnV4,\n ...classes: ClassValues\n): string => {\n if (!isFunction(customTwMergeV4)) {\n throw new TypeError(\n `first Parameter (\\`customTwMergeV4\\`) must be of type \\`function\\`, but received: \\`${getPreciseType(\n customTwMergeV4\n )}\\`.`\n );\n }\n\n return customTwMergeV4(cx(...classes));\n};\n","import { twMerge as twMergeV3 } from \"tailwind-merge-v3\";\nimport { twMerge as twMergeV4 } from \"tailwind-merge-v4\";\n\nimport { cx, type ClassValues } from \"./cx\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { customCnV3, customCnV4 } from \"./customCn\";\nimport { twMergeDefaultV3 } from \"../tw-merge/v3/twMergeDefault\";\nimport { twMergeDefaultV4 } from \"../tw-merge/v4/twMergeDefault\";\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v3` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV3 | `twMerge`} version **2** for ***`tailwind version 3`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer3 = (...values: ClassValues): string =>\n twMergeV3(cx(...values));\n\n/** -------------------------------------------------------------------\n * * ***Combines and merges class utility values into a single normalized\n * string with `Tailwind CSS v4` conflict resolution.***\n * --------------------------------------------------------------------\n *\n * This utility composes {@link cx | `cx`} and {@link twMergeV4 | `twMerge`} version **3** for ***`tailwind version 4`***:\n *\n * - `cx` handles flexible class inputs (like `clsx`)\n * - `twMerge` resolves Tailwind CSS utility conflicts\n *\n * This provides a complete solution for conditional class composition\n * with deterministic Tailwind merging.\n *\n * - **Behavior:**\n * - Accepts strings, numbers, arrays, and objects\n * - Supports deeply nested class structures\n * - Ignores falsy values (`false`, `null`, `undefined`, `\"\"`, `0`)\n * - Includes object keys with truthy values (including inherited keys)\n * - Unwraps boxed primitives (`new String()`, etc.)\n * - Resolves Tailwind utility conflicts deterministically\n * - Keeps the last conflicting class based on input order\n * - Produces a clean, space-normalized class string\n *\n * This utility is a drop-in replacement for `clsx` or `classnames`\n * with built-in Tailwind conflict resolution.\n *\n * @param values - A list of mixed class values including strings,\n * numbers, arrays, objects, and conditional expressions.\n *\n * @returns A merged and normalized CSS class string.\n *\n * @example\n * ```ts\n * cn(\n * \"p-2\",\n * isActive && \"bg-blue-500\",\n * [\"text-sm\", { \"font-bold\": isBold }],\n * null,\n * 0\n * );\n * // => \"p-2 bg-blue-500 text-sm font-bold\"\n * ```\n *\n * @example\n * ```ts\n * cn(\"p-2 p-4\", { \"text-sm\": true, \"text-lg\": true });\n * // => \"p-4 text-lg\"\n * ```\n */\nexport const cnVer4 = (...values: ClassValues): string =>\n twMergeV4(cx(...values));\n\nconst defaultTwMergeV3 = twMergeDefaultV3();\nconst defaultTwMergeV4 = twMergeDefaultV4();\n\n/** -------------------------------------------------------------\n * * ***Default `cnV3` utility (Tailwind v3).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV3 | `twMergeDefaultV3`}\n * with **Tailwind v3 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v3**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV3 | `twMergeDefaultV3`} +\n * {@link customCnV3 | `customCnV3`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer3 | `cnVer3`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n *\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v3).\n * ```ts\n * cnV3(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV3(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV3([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV3, customCnV3, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV3(\n * twMergeDefaultV3({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV3 = (...classes: ClassValues): string => {\n return defaultTwMergeV3(cx(...classes));\n};\n\n/** -------------------------------------------------------------\n * * ***Default `cnV4` utility (Tailwind v4).***\n * -------------------------------------------------------------\n *\n * **Combines class-name values and then deduplicates/resolves\n * conflicts using {@link twMergeDefaultV4 | `twMergeDefaultV4`}\n * with **Tailwind v4 default config only**.**\n * - ✅ **Use this when:**\n * - Your project uses **Tailwind v4**.\n * - You need a simple `cn` that works out of the box without a custom config.\n * - ⚡ **Need custom rules?**\n * - Create a project-wide helper using\n * {@link twMergeDefaultV4 | `twMergeDefaultV4`} +\n * {@link customCnV4 | `customCnV4`} (see Example 2).\n *\n * @deprecated ***Still supported, but significantly slower during hydration because it uses extended runtime merge logic, prefer {@link cnVer4 | `cnVer4`} for\n * better performance, this utility may be removed in a future release.***\n *\n * @param {ClassValues} classes - Class values (`string`, `array`, `object`, `etc`).\n * @returns {string} Merged Tailwind class string.\n * @example\n * #### Example 1: ✅ Default usage (Tailwind v4).\n * ```ts\n * cnV4(\"p-2\", \"p-4\");\n * // ➔ \"p-4\"\n *\n * cnV4(\"text-red-500\", { \"text-blue-500\": true });\n * // ➔ \"text-blue-500\"\n *\n * cnV4([\"m-2\", [\"m-4\"]], \"m-8\");\n * // ➔ \"m-8\"\n * ```\n * #### Example 2: ⚡ Custom project-wide usage with Tailwind config.\n * ```ts\n * import tailwindConfig from \"../tailwind.config\";\n * import { twMergeDefaultV4, customCnV4, type ClassValues } from \"@rzl-zone/utils-js/tailwind\";\n *\n * const cnApp = (...classes: ClassValues) => {\n * return customCnV4(\n * twMergeDefaultV4({\n * config: tailwindConfig,\n * extend: {\n * classGroups: {\n * \"text-shadow\": [\n * \"text-shadow\",\n * \"text-shadow-sm\",\n * \"text-shadow-md\",\n * ],\n * },\n * },\n * }),\n * // ...other options classes,\n * );\n * };\n *\n * cnApp(\"p-2 p-4\"); // ➔ \"p-4\"\n * cnApp(\"shadow-sm shadow-md\"); // ➔ \"shadow-md\"\n * cnApp(\"text-base text-xxs\"); // ➔ \"text-xxs\" (resolved from config)\n * ```\n */\nexport const cnV4 = (...classes: ClassValues): string => {\n return defaultTwMergeV4(cx(...classes));\n};\n","import type { Stringify } from \"@rzl-zone/ts-types-plus\";\n\nimport { isString } from \"@/predicates/is/isString\";\nimport { isEmptyString } from \"@/predicates/is/isEmptyString\";\nimport { getPreciseType } from \"@/predicates/type/getPreciseType\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `shouldForwardProp`.***\n * ----------------------------------------------------------\n * **Creates a helper for styled-components `shouldForwardProp`.**\n *\n * @description\n * 1. Returns a **predicate function** that determines whether a given prop\n * should be forwarded to the DOM.\n * 2. Useful for filtering out internal props (e.g., `$size`, `$active`)\n * so they don't become invalid HTML attributes.\n *\n * - **Behavior:**\n * - Accepts a strict tuple of **string keys** to exclude from forwarding.\n * - Every key is validated as a **non-empty string** at runtime.\n * - Throws a `TypeError` if:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n * - Automatically coerces the tested prop name to string for matching.\n *\n * @template CustomProps\n * The component props type to validate against.\n *\n * @param {readonly Stringify<keyof CustomProps>[]}\n * props\n * The list of prop names (keys of `CustomProps`) to exclude from forwarding.\n *\n * @returns {(propName: keyof CustomProps | ({} & string)) => boolean}\n * A function that receives a prop name and returns:\n * - `true` ➔ the prop **will** be forwarded to the DOM.\n * - `false` ➔ the prop **will not** be forwarded.\n *\n * @throws **{@link TypeError | `TypeError`}**\n * when:\n * - `props` is not an array, or\n * - any item is not a non-empty string.\n *\n * @example\n * // Basic usage\n * type Props = { $size: string; color: string; visible: boolean };\n * const filter = shouldForwardProp<Props>([\"$size\"]);\n *\n * filter(\"$size\"); // ➔ false (blocked).\n * filter(\"color\"); // ➔ true (forwarded).\n * filter(\"visible\"); // ➔ true (forwarded).\n *\n * @example\n * // With styled-components\n * type CustomProps = { $internal: boolean; public: string; another: boolean };\n *\n * styled.div.withConfig({\n * shouldForwardProp: shouldForwardProp<CustomProps>([\"$internal\"])\n * });\n */\nexport const shouldForwardProp = <CustomProps extends Record<string, unknown>>(\n props: readonly Stringify<keyof CustomProps>[]\n // props: Partial<UnionToTupleStrict<keyof CustomProps>>\n): ((propName: keyof CustomProps | ({} & string)) => boolean) => {\n assertIsArray(props, {\n message: ({ currentType, validType }) =>\n `First parameter (\\`props\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const invalidItems: { index: number; reason: string }[] = [];\n\n props.forEach((p, idx) => {\n if (!isString(p)) {\n invalidItems.push({\n index: idx,\n reason: `Expected a non-empty string, but received ${getPreciseType(p, {\n formatCase: \"toPascalCaseSpace\"\n })}.`\n });\n } else if (isEmptyString(p)) {\n invalidItems.push({\n index: idx,\n reason: \"Expected a non-empty string, but received EmptyString.\"\n });\n }\n });\n\n if (isNonEmptyArray(invalidItems)) {\n const maxWidth = Math.max(\n ...invalidItems.map((item) => String(item.index).length)\n );\n\n const details = invalidItems\n .map(\n (item) =>\n `• [Index ${String(item.index).padStart(maxWidth, \"0\")}] ${item.reason}`\n )\n .join(\"\\n\");\n\n throw new TypeError(\n `First parameter (\\`props\\`) contains invalid entries:\\n${details}`\n );\n }\n\n return (propName): boolean => {\n return !props.map(String).includes(String(propName));\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,SAAS,cAAc,OAA2B;CAChD,IAAI,MAAM;CAEV,IAAIA,yCAAiB,KAAK,KAAKC,iCAAS,KAAK,GAC3C,OAAO;MACF,IAAIC,wCAAgB,KAAK,GAC9B,IACEC,uCAAe,KAAK,KACpBC,uCAAe,KAAK,KACpBC,wCAAgB,KAAK,GACrB;EACA,MAAM,MAAM,MAAM,QAAQ;EAC1B,IAAI,KAAK,OAAO;CAClB,OAAO,IAAIC,gCAAQ,KAAK,GACtB,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,CAAC,MAAM;EACX,MAAM,IAAI,cAAc,IAAI;EAC5B,IAAI,CAAC,GAAG;EACR,IAAI,KAAK,OAAO;EAChB,OAAO;CACT;MAEA,KAAK,MAAM,OAAO,OAAO;EACvB,IAAI,CAAC,MAAM,MAAM;EACjB,IAAI,KAAK,OAAO;EAChB,OAAO;CACT;CAIJ,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAgB,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ACzD;EAEA,MAAM,UAAU,aACb,KACE,SACC,YAAY,OAAO,KAAK,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,IAAI,KAAK,QACpE,EACC,KAAK,IAAI;EAEZ,MAAM,IAAI,UACR,0DAA0D,SAC5D;CACF;CAEA,QAAQ,aAAsB;EAC5B,OAAO,CAAC,MAAM,IAAI,MAAM,EAAE,SAAS,OAAO,QAAQ,CAAC;CACrD;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toStringArrayUnRecursive-OOHGazks.js","names":[],"sources":["../src/conversions/arrays/transforms/filterNilArray.ts","../src/conversions/arrays/casts/toStringArrayUnRecursive.ts"],"sourcesContent":["import type {\n FilterNilArray,\n FilterNilArrayFromTuple,\n PreserveMutability\n} from \"./_private/filterNilArray.types\";\n\nimport { isNil } from \"@/predicates/is/isNil\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isEmptyArray } from \"@/predicates/is/isEmptyArray\";\n\n/** ----------------------------------------------------------\n * * ***Utility: `filterNilArray`.***\n * ---------------------------------------------\n * **Removes `null` and `undefined` values from an array, including nested arrays.**\n * - **Behavior:**\n * - Returns `undefined` if the input is explicitly `undefined` or `null`.\n * - Returns `[]` if input is empty or all elements are removed after filtering.\n * - Recursively filters nested arrays while preserving structure.\n * - Ensures proper type inference for safer downstream operations.\n * @template A - The type of elements in the array.\n * @param {T[]|null|undefined} input - The array to be filtered.\n * @returns {T[] | undefined} A new array with `null` and `undefined` values removed,\n * or `undefined` if the input is explicitly `undefined` or `null`.\n * @example\n * ```ts\n * filterNilArray([1, null, 2, undefined, 3]);\n * // ➔ [1, 2, 3]\n * filterNilArray([null, undefined]);\n * // ➔ []\n * filterNilArray(undefined);\n * // ➔ undefined\n * filterNilArray(null);\n * // ➔ undefined\n * filterNilArray([]); // or\n * filterNilArray([[[]]]); // or\n * filterNilArray([[[],undefined,null]]);\n * // ➔ []\n * filterNilArray([1, [null, 2, [undefined, 3]]]);\n * // ➔ [1, [2, [3]]]\n * ```\n */\nexport function filterNilArray(input: null | undefined): undefined;\nexport function filterNilArray<A extends readonly unknown[]>(\n input: A\n): PreserveMutability<A, FilterNilArrayFromTuple<A>>;\nexport function filterNilArray<A extends readonly unknown[]>(\n input: A | null | undefined\n): PreserveMutability<A, FilterNilArrayFromTuple<A>> | undefined;\nexport function filterNilArray<A>(\n input: (A | null | undefined)[] | null | undefined\n): FilterNilArray<A> | undefined;\nexport function filterNilArray(\n input: readonly unknown[] | null | undefined\n): unknown[] | undefined;\nexport function filterNilArray(input: unknown[]): unknown[];\nexport function filterNilArray(input: unknown): unknown {\n if (isNil(input)) return undefined;\n if (!isArray(input)) return [];\n\n const filtered = input.reduce<unknown[]>((output, element) => {\n if (!isNil(element)) {\n if (isArray(element)) {\n const cleanedNested = filterNilArray(element);\n if (cleanedNested && !isEmptyArray(cleanedNested)) {\n output.push(cleanedNested);\n }\n } else {\n output.push(element);\n }\n }\n return output;\n }, []);\n\n return filtered;\n}\n","import type {\n ToStringArrayUnRecursiveOptions,\n ToStringArrayUnRecursiveReturn\n} from \"./toStringArrayUnRecursive.types\";\n\nimport { isNull } from \"@/predicates/is/isNull\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isString } from \"@/predicates/is/isString\";\nimport { isFinite } from \"@/predicates/is/isFinite\";\nimport { isBigInt } from \"@/predicates/is/isBigInt\";\nimport { isBoolean } from \"@/predicates/is/isBoolean\";\nimport { hasOwnProp } from \"@/predicates/has/hasOwnProp\";\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\nimport { filterNilArray } from \"../transforms/filterNilArray\";\n\n/** ---------------------------------------------\n * * ***Utility: `toStringArrayUnRecursive`.***\n * ---------------------------------------------\n * **Converts all values in a flat array into string representations.**\n * - **Behavior:**\n * - Only processes **flat arrays** (non-recursive).\n * - Supports input values: `string`, `number`, `bigint`, `boolean`,\n * `null`, `undefined`.\n * - Invalid values (`null` and `undefined`) can be **removed** or **kept**\n * depending on the option.\n * - Other unsupported types will be converted to `undefined` (and removed\n * if `removeInvalidValue=true`).\n * - **ℹ️ Note:**\n * - _For recursive / nested arrays, use ***`toStringDeep` utility function*** instead._\n * @template T - Element type of the input array.\n * @template R - Whether invalid values should be removed (`true`) or kept (`false`).\n * @param {Array<string | number | bigint | boolean | null | undefined> | null | undefined} [array] - The array to convert, returns `undefined` if not an array.\n * @param {ToStringArrayUnRecursiveOptions<RemoveInvalidValue>} [options] - Options to control transformation behavior, defaults to `{ removeInvalidValue: true }`.\n * @param {RemoveInvalidValue extends true ? boolean : boolean} [options.removeInvalidValue=true] Whether to remove invalid values (`null`, `undefined`, or unsupported types), default: `true`.\n * @returns {RemoveInvalidValue extends true ? string[] : (string | null | undefined)[]} A new array of string representations, with invalid values optionally removed.\n * @example\n * ```ts\n * // Convert numbers and strings\n * toStringArrayUnRecursive([1, 2, '3']);\n * // ➔ ['1', '2', '3']\n * // Remove null and undefined\n * toStringArrayUnRecursive([1, null, undefined, 'abc'], {\n * removeInvalidValue: true\n * });\n * // ➔ ['1', 'abc']\n * // Keep null and undefined\n * toStringArrayUnRecursive([1, null, undefined, 'abc'], {\n * removeInvalidValue: false\n * });\n * // ➔ ['1', null, undefined, 'abc']\n * // Convert boolean and bigint\n * toStringArrayUnRecursive([true, false, 10n]);\n * // ➔ ['true', 'false', '10']\n * // Not an array ➔ returns undefined\n * toStringArrayUnRecursive(null);\n * // ➔ undefined\n * toStringArrayUnRecursive(undefined);\n * // ➔ undefined\n * toStringArrayUnRecursive(1);\n * // ➔ undefined\n * toStringArrayUnRecursive(\"string\");\n * // ➔ undefined\n * ```\n */\nexport function toStringArrayUnRecursive(\n array?: undefined | null,\n options?: ToStringArrayUnRecursiveOptions<boolean>\n): undefined;\nexport function toStringArrayUnRecursive(\n array?: Array<never>,\n options?: ToStringArrayUnRecursiveOptions<boolean>\n): [];\nexport function toStringArrayUnRecursive<T, R extends boolean = true>(\n array?: Array<T> | readonly T[] | null,\n options?: ToStringArrayUnRecursiveOptions<R>\n): ToStringArrayUnRecursiveReturn<T, R>;\nexport function toStringArrayUnRecursive<T = unknown>(\n array?: T,\n options?: ToStringArrayUnRecursiveOptions<boolean>\n): undefined;\nexport function toStringArrayUnRecursive<T>(\n array?: Array<T> | readonly T[] | null,\n options: ToStringArrayUnRecursiveOptions<boolean> = {}\n) {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const riv = hasOwnProp(options, \"removeInvalidValue\")\n ? options.removeInvalidValue\n : true;\n\n assertIsBoolean(riv, {\n message: ({ currentType, validType }) =>\n `Parameter \\`removeInvalidValue\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n if (isArray(array)) {\n // Convert each item in the array to a string, or null/undefined if it's not a valid value.\n const result = Array.from(array, (x) => {\n // Convert finite number, boolean, bigInt or string to string\n if (isString(x) || isFinite(x) || isBoolean(x) || isBigInt(x))\n return String(x);\n\n // Handle null or undefined values\n return isNull(x) ? null : undefined;\n });\n\n // Remove invalid values (null, undefined) if specified in options\n if (riv) return filterNilArray(result);\n\n return result;\n }\n\n // Return undefined if no array is provided\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAuDA,SAAgB,eAAe,OAAyB;CACtD,IAAI,MAAM,KAAK,GAAG,OAAO;CACzB,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO,CAAC;CAgB7B,OAdiB,MAAM,QAAmB,QAAQ,YAAY;EAC5D,IAAI,CAAC,MAAM,OAAO,GAChB,IAAI,QAAQ,OAAO,GAAG;GACpB,MAAM,gBAAgB,eAAe,OAAO;GAC5C,IAAI,iBAAiB,CAAC,aAAa,aAAa,GAC9C,OAAO,KAAK,aAAa;EAE7B,OACE,OAAO,KAAK,OAAO;EAGvB,OAAO;CACT,GAAG,CAAC,CAEU;AAChB;;;;ACQA,SAAgB,yBACd,OACA,UAAoD,CAAC,GACrD;CACA,oBAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,MAAM,WAAW,SAAS,oBAAoB,IAChD,QAAQ,qBACR;CAEJ,gBAAgB,KAAK,EACnB,UAAU,EAAE,aAAa,gBACvB,qGAAqG,UAAU,sBAAsB,YAAY,KACrJ,CAAC;CAED,IAAI,QAAQ,KAAK,GAAG;EAElB,MAAM,SAAS,MAAM,KAAK,QAAQ,MAAM;GAEtC,IAAI,SAAS,CAAC,KAAK,SAAS,CAAC,KAAK,UAAU,CAAC,KAAK,SAAS,CAAC,GAC1D,OAAO,OAAO,CAAC;GAGjB,OAAO,OAAO,CAAC,IAAI,OAAO;EAC5B,CAAC;EAGD,IAAI,KAAK,OAAO,eAAe,MAAM;EAErC,OAAO;CACT;AAIF"}
|