@visulima/string 1.2.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +46 -0
  4. package/dist/case/camel-case.cjs +1 -59
  5. package/dist/case/camel-case.d.cts +2 -2
  6. package/dist/case/camel-case.d.mts +2 -2
  7. package/dist/case/camel-case.d.ts +2 -2
  8. package/dist/case/camel-case.mjs +1 -57
  9. package/dist/case/capital-case.cjs +1 -51
  10. package/dist/case/capital-case.d.cts +2 -2
  11. package/dist/case/capital-case.d.mts +2 -2
  12. package/dist/case/capital-case.d.ts +2 -2
  13. package/dist/case/capital-case.mjs +1 -49
  14. package/dist/case/constant-case.cjs +1 -11
  15. package/dist/case/constant-case.d.cts +2 -2
  16. package/dist/case/constant-case.d.mts +2 -2
  17. package/dist/case/constant-case.d.ts +2 -2
  18. package/dist/case/constant-case.mjs +1 -9
  19. package/dist/case/dot-case.cjs +1 -11
  20. package/dist/case/dot-case.d.cts +2 -2
  21. package/dist/case/dot-case.d.mts +2 -2
  22. package/dist/case/dot-case.d.ts +2 -2
  23. package/dist/case/dot-case.mjs +1 -9
  24. package/dist/case/flat-case.cjs +1 -11
  25. package/dist/case/flat-case.d.cts +2 -2
  26. package/dist/case/flat-case.d.mts +2 -2
  27. package/dist/case/flat-case.d.ts +2 -2
  28. package/dist/case/flat-case.mjs +1 -9
  29. package/dist/case/flip-case.cjs +1 -61
  30. package/dist/case/flip-case.d.cts +4 -3
  31. package/dist/case/flip-case.d.mts +4 -3
  32. package/dist/case/flip-case.d.ts +4 -3
  33. package/dist/case/flip-case.mjs +1 -57
  34. package/dist/case/identify-case.cjs +1 -69
  35. package/dist/case/identify-case.d.cts +2 -2
  36. package/dist/case/identify-case.d.mts +2 -2
  37. package/dist/case/identify-case.d.ts +2 -2
  38. package/dist/case/identify-case.mjs +1 -67
  39. package/dist/case/index.cjs +1 -47
  40. package/dist/case/index.d.cts +2 -2
  41. package/dist/case/index.d.mts +2 -2
  42. package/dist/case/index.d.ts +2 -2
  43. package/dist/case/index.mjs +1 -20
  44. package/dist/case/kebab-case.cjs +1 -61
  45. package/dist/case/kebab-case.d.cts +4 -3
  46. package/dist/case/kebab-case.d.mts +4 -3
  47. package/dist/case/kebab-case.d.ts +4 -3
  48. package/dist/case/kebab-case.mjs +1 -57
  49. package/dist/case/lower-first.cjs +1 -13
  50. package/dist/case/lower-first.d.cts +2 -2
  51. package/dist/case/lower-first.d.mts +2 -2
  52. package/dist/case/lower-first.d.ts +2 -2
  53. package/dist/case/lower-first.mjs +1 -11
  54. package/dist/case/no-case.cjs +1 -11
  55. package/dist/case/no-case.d.cts +2 -2
  56. package/dist/case/no-case.d.mts +2 -2
  57. package/dist/case/no-case.d.ts +2 -2
  58. package/dist/case/no-case.mjs +1 -9
  59. package/dist/case/pascal-case.cjs +1 -52
  60. package/dist/case/pascal-case.d.cts +2 -2
  61. package/dist/case/pascal-case.d.mts +2 -2
  62. package/dist/case/pascal-case.d.ts +2 -2
  63. package/dist/case/pascal-case.mjs +1 -50
  64. package/dist/case/pascal-snake-case.cjs +1 -32
  65. package/dist/case/pascal-snake-case.d.cts +2 -2
  66. package/dist/case/pascal-snake-case.d.mts +2 -2
  67. package/dist/case/pascal-snake-case.d.ts +2 -2
  68. package/dist/case/pascal-snake-case.mjs +1 -30
  69. package/dist/case/path-case.cjs +1 -11
  70. package/dist/case/path-case.d.cts +2 -2
  71. package/dist/case/path-case.d.mts +2 -2
  72. package/dist/case/path-case.d.ts +2 -2
  73. package/dist/case/path-case.mjs +1 -9
  74. package/dist/case/sentence-case.cjs +1 -58
  75. package/dist/case/sentence-case.d.cts +2 -2
  76. package/dist/case/sentence-case.d.mts +2 -2
  77. package/dist/case/sentence-case.d.ts +2 -2
  78. package/dist/case/sentence-case.mjs +1 -56
  79. package/dist/case/snake-case.cjs +1 -11
  80. package/dist/case/snake-case.d.cts +2 -2
  81. package/dist/case/snake-case.d.mts +2 -2
  82. package/dist/case/snake-case.d.ts +2 -2
  83. package/dist/case/snake-case.mjs +1 -9
  84. package/dist/case/split-by-case.cjs +1 -641
  85. package/dist/case/split-by-case.d.cts +4 -3
  86. package/dist/case/split-by-case.d.mts +4 -3
  87. package/dist/case/split-by-case.d.ts +4 -3
  88. package/dist/case/split-by-case.mjs +1 -637
  89. package/dist/case/title-case.cjs +1 -47
  90. package/dist/case/title-case.d.cts +2 -2
  91. package/dist/case/title-case.d.mts +2 -2
  92. package/dist/case/title-case.d.ts +2 -2
  93. package/dist/case/title-case.mjs +1 -45
  94. package/dist/case/train-case.cjs +1 -44
  95. package/dist/case/train-case.d.cts +2 -2
  96. package/dist/case/train-case.d.mts +2 -2
  97. package/dist/case/train-case.d.ts +2 -2
  98. package/dist/case/train-case.mjs +1 -42
  99. package/dist/case/upper-first.cjs +1 -13
  100. package/dist/case/upper-first.d.cts +2 -2
  101. package/dist/case/upper-first.d.mts +2 -2
  102. package/dist/case/upper-first.d.ts +2 -2
  103. package/dist/case/upper-first.mjs +1 -11
  104. package/dist/get-string-truncated-width.cjs +1 -422
  105. package/dist/get-string-truncated-width.d.cts +2 -1
  106. package/dist/get-string-truncated-width.d.mts +2 -1
  107. package/dist/get-string-truncated-width.d.ts +2 -1
  108. package/dist/get-string-truncated-width.mjs +1 -418
  109. package/dist/get-string-width.cjs +1 -11
  110. package/dist/get-string-width.d.cts +2 -1
  111. package/dist/get-string-width.d.mts +2 -1
  112. package/dist/get-string-width.d.ts +2 -1
  113. package/dist/get-string-width.mjs +1 -7
  114. package/dist/index.cjs +1 -66
  115. package/dist/index.d.cts +15 -5
  116. package/dist/index.d.mts +15 -5
  117. package/dist/index.d.ts +15 -5
  118. package/dist/index.mjs +1 -29
  119. package/dist/native-string-types.d.cts +1 -1
  120. package/dist/native-string-types.d.mts +1 -1
  121. package/dist/native-string-types.d.ts +1 -1
  122. package/dist/outdent.cjs +1 -125
  123. package/dist/outdent.d.cts +2 -1
  124. package/dist/outdent.d.mts +2 -1
  125. package/dist/outdent.d.ts +2 -1
  126. package/dist/outdent.mjs +1 -121
  127. package/dist/packem_shared/LRUCache-Bjo6gsbC.mjs +1 -0
  128. package/dist/packem_shared/LRUCache-TYqfUYE5.cjs +1 -0
  129. package/dist/packem_shared/WrapMode-BL2dnSc8.cjs +8 -0
  130. package/dist/packem_shared/WrapMode-DxH5g69E.mjs +8 -0
  131. package/dist/packem_shared/alignText-BCKbnqhC.mjs +2 -0
  132. package/dist/packem_shared/alignText-CLZJuPP6.cjs +2 -0
  133. package/dist/packem_shared/constants-Cd17VNEv.mjs +1 -0
  134. package/dist/packem_shared/constants-D3K8u3G8.cjs +1 -0
  135. package/dist/packem_shared/generate-cache-key-BZf0GiMs.cjs +1 -0
  136. package/dist/packem_shared/generate-cache-key-DPByFaMH.mjs +1 -0
  137. package/dist/packem_shared/joinSegments-CDHNMXsF.cjs +1 -0
  138. package/dist/packem_shared/joinSegments-H7QJ7rwJ.mjs +1 -0
  139. package/dist/packem_shared/normalize-german-eszett-4k1qRtEP.mjs +1 -0
  140. package/dist/packem_shared/normalize-german-eszett-Bop4wOp9.cjs +1 -0
  141. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +1 -0
  142. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +1 -0
  143. package/dist/packem_shared/slugify-B1vlQQO1.mjs +1 -0
  144. package/dist/packem_shared/slugify-CH3GI7E5.cjs +1 -0
  145. package/dist/packem_shared/transliterate-BXaP38Sh.mjs +5 -0
  146. package/dist/packem_shared/transliterate-CToQ-aeM.cjs +5 -0
  147. package/dist/packem_shared/{types-DmfKbIaI.d.ts → types-BSdIWVzn.d.cts} +2 -1
  148. package/dist/packem_shared/{types-DmfKbIaI.d.cts → types-BSdIWVzn.d.mts} +2 -1
  149. package/dist/packem_shared/{types-DmfKbIaI.d.mts → types-BSdIWVzn.d.ts} +2 -1
  150. package/dist/packem_shared/{types-DcGtApe2.d.ts → types-BfGNLD2K.d.ts} +1 -1
  151. package/dist/packem_shared/{types-C5Pk8B8Q.d.cts → types-DrtiqNkK.d.cts} +1 -1
  152. package/dist/packem_shared/{types-_jqW_ZOt.d.mts → types-mlwFVBiS.d.mts} +1 -1
  153. package/dist/slice.cjs +1 -419
  154. package/dist/slice.d.cts +2 -1
  155. package/dist/slice.d.mts +2 -1
  156. package/dist/slice.d.ts +2 -1
  157. package/dist/slice.mjs +1 -415
  158. package/dist/test/utils.cjs +13 -74
  159. package/dist/test/utils.d.cts +2 -1
  160. package/dist/test/utils.d.mts +2 -1
  161. package/dist/test/utils.d.ts +2 -1
  162. package/dist/test/utils.mjs +14 -69
  163. package/dist/test/vitest.cjs +1 -11
  164. package/dist/test/vitest.d.cts +2 -1
  165. package/dist/test/vitest.d.mts +2 -1
  166. package/dist/test/vitest.d.ts +2 -1
  167. package/dist/test/vitest.mjs +1 -7
  168. package/dist/truncate.cjs +1 -101
  169. package/dist/truncate.d.cts +2 -1
  170. package/dist/truncate.d.mts +2 -1
  171. package/dist/truncate.d.ts +2 -1
  172. package/dist/truncate.mjs +1 -97
  173. package/dist/utils.cjs +1 -65
  174. package/dist/utils.d.cts +1 -1
  175. package/dist/utils.d.mts +1 -1
  176. package/dist/utils.d.ts +1 -1
  177. package/dist/utils.mjs +1 -56
  178. package/package.json +9 -6
  179. package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +0 -53
  180. package/dist/packem_shared/LRUCache-udNErhWw.mjs +0 -51
  181. package/dist/packem_shared/WrapMode-B-WBY1mj.mjs +0 -545
  182. package/dist/packem_shared/WrapMode-Dsqu9BaX.cjs +0 -550
  183. package/dist/packem_shared/constants-CKuHriHc.cjs +0 -151
  184. package/dist/packem_shared/constants-CsGLUb4U.mjs +0 -100
  185. package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +0 -10
  186. package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +0 -8
  187. package/dist/packem_shared/joinSegments-B_7bxy5J.cjs +0 -48
  188. package/dist/packem_shared/joinSegments-BovQ2h_P.mjs +0 -46
  189. package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +0 -11
  190. package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +0 -9
  191. package/dist/packem_shared/replaceString-C7Dp5vAg.mjs +0 -200
  192. package/dist/packem_shared/replaceString-iYo1cDfZ.cjs +0 -202
  193. package/dist/packem_shared/slugify-DhE59J2A.mjs +0 -48
  194. package/dist/packem_shared/slugify-jh6PftAT.cjs +0 -50
  195. package/dist/packem_shared/transliterate-BEci5RC8.cjs +0 -47782
  196. package/dist/packem_shared/transliterate-DwSldp0o.mjs +0 -47780
