@tolki/str 1.0.2 → 1.0.4
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/base64/index.js +85 -83
- 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 +266 -265
- 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 R = /* @__PURE__ */ new Map(),
|
|
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 R = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
4
|
+
let E = 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,29 +112,29 @@ 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;
|
|
132
130
|
}
|
|
133
|
-
function
|
|
131
|
+
function Et(t) {
|
|
134
132
|
for (let e = 0; e < t.length; e++)
|
|
135
133
|
if (t.charCodeAt(e) > 127)
|
|
136
134
|
return !1;
|
|
137
135
|
return !0;
|
|
138
136
|
}
|
|
139
|
-
function
|
|
137
|
+
function Rt(t) {
|
|
140
138
|
if (!_(t))
|
|
141
139
|
return !1;
|
|
142
140
|
try {
|
|
@@ -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].trimEnd() + 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 (E ?? ((n) => D(n)))(t);
|
|
475
474
|
}
|
|
476
475
|
function v(t) {
|
|
477
|
-
|
|
476
|
+
E = 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 = E;
|
|
482
|
+
E = null;
|
|
483
|
+
const c = j(s);
|
|
484
|
+
return E = 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
|
+
E = 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,120 @@ 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
|
+
let e = "", n = !1;
|
|
638
|
+
for (let r = 0; r < t.length; r++) {
|
|
639
|
+
const s = t[r];
|
|
640
|
+
s === "<" ? n = !0 : s === ">" ? n = !1 : n || (e += s);
|
|
641
|
+
}
|
|
642
|
+
return e;
|
|
640
643
|
}
|
|
641
644
|
function Yt(t, e, n = !0) {
|
|
642
|
-
const r = typeof t == "string" ? [t] : Array.from(t),
|
|
645
|
+
const r = typeof t == "string" ? [t] : Array.from(t), s = (c) => c.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), o = (c) => {
|
|
643
646
|
let i = c;
|
|
644
647
|
for (const f of r)
|
|
645
648
|
if (f !== "")
|
|
646
649
|
if (n)
|
|
647
650
|
i = i.split(f).join("");
|
|
648
651
|
else {
|
|
649
|
-
const l = new RegExp(
|
|
652
|
+
const l = new RegExp(s(f), "gi");
|
|
650
653
|
i = i.replace(l, "");
|
|
651
654
|
}
|
|
652
655
|
return i;
|
|
653
656
|
};
|
|
654
|
-
return typeof e == "string" ?
|
|
657
|
+
return typeof e == "string" ? o(e) : Array.from(e, (c) => o(String(c)));
|
|
655
658
|
}
|
|
656
659
|
function jt(t) {
|
|
657
660
|
return Array.from(t).reverse().join("");
|
|
@@ -665,7 +668,7 @@ function te(t) {
|
|
|
665
668
|
if (e === "")
|
|
666
669
|
return "";
|
|
667
670
|
let n = e.split(/\s+/u);
|
|
668
|
-
return n.length > 1 ? n = n.map((
|
|
671
|
+
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
672
|
}
|
|
670
673
|
function ee(t) {
|
|
671
674
|
if (t.trim() === "")
|
|
@@ -706,19 +709,19 @@ function ee(t) {
|
|
|
706
709
|
"des",
|
|
707
710
|
"par",
|
|
708
711
|
"à"
|
|
709
|
-
]), n = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u),
|
|
710
|
-
if (!
|
|
711
|
-
const c = Array.from(
|
|
712
|
+
]), n = /* @__PURE__ */ new Set([".", "!", "?", ":", "—", ","]), r = t.split(/\s+/u), s = (o) => {
|
|
713
|
+
if (!o) return o;
|
|
714
|
+
const c = Array.from(o), i = c[0].toLocaleUpperCase(), f = c.slice(1).join("");
|
|
712
715
|
return i + f;
|
|
713
716
|
};
|
|
714
|
-
for (let
|
|
715
|
-
const c = r[
|
|
717
|
+
for (let o = 0; o < r.length; o++) {
|
|
718
|
+
const c = r[o].toLocaleLowerCase();
|
|
716
719
|
if (c.includes("-")) {
|
|
717
|
-
const f = c.split("-").map((l) => e.has(l) && l.length <= 3 ? l :
|
|
718
|
-
r[
|
|
720
|
+
const f = c.split("-").map((l) => e.has(l) && l.length <= 3 ? l : s(l));
|
|
721
|
+
r[o] = f.join("-");
|
|
719
722
|
} else {
|
|
720
|
-
const i =
|
|
721
|
-
e.has(c) && c.length <= 3 && !l ? r[
|
|
723
|
+
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);
|
|
724
|
+
e.has(c) && c.length <= 3 && !l ? r[o] = c : r[o] = s(c);
|
|
722
725
|
}
|
|
723
726
|
}
|
|
724
727
|
return r.join(" ");
|
|
@@ -727,42 +730,40 @@ function rt(t, e = "_") {
|
|
|
727
730
|
const r = `${t}|${e}`;
|
|
728
731
|
if (R.has(r))
|
|
729
732
|
return R.get(r);
|
|
730
|
-
let
|
|
731
|
-
return /^[a-z]+$/.test(t) || (
|
|
733
|
+
let s = t;
|
|
734
|
+
return /^[a-z]+$/.test(t) || (s = it(t).replace(/\s+/gu, ""), s = s.replace(/(.)(?=[A-Z])/g, `$1${e}`), s = J(s)), R.set(r, s), s;
|
|
732
735
|
}
|
|
733
736
|
function ne(t) {
|
|
734
|
-
return
|
|
737
|
+
return K(t).replace(/[\s\u3164\u1160]+/gu, " ");
|
|
735
738
|
}
|
|
736
|
-
function
|
|
739
|
+
function P(t, e) {
|
|
737
740
|
if (t == null || e == null)
|
|
738
741
|
return !1;
|
|
739
|
-
let n
|
|
740
|
-
|
|
741
|
-
];
|
|
742
|
-
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) && (n = Array.from(e));
|
|
742
|
+
let n;
|
|
743
|
+
_(e) || V(e) ? n = [e] : Symbol.iterator in Object(e) ? n = Array.from(e) : n = [e];
|
|
743
744
|
const r = String(t);
|
|
744
|
-
for (const
|
|
745
|
-
if (
|
|
745
|
+
for (const s of n) {
|
|
746
|
+
if (s == null)
|
|
746
747
|
continue;
|
|
747
|
-
const
|
|
748
|
-
if (
|
|
748
|
+
const o = String(s);
|
|
749
|
+
if (o !== "" && r.startsWith(o))
|
|
749
750
|
return !0;
|
|
750
751
|
}
|
|
751
752
|
return !1;
|
|
752
753
|
}
|
|
753
754
|
function re(t, e) {
|
|
754
|
-
return !
|
|
755
|
+
return !P(t, e);
|
|
755
756
|
}
|
|
756
757
|
function H(t) {
|
|
757
758
|
const e = t;
|
|
758
|
-
if (
|
|
759
|
-
return
|
|
760
|
-
const n = String(t).replace(/[-_]+/g, " "), r = n.trim() === "" ? [] : n.split(/\s+/u),
|
|
759
|
+
if (F.has(e))
|
|
760
|
+
return F.get(e);
|
|
761
|
+
const n = String(t).replace(/[-_]+/g, " "), r = n.trim() === "" ? [] : n.split(/\s+/u), s = (c) => {
|
|
761
762
|
if (!c) return c;
|
|
762
763
|
const i = Array.from(c), f = i[0].toUpperCase(), l = i.slice(1).join("");
|
|
763
764
|
return f + l;
|
|
764
|
-
},
|
|
765
|
-
return
|
|
765
|
+
}, o = r.map(s).join("");
|
|
766
|
+
return F.set(e, o), o;
|
|
766
767
|
}
|
|
767
768
|
function se(t) {
|
|
768
769
|
return H(t);
|
|
@@ -770,12 +771,12 @@ function se(t) {
|
|
|
770
771
|
function oe(t, e) {
|
|
771
772
|
if (!t || Object.keys(t).length === 0)
|
|
772
773
|
return e;
|
|
773
|
-
const n = Object.keys(t).filter((
|
|
774
|
+
const n = Object.keys(t).filter((o) => o !== "");
|
|
774
775
|
if (n.length === 0)
|
|
775
776
|
return e;
|
|
776
|
-
n.sort((
|
|
777
|
-
const r = (
|
|
778
|
-
return e.replace(
|
|
777
|
+
n.sort((o, c) => c.length - o.length);
|
|
778
|
+
const r = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), s = new RegExp(n.map(r).join("|"), "gu");
|
|
779
|
+
return e.replace(s, (o) => t[o]);
|
|
779
780
|
}
|
|
780
781
|
function ie(t, e) {
|
|
781
782
|
return e < 0 ? x(t, e) : x(t, 0, e);
|
|
@@ -784,39 +785,39 @@ function st(t) {
|
|
|
784
785
|
return J(x(t, 0, 1)) + x(t, 1);
|
|
785
786
|
}
|
|
786
787
|
function ce(t) {
|
|
787
|
-
return
|
|
788
|
+
return Z(x(t, 0, 1)) + x(t, 1);
|
|
788
789
|
}
|
|
789
790
|
function ot(t) {
|
|
790
791
|
return t.split(new RegExp("(?=\\p{Lu})", "u")).filter(Boolean);
|
|
791
792
|
}
|
|
792
793
|
function it(t, e = ` \r
|
|
793
794
|
\f\v`) {
|
|
794
|
-
const n = S(e) ? e.join("") : e, r = (i) => i.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"),
|
|
795
|
+
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
796
|
return t.replace(c, (i, f, l) => f + l.toUpperCase());
|
|
796
797
|
}
|
|
797
798
|
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
|
|
799
|
+
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);
|
|
800
|
+
return s ? s.length : 0;
|
|
800
801
|
}
|
|
801
802
|
function fe(t, e = 75, n = `
|
|
802
803
|
`, r = !1) {
|
|
803
804
|
if (t.length === 0 || e < 1 || n === "")
|
|
804
805
|
return t;
|
|
805
|
-
const
|
|
806
|
-
for (const c of
|
|
806
|
+
const s = t.split(/\r\n|\n|\r/), o = [];
|
|
807
|
+
for (const c of s) {
|
|
807
808
|
let i = c;
|
|
808
809
|
if (i.length === 0) {
|
|
809
|
-
|
|
810
|
+
o.push("");
|
|
810
811
|
continue;
|
|
811
812
|
}
|
|
812
813
|
if (r) {
|
|
813
814
|
for (; i.length > 0 && !(/^\s/u.test(i) && (i = i.replace(/^\s+/u, ""), i.length === 0)); ) {
|
|
814
815
|
if (i.length <= e) {
|
|
815
|
-
|
|
816
|
+
o.push(i);
|
|
816
817
|
break;
|
|
817
818
|
}
|
|
818
819
|
let f = i.slice(0, e);
|
|
819
|
-
f = f.replace(/\s+$/u, ""),
|
|
820
|
+
f = f.replace(/\s+$/u, ""), o.push(f), i = i.slice(e).replace(/^\s+/u, "");
|
|
820
821
|
}
|
|
821
822
|
continue;
|
|
822
823
|
}
|
|
@@ -825,39 +826,39 @@ function fe(t, e = 75, n = `
|
|
|
825
826
|
if (f.length !== i.length && (i = f, i.length <= e))
|
|
826
827
|
break;
|
|
827
828
|
const l = i.slice(0, e + 1);
|
|
828
|
-
let
|
|
829
|
-
for (let
|
|
830
|
-
if (/\s/u.test(l[
|
|
831
|
-
|
|
829
|
+
let m = -1;
|
|
830
|
+
for (let p = l.length - 1; p >= 0; p--)
|
|
831
|
+
if (/\s/u.test(l[p])) {
|
|
832
|
+
m = p;
|
|
832
833
|
break;
|
|
833
834
|
}
|
|
834
|
-
if (
|
|
835
|
-
|
|
835
|
+
if (m > 0) {
|
|
836
|
+
o.push(i.slice(0, m)), i = i.slice(m + 1);
|
|
836
837
|
continue;
|
|
837
838
|
}
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
|
|
839
|
+
const a = i.search(/\s/u);
|
|
840
|
+
if (a >= 0) {
|
|
841
|
+
o.push(i.slice(0, a)), i = i.slice(a + 1);
|
|
841
842
|
continue;
|
|
842
843
|
}
|
|
843
|
-
|
|
844
|
+
o.push(i), i = "";
|
|
844
845
|
break;
|
|
845
846
|
}
|
|
846
|
-
i.length > 0 &&
|
|
847
|
+
i.length > 0 && o.push(i);
|
|
847
848
|
}
|
|
848
|
-
return
|
|
849
|
+
return o.join(n);
|
|
849
850
|
}
|
|
850
851
|
function ae() {
|
|
851
852
|
return R.size;
|
|
852
853
|
}
|
|
853
854
|
function ue() {
|
|
854
|
-
return
|
|
855
|
+
return C.size;
|
|
855
856
|
}
|
|
856
857
|
function pe() {
|
|
857
|
-
return
|
|
858
|
+
return F.size;
|
|
858
859
|
}
|
|
859
860
|
function ge() {
|
|
860
|
-
R.clear(),
|
|
861
|
+
R.clear(), C.clear(), F.clear();
|
|
861
862
|
}
|
|
862
863
|
export {
|
|
863
864
|
T as after,
|
|
@@ -881,31 +882,31 @@ export {
|
|
|
881
882
|
xt as doesntContain,
|
|
882
883
|
$t as doesntEndWith,
|
|
883
884
|
re as doesntStartWith,
|
|
884
|
-
|
|
885
|
+
M as endsWith,
|
|
885
886
|
yt as excerpt,
|
|
886
887
|
kt as finish,
|
|
887
888
|
ge as flushCache,
|
|
888
889
|
te as headline,
|
|
889
890
|
Lt as is,
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
891
|
+
Et as isAscii,
|
|
892
|
+
Rt as isJson,
|
|
893
|
+
Wt as isMatch,
|
|
893
894
|
Ct as isUrl,
|
|
894
895
|
Ft as kebab,
|
|
895
896
|
st as lcfirst,
|
|
896
|
-
|
|
897
|
-
|
|
897
|
+
N as length,
|
|
898
|
+
Nt as limit,
|
|
898
899
|
J as lower,
|
|
899
900
|
z as makePad,
|
|
900
|
-
|
|
901
|
+
_t as mask,
|
|
901
902
|
Ot as match,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
903
|
+
Mt as matchAll,
|
|
904
|
+
Pt as numbers,
|
|
905
|
+
Ut as padBoth,
|
|
906
|
+
It as padLeft,
|
|
907
|
+
qt as padRight,
|
|
907
908
|
se as pascal,
|
|
908
|
-
|
|
909
|
+
Gt as password,
|
|
909
910
|
Tt as position,
|
|
910
911
|
j as random,
|
|
911
912
|
Yt as remove,
|
|
@@ -922,7 +923,7 @@ export {
|
|
|
922
923
|
ae as snakeCacheSize,
|
|
923
924
|
ne as squish,
|
|
924
925
|
vt as start,
|
|
925
|
-
|
|
926
|
+
P as startsWith,
|
|
926
927
|
nt as stripTags,
|
|
927
928
|
H as studly,
|
|
928
929
|
pe as studlyCacheSize,
|
|
@@ -935,6 +936,6 @@ export {
|
|
|
935
936
|
bt as unwrap,
|
|
936
937
|
le as wordCount,
|
|
937
938
|
fe as wordWrap,
|
|
938
|
-
|
|
939
|
+
zt as words,
|
|
939
940
|
At as wrap
|
|
940
941
|
};
|