@tolki/str 1.7.1 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/str.js CHANGED
@@ -4,126 +4,149 @@ import { substr as i } from "./replacer/index.js";
4
4
  import { ltrim as a, rtrim as o, trim as s } from "./trimmer/index.js";
5
5
  import { createUlidsNormally as c } from "./ulid/index.js";
6
6
  import { createUuidsNormally as l } from "./uuid/index.js";
7
- import { isArray as u, isFunction as d, isNull as f, isNumber as p, isString as m, isUndefined as h, phpStringCast as g, toLower as _ } from "@tolki/utils";
7
+ import { hasOwnToString as u, isArray as d, isFunction as f, isIterable as p, isMap as m, isNull as h, isNumber as g, isObject as _, isPlainObject as v, isString as y, isUndefined as ee, phpStringCast as b, toLower as x } from "@tolki/utils";
8
8
  // src/str.ts
9
- var v = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), x = null;
10
- function S(e, t) {
9
+ var S = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), T = null;
10
+ /* @__NO_SIDE_EFFECTS__ */
11
+ function E(e, t) {
11
12
  if (t === "") return e;
12
13
  let n = String(t), r = e.indexOf(n);
13
14
  return r === -1 ? e : e.slice(r + n.length);
14
15
  }
15
- function ee(e, t) {
16
+ /* @__NO_SIDE_EFFECTS__ */
17
+ function te(e, t) {
16
18
  if (t === "") return e;
17
19
  let n = e.lastIndexOf(String(t));
18
20
  return n === -1 ? e : e.slice(n + String(t).length);
19
21
  }
20
- function C(e, t) {
22
+ /* @__NO_SIDE_EFFECTS__ */
23
+ function D(e, t) {
21
24
  if (t === "") return e;
22
25
  let n = e.indexOf(String(t));
23
26
  return n === -1 ? e : e.slice(0, n);
24
27
  }
25
- function w(e, t) {
28
+ /* @__NO_SIDE_EFFECTS__ */
29
+ function O(e, t) {
26
30
  if (t === "") return e;
27
31
  let n = e.lastIndexOf(String(t));
28
- return n === -1 ? e : i(e, 0, n);
29
- }
30
- function te(e, t, n) {
31
- return t === "" || n === "" ? e : w(S(e, t), n);
32
+ return n === -1 ? e : /* @__PURE__ */ i(e, 0, n);
32
33
  }
34
+ /* @__NO_SIDE_EFFECTS__ */
33
35
  function ne(e, t, n) {
34
- return t === "" || n === "" ? e : C(S(e, t), n);
36
+ return t === "" || n === "" ? e : /* @__PURE__ */ O(/* @__PURE__ */ E(e, t), n);
35
37
  }
36
- function re(e) {
37
- if (y.has(e)) return y.get(e);
38
- let t = Y(J(e));
39
- return y.set(e, t), t;
38
+ /* @__NO_SIDE_EFFECTS__ */
39
+ function re(e, t, n) {
40
+ return t === "" || n === "" ? e : /* @__PURE__ */ D(/* @__PURE__ */ E(e, t), n);
41
+ }
42
+ /* @__NO_SIDE_EFFECTS__ */
43
+ function k(e) {
44
+ if (C.has(e)) return C.get(e);
45
+ let t = /* @__PURE__ */ Y(/* @__PURE__ */ J(e));
46
+ return C.set(e, t), t;
40
47
  }
48
+ /* @__NO_SIDE_EFFECTS__ */
41
49
  function ie(e, t) {
42
50
  let n = e.length;
43
51
  return !(t < 0 ? t < -n : t > n - 1) && (t < 0 && (t += n), e.charAt(t));
44
52
  }
53
+ /* @__NO_SIDE_EFFECTS__ */
45
54
  function ae(e, t) {
46
- for (let n of u(t) ? t : [t]) if (n !== "" && e.startsWith(n)) {
55
+ for (let n of d(t) ? t : [t]) if (n !== "" && e.startsWith(n)) {
47
56
  let t = [...e], r = [...n];
48
57
  return t.slice(r.length).join("");
49
58
  }
50
59
  return e;
51
60
  }
61
+ /* @__NO_SIDE_EFFECTS__ */
52
62
  function oe(e, t) {
53
- for (let n of u(t) ? t : [t]) if (n !== "" && e.endsWith(n)) {
63
+ for (let n of d(t) ? t : [t]) if (n !== "" && e.endsWith(n)) {
54
64
  let t = [...e], r = [...n];
55
65
  return t.slice(0, -r.length).join("");
56
66
  }
57
67
  return e;
58
68
  }
59
- function T(e, t, n = !1) {
69
+ /* @__NO_SIDE_EFFECTS__ */
70
+ function A(e, t, n = !1) {
60
71
  n && (e = e.toLowerCase());
61
72
  let r;
62
73
  r = typeof t == "string" ? [t] : Array.from(t);
63
74
  for (let t of r) if (n && (t = t.toLowerCase()), t !== "" && e.includes(t)) return !0;
64
75
  return !1;
65
76
  }
77
+ /* @__NO_SIDE_EFFECTS__ */
66
78
  function se(e, t = "", n = {}) {
67
79
  let { radius: r = 100, omission: s = "..." } = n, c = String(e ?? ""), l = RegExp(`^(.*?)(${((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))(t ?? "")})(.*)$`, "iu").exec(c);
68
80
  if (!l) return null;
69
- let u = String(l[1]), d = String(l[2]), f = String(l[3]), p = a(u), m = Array.from(p).length, h = i(p, Math.max(m - r, 0), r), g = a(h);
81
+ let u = String(l[1]), d = String(l[2]), f = String(l[3]), p = /* @__PURE__ */ a(u), m = Array.from(p).length, h = /* @__PURE__ */ i(p, Math.max(m - r, 0), r), g = /* @__PURE__ */ a(h);
70
82
  g !== p && (g = s + g);
71
- let _ = o(f), v = i(_, 0, r), y = o(v);
72
- return y !== _ && (y += s), g + d + y;
83
+ let _ = /* @__PURE__ */ o(f), v = /* @__PURE__ */ o(/* @__PURE__ */ i(_, 0, r));
84
+ return v !== _ && (v += s), g + d + v;
73
85
  }
86
+ /* @__NO_SIDE_EFFECTS__ */
74
87
  function ce(e, t, n = !1) {
75
88
  let r = !1;
76
- for (let i of t) if (r = !0, !T(e, i, n)) return !1;
89
+ for (let i of t) if (r = !0, !/* @__PURE__ */ A(e, i, n)) return !1;
77
90
  return r;
78
91
  }
92
+ /* @__NO_SIDE_EFFECTS__ */
79
93
  function le(e, t, n = !1) {
80
- return !T(e, t, n);
94
+ return !/* @__PURE__ */ A(e, t, n);
81
95
  }
96
+ /* @__NO_SIDE_EFFECTS__ */
82
97
  function ue(e, t = " ") {
83
- return u(t) ? (t.forEach((t) => {
98
+ return d(t) ? (t.forEach((t) => {
84
99
  e = e.replace(RegExp(`${t}+`, "g"), t);
85
100
  }), e) : e.replace(RegExp(`${t}+`, "g"), t);
86
101
  }
87
- function E(e, t) {
102
+ /* @__NO_SIDE_EFFECTS__ */
103
+ function j(e, t) {
88
104
  if (e === null) return !1;
89
- e = String(e), t = u(t) ? Array.from(t) : [String(t)];
105
+ e = String(e), t = d(t) ? Array.from(t) : [String(t)];
90
106
  for (let n of t) if (n !== "" && e.endsWith(n)) return !0;
91
107
  return !1;
92
108
  }
109
+ /* @__NO_SIDE_EFFECTS__ */
93
110
  function de(e, t) {
94
- return !E(e, t);
111
+ return !/* @__PURE__ */ j(e, t);
95
112
  }
113
+ /* @__NO_SIDE_EFFECTS__ */
96
114
  function fe(e, t) {
97
- let n = g(e), r = g(t);
115
+ let n = b(e), r = b(t);
98
116
  if (r === "") return n;
99
117
  let i = n.length;
100
118
  for (; n.endsWith(r, i);) i -= r.length;
101
119
  return `${n.slice(0, i)}${r}`;
102
120
  }
121
+ /* @__NO_SIDE_EFFECTS__ */
103
122
  function pe(e, t, n = null) {
104
123
  return t + e + (n ?? t);
105
124
  }
125
+ /* @__NO_SIDE_EFFECTS__ */
106
126
  function me(e, t, n = null) {
107
- return q(e, t) && (e = i(e, O(t))), E(e, n ??= t) && (e = i(e, 0, -O(n))), e;
127
+ return /* @__PURE__ */ q(e, t) && (e = /* @__PURE__ */ i(e, /* @__PURE__ */ N(t))), /* @__PURE__ */ j(e, n ??= t) && (e = /* @__PURE__ */ i(e, 0, -/* @__PURE__ */ N(n))), e;
108
128
  }
129
+ /* @__NO_SIDE_EFFECTS__ */
109
130
  function he(e, t, n = !1) {
110
131
  t = String(t);
111
132
  let r;
112
133
  r = typeof e == "string" ? [e] : Array.from(e);
113
134
  for (let e of r) {
114
- if (e = String(e), e === t || n && _(e) === _(t)) return !0;
135
+ if (e = String(e), e === t || n && x(e) === x(t)) return !0;
115
136
  e = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), e = e.replace(/\\\*/g, ".*");
116
137
  let r = n ? "iu" : "u";
117
138
  if (RegExp(`^${e}$`, r).test(t)) return !0;
118
139
  }
119
140
  return !1;
120
141
  }
121
- function D(e) {
142
+ /* @__NO_SIDE_EFFECTS__ */
143
+ function M(e) {
122
144
  for (let t = 0; t < e.length; t++) if (e.charCodeAt(t) > 127) return !1;
123
145
  return !0;
124
146
  }
147
+ /* @__NO_SIDE_EFFECTS__ */
125
148
  function ge(e) {
126
- if (!m(e)) return !1;
149
+ if (!y(e)) return !1;
127
150
  try {
128
151
  JSON.parse(e);
129
152
  } catch {
@@ -131,8 +154,9 @@ function ge(e) {
131
154
  }
132
155
  return !0;
133
156
  }
157
+ /* @__NO_SIDE_EFFECTS__ */
134
158
  function _e(e, t = []) {
135
- if (!m(e)) return !1;
159
+ if (!y(e)) return !1;
136
160
  let n = (t.length === 0 ? "aaa|aaas|about|acap|acct|acd|acr|adiumxtra|adt|afp|afs|aim|amss|android|appdata|apt|ark|attachment|aw|barion|beshare|bitcoin|bitcoincash|blob|bolo|browserext|calculator|callto|cap|cast|casts|chrome|chrome-extension|cid|coap|coap+tcp|coap+ws|coaps|coaps+tcp|coaps+ws|com-eventbrite-attendee|content|conti|crid|cvs|dab|data|dav|diaspora|dict|did|dis|dlna-playcontainer|dlna-playsingle|dns|dntp|dpp|drm|drop|dtn|dvb|ed2k|elsi|example|facetime|fax|feed|feedready|file|filesystem|finger|first-run-pen-experience|fish|fm|ftp|fuchsia-pkg|geo|gg|git|gizmoproject|go|gopher|graph|gtalk|h323|ham|hcap|hcp|http|https|hxxp|hxxps|hydrazone|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|isostore|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|leaptofrogans|lorawan|lvlt|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|mongodb|moz|ms-access|ms-browser-extension|ms-calculator|ms-drive-to|ms-enrollment|ms-excel|ms-eyecontrolspeech|ms-gamebarservices|ms-gamingoverlay|ms-getoffice|ms-help|ms-infopath|ms-inputapp|ms-lockscreencomponent-config|ms-media-stream-id|ms-mixedrealitycapture|ms-mobileplans|ms-officeapp|ms-people|ms-project|ms-powerpoint|ms-publisher|ms-restoretabcompanion|ms-screenclip|ms-screensketch|ms-search|ms-search-repair|ms-secondary-screen-controller|ms-secondary-screen-setup|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-connectabledevices|ms-settings-displays-topology|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|ms-spd|ms-sttoverlay|ms-transit-to|ms-useractivityset|ms-virtualtouchpad|ms-visio|ms-walk-to|ms-whiteboard|ms-whiteboard-cmd|ms-word|msnim|msrp|msrps|mss|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|ocf|oid|onenote|onenote-cmd|opaquelocktoken|openpgp4fpr|pack|palm|paparazzi|payto|pkcs11|platform|pop|pres|prospero|proxy|pwid|psyc|pttp|qb|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|s3|secondlife|service|session|sftp|sgn|shttp|sieve|simpleledger|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spiffe|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|tg|things|thismessage|tip|tn3270|tool|ts3server|turn|turns|tv|udp|unreal|urn|ut2004|v-event|vemmi|ventrilo|videotex|vnc|view-source|wais|webcal|wpid|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39.50|z39.50r|z39.50s" : t.join("|")).split("|").map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
137
161
  try {
138
162
  let t = new URL(e), r = t.protocol.replace(":", ""), i = t.hostname, a = e.slice(e.indexOf("://") + 3).startsWith("/"), o = i.length > 0 && !/^\.+$/.test(i) && !a, s = r === "file" && a;
@@ -158,28 +182,34 @@ function _e(e, t = []) {
158
182
  ].join("");
159
183
  return new RegExp(r, "iu").test(e);
160
184
  }
185
+ /* @__NO_SIDE_EFFECTS__ */
161
186
  function ve(e) {
162
- return K(e, "-");
187
+ return /* @__PURE__ */ K(e, "-");
163
188
  }
164
- function O(e) {
189
+ /* @__NO_SIDE_EFFECTS__ */
190
+ function N(e) {
165
191
  return e.length;
166
192
  }
193
+ /* @__NO_SIDE_EFFECTS__ */
167
194
  function ye(e, t = 100, n = "...", r = !1) {
168
195
  if (e.length <= t) return e;
169
196
  if (!r) return e.slice(0, t).trimEnd() + n;
170
- e = G(e).replace(/[\n\r]+/g, " ").trim();
197
+ e = (/* @__PURE__ */ G(e)).replace(/[\n\r]+/g, " ").trim();
171
198
  let i = e.slice(0, t).trimEnd();
172
199
  return e.substring(t, t + 1) === " " || !/\s/.test(i) ? i + n : i.replace(/(.*)\s.*/, "$1") + n;
173
200
  }
174
- function k(e) {
175
- return _(e);
201
+ /* @__NO_SIDE_EFFECTS__ */
202
+ function P(e) {
203
+ return x(e);
176
204
  }
177
- function A(e, t = 100, n = "...") {
205
+ /* @__NO_SIDE_EFFECTS__ */
206
+ function be(e, t = 100, n = "...") {
178
207
  if (t <= 0) return e;
179
208
  let r = RegExp(`^\\s*(?:\\S+\\s*){1,${t}}`, "u"), i = e.match(r);
180
- return !i || O(e) === O(i[0]) ? e : i[0].trimEnd() + n;
209
+ return !i || /* @__PURE__ */ N(e) === /* @__PURE__ */ N(i[0]) ? e : i[0].trimEnd() + n;
181
210
  }
182
- function j(e, t, n, r = null) {
211
+ /* @__NO_SIDE_EFFECTS__ */
212
+ function xe(e, t, n, r = null) {
183
213
  if (t === "") return e;
184
214
  let i = e.length, a = n;
185
215
  n < 0 && (a = n < -i ? 0 : i + n);
@@ -188,7 +218,8 @@ function j(e, t, n, r = null) {
188
218
  let s = e.slice(0, a), c = o.length, l = e.slice(a + c);
189
219
  return s + t.slice(0, 1).repeat(c) + l;
190
220
  }
191
- function M(e, t) {
221
+ /* @__NO_SIDE_EFFECTS__ */
222
+ function Se(e, t) {
192
223
  let n = "u", r = e;
193
224
  if (e.length >= 2 && e[0] === "/") {
194
225
  let t = -1;
@@ -213,7 +244,8 @@ function M(e, t) {
213
244
  return "";
214
245
  }
215
246
  }
216
- function N(e, t) {
247
+ /* @__NO_SIDE_EFFECTS__ */
248
+ function Ce(e, t) {
217
249
  t = String(t);
218
250
  let n = typeof e == "string" ? [e] : Array.from(e);
219
251
  for (let e of n) {
@@ -241,7 +273,8 @@ function N(e, t) {
241
273
  }
242
274
  return !1;
243
275
  }
244
- function P(e, t) {
276
+ /* @__NO_SIDE_EFFECTS__ */
277
+ function we(e, t) {
245
278
  let n = "u", r = e;
246
279
  if (e.length >= 2 && e[0] === "/") {
247
280
  let t = -1;
@@ -269,29 +302,35 @@ function P(e, t) {
269
302
  }
270
303
  return i;
271
304
  }
272
- function be(e) {
273
- return u(e) ? e.map((e) => e.replace(/\D/g, "")) : e.replace(/\D/g, "");
305
+ /* @__NO_SIDE_EFFECTS__ */
306
+ function Te(e) {
307
+ return d(e) ? e.map((e) => e.replace(/\D/g, "")) : e.replace(/\D/g, "");
274
308
  }
275
- function xe(e, t, n = " ") {
309
+ /* @__NO_SIDE_EFFECTS__ */
310
+ function Ee(e, t, n = " ") {
276
311
  let r = e.length;
277
312
  if (t <= r || n === "") return e;
278
313
  let i = t - r, a = Math.floor(i / 2), o = i - a;
279
- return F(n, a) + e + F(n, o);
314
+ return /* @__PURE__ */ F(n, a) + e + /* @__PURE__ */ F(n, o);
280
315
  }
281
- function Se(e, t, n = " ") {
316
+ /* @__NO_SIDE_EFFECTS__ */
317
+ function De(e, t, n = " ") {
282
318
  let r = e.length;
283
- return t <= r || n === "" ? e : F(n, t - r) + e;
319
+ return t <= r || n === "" ? e : /* @__PURE__ */ F(n, t - r) + e;
284
320
  }
285
- function Ce(e, t, n = " ") {
321
+ /* @__NO_SIDE_EFFECTS__ */
322
+ function Oe(e, t, n = " ") {
286
323
  let r = e.length;
287
- return t <= r || n === "" ? e : e + F(n, t - r);
324
+ return t <= r || n === "" ? e : e + /* @__PURE__ */ F(n, t - r);
288
325
  }
326
+ /* @__NO_SIDE_EFFECTS__ */
289
327
  function F(e, t) {
290
328
  if (t <= 0 || e.length === 0) return "";
291
329
  let n = Math.ceil(t / e.length);
292
330
  return e.repeat(n).slice(0, t);
293
331
  }
294
- function we(e = 32, t = !0, r = !0, i = !0, a = !1) {
332
+ /* @__NO_SIDE_EFFECTS__ */
333
+ function ke(e = 32, t = !0, r = !0, i = !0, a = !1) {
295
334
  let o = [
296
335
  t ? /* @__PURE__ */ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("") : null,
297
336
  r ? [
@@ -308,20 +347,21 @@ function we(e = 32, t = !0, r = !0, i = !0, a = !1) {
308
347
  ] : null,
309
348
  i ? /* @__PURE__ */ "~!#$%^&*()-_.,<>?/\\{}[]|:;".split("") : null,
310
349
  a ? [" "] : null
311
- ].filter((e) => u(e));
350
+ ].filter((e) => d(e));
312
351
  if (o.length === 0) throw Error("At least one character pool must be enabled.");
313
- let s = o.flat(), c = I(o).slice(0, Math.max(0, e)).map((e) => e[n(0, e.length - 1)]), l = Array.from({ length: Math.max(0, e - c.length) }, () => s[n(0, s.length - 1)]);
352
+ let s = o.flat(), c = I(o).slice(0, Math.max(0, e)).map((e) => e[/* @__PURE__ */ n(0, e.length - 1)]), l = Array.from({ length: Math.max(0, e - c.length) }, () => s[/* @__PURE__ */ n(0, s.length - 1)]);
314
353
  return I([...c, ...l]).join("");
315
354
  }
316
355
  function I(e) {
317
356
  let t = [...e];
318
357
  for (let e = t.length - 1; e > 0; e--) {
319
- let r = n(0, e);
358
+ let r = /* @__PURE__ */ n(0, e);
320
359
  [t[e], t[r]] = [t[r], t[e]];
321
360
  }
322
361
  return t;
323
362
  }
324
- function Te(e, t, n = 0) {
363
+ /* @__NO_SIDE_EFFECTS__ */
364
+ function Ae(e, t, n = 0) {
325
365
  if (t === "") return !1;
326
366
  let r = Array.from(e), i = Array.from(t), a = n >= 0 ? n : r.length + n;
327
367
  if (a < 0 && (a = 0), a >= r.length) return !1;
@@ -336,30 +376,33 @@ function Te(e, t, n = 0) {
336
376
  }
337
377
  return !1;
338
378
  }
379
+ /* @__NO_SIDE_EFFECTS__ */
339
380
  function L(e = 16) {
340
- return (x ?? ((e) => r(e)))(e);
381
+ return (T ?? ((e) => /* @__PURE__ */ r(e)))(e);
341
382
  }
342
383
  function R(e) {
343
- x = e;
384
+ T = e;
344
385
  }
345
- function Ee(e, t) {
386
+ function je(e, t) {
346
387
  let n = 0, r = t ?? function(e) {
347
- let t = x;
348
- x = null;
349
- let r = L(e);
350
- return x = t, n++, r;
388
+ let t = T;
389
+ T = null;
390
+ let r = /* @__PURE__ */ L(e);
391
+ return T = t, n++, r;
351
392
  };
352
393
  R((t) => n < e.length ? String(e[n++]) : r(t));
353
394
  }
354
395
  function z() {
355
- x = null;
396
+ T = null;
356
397
  }
357
- function De(e, t) {
398
+ /* @__NO_SIDE_EFFECTS__ */
399
+ function Me(e, t) {
358
400
  return t <= 0 ? "" : e.repeat(t);
359
401
  }
360
- function Oe(e, t, n) {
402
+ /* @__NO_SIDE_EFFECTS__ */
403
+ function Ne(e, t, n) {
361
404
  let r;
362
- r = typeof t == "object" && !u(t) ? Object.values(t) : u(t) ? [...t] : Array.from(t);
405
+ r = typeof t == "object" && !d(t) ? Object.values(t) : d(t) ? [...t] : Array.from(t);
363
406
  let i = n.split(e);
364
407
  if (i.length === 1) return n;
365
408
  let a = i[0];
@@ -369,7 +412,8 @@ function Oe(e, t, n) {
369
412
  }
370
413
  return String(a);
371
414
  }
372
- function ke(e, t) {
415
+ /* @__NO_SIDE_EFFECTS__ */
416
+ function Pe(e, t) {
373
417
  try {
374
418
  let t = String(e);
375
419
  if (t.length) return t;
@@ -378,42 +422,50 @@ function ke(e, t) {
378
422
  return t;
379
423
  }
380
424
  }
381
- function Ae(e, t, n, r = !0) {
382
- if (m(e) && !m(t)) throw TypeError("The replacement must be a string when the search term is a string.");
383
- let i = m(n) ? n : Array.from(n, (e) => V(e));
384
- if (!r) return B(e, t, i);
385
- let a = m(e) ? [e] : Array.from(e, (e) => V(e)), o = m(t) ? a.map(() => t) : Array.from(t, (e) => V(e)), s = (e) => a.reduce((e, t, n) => t === "" ? e : e.split(t).join(o[n] ?? ""), e);
386
- return m(i) ? s(i) : i.map(s);
387
- }
388
- function B(e, t, n) {
389
- let r = m(e) ? [e] : Array.from(e, (e) => V(e)), i = m(t) ? r.map(() => t) : Array.from(t, (e) => V(e)), a = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (e) => r.reduce((e, t, n) => {
390
- if (t === "") return e;
391
- let r = i[n] ?? "", o = new RegExp(a(t), D(t) ? "gi" : "giu");
392
- return e.replace(o, () => r);
393
- }, e);
394
- return m(n) ? o(n) : n.map(o);
395
- }
396
- function V(e) {
397
- return f(e) || h(e) ? "" : String(e);
398
- }
399
- function H(e, t, n) {
425
+ /* @__NO_SIDE_EFFECTS__ */
426
+ function B(e, t, n, r = !0) {
427
+ if (y(e) && !y(t)) throw TypeError("The replacement must be a string when the search term is a string.");
428
+ let i = y(e) ? [e] : Array.from(e, (e) => H(e)), a = y(t) ? i.map(() => t) : Array.from(t, (e) => H(e));
429
+ return V(n, (e) => r ? i.reduce((e, t, n) => t === "" ? e : e.split(t).join(a[n] ?? ""), e) : Fe(i, a, e));
430
+ }
431
+ function Fe(e, t, n) {
432
+ let r = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
433
+ return e.reduce((e, n, i) => {
434
+ if (n === "") return e;
435
+ let a = t[i] ?? "", o = new RegExp(r(n), /* @__PURE__ */ M(n) ? "gi" : "giu");
436
+ return e.replace(o, () => a);
437
+ }, n);
438
+ }
439
+ function V(e, t) {
440
+ let n = (e) => Object.fromEntries(Object.entries(e).map(([e, n]) => [e, t(H(n))]));
441
+ return y(e) ? t(e) : d(e) ? e.map((e) => t(H(e))) : m(e) ? new Map(Array.from(e, ([e, n]) => [e, t(H(n))])) : v(e) ? n(e) : _(e) && f(e.all) ? V(e.all(), t) : p(e) ? Array.from(e, (e) => t(H(e))) : u(e) ? t(String(e)) : _(e) ? n(e) : t(H(e));
442
+ }
443
+ function H(e) {
444
+ return h(e) || ee(e) ? "" : String(e);
445
+ }
446
+ /* @__NO_SIDE_EFFECTS__ */
447
+ function U(e, t, n) {
400
448
  if (e = String(e), e === "") return n;
401
449
  let r = n.indexOf(e);
402
450
  return r === -1 ? n : n.slice(0, r) + t + n.slice(r + e.length);
403
451
  }
404
- function U(e, t, n) {
405
- return e = String(e), e === "" ? n : q(n, e) ? H(e, t, n) : n;
452
+ /* @__NO_SIDE_EFFECTS__ */
453
+ function Ie(e, t, n) {
454
+ return e = String(e), e === "" ? n : /* @__PURE__ */ q(n, e) ? /* @__PURE__ */ U(e, t, n) : n;
406
455
  }
456
+ /* @__NO_SIDE_EFFECTS__ */
407
457
  function W(e, t, n) {
408
458
  if (e = String(e), e === "") return n;
409
459
  let r = n.lastIndexOf(e);
410
460
  return r === -1 ? n : n.slice(0, r) + t + n.slice(r + e.length);
411
461
  }
412
- function je(e, t, n) {
413
- return e = String(e), e === "" ? n : E(n, e) ? W(e, t, n) : n;
462
+ /* @__NO_SIDE_EFFECTS__ */
463
+ function Le(e, t, n) {
464
+ return e = String(e), e === "" ? n : /* @__PURE__ */ j(n, e) ? /* @__PURE__ */ W(e, t, n) : n;
414
465
  }
415
- function Me(e, t, n, r = -1) {
416
- let i = (e) => u(e) ? e : [e], a = i(e);
466
+ /* @__NO_SIDE_EFFECTS__ */
467
+ function Re(e, t, n, r = -1) {
468
+ let i = (e) => d(e) ? e : [e], a = i(e);
417
469
  function o(e) {
418
470
  try {
419
471
  if (e instanceof RegExp) {
@@ -448,7 +500,7 @@ function Me(e, t, n, r = -1) {
448
500
  if (!t) return null;
449
501
  s.push(t);
450
502
  }
451
- let c = d(t), l = c ? [] : i(t), f = (e) => {
503
+ let c = f(t), l = c ? [] : i(t), u = (e) => {
452
504
  let n = e;
453
505
  for (let e = 0; e < s.length; e++) {
454
506
  let i = s[e];
@@ -481,8 +533,9 @@ function Me(e, t, n, r = -1) {
481
533
  }
482
534
  return n;
483
535
  };
484
- return u(n) ? n.map(f) : f(n);
536
+ return d(n) ? n.map(u) : u(n);
485
537
  }
538
+ /* @__NO_SIDE_EFFECTS__ */
486
539
  function G(e) {
487
540
  let t = "", n = !1;
488
541
  for (let r = 0; r < e.length; r++) {
@@ -491,37 +544,36 @@ function G(e) {
491
544
  }
492
545
  return t;
493
546
  }
494
- function Ne(e, t, n = !0) {
495
- let r = m(t) ? t : Array.from(t, (e) => V(e));
496
- if (!n) return B(e, "", r);
497
- let i = m(e) ? [e] : Array.from(e, (e) => V(e)), a = (e) => {
498
- let t = e;
499
- for (let e of i) e !== "" && (t = t.split(e).join(""));
500
- return t;
501
- };
502
- return m(r) ? a(r) : r.map(a);
547
+ /* @__NO_SIDE_EFFECTS__ */
548
+ function ze(e, t, n = !0) {
549
+ return /* @__PURE__ */ B(e, "", t, n);
503
550
  }
504
- function Pe(e) {
551
+ /* @__NO_SIDE_EFFECTS__ */
552
+ function Be(e) {
505
553
  return Array.from(e).reverse().join("");
506
554
  }
507
- function Fe(e, t) {
508
- let n = g(e), r = g(t);
555
+ /* @__NO_SIDE_EFFECTS__ */
556
+ function Ve(e, t) {
557
+ let n = b(e), r = b(t);
509
558
  if (r === "") return n;
510
559
  let i = 0;
511
560
  for (; n.startsWith(r, i);) i += r.length;
512
561
  return `${r}${n.slice(i)}`;
513
562
  }
514
- function Ie(t) {
563
+ /* @__NO_SIDE_EFFECTS__ */
564
+ function He(t) {
515
565
  let n = String(t).trim();
516
566
  if (n === "") return "";
517
567
  let r = n.split(/\s+/u);
518
- return r = r.length > 1 ? r.map((t) => e(t)) : X(r.join("_")).map((t) => e(t)), r.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((e) => e.length > 0).join(" ");
568
+ return r = r.length > 1 ? r.map((t) => /* @__PURE__ */ e(t)) : (/* @__PURE__ */ X(r.join("_"))).map((t) => /* @__PURE__ */ e(t)), r.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((e) => e.length > 0).join(" ");
519
569
  }
520
- function Le(e, n = !1) {
570
+ /* @__NO_SIDE_EFFECTS__ */
571
+ function Ue(e, n = !1) {
521
572
  let r = e.split(/\s+/u).filter((e) => e.length > 0).map((e) => [...e][0]).join("");
522
- return n ? t(r) : r;
573
+ return n ? /* @__PURE__ */ t(r) : r;
523
574
  }
524
- function Re(e) {
575
+ /* @__NO_SIDE_EFFECTS__ */
576
+ function We(e) {
525
577
  if (e.trim() === "") return e;
526
578
  let t = /* @__PURE__ */ new Set(/* @__PURE__ */ "and.as.but.for.if.nor.or.so.yet.a.an.the.at.by.for.in.of.off.on.per.to.up.via.et.ou.un.une.la.le.les.de.du.des.par.à".split(".")), n = /* @__PURE__ */ new Set([
527
579
  ".",
@@ -547,19 +599,22 @@ function Re(e) {
547
599
  }
548
600
  return r.join(" ");
549
601
  }
602
+ /* @__NO_SIDE_EFFECTS__ */
550
603
  function K(e, t = "_") {
551
604
  let n = `${e}|${t}`;
552
- if (v.has(n)) return v.get(n);
605
+ if (S.has(n)) return S.get(n);
553
606
  let r = e;
554
- return /^[a-z]+$/.test(e) || (r = Z(e).replace(/\s+/gu, ""), r = r.replace(/(.)(?=[A-Z])/g, `$1${t}`), r = k(r)), v.set(n, r), r;
607
+ return /^[a-z]+$/.test(e) || (r = (/* @__PURE__ */ Z(e)).replace(/\s+/gu, ""), r = r.replace(/(.)(?=[A-Z])/g, `$1${t}`), r = /* @__PURE__ */ P(r)), S.set(n, r), r;
555
608
  }
556
- function ze(e) {
557
- return s(e).replace(/[\s\u3164\u1160]+/gu, " ");
609
+ /* @__NO_SIDE_EFFECTS__ */
610
+ function Ge(e) {
611
+ return (/* @__PURE__ */ s(e)).replace(/[\s\u3164\u1160]+/gu, " ");
558
612
  }
613
+ /* @__NO_SIDE_EFFECTS__ */
559
614
  function q(e, t) {
560
615
  if (e == null || t == null) return !1;
561
616
  let n;
562
- n = m(t) || p(t) ? [t] : Symbol.iterator in Object(t) ? Array.from(t) : [t];
617
+ n = y(t) || g(t) ? [t] : Symbol.iterator in Object(t) ? Array.from(t) : [t];
563
618
  let r = String(e);
564
619
  for (let e of n) {
565
620
  if (e == null) continue;
@@ -568,25 +623,29 @@ function q(e, t) {
568
623
  }
569
624
  return !1;
570
625
  }
571
- function Be(e, t) {
572
- return !q(e, t);
626
+ /* @__NO_SIDE_EFFECTS__ */
627
+ function Ke(e, t) {
628
+ return !/* @__PURE__ */ q(e, t);
573
629
  }
630
+ /* @__NO_SIDE_EFFECTS__ */
574
631
  function J(e, t = !1) {
575
632
  let n = e;
576
633
  t && (n = e.replace(/(^|[-_ \s])([A-Z]+)(?=[-_ \s]|$)/gu, (e, t, n) => t + n.toLowerCase()));
577
634
  let r = n;
578
- if (b.has(r)) return b.get(r);
635
+ if (w.has(r)) return w.get(r);
579
636
  let i = String(n).replace(/[-_]+/g, " "), a = (i.trim() === "" ? [] : i.split(/\s+/u)).map((e) => {
580
637
  if (!e) return e;
581
638
  let t = Array.from(e);
582
639
  return t[0].toUpperCase() + t.slice(1).join("");
583
640
  }).join("");
584
- return b.set(r, a), a;
641
+ return w.set(r, a), a;
585
642
  }
586
- function Ve(e, t = !1) {
587
- return J(e, t);
643
+ /* @__NO_SIDE_EFFECTS__ */
644
+ function qe(e, t = !1) {
645
+ return /* @__PURE__ */ J(e, t);
588
646
  }
589
- function He(e, t) {
647
+ /* @__NO_SIDE_EFFECTS__ */
648
+ function Je(e, t) {
590
649
  if (!e || Object.keys(e).length === 0) return t;
591
650
  let n = Object.keys(e).filter((e) => e !== "");
592
651
  if (n.length === 0) return t;
@@ -594,23 +653,29 @@ function He(e, t) {
594
653
  let r = new RegExp(n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "gu");
595
654
  return t.replace(r, (t) => e[t]);
596
655
  }
597
- function Ue(e, t) {
598
- return t < 0 ? i(e, t) : i(e, 0, t);
656
+ /* @__NO_SIDE_EFFECTS__ */
657
+ function Ye(e, t) {
658
+ return t < 0 ? /* @__PURE__ */ i(e, t) : /* @__PURE__ */ i(e, 0, t);
599
659
  }
660
+ /* @__NO_SIDE_EFFECTS__ */
600
661
  function Y(e) {
601
- return k(i(e, 0, 1)) + i(e, 1);
662
+ return /* @__PURE__ */ P(/* @__PURE__ */ i(e, 0, 1)) + /* @__PURE__ */ i(e, 1);
602
663
  }
603
- function We(e) {
604
- return t(i(e, 0, 1)) + i(e, 1);
664
+ /* @__NO_SIDE_EFFECTS__ */
665
+ function Xe(e) {
666
+ return /* @__PURE__ */ t(/* @__PURE__ */ i(e, 0, 1)) + /* @__PURE__ */ i(e, 1);
605
667
  }
668
+ /* @__NO_SIDE_EFFECTS__ */
606
669
  function X(e) {
607
670
  return e.split(/(?=\p{Lu})/u).filter(Boolean);
608
671
  }
672
+ /* @__NO_SIDE_EFFECTS__ */
609
673
  function Z(e, t = " \r\n\f\v") {
610
- let n = u(t) ? t.join("") : t, r = n.length ? ((e) => e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"))(n) : "", i = r.length ? `(?:\\s|[${r}])` : "\\s", a = RegExp(`(^|${i})(\\p{Ll})`, "gu");
674
+ let n = d(t) ? t.join("") : t, r = n.length ? ((e) => e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"))(n) : "", i = r.length ? `(?:\\s|[${r}])` : "\\s", a = RegExp(`(^|${i})(\\p{Ll})`, "gu");
611
675
  return e.replace(a, (e, t, n) => t + n.toUpperCase());
612
676
  }
613
- function Ge(e, t = null) {
677
+ /* @__NO_SIDE_EFFECTS__ */
678
+ function Ze(e, t = null) {
614
679
  let n = t && t.length > 0 ? t.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu, i = e.match(r);
615
680
  return i ? i.length : 0;
616
681
  }
@@ -622,12 +687,13 @@ function $(e, t, n) {
622
687
  for (; r < n && Q(e[r]);) r++;
623
688
  return r;
624
689
  }
625
- function Ke(e, t, n) {
690
+ function Qe(e, t, n) {
626
691
  let r = n;
627
692
  for (; r > t && Q(e[r - 1]);) r--;
628
693
  return r;
629
694
  }
630
- function qe(e, t = 75, n = "\n", r = !1) {
695
+ /* @__NO_SIDE_EFFECTS__ */
696
+ function $e(e, t = 75, n = "\n", r = !1) {
631
697
  if (e.length === 0 || t < 1 || n === "") return e;
632
698
  let i = e.split(/\r\n|\n|\r/), a = [];
633
699
  for (let e of i) {
@@ -642,7 +708,7 @@ function qe(e, t = 75, n = "\n", r = !1) {
642
708
  a.push(n.slice(o, i).join(""));
643
709
  break;
644
710
  }
645
- let e = Ke(n, o, o + t);
711
+ let e = Qe(n, o, o + t);
646
712
  a.push(n.slice(o, e).join("")), o += t;
647
713
  }
648
714
  else {
@@ -674,19 +740,22 @@ function qe(e, t = 75, n = "\n", r = !1) {
674
740
  }
675
741
  return a.join(n);
676
742
  }
677
- function Je() {
678
- return v.size;
743
+ /* @__NO_SIDE_EFFECTS__ */
744
+ function et() {
745
+ return S.size;
679
746
  }
680
- function Ye() {
681
- return y.size;
747
+ /* @__NO_SIDE_EFFECTS__ */
748
+ function tt() {
749
+ return C.size;
682
750
  }
683
- function Xe() {
684
- return b.size;
751
+ /* @__NO_SIDE_EFFECTS__ */
752
+ function nt() {
753
+ return w.size;
685
754
  }
686
- function Ze() {
687
- v.clear(), y.clear(), b.clear();
755
+ function rt() {
756
+ S.clear(), C.clear(), w.clear();
688
757
  }
689
- function Qe() {
758
+ function it() {
690
759
  z(), c(), l();
691
760
  }
692
- export { S as after, ee as afterLast, Re as apa, C as before, w as beforeLast, te as between, ne as betweenFirst, re as camel, Ye as camelCacheSize, ie as charAt, oe as chopEnd, ae as chopStart, T as contains, ce as containsAll, z as createRandomStringsNormally, R as createRandomStringsUsing, Ee as createRandomStringsUsingSequence, ue as deduplicate, le as doesntContain, de as doesntEndWith, Be as doesntStartWith, E as endsWith, se as excerpt, fe as finish, Ze as flushCache, Ie as headline, Le as initials, he as is, D as isAscii, ge as isJson, N as isMatch, _e as isUrl, ve as kebab, Y as lcfirst, O as length, ye as limit, k as lower, F as makePad, j as mask, M as match, P as matchAll, be as numbers, xe as padBoth, Se as padLeft, Ce as padRight, Ve as pascal, we as password, Te as position, L as random, Ne as remove, De as repeat, Ae as replace, Oe as replaceArray, je as replaceEnd, H as replaceFirst, W as replaceLast, Me as replaceMatches, U as replaceStart, Qe as resetFactoryState, Pe as reverse, K as snake, Je as snakeCacheSize, ze as squish, Fe as start, q as startsWith, G as stripTags, J as studly, Xe as studlyCacheSize, He as swap, Ue as take, ke as toStringOr, We as ucfirst, X as ucsplit, Z as ucwords, me as unwrap, Ge as wordCount, qe as wordWrap, A as words, pe as wrap };
761
+ export { E as after, te as afterLast, We as apa, D as before, O as beforeLast, ne as between, re as betweenFirst, k as camel, tt as camelCacheSize, ie as charAt, oe as chopEnd, ae as chopStart, A as contains, ce as containsAll, z as createRandomStringsNormally, R as createRandomStringsUsing, je as createRandomStringsUsingSequence, ue as deduplicate, le as doesntContain, de as doesntEndWith, Ke as doesntStartWith, j as endsWith, se as excerpt, fe as finish, rt as flushCache, He as headline, Ue as initials, he as is, M as isAscii, ge as isJson, Ce as isMatch, _e as isUrl, ve as kebab, Y as lcfirst, N as length, ye as limit, P as lower, F as makePad, xe as mask, Se as match, we as matchAll, Te as numbers, Ee as padBoth, De as padLeft, Oe as padRight, qe as pascal, ke as password, Ae as position, L as random, ze as remove, Me as repeat, B as replace, Ne as replaceArray, Le as replaceEnd, U as replaceFirst, W as replaceLast, Re as replaceMatches, Ie as replaceStart, it as resetFactoryState, Be as reverse, K as snake, et as snakeCacheSize, Ge as squish, Ve as start, q as startsWith, G as stripTags, J as studly, nt as studlyCacheSize, Je as swap, Ye as take, Pe as toStringOr, Xe as ucfirst, X as ucsplit, Z as ucwords, me as unwrap, Ze as wordCount, $e as wordWrap, be as words, pe as wrap };