@@ -1,100 +0,0 @@
1
- var __defProp$1 = Object.defineProperty;
2
- var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
3
- const r = String.raw;
4
- const seq = r`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`;
5
- const sTags = r`\u{E0061}-\u{E007A}`;
6
- const emojiRegex = /* @__PURE__ */ __name$1(() => new RegExp(r`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${sTags}]{2}[\u{E0030}-\u{E0039}${sTags}]{1,3}\u{E007F}|${seq}(?:\u200D${seq})*`, "gu"), "default");
7
-
8
- var __defProp = Object.defineProperty;
9
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- const ESCAPES = /* @__PURE__ */ new Set(["\x1B", "›"]);
11
- const ANSI_ESCAPE_BELL = "\x07";
12
- const ANSI_CSI = "[";
13
- const ANSI_SGR_TERMINATOR = "m";
14
- const ANSI_ESCAPE_LINK = `]8;;`;
15
- const END_CODE = 39;
16
- const RE_ZERO_WIDTH = /[\u200B\uFEFF\u2060-\u2064]/g;
17
- const RE_ESCAPE_PATTERN = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`);
18
- const ANSI_RESET_CODES = Object.freeze(
19
- /* @__PURE__ */ new Map([
20
- [0, 0],
21
- // Reset all
22
- [1, 22],
23
- // Bold → Not bold
24
- [2, 22],
25
- // Dim → Not bold
26
- [3, 23],
27
- // Italic → Not italic
28
- [4, 24],
29
- // Underline → Not underline
30
- [7, 27],
31
- // Inverse → Not inverse
32
- [8, 28],
33
- // Hidden → Not hidden
34
- [9, 29],
35
- // Strikethrough → Not strikethrough
36
- [30, 39],
37
- // Foreground colors → Default foreground
38
- [31, 39],
39
- [32, 39],
40
- [33, 39],
41
- [34, 39],
42
- [35, 39],
43
- [36, 39],
44
- [37, 39],
45
- [40, 49],
46
- // Background colors → Default background
47
- [41, 49],
48
- [42, 49],
49
- [43, 49],
50
- [44, 49],
51
- [45, 49],
52
- [46, 49],
53
- [47, 49],
54
- [90, 39]
55
- // Bright foreground → Default foreground
56
- ])
57
- );
58
- const RE_LEADING_NEWLINE = /^[ \t]*(?:\r\n|\r|\n)/;
59
- const RE_TRAILING_NEWLINE = /(?:\r\n|\r|\n)[ \t]*$/;
60
- const RE_STARTS_WITH_NEWLINE_OR_IS_EMPTY = /^(?:[\r\n]|$)/;
61
- const RE_DETECT_INDENTATION = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
62
- const RE_ONLY_WHITESPACE_WITH_AT_LEAST_ONE_NEWLINE = /^[ \t]*[\r\n][ \t\r\n]*$/;
63
- const RE_MATCH_NEWLINES = /\r\n|\n|\r/g;
64
- const RE_ANSI = /[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g;
65
- const RE_VALID_ANSI_PAIRS = /\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g;
66
- const RE_VALID_HYPERLINKS = /\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g;
67
- const RE_CONTROL = /[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y;
68
- const RE_EMOJI = emojiRegex();
69
- const RE_SEPARATORS = /[-_./\s]+/g;
70
- const RE_FAST_ANSI = /(\u001B\[[0-9;]*[a-z])/i;
71
- const RE_ARABIC = new RegExp("\\p{Script=Arabic}", "u");
72
- const RE_BENGALI = new RegExp("\\p{Script=Bengali}", "u");
73
- const RE_CYRILLIC = new RegExp("\\p{Script=Cyrillic}", "u");
74
- const RE_DEVANAGARI = new RegExp("\\p{Script=Devanagari}", "u");
75
- const RE_ETHIOPIC = new RegExp("\\p{Script=Ethiopic}", "u");
76
- const RE_GREEK = new RegExp("\\p{Script=Greek}", "u");
77
- const RE_GREEK_LATIN_SPLIT = new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+", "gu");
78
- const RE_GUJARATI = new RegExp("\\p{Script=Gujarati}", "u");
79
- const RE_GURMUKHI = new RegExp("\\p{Script=Gurmukhi}", "u");
80
- const RE_HANGUL = new RegExp("\\p{Script=Hangul}", "u");
81
- const RE_HEBREW = new RegExp("\\p{Script=Hebrew}", "u");
82
- const RE_HIRAGANA = new RegExp("\\p{Script=Hiragana}", "u");
83
- const RE_KANJI = new RegExp("\\p{Script=Han}", "u");
84
- const RE_KANNADA = new RegExp("\\p{Script=Kannada}", "u");
85
- const RE_KATAKANA = new RegExp("\\p{Script=Katakana}", "u");
86
- const RE_KHMER = new RegExp("\\p{Script=Khmer}", "u");
87
- const RE_LAO = new RegExp("\\p{Script=Lao}", "u");
88
- const RE_LATIN = new RegExp("\\p{Script=Latin}", "u");
89
- const RE_MALAYALAM = new RegExp("\\p{Script=Malayalam}", "u");
90
- const RE_MYANMAR = new RegExp("\\p{Script=Myanmar}", "u");
91
- const RE_ORIYA = new RegExp("\\p{Script=Oriya}", "u");
92
- const RE_SINHALA = new RegExp("\\p{Script=Sinhala}", "u");
93
- const RE_TAMIL = new RegExp("\\p{Script=Tamil}", "u");
94
- const RE_TELUGU = new RegExp("\\p{Script=Telugu}", "u");
95
- const RE_THAI = new RegExp("\\p{Script=Thai}", "u");
96
- const RE_TIBETAN = new RegExp("\\p{Script=Tibetan}", "u");
97
- const RE_UZBEK_LATIN_MODIFIER = /[\u02BB\u02BC\u0027]/u;
98
- const stripEmoji = /* @__PURE__ */ __name((stringValue) => stringValue.replace(RE_EMOJI, ""), "stripEmoji");
99
-
100
- export { RE_GURMUKHI as A, RE_KANNADA as B, RE_TAMIL as C, RE_TELUGU as D, RE_MALAYALAM as E, RE_SINHALA as F, RE_THAI as G, RE_LAO as H, RE_TIBETAN as I, RE_MYANMAR as J, RE_ETHIOPIC as K, RE_KHMER as L, RE_ORIYA as M, RE_CONTROL as N, ESCAPES as O, ANSI_ESCAPE_LINK as P, ANSI_SGR_TERMINATOR as Q, RE_FAST_ANSI as R, ANSI_ESCAPE_BELL as S, ANSI_CSI as T, RE_ESCAPE_PATTERN as U, ANSI_RESET_CODES as V, END_CODE as W, RE_ZERO_WIDTH as X, RE_VALID_ANSI_PAIRS as a, RE_VALID_HYPERLINKS as b, RE_ANSI as c, RE_ONLY_WHITESPACE_WITH_AT_LEAST_ONE_NEWLINE as d, RE_STARTS_WITH_NEWLINE_OR_IS_EMPTY as e, RE_LEADING_NEWLINE as f, RE_TRAILING_NEWLINE as g, RE_MATCH_NEWLINES as h, RE_DETECT_INDENTATION as i, RE_EMOJI as j, RE_SEPARATORS as k, RE_CYRILLIC as l, RE_LATIN as m, RE_GREEK as n, RE_GREEK_LATIN_SPLIT as o, RE_KANJI as p, RE_HEBREW as q, RE_ARABIC as r, stripEmoji as s, RE_HANGUL as t, RE_UZBEK_LATIN_MODIFIER as u, RE_KATAKANA as v, RE_HIRAGANA as w, RE_DEVANAGARI as x, RE_BENGALI as y, RE_GUJARATI as z };
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const generateCacheKey = /* @__PURE__ */ __name((value, options) => (
6
- // Only include options that affect the output
7
- `${value}::${options?.joiner ?? ""}::${options?.locale ?? ""}::${options?.knownAcronyms?.join(",") ?? ""}::${options?.normalize ? "true" : "false"}`
8
- ), "generateCacheKey");
9
-
10
- exports.generateCacheKey = generateCacheKey;
@@ -1,8 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const generateCacheKey = /* @__PURE__ */ __name((value, options) => (
4
- // Only include options that affect the output
5
- `${value}::${options?.joiner ?? ""}::${options?.locale ?? ""}::${options?.knownAcronyms?.join(",") ?? ""}::${options?.normalize ? "true" : "false"}`
6
- ), "generateCacheKey");
7
-
8
- export { generateCacheKey as g };
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- const constants = require('./constants-CKuHriHc.cjs');
4
-
5
- var __defProp = Object.defineProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- const joinSegments = /* @__PURE__ */ __name((segments, joiner) => {
8
- const { length } = segments;
9
- if (length === 0) {
10
- return "";
11
- }
12
- if (length === 1) {
13
- return segments[0];
14
- }
15
- const result = [];
16
- let ansiStart = "";
17
- let currentContent = "";
18
- for (let index = 0; index < length; index++) {
19
- const segment = segments[index];
20
- if (constants.RE_FAST_ANSI.test(segment)) {
21
- if (ansiStart) {
22
- result.push(ansiStart + currentContent + segment);
23
- ansiStart = "";
24
- currentContent = "";
25
- } else {
26
- if (result.length > 0) {
27
- result.push(joiner);
28
- }
29
- ansiStart = segment;
30
- }
31
- continue;
32
- }
33
- if (ansiStart) {
34
- if (currentContent) {
35
- currentContent += joiner;
36
- }
37
- currentContent += segment;
38
- } else {
39
- if (result.length > 0) {
40
- result.push(joiner);
41
- }
42
- result.push(segment);
43
- }
44
- }
45
- return result.join("");
46
- }, "joinSegments");
47
-
48
- module.exports = joinSegments;
@@ -1,46 +0,0 @@
1
- import { R as RE_FAST_ANSI } from './constants-CsGLUb4U.mjs';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const joinSegments = /* @__PURE__ */ __name((segments, joiner) => {
6
- const { length } = segments;
7
- if (length === 0) {
8
- return "";
9
- }
10
- if (length === 1) {
11
- return segments[0];
12
- }
13
- const result = [];
14
- let ansiStart = "";
15
- let currentContent = "";
16
- for (let index = 0; index < length; index++) {
17
- const segment = segments[index];
18
- if (RE_FAST_ANSI.test(segment)) {
19
- if (ansiStart) {
20
- result.push(ansiStart + currentContent + segment);
21
- ansiStart = "";
22
- currentContent = "";
23
- } else {
24
- if (result.length > 0) {
25
- result.push(joiner);
26
- }
27
- ansiStart = segment;
28
- }
29
- continue;
30
- }
31
- if (ansiStart) {
32
- if (currentContent) {
33
- currentContent += joiner;
34
- }
35
- currentContent += segment;
36
- } else {
37
- if (result.length > 0) {
38
- result.push(joiner);
39
- }
40
- result.push(segment);
41
- }
42
- }
43
- return result.join("");
44
- }, "joinSegments");
45
-
46
- export { joinSegments as default };
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const normalizeGermanEszett = /* @__PURE__ */ __name((value) => (
6
- // Replace "SS" with "ß" only when both letters are uppercase
7
- // This uses a positive lookbehind to ensure we don't convert "ss" or "Ss"
8
- value.replaceAll(/(?<![a-zß])SS(?![a-z])/g, "ß")
9
- ), "normalizeGermanEszett");
10
-
11
- exports.normalizeGermanEszett = normalizeGermanEszett;
@@ -1,9 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const normalizeGermanEszett = /* @__PURE__ */ __name((value) => (
4
- // Replace "SS" with "ß" only when both letters are uppercase
5
- // This uses a positive lookbehind to ensure we don't convert "ss" or "Ss"
6
- value.replaceAll(/(?<![a-zß])SS(?![a-z])/g, "ß")
7
- ), "normalizeGermanEszett");
8
-
9
- export { normalizeGermanEszett as n };
@@ -1,200 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const mergeIntervals = /* @__PURE__ */ __name((intervals) => {
4
- if (intervals.length === 0) {
5
- return [];
6
- }
7
- const merged = [];
8
- let currentMerge = [...intervals[0]];
9
- for (let index = 1; index < intervals.length; index++) {
10
- const next = intervals[index];
11
- if (next && next[0] <= currentMerge[1] + 1) {
12
- currentMerge[1] = Math.max(currentMerge[1], next[1]);
13
- } else {
14
- merged.push(currentMerge);
15
- currentMerge = [...next];
16
- }
17
- }
18
- merged.push(currentMerge);
19
- return merged;
20
- }, "mergeIntervals");
21
- const replaceString = /* @__PURE__ */ __name((source, searches, ignoreRanges) => {
22
- if (!source) {
23
- return "";
24
- }
25
- const potentialMatches = [];
26
- let matchIdCounter = 0;
27
- for (const item of searches) {
28
- if (!item || item.length < 2) {
29
- continue;
30
- }
31
- const [searchKey, replacementValue] = item;
32
- if (replacementValue === void 0) {
33
- continue;
34
- }
35
- try {
36
- if (searchKey instanceof RegExp) {
37
- const searchPattern = new RegExp(searchKey.source, `${searchKey.flags.replace("g", "")}g`);
38
- let match;
39
- while ((match = searchPattern.exec(source)) !== null) {
40
- const start = match.index;
41
- const original = match[0];
42
- if (original.length === 0 && searchPattern.lastIndex === match.index) {
43
- searchPattern.lastIndex++;
44
- }
45
- const end = start + original.length - 1;
46
- const finalReplacement = replacementValue.replaceAll(/\$([\d&$`'])/g, (substringFound, capturedSymbolOrDigits) => {
47
- if (capturedSymbolOrDigits === "&") {
48
- return original;
49
- }
50
- if (capturedSymbolOrDigits === "$") {
51
- return "$";
52
- }
53
- if (capturedSymbolOrDigits === "`") {
54
- return source.substring(0, start);
55
- }
56
- if (capturedSymbolOrDigits === "'") {
57
- return source.substring(start + original.length);
58
- }
59
- const groupIndex = Number.parseInt(capturedSymbolOrDigits, 10);
60
- if (match && groupIndex > 0 && groupIndex < match.length) {
61
- return match[groupIndex] ?? "";
62
- }
63
- return substringFound;
64
- });
65
- potentialMatches.push({ end, id: matchIdCounter++, original, replacement: finalReplacement, start });
66
- if (original.length === 0 && searchPattern.lastIndex === start) {
67
- searchPattern.lastIndex++;
68
- }
69
- }
70
- } else if (typeof searchKey === "string" && searchKey.length > 0) {
71
- for (let index = 0; (index = source.indexOf(searchKey, index)) !== -1; index++) {
72
- const start = index;
73
- const original = searchKey;
74
- const end = start + original.length - 1;
75
- const mockMatch = Object.assign([original], { index: start, input: source });
76
- const finalReplacement = replacementValue.replaceAll(/\$(\d+|&|\$)/g, (substringFound, capturedSymbolOrDigits) => {
77
- if (capturedSymbolOrDigits === "&") {
78
- return original;
79
- }
80
- if (capturedSymbolOrDigits === "$") {
81
- return "$";
82
- }
83
- const groupIndex = Number.parseInt(capturedSymbolOrDigits, 10);
84
- if (mockMatch && groupIndex > 0 && groupIndex < mockMatch.length) {
85
- return mockMatch[groupIndex] ?? "";
86
- }
87
- return substringFound;
88
- });
89
- potentialMatches.push({ end, id: matchIdCounter++, original, replacement: finalReplacement, start });
90
- }
91
- } else {
92
- continue;
93
- }
94
- } catch {
95
- continue;
96
- }
97
- }
98
- potentialMatches.sort((a, b) => {
99
- if (a.start !== b.start) {
100
- return a.start - b.start;
101
- }
102
- return b.end - a.end;
103
- });
104
- const sortedIgnores = [...ignoreRanges].sort((a, b) => a[0] - b[0]);
105
- const mergedIgnores = mergeIntervals(sortedIgnores);
106
- const processedChars = source.split("").map((char, index) => {
107
- return {
108
- appliedMatchId: null,
109
- char,
110
- index,
111
- insertBeforeReplacement: null,
112
- isIgnored: false,
113
- isMatchStart: false,
114
- matchReplacement: null
115
- };
116
- });
117
- for (const range of mergedIgnores) {
118
- for (let index = range[0]; index <= range[1]; index++) {
119
- if (processedChars[index]) {
120
- processedChars[index].isIgnored = true;
121
- }
122
- }
123
- }
124
- let insertionAfterEnd = "";
125
- for (const match of potentialMatches) {
126
- if (match.original.length === 0 && match.start >= 0 && match.start <= processedChars.length) {
127
- const targetIndex = match.start;
128
- if (processedChars[targetIndex]) {
129
- const targetChar = processedChars[targetIndex];
130
- if (!targetChar.isIgnored) {
131
- targetChar.insertBeforeReplacement = (targetChar.insertBeforeReplacement ?? "") + match.replacement;
132
- }
133
- } else if (targetIndex === processedChars.length) {
134
- insertionAfterEnd += match.replacement;
135
- }
136
- }
137
- }
138
- for (const match of potentialMatches) {
139
- if (match.original.length === 0) {
140
- continue;
141
- }
142
- let canApply = true;
143
- for (let index = match.start; index <= match.end; index++) {
144
- if (
145
- // eslint-disable-next-line security/detect-object-injection
146
- !processedChars[index] || // Out of bounds
147
- // eslint-disable-next-line security/detect-object-injection
148
- processedChars[index].isIgnored || // Overlaps ignore
149
- // eslint-disable-next-line security/detect-object-injection
150
- processedChars[index].appliedMatchId !== null
151
- ) {
152
- canApply = false;
153
- break;
154
- }
155
- }
156
- if (canApply && // Apply this valid match
157
- match.start >= 0 && match.start < processedChars.length) {
158
- for (let index = match.start; index <= match.end; index++) {
159
- if (processedChars[index]) {
160
- processedChars[index].appliedMatchId = match.id;
161
- }
162
- }
163
- if (processedChars[match.start]) {
164
- processedChars[match.start].isMatchStart = true;
165
- processedChars[match.start].matchReplacement = match.replacement;
166
- }
167
- }
168
- }
169
- let result = "";
170
- let currentIndex = 0;
171
- while (currentIndex < processedChars.length) {
172
- const pChar = processedChars[currentIndex];
173
- if (pChar.insertBeforeReplacement !== null) {
174
- result += pChar.insertBeforeReplacement;
175
- }
176
- if (pChar.isMatchStart && pChar.appliedMatchId !== null) {
177
- result += pChar.matchReplacement ?? "";
178
- let matchEndIndex = currentIndex;
179
- for (let index = currentIndex + 1; index < processedChars.length; index++) {
180
- if (processedChars[index]?.appliedMatchId === pChar.appliedMatchId) {
181
- matchEndIndex = index;
182
- } else {
183
- break;
184
- }
185
- }
186
- currentIndex = matchEndIndex + 1;
187
- } else if (pChar.appliedMatchId === null) {
188
- result += pChar.char;
189
- currentIndex++;
190
- } else {
191
- currentIndex++;
192
- }
193
- }
194
- if (insertionAfterEnd.length > 0) {
195
- result += insertionAfterEnd;
196
- }
197
- return result;
198
- }, "replaceString");
199
-
200
- export { replaceString as default };
@@ -1,202 +0,0 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const mergeIntervals = /* @__PURE__ */ __name((intervals) => {
6
- if (intervals.length === 0) {
7
- return [];
8
- }
9
- const merged = [];
10
- let currentMerge = [...intervals[0]];
11
- for (let index = 1; index < intervals.length; index++) {
12
- const next = intervals[index];
13
- if (next && next[0] <= currentMerge[1] + 1) {
14
- currentMerge[1] = Math.max(currentMerge[1], next[1]);
15
- } else {
16
- merged.push(currentMerge);
17
- currentMerge = [...next];
18
- }
19
- }
20
- merged.push(currentMerge);
21
- return merged;
22
- }, "mergeIntervals");
23
- const replaceString = /* @__PURE__ */ __name((source, searches, ignoreRanges) => {
24
- if (!source) {
25
- return "";
26
- }
27
- const potentialMatches = [];
28
- let matchIdCounter = 0;
29
- for (const item of searches) {
30
- if (!item || item.length < 2) {
31
- continue;
32
- }
33
- const [searchKey, replacementValue] = item;
34
- if (replacementValue === void 0) {
35
- continue;
36
- }
37
- try {
38
- if (searchKey instanceof RegExp) {
39
- const searchPattern = new RegExp(searchKey.source, `${searchKey.flags.replace("g", "")}g`);
40
- let match;
41
- while ((match = searchPattern.exec(source)) !== null) {
42
- const start = match.index;
43
- const original = match[0];
44
- if (original.length === 0 && searchPattern.lastIndex === match.index) {
45
- searchPattern.lastIndex++;
46
- }
47
- const end = start + original.length - 1;
48
- const finalReplacement = replacementValue.replaceAll(/\$([\d&$`'])/g, (substringFound, capturedSymbolOrDigits) => {
49
- if (capturedSymbolOrDigits === "&") {
50
- return original;
51
- }
52
- if (capturedSymbolOrDigits === "$") {
53
- return "$";
54
- }
55
- if (capturedSymbolOrDigits === "`") {
56
- return source.substring(0, start);
57
- }
58
- if (capturedSymbolOrDigits === "'") {
59
- return source.substring(start + original.length);
60
- }
61
- const groupIndex = Number.parseInt(capturedSymbolOrDigits, 10);
62
- if (match && groupIndex > 0 && groupIndex < match.length) {
63
- return match[groupIndex] ?? "";
64
- }
65
- return substringFound;
66
- });
67
- potentialMatches.push({ end, id: matchIdCounter++, original, replacement: finalReplacement, start });
68
- if (original.length === 0 && searchPattern.lastIndex === start) {
69
- searchPattern.lastIndex++;
70
- }
71
- }
72
- } else if (typeof searchKey === "string" && searchKey.length > 0) {
73
- for (let index = 0; (index = source.indexOf(searchKey, index)) !== -1; index++) {
74
- const start = index;
75
- const original = searchKey;
76
- const end = start + original.length - 1;
77
- const mockMatch = Object.assign([original], { index: start, input: source });
78
- const finalReplacement = replacementValue.replaceAll(/\$(\d+|&|\$)/g, (substringFound, capturedSymbolOrDigits) => {
79
- if (capturedSymbolOrDigits === "&") {
80
- return original;
81
- }
82
- if (capturedSymbolOrDigits === "$") {
83
- return "$";
84
- }
85
- const groupIndex = Number.parseInt(capturedSymbolOrDigits, 10);
86
- if (mockMatch && groupIndex > 0 && groupIndex < mockMatch.length) {
87
- return mockMatch[groupIndex] ?? "";
88
- }
89
- return substringFound;
90
- });
91
- potentialMatches.push({ end, id: matchIdCounter++, original, replacement: finalReplacement, start });
92
- }
93
- } else {
94
- continue;
95
- }
96
- } catch {
97
- continue;
98
- }
99
- }
100
- potentialMatches.sort((a, b) => {
101
- if (a.start !== b.start) {
102
- return a.start - b.start;
103
- }
104
- return b.end - a.end;
105
- });
106
- const sortedIgnores = [...ignoreRanges].sort((a, b) => a[0] - b[0]);
107
- const mergedIgnores = mergeIntervals(sortedIgnores);
108
- const processedChars = source.split("").map((char, index) => {
109
- return {
110
- appliedMatchId: null,
111
- char,
112
- index,
113
- insertBeforeReplacement: null,
114
- isIgnored: false,
115
- isMatchStart: false,
116
- matchReplacement: null
117
- };
118
- });
119
- for (const range of mergedIgnores) {
120
- for (let index = range[0]; index <= range[1]; index++) {
121
- if (processedChars[index]) {
122
- processedChars[index].isIgnored = true;
123
- }
124
- }
125
- }
126
- let insertionAfterEnd = "";
127
- for (const match of potentialMatches) {
128
- if (match.original.length === 0 && match.start >= 0 && match.start <= processedChars.length) {
129
- const targetIndex = match.start;
130
- if (processedChars[targetIndex]) {
131
- const targetChar = processedChars[targetIndex];
132
- if (!targetChar.isIgnored) {
133
- targetChar.insertBeforeReplacement = (targetChar.insertBeforeReplacement ?? "") + match.replacement;
134
- }
135
- } else if (targetIndex === processedChars.length) {
136
- insertionAfterEnd += match.replacement;
137
- }
138
- }
139
- }
140
- for (const match of potentialMatches) {
141
- if (match.original.length === 0) {
142
- continue;
143
- }
144
- let canApply = true;
145
- for (let index = match.start; index <= match.end; index++) {
146
- if (
147
- // eslint-disable-next-line security/detect-object-injection
148
- !processedChars[index] || // Out of bounds
149
- // eslint-disable-next-line security/detect-object-injection
150
- processedChars[index].isIgnored || // Overlaps ignore
151
- // eslint-disable-next-line security/detect-object-injection
152
- processedChars[index].appliedMatchId !== null
153
- ) {
154
- canApply = false;
155
- break;
156
- }
157
- }
158
- if (canApply && // Apply this valid match
159
- match.start >= 0 && match.start < processedChars.length) {
160
- for (let index = match.start; index <= match.end; index++) {
161
- if (processedChars[index]) {
162
- processedChars[index].appliedMatchId = match.id;
163
- }
164
- }
165
- if (processedChars[match.start]) {
166
- processedChars[match.start].isMatchStart = true;
167
- processedChars[match.start].matchReplacement = match.replacement;
168
- }
169
- }
170
- }
171
- let result = "";
172
- let currentIndex = 0;
173
- while (currentIndex < processedChars.length) {
174
- const pChar = processedChars[currentIndex];
175
- if (pChar.insertBeforeReplacement !== null) {
176
- result += pChar.insertBeforeReplacement;
177
- }
178
- if (pChar.isMatchStart && pChar.appliedMatchId !== null) {
179
- result += pChar.matchReplacement ?? "";
180
- let matchEndIndex = currentIndex;
181
- for (let index = currentIndex + 1; index < processedChars.length; index++) {
182
- if (processedChars[index]?.appliedMatchId === pChar.appliedMatchId) {
183
- matchEndIndex = index;
184
- } else {
185
- break;
186
- }
187
- }
188
- currentIndex = matchEndIndex + 1;
189
- } else if (pChar.appliedMatchId === null) {
190
- result += pChar.char;
191
- currentIndex++;
192
- } else {
193
- currentIndex++;
194
- }
195
- }
196
- if (insertionAfterEnd.length > 0) {
197
- result += insertionAfterEnd;
198
- }
199
- return result;
200
- }, "replaceString");
201
-
202
- module.exports = replaceString;