@tolki/str 1.0.2 → 1.0.3
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/ascii/index.d.ts.map +1 -1
- package/dist/ascii/index.js +23 -28
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/markdown/index.js +12 -11
- package/dist/replacer/index.d.ts +2 -0
- package/dist/replacer/index.d.ts.map +1 -1
- package/dist/replacer/index.js +31 -27
- package/dist/str.d.ts +4 -0
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +259 -263
- package/dist/stringable/index.d.ts +1 -1
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +109 -118
- package/dist/ulid/index.d.ts +1 -1
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/ulid/index.js +8 -8
- package/dist/uuid/index.d.ts +1 -1
- package/dist/uuid/index.d.ts.map +1 -1
- package/dist/uuid/index.js +6 -6
- package/package.json +3 -3
package/dist/str.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { substr as x, ltrim as
|
|
2
|
-
import { isArray as S, toLower as
|
|
3
|
-
const
|
|
4
|
-
let
|
|
1
|
+
import { substr as x, ltrim as I, rtrim as q, randomInt as O, title as G, trim as K, upper as Z, randomString as D } from "@tolki/str";
|
|
2
|
+
import { isArray as S, toLower as W, isString as _, isFunction as Q, isNumber as V } from "@tolki/utils";
|
|
3
|
+
const E = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
4
|
+
let R = null;
|
|
5
5
|
function T(t, e) {
|
|
6
6
|
if (e === "")
|
|
7
7
|
return t;
|
|
@@ -33,10 +33,10 @@ function pt(t, e, n) {
|
|
|
33
33
|
return e === "" || n === "" ? t : X(T(t, e), n);
|
|
34
34
|
}
|
|
35
35
|
function gt(t) {
|
|
36
|
-
if (
|
|
37
|
-
return
|
|
36
|
+
if (C.has(t))
|
|
37
|
+
return C.get(t);
|
|
38
38
|
const e = st(H(t));
|
|
39
|
-
return
|
|
39
|
+
return C.set(t, e), e;
|
|
40
40
|
}
|
|
41
41
|
function mt(t, e) {
|
|
42
42
|
const n = t.length;
|
|
@@ -45,16 +45,16 @@ function mt(t, e) {
|
|
|
45
45
|
function ht(t, e) {
|
|
46
46
|
for (const n of S(e) ? e : [e])
|
|
47
47
|
if (n !== "" && t.startsWith(n)) {
|
|
48
|
-
const r = [...t],
|
|
49
|
-
return r.slice(
|
|
48
|
+
const r = [...t], s = [...n];
|
|
49
|
+
return r.slice(s.length).join("");
|
|
50
50
|
}
|
|
51
51
|
return t;
|
|
52
52
|
}
|
|
53
53
|
function dt(t, e) {
|
|
54
54
|
for (const n of S(e) ? e : [e])
|
|
55
55
|
if (n !== "" && t.endsWith(n)) {
|
|
56
|
-
const r = [...t],
|
|
57
|
-
return r.slice(0, -
|
|
56
|
+
const r = [...t], s = [...n];
|
|
57
|
+
return r.slice(0, -s.length).join("");
|
|
58
58
|
}
|
|
59
59
|
return t;
|
|
60
60
|
}
|
|
@@ -62,23 +62,21 @@ function B(t, e, n = !1) {
|
|
|
62
62
|
n && (t = t.toLowerCase());
|
|
63
63
|
let r;
|
|
64
64
|
typeof e == "string" ? r = [e] : r = Array.from(e);
|
|
65
|
-
for (let
|
|
66
|
-
if (n && (
|
|
65
|
+
for (let s of r)
|
|
66
|
+
if (n && (s = s.toLowerCase()), s !== "" && t.includes(s))
|
|
67
67
|
return !0;
|
|
68
68
|
return !1;
|
|
69
69
|
}
|
|
70
70
|
function yt(t, e = "", n = {}) {
|
|
71
|
-
const { radius: r = 100, omission:
|
|
71
|
+
const { radius: r = 100, omission: s = "..." } = n, o = String(t ?? ""), c = e ?? "", i = ($) => $.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), l = new RegExp(`^(.*?)(${i(c)})(.*)$`, "iu").exec(o);
|
|
72
72
|
if (!l)
|
|
73
73
|
return null;
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
const d = l[2] ?? "";
|
|
81
|
-
return a + d + w;
|
|
74
|
+
const m = String(l[1]), a = String(l[2]), p = String(l[3]), u = I(m), g = Array.from(u).length, y = x(u, Math.max(g - r, 0), r);
|
|
75
|
+
let w = I(y);
|
|
76
|
+
w !== u && (w = s + w);
|
|
77
|
+
const h = q(p), d = x(h, 0, r);
|
|
78
|
+
let k = q(d);
|
|
79
|
+
return k !== h && (k = k + s), w + a + k;
|
|
82
80
|
}
|
|
83
81
|
function wt(t, e, n = !1) {
|
|
84
82
|
for (const r of e)
|
|
@@ -94,7 +92,7 @@ function St(t, e = " ") {
|
|
|
94
92
|
t = t.replace(new RegExp(`${n}+`, "g"), n);
|
|
95
93
|
}), t) : t.replace(new RegExp(`${e}+`, "g"), e);
|
|
96
94
|
}
|
|
97
|
-
function
|
|
95
|
+
function M(t, e) {
|
|
98
96
|
if (t === null)
|
|
99
97
|
return !1;
|
|
100
98
|
t = String(t), S(e) ? e = Array.from(e) : e = [String(e)];
|
|
@@ -104,7 +102,7 @@ function W(t, e) {
|
|
|
104
102
|
return !1;
|
|
105
103
|
}
|
|
106
104
|
function $t(t, e) {
|
|
107
|
-
return !
|
|
105
|
+
return !M(t, e);
|
|
108
106
|
}
|
|
109
107
|
function kt(t, e) {
|
|
110
108
|
const n = e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -114,18 +112,18 @@ function At(t, e, n = null) {
|
|
|
114
112
|
return e + t + (n ?? e);
|
|
115
113
|
}
|
|
116
114
|
function bt(t, e, n = null) {
|
|
117
|
-
return
|
|
115
|
+
return P(t, e) && (t = x(t, N(e))), M(t, n ??= e) && (t = x(t, 0, -N(n))), t;
|
|
118
116
|
}
|
|
119
117
|
function Lt(t, e, n = !1) {
|
|
120
118
|
e = String(e);
|
|
121
119
|
let r;
|
|
122
120
|
typeof t == "string" ? r = [t] : r = Array.from(t);
|
|
123
|
-
for (let
|
|
124
|
-
if (
|
|
121
|
+
for (let s of r) {
|
|
122
|
+
if (s = String(s), s === e || n && W(s) === W(e))
|
|
125
123
|
return !0;
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
if (new RegExp(`^${
|
|
124
|
+
s = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = s.replace(/\\\*/g, ".*");
|
|
125
|
+
const o = n ? "iu" : "u";
|
|
126
|
+
if (new RegExp(`^${s}$`, o).test(e))
|
|
129
127
|
return !0;
|
|
130
128
|
}
|
|
131
129
|
return !1;
|
|
@@ -149,14 +147,14 @@ function Et(t) {
|
|
|
149
147
|
function Ct(t, e = []) {
|
|
150
148
|
if (!_(t))
|
|
151
149
|
return !1;
|
|
152
|
-
const r = (e.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" : e.join("|")).split("|").map((
|
|
150
|
+
const r = (e.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" : e.join("|")).split("|").map((o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
153
151
|
try {
|
|
154
152
|
const c = new URL(t).protocol.replace(":", "");
|
|
155
153
|
if (r.split("|").includes(c))
|
|
156
154
|
return !0;
|
|
157
155
|
} catch {
|
|
158
156
|
}
|
|
159
|
-
const
|
|
157
|
+
const s = [
|
|
160
158
|
"^(",
|
|
161
159
|
r,
|
|
162
160
|
"):\\/\\/",
|
|
@@ -175,7 +173,7 @@ function Ct(t, e = []) {
|
|
|
175
173
|
"$"
|
|
176
174
|
].join("");
|
|
177
175
|
try {
|
|
178
|
-
return new RegExp(
|
|
176
|
+
return new RegExp(s, "iu").test(t);
|
|
179
177
|
} catch {
|
|
180
178
|
return !1;
|
|
181
179
|
}
|
|
@@ -183,77 +181,77 @@ function Ct(t, e = []) {
|
|
|
183
181
|
function Ft(t) {
|
|
184
182
|
return rt(t, "-");
|
|
185
183
|
}
|
|
186
|
-
function
|
|
184
|
+
function N(t) {
|
|
187
185
|
return t.length;
|
|
188
186
|
}
|
|
189
|
-
function
|
|
187
|
+
function Nt(t, e = 100, n = "...", r = !1) {
|
|
190
188
|
if (t.length <= e)
|
|
191
189
|
return t;
|
|
192
190
|
if (!r)
|
|
193
191
|
return t.slice(0, e).replace(/\s+$/, "") + n;
|
|
194
192
|
t = nt(t).replace(/[\n\r]+/g, " ").trim();
|
|
195
|
-
const
|
|
196
|
-
return t.substring(e, e + 1) === " " ?
|
|
193
|
+
const s = t.slice(0, e).replace(/\s+$/, "");
|
|
194
|
+
return t.substring(e, e + 1) === " " ? s + n : s.replace(/(.*)\s.*/, "$1") + n;
|
|
197
195
|
}
|
|
198
196
|
function J(t) {
|
|
199
|
-
return
|
|
197
|
+
return W(t);
|
|
200
198
|
}
|
|
201
|
-
function
|
|
199
|
+
function zt(t, e = 100, n = "...") {
|
|
202
200
|
if (e <= 0)
|
|
203
201
|
return t;
|
|
204
|
-
const r = e,
|
|
205
|
-
return !
|
|
202
|
+
const r = e, s = new RegExp(`^\\s*(?:\\S+\\s*){1,${r}}`, "u"), o = t.match(s);
|
|
203
|
+
return !o || N(t) === N(o[0]) ? t : o[0].replace(/\s+$/, "") + n;
|
|
206
204
|
}
|
|
207
|
-
function
|
|
205
|
+
function _t(t, e, n, r = null) {
|
|
208
206
|
if (e === "")
|
|
209
207
|
return t;
|
|
210
|
-
const
|
|
211
|
-
let
|
|
212
|
-
n < 0 && (
|
|
208
|
+
const s = t.length;
|
|
209
|
+
let o = n;
|
|
210
|
+
n < 0 && (o = n < -s ? 0 : s + n);
|
|
213
211
|
const c = t.slice(
|
|
214
|
-
|
|
215
|
-
r !== null ?
|
|
212
|
+
o,
|
|
213
|
+
r !== null ? o + r : void 0
|
|
216
214
|
);
|
|
217
215
|
if (c === "")
|
|
218
216
|
return t;
|
|
219
|
-
const i = t.slice(0,
|
|
217
|
+
const i = t.slice(0, o), f = c.length, l = t.slice(o + f);
|
|
220
218
|
return i + e.slice(0, 1).repeat(f) + l;
|
|
221
219
|
}
|
|
222
220
|
function Ot(t, e) {
|
|
223
221
|
let n = "u", r = t;
|
|
224
222
|
if (t.length >= 2 && t[0] === "/") {
|
|
225
|
-
let
|
|
226
|
-
for (let
|
|
227
|
-
if (t[
|
|
223
|
+
let s = -1;
|
|
224
|
+
for (let o = t.length - 1; o > 0; o--)
|
|
225
|
+
if (t[o] === "/") {
|
|
228
226
|
let c = 0;
|
|
229
|
-
for (let i =
|
|
227
|
+
for (let i = o - 1; i >= 0 && t[i] === "\\"; i--)
|
|
230
228
|
c++;
|
|
231
229
|
if (c % 2 === 0) {
|
|
232
|
-
|
|
230
|
+
s = o;
|
|
233
231
|
break;
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
|
-
if (
|
|
237
|
-
r = t.slice(1,
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
for (const c of
|
|
234
|
+
if (s > 0) {
|
|
235
|
+
r = t.slice(1, s);
|
|
236
|
+
const o = t.slice(s + 1);
|
|
237
|
+
if (o)
|
|
238
|
+
for (const c of o)
|
|
241
239
|
/[imsuy]/.test(c) && !n.includes(c) && (n += c);
|
|
242
240
|
}
|
|
243
241
|
}
|
|
244
242
|
try {
|
|
245
|
-
const
|
|
246
|
-
return
|
|
243
|
+
const o = new RegExp(r, n).exec(e);
|
|
244
|
+
return o ? o[1] !== void 0 ? o[1] : o[0] : "";
|
|
247
245
|
} catch {
|
|
248
246
|
return "";
|
|
249
247
|
}
|
|
250
248
|
}
|
|
251
|
-
function
|
|
249
|
+
function Wt(t, e) {
|
|
252
250
|
e = String(e);
|
|
253
251
|
const n = typeof t == "string" ? [t] : Array.from(t);
|
|
254
252
|
for (const r of n) {
|
|
255
253
|
if (typeof r != "string" || r === "") continue;
|
|
256
|
-
let
|
|
254
|
+
let s = "u", o = r;
|
|
257
255
|
if (r.length >= 2 && r[0] === "/") {
|
|
258
256
|
let c = -1;
|
|
259
257
|
for (let i = r.length - 1; i > 0; i--)
|
|
@@ -267,85 +265,86 @@ function Nt(t, e) {
|
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
267
|
if (c > 0) {
|
|
270
|
-
|
|
268
|
+
o = r.slice(1, c);
|
|
271
269
|
const i = r.slice(c + 1);
|
|
272
270
|
if (i)
|
|
273
271
|
for (const f of i)
|
|
274
|
-
/[imsuy]/.test(f) && !
|
|
272
|
+
/[imsuy]/.test(f) && !s.includes(f) && (s += f);
|
|
275
273
|
}
|
|
276
274
|
}
|
|
277
275
|
try {
|
|
278
|
-
if (new RegExp(
|
|
276
|
+
if (new RegExp(o, s).test(e))
|
|
279
277
|
return !0;
|
|
280
278
|
} catch {
|
|
281
279
|
}
|
|
282
280
|
}
|
|
283
281
|
return !1;
|
|
284
282
|
}
|
|
285
|
-
function
|
|
283
|
+
function Mt(t, e) {
|
|
286
284
|
let n = "u", r = t;
|
|
287
285
|
if (t.length >= 2 && t[0] === "/") {
|
|
288
|
-
let
|
|
286
|
+
let o = -1;
|
|
289
287
|
for (let c = t.length - 1; c > 0; c--)
|
|
290
288
|
if (t[c] === "/") {
|
|
291
289
|
let i = 0;
|
|
292
290
|
for (let f = c - 1; f >= 0 && t[f] === "\\"; f--)
|
|
293
291
|
i++;
|
|
294
292
|
if (i % 2 === 0) {
|
|
295
|
-
|
|
293
|
+
o = c;
|
|
296
294
|
break;
|
|
297
295
|
}
|
|
298
296
|
}
|
|
299
|
-
if (
|
|
300
|
-
r = t.slice(1,
|
|
301
|
-
const c = t.slice(
|
|
297
|
+
if (o > 0) {
|
|
298
|
+
r = t.slice(1, o);
|
|
299
|
+
const c = t.slice(o + 1);
|
|
302
300
|
if (c)
|
|
303
301
|
for (const i of c)
|
|
304
|
-
/[
|
|
302
|
+
/[gimsuy]/.test(i) && !n.includes(i) && (n += i);
|
|
305
303
|
}
|
|
306
304
|
}
|
|
307
305
|
n.includes("g") || (n += "g");
|
|
308
|
-
let
|
|
306
|
+
let s = [];
|
|
309
307
|
try {
|
|
310
|
-
const
|
|
308
|
+
const o = new RegExp(r, n);
|
|
311
309
|
let c;
|
|
312
|
-
for (; (c =
|
|
313
|
-
|
|
310
|
+
for (; (c = o.exec(e)) !== null; )
|
|
311
|
+
s.push(c[1] !== void 0 ? c[1] : c[0]), c[0] === "" && o.lastIndex++;
|
|
314
312
|
} catch {
|
|
315
|
-
|
|
313
|
+
s = [];
|
|
316
314
|
}
|
|
317
|
-
return
|
|
315
|
+
return s;
|
|
318
316
|
}
|
|
319
|
-
function
|
|
317
|
+
function Pt(t) {
|
|
320
318
|
return S(t) ? t.map((e) => e.replace(/[^0-9]/g, "")) : t.replace(/[^0-9]/g, "");
|
|
321
319
|
}
|
|
322
|
-
function
|
|
320
|
+
function Ut(t, e, n = " ") {
|
|
323
321
|
const r = t.length;
|
|
324
322
|
if (e <= r || n === "")
|
|
325
323
|
return t;
|
|
326
|
-
const
|
|
327
|
-
return z(n,
|
|
324
|
+
const s = e - r, o = Math.floor(s / 2), c = s - o;
|
|
325
|
+
return z(n, o) + t + z(n, c);
|
|
328
326
|
}
|
|
329
|
-
function
|
|
327
|
+
function It(t, e, n = " ") {
|
|
330
328
|
const r = t.length;
|
|
331
329
|
if (e <= r || n === "")
|
|
332
330
|
return t;
|
|
333
|
-
const
|
|
334
|
-
return z(n,
|
|
331
|
+
const o = e - r;
|
|
332
|
+
return z(n, o) + t;
|
|
335
333
|
}
|
|
336
|
-
function
|
|
334
|
+
function qt(t, e, n = " ") {
|
|
337
335
|
const r = t.length;
|
|
338
336
|
if (e <= r || n === "")
|
|
339
337
|
return t;
|
|
340
|
-
const
|
|
341
|
-
return t + z(n,
|
|
338
|
+
const o = e - r;
|
|
339
|
+
return t + z(n, o);
|
|
342
340
|
}
|
|
343
341
|
function z(t, e) {
|
|
344
|
-
if (e <= 0
|
|
342
|
+
if (e <= 0 || t.length === 0)
|
|
343
|
+
return "";
|
|
345
344
|
const n = Math.ceil(e / t.length);
|
|
346
345
|
return t.repeat(n).slice(0, e);
|
|
347
346
|
}
|
|
348
|
-
function
|
|
347
|
+
function Gt(t = 32, e = !0, n = !0, r = !0, s = !1) {
|
|
349
348
|
const l = [
|
|
350
349
|
e ? [
|
|
351
350
|
"a",
|
|
@@ -430,38 +429,38 @@ function Pt(t = 32, e = !0, n = !0, r = !0, o = !1) {
|
|
|
430
429
|
":",
|
|
431
430
|
";"
|
|
432
431
|
] : null,
|
|
433
|
-
|
|
434
|
-
].filter((
|
|
432
|
+
s ? [" "] : null
|
|
433
|
+
].filter((u) => S(u));
|
|
435
434
|
if (l.length === 0 || t <= 0)
|
|
436
435
|
return "";
|
|
437
|
-
const
|
|
438
|
-
for (const
|
|
439
|
-
const
|
|
440
|
-
|
|
436
|
+
const m = [];
|
|
437
|
+
for (const u of l) {
|
|
438
|
+
const g = O(0, u.length - 1);
|
|
439
|
+
m.push(u[g]);
|
|
441
440
|
}
|
|
442
|
-
const
|
|
443
|
-
for (let
|
|
444
|
-
const
|
|
445
|
-
|
|
441
|
+
const a = Math.max(0, t - m.length), p = l.flat();
|
|
442
|
+
for (let u = 0; u < a; u++) {
|
|
443
|
+
const g = O(0, p.length - 1);
|
|
444
|
+
m.push(p[g]);
|
|
446
445
|
}
|
|
447
|
-
for (let
|
|
448
|
-
const
|
|
449
|
-
|
|
446
|
+
for (let u = m.length - 1; u > 0; u--) {
|
|
447
|
+
const g = O(0, u), y = m[u];
|
|
448
|
+
m[u] = m[g], m[g] = y;
|
|
450
449
|
}
|
|
451
|
-
return
|
|
450
|
+
return m.join("");
|
|
452
451
|
}
|
|
453
452
|
function Tt(t, e, n = 0) {
|
|
454
453
|
if (e === "")
|
|
455
454
|
return !1;
|
|
456
|
-
const r = Array.from(t),
|
|
457
|
-
let
|
|
458
|
-
if (
|
|
455
|
+
const r = Array.from(t), s = Array.from(e);
|
|
456
|
+
let o = n >= 0 ? n : r.length + n;
|
|
457
|
+
if (o < 0 && (o = 0), o >= r.length)
|
|
459
458
|
return !1;
|
|
460
|
-
const c = r.length -
|
|
461
|
-
for (let i =
|
|
459
|
+
const c = r.length - s.length;
|
|
460
|
+
for (let i = o; i <= c; i++) {
|
|
462
461
|
let f = !0;
|
|
463
|
-
for (let l = 0; l <
|
|
464
|
-
if (r[i + l] !==
|
|
462
|
+
for (let l = 0; l < s.length; l++)
|
|
463
|
+
if (r[i + l] !== s[l]) {
|
|
465
464
|
f = !1;
|
|
466
465
|
break;
|
|
467
466
|
}
|
|
@@ -471,23 +470,23 @@ function Tt(t, e, n = 0) {
|
|
|
471
470
|
return !1;
|
|
472
471
|
}
|
|
473
472
|
function j(t = 16) {
|
|
474
|
-
return (
|
|
473
|
+
return (R ?? ((n) => D(n)))(t);
|
|
475
474
|
}
|
|
476
475
|
function v(t) {
|
|
477
|
-
|
|
476
|
+
R = t;
|
|
478
477
|
}
|
|
479
478
|
function Bt(t, e) {
|
|
480
479
|
let n = 0;
|
|
481
|
-
const r = e ?? function(
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
const c = j(
|
|
485
|
-
return
|
|
480
|
+
const r = e ?? function(s) {
|
|
481
|
+
const o = R;
|
|
482
|
+
R = null;
|
|
483
|
+
const c = j(s);
|
|
484
|
+
return R = o, n++, c;
|
|
486
485
|
};
|
|
487
|
-
v((
|
|
486
|
+
v((s) => n < t.length ? String(t[n++]) : r(s));
|
|
488
487
|
}
|
|
489
488
|
function Jt() {
|
|
490
|
-
|
|
489
|
+
R = null;
|
|
491
490
|
}
|
|
492
491
|
function Ht(t, e) {
|
|
493
492
|
return e <= 0 ? "" : t.repeat(e);
|
|
@@ -495,15 +494,15 @@ function Ht(t, e) {
|
|
|
495
494
|
function Kt(t, e, n) {
|
|
496
495
|
let r;
|
|
497
496
|
typeof e == "object" && !S(e) ? r = Object.values(e) : r = S(e) ? [...e] : Array.from(e);
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
497
|
+
const s = n.split(t);
|
|
498
|
+
if (s.length === 1)
|
|
500
499
|
return n;
|
|
501
|
-
let
|
|
502
|
-
for (let c = 1; c <
|
|
500
|
+
let o = s[0];
|
|
501
|
+
for (let c = 1; c < s.length; c++) {
|
|
503
502
|
const i = r.length ? r.shift() : t;
|
|
504
|
-
|
|
503
|
+
o += i + s[c];
|
|
505
504
|
}
|
|
506
|
-
return String(
|
|
505
|
+
return String(o);
|
|
507
506
|
}
|
|
508
507
|
function Zt(t, e) {
|
|
509
508
|
try {
|
|
@@ -516,13 +515,13 @@ function Zt(t, e) {
|
|
|
516
515
|
}
|
|
517
516
|
}
|
|
518
517
|
function Dt(t, e, n, r = !0) {
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
const
|
|
518
|
+
const s = (l) => typeof l == "string" ? [l] : Array.from(l), o = s(t), c = s(e), i = (l) => l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = (l) => o.reduce((m, a, p) => {
|
|
519
|
+
if (a === "") return m;
|
|
520
|
+
const u = c[p] ?? "";
|
|
522
521
|
if (!r)
|
|
523
|
-
return
|
|
524
|
-
const
|
|
525
|
-
return
|
|
522
|
+
return m.split(a).join(u);
|
|
523
|
+
const g = new RegExp(i(a), "gi");
|
|
524
|
+
return m.replace(g, () => u);
|
|
526
525
|
}, l);
|
|
527
526
|
return _(n) ? f(n) : Array.from(n).map(f);
|
|
528
527
|
}
|
|
@@ -533,7 +532,7 @@ function tt(t, e, n) {
|
|
|
533
532
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
534
533
|
}
|
|
535
534
|
function Qt(t, e, n) {
|
|
536
|
-
return t = String(t), t === "" ? n :
|
|
535
|
+
return t = String(t), t === "" ? n : P(n, t) ? tt(t, e, n) : n;
|
|
537
536
|
}
|
|
538
537
|
function et(t, e, n) {
|
|
539
538
|
if (t = String(t), t === "")
|
|
@@ -542,116 +541,115 @@ function et(t, e, n) {
|
|
|
542
541
|
return r !== -1 ? n.slice(0, r) + e + n.slice(r + t.length) : n;
|
|
543
542
|
}
|
|
544
543
|
function Vt(t, e, n) {
|
|
545
|
-
return t = String(t), t === "" ? n :
|
|
544
|
+
return t = String(t), t === "" ? n : M(n, t) ? et(t, e, n) : n;
|
|
546
545
|
}
|
|
547
546
|
function Xt(t, e, n, r = -1) {
|
|
548
|
-
const
|
|
549
|
-
function c(
|
|
547
|
+
const s = (a) => S(a) ? a : [a], o = s(t);
|
|
548
|
+
function c(a) {
|
|
550
549
|
try {
|
|
551
|
-
if (
|
|
552
|
-
let
|
|
553
|
-
return
|
|
550
|
+
if (a instanceof RegExp) {
|
|
551
|
+
let g = a.flags;
|
|
552
|
+
return g.includes("g") || (g += "g"), g.includes("u") || (g += "u"), new RegExp(a.source, g);
|
|
554
553
|
}
|
|
555
|
-
let
|
|
556
|
-
if (
|
|
557
|
-
let
|
|
558
|
-
for (let
|
|
559
|
-
if (
|
|
554
|
+
let p = a, u = "gu";
|
|
555
|
+
if (a.length >= 2 && a[0] === "/") {
|
|
556
|
+
let g = -1;
|
|
557
|
+
for (let y = a.length - 1; y > 0; y--)
|
|
558
|
+
if (a[y] === "/") {
|
|
560
559
|
let w = 0;
|
|
561
|
-
for (let
|
|
560
|
+
for (let h = y - 1; h >= 0 && a[h] === "\\"; h--)
|
|
562
561
|
w++;
|
|
563
562
|
if (w % 2 === 0) {
|
|
564
|
-
|
|
563
|
+
g = y;
|
|
565
564
|
break;
|
|
566
565
|
}
|
|
567
566
|
}
|
|
568
|
-
if (
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
if (
|
|
572
|
-
for (const w of
|
|
573
|
-
/[imsuy]/.test(w) && !
|
|
574
|
-
a.includes("g") || (a += "g"), a.includes("u") || (a += "u");
|
|
567
|
+
if (g > 1) {
|
|
568
|
+
p = a.slice(1, g);
|
|
569
|
+
const y = a.slice(g + 1);
|
|
570
|
+
if (y)
|
|
571
|
+
for (const w of y)
|
|
572
|
+
/[imsuy]/.test(w) && !u.includes(w) && (u += w);
|
|
575
573
|
}
|
|
576
574
|
}
|
|
577
575
|
return new RegExp(
|
|
578
|
-
|
|
579
|
-
Array.from(new Set(
|
|
576
|
+
p,
|
|
577
|
+
Array.from(new Set(u.split(""))).join("")
|
|
580
578
|
);
|
|
581
579
|
} catch {
|
|
582
580
|
return null;
|
|
583
581
|
}
|
|
584
582
|
}
|
|
585
583
|
const i = [];
|
|
586
|
-
for (const
|
|
587
|
-
const
|
|
588
|
-
if (!
|
|
589
|
-
i.push(
|
|
584
|
+
for (const a of o) {
|
|
585
|
+
const p = c(a);
|
|
586
|
+
if (!p) return null;
|
|
587
|
+
i.push(p);
|
|
590
588
|
}
|
|
591
|
-
const f = Q(e), l = f ? [] :
|
|
592
|
-
let
|
|
593
|
-
for (let
|
|
594
|
-
const
|
|
589
|
+
const f = Q(e), l = f ? [] : s(e), m = (a) => {
|
|
590
|
+
let p = a;
|
|
591
|
+
for (let u = 0; u < i.length; u++) {
|
|
592
|
+
const g = i[u];
|
|
595
593
|
if (f) {
|
|
596
|
-
let
|
|
594
|
+
let y = 0;
|
|
597
595
|
const w = e;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
(
|
|
601
|
-
if (r >= 0 &&
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
for (let
|
|
605
|
-
$.push(
|
|
606
|
-
const
|
|
607
|
-
return w(
|
|
596
|
+
p = p.replace(
|
|
597
|
+
g,
|
|
598
|
+
(h, ...d) => {
|
|
599
|
+
if (r >= 0 && y >= r) return h;
|
|
600
|
+
y++;
|
|
601
|
+
const b = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, $ = [];
|
|
602
|
+
for (let A = 0; A < b; A++)
|
|
603
|
+
$.push(d[A]);
|
|
604
|
+
const L = [h, ...$];
|
|
605
|
+
return w(L);
|
|
608
606
|
}
|
|
609
607
|
);
|
|
610
608
|
} else {
|
|
611
|
-
const
|
|
609
|
+
const y = l[u] ?? (l.length === 1 ? l[0] : "");
|
|
612
610
|
if (r < 0)
|
|
613
|
-
|
|
614
|
-
const
|
|
615
|
-
return
|
|
616
|
-
const
|
|
617
|
-
return (
|
|
611
|
+
p = p.replace(g, (w, ...h) => {
|
|
612
|
+
const k = h.length > 0 && h[h.length - 1] !== null && typeof h[h.length - 1] == "object" ? h.length - 3 : h.length - 2, b = h.slice(0, k).map(($) => String($));
|
|
613
|
+
return y.replace(/\$(\d{1,2})/g, ($, L) => {
|
|
614
|
+
const A = parseInt(L, 10);
|
|
615
|
+
return (b[A - 1] ?? "").toUpperCase();
|
|
618
616
|
});
|
|
619
617
|
});
|
|
620
618
|
else {
|
|
621
619
|
let w = 0;
|
|
622
|
-
|
|
623
|
-
if (w >= r) return
|
|
620
|
+
p = p.replace(g, (h, ...d) => {
|
|
621
|
+
if (w >= r) return h;
|
|
624
622
|
w++;
|
|
625
|
-
const
|
|
626
|
-
return
|
|
627
|
-
const
|
|
628
|
-
return ($[
|
|
623
|
+
const b = d.length > 0 && d[d.length - 1] !== null && typeof d[d.length - 1] == "object" ? d.length - 3 : d.length - 2, $ = d.slice(0, b).map((L) => String(L));
|
|
624
|
+
return y.replace(/\$(\d{1,2})/g, (L, A) => {
|
|
625
|
+
const U = parseInt(A, 10);
|
|
626
|
+
return ($[U - 1] ?? "").toUpperCase();
|
|
629
627
|
});
|
|
630
628
|
});
|
|
631
629
|
}
|
|
632
630
|
}
|
|
633
631
|
}
|
|
634
|
-
return
|
|
632
|
+
return p;
|
|
635
633
|
};
|
|
636
|
-
return S(n) ? n.map(
|
|
634
|
+
return S(n) ? n.map(m) : m(n);
|
|
637
635
|
}
|
|
638
636
|
function nt(t) {
|
|
639
637
|
return t.replace(/<\/?[^>]+(>|$)/g, "");
|
|
640
638
|
}
|
|
641
639
|
function Yt(t, e, n = !0) {
|
|
642
|
-
const r = typeof t == "string" ? [t] : Array.from(t),
|
|
640
|
+
const r = typeof t == "string" ? [t] : Array.from(t), s = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => {
|
|
643
641
|
let i = c;
|
|
644
642
|
for (const f of r)
|
|
645
643
|
if (f !== "")
|
|
646
644
|
if (n)
|
|
647
645
|
i = i.split(f).join("");
|
|
648
646
|
else {
|
|
649
|
-
const l = new RegExp(
|
|
647
|
+
const l = new RegExp(s(f), "gi");
|
|
650
648
|
i = i.replace(l, "");
|
|
651
649
|
}
|
|
652
650
|
return i;
|
|
653
651
|
};
|
|
654
|
-
return typeof e == "string" ?
|
|
652
|
+
return typeof e == "string" ? o(e) : Array.from(e, (c) => o(String(c)));
|
|
655
653
|
}
|
|
656
654
|
function jt(t) {
|
|
657
655
|
return Array.from(t).reverse().join("");
|
|
@@ -665,7 +663,7 @@ function te(t) {
|
|
|
665
663
|
if (e === "")
|
|
666
664
|
return "";
|
|
667
665
|
let n = e.split(/\s+/u);
|
|
668
|
-
return n.length > 1 ? n = n.map((
|
|
666
|
+
return n.length > 1 ? n = n.map((s) => G(s)) : n = ot(n.join("_")).map((s) => G(s)), n.join("_").replace(/[-_ ]+/gu, "_").split("_").filter((s) => s.length > 0).join(" ");
|
|
669
667
|
}
|
|
670
668
|
function ee(t) {
|
|
671
669
|
if (t.trim() === "")
|
|
@@ -706,63 +704,61 @@ function ee(t) {
|
|
|
706
704
|
"des",
|
|
707
705
|
"par",
|
|
708
706
|
"à"
|
|
709
|
-
]), n = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u),
|
|
710
|
-
if (!
|
|
711
|
-
const c = Array.from(
|
|
707
|
+
]), n = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u), s = (o) => {
|
|
708
|
+
if (!o) return o;
|
|
709
|
+
const c = Array.from(o), i = c[0].toLocaleUpperCase(), f = c.slice(1).join("");
|
|
712
710
|
return i + f;
|
|
713
711
|
};
|
|
714
|
-
for (let
|
|
715
|
-
const c = r[
|
|
712
|
+
for (let o = 0; o < r.length; o++) {
|
|
713
|
+
const c = r[o].toLocaleLowerCase();
|
|
716
714
|
if (c.includes("-")) {
|
|
717
|
-
const f = c.split("-").map((l) => e.has(l) && l.length <= 3 ? l :
|
|
718
|
-
r[
|
|
715
|
+
const f = c.split("-").map((l) => e.has(l) && l.length <= 3 ? l : s(l));
|
|
716
|
+
r[o] = f.join("-");
|
|
719
717
|
} else {
|
|
720
|
-
const i =
|
|
721
|
-
e.has(c) && c.length <= 3 && !l ? r[
|
|
718
|
+
const i = o > 0 ? r[o - 1] : "", f = i ? Array.from(i).slice(-1)[0] : void 0, l = o === 0 || f !== void 0 && n.has(f);
|
|
719
|
+
e.has(c) && c.length <= 3 && !l ? r[o] = c : r[o] = s(c);
|
|
722
720
|
}
|
|
723
721
|
}
|
|
724
722
|
return r.join(" ");
|
|
725
723
|
}
|
|
726
724
|
function rt(t, e = "_") {
|
|
727
725
|
const r = `${t}|${e}`;
|
|
728
|
-
if (
|
|
729
|
-
return
|
|
730
|
-
let
|
|
731
|
-
return /^[a-z]+$/.test(t) || (
|
|
726
|
+
if (E.has(r))
|
|
727
|
+
return E.get(r);
|
|
728
|
+
let s = t;
|
|
729
|
+
return /^[a-z]+$/.test(t) || (s = it(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = J(s)), E.set(r, s), s;
|
|
732
730
|
}
|
|
733
731
|
function ne(t) {
|
|
734
|
-
return
|
|
732
|
+
return K(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
735
733
|
}
|
|
736
|
-
function
|
|
734
|
+
function P(t, e) {
|
|
737
735
|
if (t == null || e == null)
|
|
738
736
|
return !1;
|
|
739
|
-
let n
|
|
740
|
-
|
|
741
|
-
];
|
|
742
|
-
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) && (n = Array.from(e));
|
|
737
|
+
let n;
|
|
738
|
+
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) ? n = Array.from(e) : n = [e];
|
|
743
739
|
const r = String(t);
|
|
744
|
-
for (const
|
|
745
|
-
if (
|
|
740
|
+
for (const s of n) {
|
|
741
|
+
if (s == null)
|
|
746
742
|
continue;
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
743
|
+
const o = String(s);
|
|
744
|
+
if (o !== "" && r.startsWith(o))
|
|
749
745
|
return !0;
|
|
750
746
|
}
|
|
751
747
|
return !1;
|
|
752
748
|
}
|
|
753
749
|
function re(t, e) {
|
|
754
|
-
return !
|
|
750
|
+
return !P(t, e);
|
|
755
751
|
}
|
|
756
752
|
function H(t) {
|
|
757
753
|
const e = t;
|
|
758
|
-
if (
|
|
759
|
-
return
|
|
760
|
-
const n = String(t).replace(/[-_]+/g, " "), r = n.trim() === "" ? [] : n.split(/\s+/u),
|
|
754
|
+
if (F.has(e))
|
|
755
|
+
return F.get(e);
|
|
756
|
+
const n = String(t).replace(/[-_]+/g, " "), r = n.trim() === "" ? [] : n.split(/\s+/u), s = (c) => {
|
|
761
757
|
if (!c) return c;
|
|
762
758
|
const i = Array.from(c), f = i[0].toUpperCase(), l = i.slice(1).join("");
|
|
763
759
|
return f + l;
|
|
764
|
-
},
|
|
765
|
-
return
|
|
760
|
+
}, o = r.map(s).join("");
|
|
761
|
+
return F.set(e, o), o;
|
|
766
762
|
}
|
|
767
763
|
function se(t) {
|
|
768
764
|
return H(t);
|
|
@@ -770,12 +766,12 @@ function se(t) {
|
|
|
770
766
|
function oe(t, e) {
|
|
771
767
|
if (!t || Object.keys(t).length === 0)
|
|
772
768
|
return e;
|
|
773
|
-
const n = Object.keys(t).filter((
|
|
769
|
+
const n = Object.keys(t).filter((o) => o !== "");
|
|
774
770
|
if (n.length === 0)
|
|
775
771
|
return e;
|
|
776
|
-
n.sort((
|
|
777
|
-
const r = (
|
|
778
|
-
return e.replace(
|
|
772
|
+
n.sort((o, c) => c.length - o.length);
|
|
773
|
+
const r = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(n.map(r).join("|"), "gu");
|
|
774
|
+
return e.replace(s, (o) => t[o]);
|
|
779
775
|
}
|
|
780
776
|
function ie(t, e) {
|
|
781
777
|
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
@@ -784,39 +780,39 @@ function st(t) {
|
|
|
784
780
|
return J(x(t, 0, 1)) + x(t, 1);
|
|
785
781
|
}
|
|
786
782
|
function ce(t) {
|
|
787
|
-
return
|
|
783
|
+
return Z(x(t, 0, 1)) + x(t, 1);
|
|
788
784
|
}
|
|
789
785
|
function ot(t) {
|
|
790
786
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
791
787
|
}
|
|
792
788
|
function it(t, e = ` \r
|
|
793
789
|
\f\v`) {
|
|
794
|
-
const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"),
|
|
790
|
+
const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"), s = n.length ? r(n) : "", o = s.length ? `(?:\\s|[${s}])` : "\\s", c = new RegExp(`(^|${o})(\\p{Ll})`, "gu");
|
|
795
791
|
return t.replace(c, (i, f, l) => f + l.toUpperCase());
|
|
796
792
|
}
|
|
797
793
|
function le(t, e = null) {
|
|
798
|
-
const n = e && e.length > 0 ? e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? new RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu,
|
|
799
|
-
return
|
|
794
|
+
const n = e && e.length > 0 ? e.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&") : "", r = n.length > 0 ? new RegExp(`[\\p{L}\\p{N}${n}]+`, "gu") : /[\p{L}\p{N}]+/gu, s = t.match(r);
|
|
795
|
+
return s ? s.length : 0;
|
|
800
796
|
}
|
|
801
797
|
function fe(t, e = 75, n = `
|
|
802
798
|
`, r = !1) {
|
|
803
799
|
if (t.length === 0 || e < 1 || n === "")
|
|
804
800
|
return t;
|
|
805
|
-
const
|
|
806
|
-
for (const c of
|
|
801
|
+
const s = t.split(/\r\n|\n|\r/), o = [];
|
|
802
|
+
for (const c of s) {
|
|
807
803
|
let i = c;
|
|
808
804
|
if (i.length === 0) {
|
|
809
|
-
|
|
805
|
+
o.push("");
|
|
810
806
|
continue;
|
|
811
807
|
}
|
|
812
808
|
if (r) {
|
|
813
809
|
for (; i.length > 0 && !(/^\s/u.test(i) && (i = i.replace(/^\s+/u, ""), i.length === 0)); ) {
|
|
814
810
|
if (i.length <= e) {
|
|
815
|
-
|
|
811
|
+
o.push(i), i = "";
|
|
816
812
|
break;
|
|
817
813
|
}
|
|
818
814
|
let f = i.slice(0, e);
|
|
819
|
-
f = f.replace(/\s+$/u, ""),
|
|
815
|
+
f = f.replace(/\s+$/u, ""), o.push(f), i = i.slice(e).replace(/^\s+/u, "");
|
|
820
816
|
}
|
|
821
817
|
continue;
|
|
822
818
|
}
|
|
@@ -825,39 +821,39 @@ function fe(t, e = 75, n = `
|
|
|
825
821
|
if (f.length !== i.length && (i = f, i.length <= e))
|
|
826
822
|
break;
|
|
827
823
|
const l = i.slice(0, e + 1);
|
|
828
|
-
let
|
|
829
|
-
for (let
|
|
830
|
-
if (/\s/u.test(l[
|
|
831
|
-
|
|
824
|
+
let m = -1;
|
|
825
|
+
for (let p = l.length - 1; p >= 0; p--)
|
|
826
|
+
if (/\s/u.test(l[p])) {
|
|
827
|
+
m = p;
|
|
832
828
|
break;
|
|
833
829
|
}
|
|
834
|
-
if (
|
|
835
|
-
|
|
830
|
+
if (m > 0) {
|
|
831
|
+
o.push(i.slice(0, m)), i = i.slice(m + 1);
|
|
836
832
|
continue;
|
|
837
833
|
}
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
|
|
834
|
+
const a = i.search(/\s/u);
|
|
835
|
+
if (a >= 0) {
|
|
836
|
+
o.push(i.slice(0, a)), i = i.slice(a + 1);
|
|
841
837
|
continue;
|
|
842
838
|
}
|
|
843
|
-
|
|
839
|
+
o.push(i), i = "";
|
|
844
840
|
break;
|
|
845
841
|
}
|
|
846
|
-
i.length > 0 &&
|
|
842
|
+
i.length > 0 && o.push(i);
|
|
847
843
|
}
|
|
848
|
-
return
|
|
844
|
+
return o.join(n);
|
|
849
845
|
}
|
|
850
846
|
function ae() {
|
|
851
|
-
return
|
|
847
|
+
return E.size;
|
|
852
848
|
}
|
|
853
849
|
function ue() {
|
|
854
|
-
return
|
|
850
|
+
return C.size;
|
|
855
851
|
}
|
|
856
852
|
function pe() {
|
|
857
|
-
return
|
|
853
|
+
return F.size;
|
|
858
854
|
}
|
|
859
855
|
function ge() {
|
|
860
|
-
|
|
856
|
+
E.clear(), C.clear(), F.clear();
|
|
861
857
|
}
|
|
862
858
|
export {
|
|
863
859
|
T as after,
|
|
@@ -881,7 +877,7 @@ export {
|
|
|
881
877
|
xt as doesntContain,
|
|
882
878
|
$t as doesntEndWith,
|
|
883
879
|
re as doesntStartWith,
|
|
884
|
-
|
|
880
|
+
M as endsWith,
|
|
885
881
|
yt as excerpt,
|
|
886
882
|
kt as finish,
|
|
887
883
|
ge as flushCache,
|
|
@@ -889,23 +885,23 @@ export {
|
|
|
889
885
|
Lt as is,
|
|
890
886
|
Rt as isAscii,
|
|
891
887
|
Et as isJson,
|
|
892
|
-
|
|
888
|
+
Wt as isMatch,
|
|
893
889
|
Ct as isUrl,
|
|
894
890
|
Ft as kebab,
|
|
895
891
|
st as lcfirst,
|
|
896
|
-
|
|
897
|
-
|
|
892
|
+
N as length,
|
|
893
|
+
Nt as limit,
|
|
898
894
|
J as lower,
|
|
899
895
|
z as makePad,
|
|
900
|
-
|
|
896
|
+
_t as mask,
|
|
901
897
|
Ot as match,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
898
|
+
Mt as matchAll,
|
|
899
|
+
Pt as numbers,
|
|
900
|
+
Ut as padBoth,
|
|
901
|
+
It as padLeft,
|
|
902
|
+
qt as padRight,
|
|
907
903
|
se as pascal,
|
|
908
|
-
|
|
904
|
+
Gt as password,
|
|
909
905
|
Tt as position,
|
|
910
906
|
j as random,
|
|
911
907
|
Yt as remove,
|
|
@@ -922,7 +918,7 @@ export {
|
|
|
922
918
|
ae as snakeCacheSize,
|
|
923
919
|
ne as squish,
|
|
924
920
|
vt as start,
|
|
925
|
-
|
|
921
|
+
P as startsWith,
|
|
926
922
|
nt as stripTags,
|
|
927
923
|
H as studly,
|
|
928
924
|
pe as studlyCacheSize,
|
|
@@ -935,6 +931,6 @@ export {
|
|
|
935
931
|
bt as unwrap,
|
|
936
932
|
le as wordCount,
|
|
937
933
|
fe as wordWrap,
|
|
938
|
-
|
|
934
|
+
zt as words,
|
|
939
935
|
At as wrap
|
|
940
936
|
};
|