@extable/sequence 0.2.0 → 0.3.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/builtins.d.ts +3 -0
- package/dist/index.js +513 -376
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const g = (e) => e.trim().normalize("NFKC").toLowerCase().replace(/\s+/g, " "), V = (e) => {
|
|
2
|
+
const t = [];
|
|
3
3
|
if (e)
|
|
4
|
-
for (const
|
|
5
|
-
const s =
|
|
6
|
-
!s ||
|
|
4
|
+
for (const n of e) {
|
|
5
|
+
const s = n.trim();
|
|
6
|
+
!s || t.includes(s) || t.push(s);
|
|
7
7
|
}
|
|
8
|
-
return
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
8
|
+
return t.length === 0 ? t.push("en") : t.includes("en") || t.push("en"), t;
|
|
9
|
+
}, J = (e, t) => {
|
|
10
|
+
const n = e.items.indexOf(t);
|
|
11
|
+
if (n !== -1)
|
|
12
|
+
return n;
|
|
13
13
|
if (!e.aliases)
|
|
14
14
|
return null;
|
|
15
|
-
const s = e.aliases[
|
|
15
|
+
const s = e.aliases[t];
|
|
16
16
|
if (!s)
|
|
17
17
|
return null;
|
|
18
18
|
const r = e.items.indexOf(s);
|
|
19
19
|
return r === -1 ? null : r;
|
|
20
|
-
},
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
20
|
+
}, R = (e, t) => {
|
|
21
|
+
const n = g(t);
|
|
22
|
+
if (g(e.id).includes(n))
|
|
23
23
|
return !0;
|
|
24
24
|
for (const s of e.items)
|
|
25
|
-
if (
|
|
25
|
+
if (g(s).includes(n))
|
|
26
26
|
return !0;
|
|
27
27
|
return e.aliases ? Object.keys(e.aliases).some(
|
|
28
|
-
(s) =>
|
|
28
|
+
(s) => g(s).includes(n)
|
|
29
29
|
) : !1;
|
|
30
|
-
},
|
|
30
|
+
}, D = (e, t) => {
|
|
31
31
|
if (e.langs.length === 0)
|
|
32
32
|
return 0;
|
|
33
|
-
let
|
|
33
|
+
let n = Number.POSITIVE_INFINITY;
|
|
34
34
|
for (const s of e.langs) {
|
|
35
|
-
const r =
|
|
36
|
-
r !== -1 && r <
|
|
35
|
+
const r = t.indexOf(s);
|
|
36
|
+
r !== -1 && r < n && (n = r);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
39
|
-
},
|
|
40
|
-
class
|
|
41
|
-
constructor(
|
|
42
|
-
this.lists = [], this.matchers = [], this.langs =
|
|
38
|
+
return n;
|
|
39
|
+
}, K = (e, t) => !e.langs || e.langs.length === 0 ? !0 : e.langs.some((n) => t.includes(n));
|
|
40
|
+
class z {
|
|
41
|
+
constructor(t) {
|
|
42
|
+
this.lists = [], this.matchers = [], this.langs = V(t?.langs);
|
|
43
43
|
}
|
|
44
|
-
register(
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
register(t) {
|
|
45
|
+
const n = this.lists.findIndex((s) => s.id === t.id);
|
|
46
|
+
n === -1 ? this.lists.push(t) : this.lists[n] = t;
|
|
47
47
|
}
|
|
48
|
-
registerMatch(
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
registerMatch(t) {
|
|
49
|
+
const n = this.matchers.findIndex((s) => s.id === t.id);
|
|
50
|
+
n === -1 ? this.matchers.push(t) : this.matchers[n] = t;
|
|
51
51
|
}
|
|
52
|
-
unregister(
|
|
53
|
-
this.lists = this.lists.filter((
|
|
52
|
+
unregister(t) {
|
|
53
|
+
this.lists = this.lists.filter((n) => n.id !== t), this.matchers = this.matchers.filter((n) => n.id !== t);
|
|
54
54
|
}
|
|
55
|
-
list(
|
|
56
|
-
let
|
|
57
|
-
if (
|
|
58
|
-
const r = new Set(
|
|
59
|
-
|
|
55
|
+
list(t) {
|
|
56
|
+
let n = [...this.lists];
|
|
57
|
+
if (t?.enabledIds && t.enabledIds.length > 0) {
|
|
58
|
+
const r = new Set(t.enabledIds);
|
|
59
|
+
n = n.filter((o) => r.has(o.id));
|
|
60
60
|
}
|
|
61
|
-
const s =
|
|
62
|
-
return s && (
|
|
61
|
+
const s = t?.queryText;
|
|
62
|
+
return s && (n = n.filter((r) => R(r, s))), n;
|
|
63
63
|
}
|
|
64
|
-
match(
|
|
65
|
-
if (
|
|
64
|
+
match(t, n) {
|
|
65
|
+
if (t.length === 0)
|
|
66
66
|
return null;
|
|
67
67
|
let s = null, r = Number.NEGATIVE_INFINITY;
|
|
68
|
-
const o =
|
|
69
|
-
for (const
|
|
70
|
-
if (o && !o.has(
|
|
68
|
+
const o = n?.enabledIds ? new Set(n.enabledIds) : null;
|
|
69
|
+
for (const i of this.matchers) {
|
|
70
|
+
if (o && !o.has(i.id) || !K(i, this.langs))
|
|
71
71
|
continue;
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
72
|
+
const a = i.match(t);
|
|
73
|
+
if (!a)
|
|
74
74
|
continue;
|
|
75
|
-
const l =
|
|
75
|
+
const l = a.score;
|
|
76
76
|
Number.isFinite(l) && l > r && (r = l, s = {
|
|
77
77
|
kind: "matcher",
|
|
78
|
-
matcher:
|
|
79
|
-
step:
|
|
80
|
-
state:
|
|
78
|
+
matcher: i,
|
|
79
|
+
step: a.step ?? 1,
|
|
80
|
+
state: a.state
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
for (const { list:
|
|
83
|
+
const u = this.list(n).map((i) => ({ list: i, rank: D(i, this.langs) })).filter((i) => Number.isFinite(i.rank)).sort((i, a) => i.rank - a.rank);
|
|
84
|
+
for (const { list: i, rank: a } of u) {
|
|
85
85
|
const l = [];
|
|
86
86
|
let c = !1;
|
|
87
|
-
for (const
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
87
|
+
for (const P of t) {
|
|
88
|
+
const k = J(i, P);
|
|
89
|
+
if (k === null) {
|
|
90
90
|
c = !0;
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
|
-
l.push(
|
|
93
|
+
l.push(k);
|
|
94
94
|
}
|
|
95
95
|
if (c)
|
|
96
96
|
continue;
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
97
|
+
const f = this.inferStep(i, l);
|
|
98
|
+
if (f === null)
|
|
99
99
|
continue;
|
|
100
|
-
const
|
|
101
|
-
|
|
100
|
+
const d = 10 - a;
|
|
101
|
+
d > r && (r = d, s = {
|
|
102
102
|
kind: "list",
|
|
103
|
-
list:
|
|
103
|
+
list: i,
|
|
104
104
|
startIndex: l[l.length - 1] ?? 0,
|
|
105
|
-
step:
|
|
105
|
+
step: f
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
return s;
|
|
109
109
|
}
|
|
110
|
-
inferStep(
|
|
111
|
-
if (
|
|
110
|
+
inferStep(t, n) {
|
|
111
|
+
if (n.length < 2)
|
|
112
112
|
return 1;
|
|
113
|
-
const s =
|
|
113
|
+
const s = t.items.length, r = this.stepBetween(t.mode, s, n[0], n[1]);
|
|
114
114
|
if (r === null)
|
|
115
115
|
return null;
|
|
116
|
-
for (let o = 2; o <
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
116
|
+
for (let o = 2; o < n.length; o += 1) {
|
|
117
|
+
const u = this.nextIndex(t.mode, s, n[o - 1], r);
|
|
118
|
+
if (u === null || u !== n[o])
|
|
119
119
|
return null;
|
|
120
120
|
}
|
|
121
121
|
return r;
|
|
122
122
|
}
|
|
123
|
-
stepBetween(
|
|
124
|
-
if (
|
|
125
|
-
return (r - s +
|
|
123
|
+
stepBetween(t, n, s, r) {
|
|
124
|
+
if (t === "cycle")
|
|
125
|
+
return (r - s + n) % n;
|
|
126
126
|
const o = r - s;
|
|
127
127
|
return o < 0 ? null : o;
|
|
128
128
|
}
|
|
129
|
-
nextIndex(
|
|
130
|
-
if (
|
|
131
|
-
return (s + r) %
|
|
129
|
+
nextIndex(t, n, s, r) {
|
|
130
|
+
if (t === "cycle")
|
|
131
|
+
return (s + r) % n;
|
|
132
132
|
const o = s + r;
|
|
133
|
-
return o >=
|
|
133
|
+
return o >= n ? null : o;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
const
|
|
136
|
+
const B = {
|
|
137
137
|
id: "weekdays-en-long",
|
|
138
138
|
mode: "cycle",
|
|
139
139
|
langs: ["en"],
|
|
140
140
|
items: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
|
141
|
-
},
|
|
141
|
+
}, G = {
|
|
142
142
|
id: "weekdays-en-short",
|
|
143
143
|
mode: "cycle",
|
|
144
144
|
langs: ["en"],
|
|
@@ -148,22 +148,22 @@ const J = {
|
|
|
148
148
|
Thur: "Thu",
|
|
149
149
|
Thurs: "Thu"
|
|
150
150
|
}
|
|
151
|
-
},
|
|
151
|
+
}, H = {
|
|
152
152
|
id: "weekdays-ja-long",
|
|
153
153
|
mode: "cycle",
|
|
154
154
|
langs: ["ja"],
|
|
155
155
|
items: ["月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日", "日曜日"]
|
|
156
|
-
},
|
|
156
|
+
}, U = {
|
|
157
157
|
id: "weekdays-ja-short",
|
|
158
158
|
mode: "cycle",
|
|
159
159
|
langs: ["ja"],
|
|
160
160
|
items: ["月曜", "火曜", "水曜", "木曜", "金曜", "土曜", "日曜"]
|
|
161
|
-
},
|
|
161
|
+
}, Y = {
|
|
162
162
|
id: "weekdays-ja-single",
|
|
163
163
|
mode: "cycle",
|
|
164
164
|
langs: ["ja"],
|
|
165
165
|
items: ["月", "火", "水", "木", "金", "土", "日"]
|
|
166
|
-
},
|
|
166
|
+
}, q = {
|
|
167
167
|
id: "months-en-long",
|
|
168
168
|
mode: "cycle",
|
|
169
169
|
langs: ["en"],
|
|
@@ -181,7 +181,7 @@ const J = {
|
|
|
181
181
|
"November",
|
|
182
182
|
"December"
|
|
183
183
|
]
|
|
184
|
-
},
|
|
184
|
+
}, X = {
|
|
185
185
|
id: "months-en-short",
|
|
186
186
|
mode: "cycle",
|
|
187
187
|
langs: ["en"],
|
|
@@ -189,32 +189,32 @@ const J = {
|
|
|
189
189
|
aliases: {
|
|
190
190
|
Sept: "Sep"
|
|
191
191
|
}
|
|
192
|
-
},
|
|
192
|
+
}, Q = {
|
|
193
193
|
id: "months-ja",
|
|
194
194
|
mode: "cycle",
|
|
195
195
|
langs: ["ja"],
|
|
196
196
|
items: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"]
|
|
197
|
-
},
|
|
197
|
+
}, Z = {
|
|
198
198
|
id: "months-ja-traditional",
|
|
199
199
|
mode: "cycle",
|
|
200
200
|
langs: ["ja"],
|
|
201
201
|
items: ["睦月", "如月", "弥生", "卯月", "皐月", "水無月", "文月", "葉月", "長月", "神無月", "霜月", "師走"]
|
|
202
|
-
},
|
|
202
|
+
}, _ = {
|
|
203
203
|
id: "quarters-en",
|
|
204
204
|
mode: "cycle",
|
|
205
205
|
langs: ["en"],
|
|
206
206
|
items: ["Q1", "Q2", "Q3", "Q4"]
|
|
207
|
-
},
|
|
207
|
+
}, ee = {
|
|
208
208
|
id: "quarters-ja",
|
|
209
209
|
mode: "cycle",
|
|
210
210
|
langs: ["ja"],
|
|
211
211
|
items: ["第1四半期", "第2四半期", "第3四半期", "第4四半期"]
|
|
212
|
-
},
|
|
212
|
+
}, te = {
|
|
213
213
|
id: "zodiac-animals-ja",
|
|
214
214
|
mode: "cycle",
|
|
215
215
|
langs: ["ja"],
|
|
216
216
|
items: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"]
|
|
217
|
-
},
|
|
217
|
+
}, ne = {
|
|
218
218
|
id: "zodiac-signs-en",
|
|
219
219
|
mode: "cycle",
|
|
220
220
|
langs: ["en"],
|
|
@@ -232,7 +232,7 @@ const J = {
|
|
|
232
232
|
"Aquarius",
|
|
233
233
|
"Pisces"
|
|
234
234
|
]
|
|
235
|
-
},
|
|
235
|
+
}, se = {
|
|
236
236
|
id: "zodiac-signs-ja",
|
|
237
237
|
mode: "cycle",
|
|
238
238
|
langs: ["ja"],
|
|
@@ -240,7 +240,7 @@ const J = {
|
|
|
240
240
|
aliases: {
|
|
241
241
|
さそり座: "蠍座"
|
|
242
242
|
}
|
|
243
|
-
},
|
|
243
|
+
}, re = {
|
|
244
244
|
id: "directions-16-en",
|
|
245
245
|
mode: "cycle",
|
|
246
246
|
langs: ["en"],
|
|
@@ -262,7 +262,7 @@ const J = {
|
|
|
262
262
|
"Northwest",
|
|
263
263
|
"North-Northwest"
|
|
264
264
|
]
|
|
265
|
-
},
|
|
265
|
+
}, ie = {
|
|
266
266
|
id: "directions-16-ja",
|
|
267
267
|
mode: "cycle",
|
|
268
268
|
langs: ["ja"],
|
|
@@ -284,7 +284,7 @@ const J = {
|
|
|
284
284
|
"北西",
|
|
285
285
|
"北北西"
|
|
286
286
|
]
|
|
287
|
-
},
|
|
287
|
+
}, oe = {
|
|
288
288
|
id: "ampm-en",
|
|
289
289
|
mode: "cycle",
|
|
290
290
|
langs: ["en"],
|
|
@@ -293,12 +293,12 @@ const J = {
|
|
|
293
293
|
"A.M.": "AM",
|
|
294
294
|
"P.M.": "PM"
|
|
295
295
|
}
|
|
296
|
-
},
|
|
296
|
+
}, ae = {
|
|
297
297
|
id: "ampm-ja",
|
|
298
298
|
mode: "cycle",
|
|
299
299
|
langs: ["ja"],
|
|
300
300
|
items: ["午前", "午後"]
|
|
301
|
-
},
|
|
301
|
+
}, ue = {
|
|
302
302
|
id: "seasons-en",
|
|
303
303
|
mode: "cycle",
|
|
304
304
|
langs: ["en"],
|
|
@@ -306,17 +306,17 @@ const J = {
|
|
|
306
306
|
aliases: {
|
|
307
307
|
Fall: "Autumn"
|
|
308
308
|
}
|
|
309
|
-
},
|
|
309
|
+
}, le = {
|
|
310
310
|
id: "seasons-ja",
|
|
311
311
|
mode: "cycle",
|
|
312
312
|
langs: ["ja"],
|
|
313
313
|
items: ["春", "夏", "秋", "冬"]
|
|
314
|
-
},
|
|
314
|
+
}, ce = {
|
|
315
315
|
id: "solfege-ja",
|
|
316
316
|
mode: "cycle",
|
|
317
317
|
langs: ["ja"],
|
|
318
318
|
items: ["ド", "レ", "ミ", "ファ", "ソ", "ラ", "シ"]
|
|
319
|
-
},
|
|
319
|
+
}, fe = {
|
|
320
320
|
id: "solfege-en",
|
|
321
321
|
mode: "cycle",
|
|
322
322
|
langs: ["en"],
|
|
@@ -325,7 +325,7 @@ const J = {
|
|
|
325
325
|
So: "Sol",
|
|
326
326
|
Si: "Ti"
|
|
327
327
|
}
|
|
328
|
-
},
|
|
328
|
+
}, de = {
|
|
329
329
|
id: "greek-letters-en",
|
|
330
330
|
mode: "cycle",
|
|
331
331
|
langs: ["en"],
|
|
@@ -355,7 +355,7 @@ const J = {
|
|
|
355
355
|
"Psi",
|
|
356
356
|
"Omega"
|
|
357
357
|
]
|
|
358
|
-
},
|
|
358
|
+
}, me = {
|
|
359
359
|
id: "greek-letters-ja",
|
|
360
360
|
mode: "cycle",
|
|
361
361
|
langs: ["ja"],
|
|
@@ -385,7 +385,7 @@ const J = {
|
|
|
385
385
|
"プサイ",
|
|
386
386
|
"オメガ"
|
|
387
387
|
]
|
|
388
|
-
},
|
|
388
|
+
}, he = {
|
|
389
389
|
id: "greek-letters-symbols",
|
|
390
390
|
mode: "cycle",
|
|
391
391
|
langs: ["en", "ja"],
|
|
@@ -418,37 +418,37 @@ const J = {
|
|
|
418
418
|
aliases: {
|
|
419
419
|
ς: "σ"
|
|
420
420
|
}
|
|
421
|
-
},
|
|
421
|
+
}, ge = {
|
|
422
422
|
id: "rokuyo-ja",
|
|
423
423
|
mode: "cycle",
|
|
424
424
|
langs: ["ja"],
|
|
425
425
|
items: ["先勝", "友引", "先負", "仏滅", "大安", "赤口"]
|
|
426
|
-
},
|
|
426
|
+
}, pe = {
|
|
427
427
|
id: "heavenly-stems-ja",
|
|
428
428
|
mode: "finite",
|
|
429
429
|
langs: ["ja"],
|
|
430
430
|
items: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"]
|
|
431
|
-
},
|
|
431
|
+
}, xe = {
|
|
432
432
|
id: "planets-en",
|
|
433
433
|
mode: "finite",
|
|
434
434
|
langs: ["en"],
|
|
435
435
|
items: ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
|
|
436
|
-
},
|
|
436
|
+
}, ye = {
|
|
437
437
|
id: "planets-ja",
|
|
438
438
|
mode: "finite",
|
|
439
439
|
langs: ["ja"],
|
|
440
440
|
items: ["水星", "金星", "地球", "火星", "木星", "土星", "天王星", "海王星"]
|
|
441
|
-
},
|
|
441
|
+
}, be = {
|
|
442
442
|
id: "kuji-in-ja",
|
|
443
443
|
mode: "finite",
|
|
444
444
|
langs: ["ja"],
|
|
445
445
|
items: ["臨", "兵", "闘", "者", "皆", "陣", "烈", "在", "前"]
|
|
446
|
-
},
|
|
446
|
+
}, Se = {
|
|
447
447
|
id: "eight-virtues-ja",
|
|
448
448
|
mode: "finite",
|
|
449
449
|
langs: ["ja"],
|
|
450
450
|
items: ["仁", "義", "礼", "智", "忠", "信", "孝", "悌"]
|
|
451
|
-
},
|
|
451
|
+
}, je = {
|
|
452
452
|
id: "element-symbols",
|
|
453
453
|
mode: "finite",
|
|
454
454
|
langs: ["ja", "en"],
|
|
@@ -572,7 +572,7 @@ const J = {
|
|
|
572
572
|
"Ts",
|
|
573
573
|
"Og"
|
|
574
574
|
]
|
|
575
|
-
},
|
|
575
|
+
}, ke = {
|
|
576
576
|
id: "element-names-ja",
|
|
577
577
|
mode: "finite",
|
|
578
578
|
langs: ["ja"],
|
|
@@ -696,7 +696,7 @@ const J = {
|
|
|
696
696
|
"テネシン",
|
|
697
697
|
"オガネソン"
|
|
698
698
|
]
|
|
699
|
-
},
|
|
699
|
+
}, we = {
|
|
700
700
|
id: "shoguns-kamakura-ja",
|
|
701
701
|
mode: "finite",
|
|
702
702
|
langs: ["ja"],
|
|
@@ -711,7 +711,7 @@ const J = {
|
|
|
711
711
|
"久明親王",
|
|
712
712
|
"守邦親王"
|
|
713
713
|
]
|
|
714
|
-
},
|
|
714
|
+
}, Ne = {
|
|
715
715
|
id: "shoguns-ashikaga-ja",
|
|
716
716
|
mode: "finite",
|
|
717
717
|
langs: ["ja"],
|
|
@@ -732,7 +732,7 @@ const J = {
|
|
|
732
732
|
"足利義栄",
|
|
733
733
|
"足利義昭"
|
|
734
734
|
]
|
|
735
|
-
},
|
|
735
|
+
}, Ie = {
|
|
736
736
|
id: "shoguns-ashikaga-given-ja",
|
|
737
737
|
mode: "finite",
|
|
738
738
|
langs: ["ja"],
|
|
@@ -753,7 +753,7 @@ const J = {
|
|
|
753
753
|
"義栄",
|
|
754
754
|
"義昭"
|
|
755
755
|
]
|
|
756
|
-
},
|
|
756
|
+
}, Te = {
|
|
757
757
|
id: "shoguns-tokugawa-ja",
|
|
758
758
|
mode: "finite",
|
|
759
759
|
langs: ["ja"],
|
|
@@ -774,7 +774,7 @@ const J = {
|
|
|
774
774
|
"徳川家茂",
|
|
775
775
|
"徳川慶喜"
|
|
776
776
|
]
|
|
777
|
-
},
|
|
777
|
+
}, Me = {
|
|
778
778
|
id: "shoguns-tokugawa-given-ja",
|
|
779
779
|
mode: "finite",
|
|
780
780
|
langs: ["ja"],
|
|
@@ -795,7 +795,7 @@ const J = {
|
|
|
795
795
|
"家茂",
|
|
796
796
|
"慶喜"
|
|
797
797
|
]
|
|
798
|
-
},
|
|
798
|
+
}, T = [
|
|
799
799
|
"北海道",
|
|
800
800
|
"青森県",
|
|
801
801
|
"岩手県",
|
|
@@ -843,24 +843,24 @@ const J = {
|
|
|
843
843
|
"宮崎県",
|
|
844
844
|
"鹿児島県",
|
|
845
845
|
"沖縄県"
|
|
846
|
-
],
|
|
847
|
-
(e,
|
|
848
|
-
if (
|
|
846
|
+
], Ae = T.reduce(
|
|
847
|
+
(e, t) => {
|
|
848
|
+
if (t === "北海道")
|
|
849
849
|
return e;
|
|
850
|
-
if (/[都府県]$/.test(
|
|
851
|
-
const
|
|
852
|
-
e[
|
|
850
|
+
if (/[都府県]$/.test(t)) {
|
|
851
|
+
const n = t.slice(0, -1);
|
|
852
|
+
e[n] = t;
|
|
853
853
|
}
|
|
854
854
|
return e;
|
|
855
855
|
},
|
|
856
856
|
{}
|
|
857
|
-
),
|
|
857
|
+
), ve = {
|
|
858
858
|
id: "prefectures-ja",
|
|
859
859
|
mode: "finite",
|
|
860
860
|
langs: ["ja"],
|
|
861
|
-
items:
|
|
862
|
-
aliases:
|
|
863
|
-
},
|
|
861
|
+
items: T,
|
|
862
|
+
aliases: Ae
|
|
863
|
+
}, Le = {
|
|
864
864
|
id: "us-states-en",
|
|
865
865
|
mode: "finite",
|
|
866
866
|
langs: ["en"],
|
|
@@ -916,7 +916,7 @@ const J = {
|
|
|
916
916
|
"Wisconsin",
|
|
917
917
|
"Wyoming"
|
|
918
918
|
]
|
|
919
|
-
},
|
|
919
|
+
}, Ee = {
|
|
920
920
|
id: "us-states-abbrev-en",
|
|
921
921
|
mode: "finite",
|
|
922
922
|
langs: ["en"],
|
|
@@ -972,7 +972,7 @@ const J = {
|
|
|
972
972
|
"WI",
|
|
973
973
|
"WY"
|
|
974
974
|
]
|
|
975
|
-
},
|
|
975
|
+
}, We = {
|
|
976
976
|
id: "windows-versions",
|
|
977
977
|
mode: "finite",
|
|
978
978
|
langs: ["ja", "en"],
|
|
@@ -995,7 +995,7 @@ const J = {
|
|
|
995
995
|
"Windows 10",
|
|
996
996
|
"Windows 11"
|
|
997
997
|
]
|
|
998
|
-
},
|
|
998
|
+
}, Ce = {
|
|
999
999
|
id: "macos-versions",
|
|
1000
1000
|
mode: "finite",
|
|
1001
1001
|
langs: ["ja", "en"],
|
|
@@ -1023,7 +1023,7 @@ const J = {
|
|
|
1023
1023
|
"Sequoia",
|
|
1024
1024
|
"Tahoe"
|
|
1025
1025
|
]
|
|
1026
|
-
},
|
|
1026
|
+
}, Oe = {
|
|
1027
1027
|
id: "debian-codenames",
|
|
1028
1028
|
mode: "finite",
|
|
1029
1029
|
langs: ["ja", "en"],
|
|
@@ -1047,13 +1047,7 @@ const J = {
|
|
|
1047
1047
|
"bookworm",
|
|
1048
1048
|
"trixie"
|
|
1049
1049
|
]
|
|
1050
|
-
},
|
|
1051
|
-
J,
|
|
1052
|
-
R,
|
|
1053
|
-
D,
|
|
1054
|
-
K,
|
|
1055
|
-
$,
|
|
1056
|
-
z,
|
|
1050
|
+
}, $e = [
|
|
1057
1051
|
B,
|
|
1058
1052
|
G,
|
|
1059
1053
|
H,
|
|
@@ -1070,87 +1064,167 @@ const J = {
|
|
|
1070
1064
|
se,
|
|
1071
1065
|
re,
|
|
1072
1066
|
ie,
|
|
1073
|
-
ae,
|
|
1074
1067
|
oe,
|
|
1075
|
-
|
|
1068
|
+
ae,
|
|
1076
1069
|
ue,
|
|
1070
|
+
le,
|
|
1077
1071
|
ce,
|
|
1078
|
-
de,
|
|
1079
1072
|
fe,
|
|
1073
|
+
de,
|
|
1080
1074
|
me,
|
|
1081
1075
|
he,
|
|
1082
1076
|
ge,
|
|
1083
1077
|
pe,
|
|
1084
|
-
ye,
|
|
1085
|
-
Se,
|
|
1086
1078
|
xe,
|
|
1079
|
+
ye,
|
|
1087
1080
|
be,
|
|
1081
|
+
Se,
|
|
1082
|
+
je,
|
|
1088
1083
|
ke,
|
|
1084
|
+
we,
|
|
1089
1085
|
Ne,
|
|
1090
1086
|
Ie,
|
|
1091
|
-
we,
|
|
1092
1087
|
Te,
|
|
1093
1088
|
Me,
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1089
|
+
ve,
|
|
1090
|
+
Le,
|
|
1091
|
+
Ee,
|
|
1092
|
+
We,
|
|
1093
|
+
Ce,
|
|
1094
|
+
Oe
|
|
1095
|
+
], p = (e) => {
|
|
1096
|
+
const t = e % 100;
|
|
1097
|
+
if (t >= 11 && t <= 13) return "th";
|
|
1098
|
+
const n = e % 10;
|
|
1099
|
+
return n === 1 ? "st" : n === 2 ? "nd" : n === 3 ? "rd" : "th";
|
|
1100
|
+
}, x = {
|
|
1101
|
+
1: "first",
|
|
1102
|
+
2: "second",
|
|
1103
|
+
3: "third",
|
|
1104
|
+
4: "fourth",
|
|
1105
|
+
5: "fifth",
|
|
1106
|
+
6: "sixth",
|
|
1107
|
+
7: "seventh",
|
|
1108
|
+
8: "eighth",
|
|
1109
|
+
9: "ninth",
|
|
1110
|
+
10: "tenth",
|
|
1111
|
+
11: "eleventh",
|
|
1112
|
+
12: "twelfth",
|
|
1113
|
+
13: "thirteenth",
|
|
1114
|
+
14: "fourteenth",
|
|
1115
|
+
15: "fifteenth",
|
|
1116
|
+
16: "sixteenth",
|
|
1117
|
+
17: "seventeenth",
|
|
1118
|
+
18: "eighteenth",
|
|
1119
|
+
19: "nineteenth"
|
|
1120
|
+
}, y = {
|
|
1121
|
+
20: "twentieth",
|
|
1122
|
+
30: "thirtieth",
|
|
1123
|
+
40: "fortieth",
|
|
1124
|
+
50: "fiftieth",
|
|
1125
|
+
60: "sixtieth",
|
|
1126
|
+
70: "seventieth",
|
|
1127
|
+
80: "eightieth",
|
|
1128
|
+
90: "ninetieth"
|
|
1129
|
+
}, M = {
|
|
1130
|
+
20: "twenty",
|
|
1131
|
+
30: "thirty",
|
|
1132
|
+
40: "forty",
|
|
1133
|
+
50: "fifty",
|
|
1134
|
+
60: "sixty",
|
|
1135
|
+
70: "seventy",
|
|
1136
|
+
80: "eighty",
|
|
1137
|
+
90: "ninety"
|
|
1138
|
+
}, w = Object.fromEntries(
|
|
1139
|
+
Object.entries(x).map(([e, t]) => [t, Number(e)])
|
|
1140
|
+
), Fe = Object.fromEntries(
|
|
1141
|
+
Object.entries(y).map(([e, t]) => [t, Number(e)])
|
|
1142
|
+
), Pe = Object.fromEntries(
|
|
1143
|
+
Object.entries(M).map(([e, t]) => [t, Number(e)])
|
|
1144
|
+
), A = (e) => {
|
|
1145
|
+
const t = e.trim().toLowerCase();
|
|
1146
|
+
if (!t) return null;
|
|
1147
|
+
const n = w[t] ?? Fe[t];
|
|
1148
|
+
if (n) return n;
|
|
1149
|
+
const s = t.split(/[-\s]+/);
|
|
1150
|
+
if (s.length !== 2) return null;
|
|
1151
|
+
const r = Pe[s[0] ?? ""], o = w[s[1] ?? ""];
|
|
1152
|
+
return !r || !o ? null : r + o;
|
|
1153
|
+
}, v = (e) => {
|
|
1154
|
+
if (!Number.isFinite(e) || e <= 0 || Math.floor(e) !== e) return null;
|
|
1155
|
+
if (e <= 19) return x[e] ?? null;
|
|
1156
|
+
if (e < 100) {
|
|
1157
|
+
if (y[e]) return y[e] ?? null;
|
|
1158
|
+
const t = Math.floor(e / 10) * 10, n = e % 10, s = M[t], r = x[n];
|
|
1159
|
+
return !s || !r ? null : `${s}-${r}`;
|
|
1160
|
+
}
|
|
1161
|
+
return null;
|
|
1162
|
+
}, N = (e) => {
|
|
1163
|
+
const t = /^(\d+)(st|nd|rd|th)$/i.exec(e);
|
|
1164
|
+
if (t) {
|
|
1165
|
+
const s = Number(t[1]);
|
|
1166
|
+
if (!Number.isFinite(s) || s <= 0) return null;
|
|
1167
|
+
const r = t[2]?.toLowerCase();
|
|
1168
|
+
return p(s) !== r ? null : { value: s, format: "numeric" };
|
|
1169
|
+
}
|
|
1170
|
+
const n = A(e);
|
|
1171
|
+
return n !== null ? { value: n, format: "word" } : null;
|
|
1172
|
+
}, Ve = {
|
|
1108
1173
|
id: "ordinal-en",
|
|
1109
1174
|
langs: ["en"],
|
|
1110
1175
|
match(e) {
|
|
1111
1176
|
if (e.length < 2) return null;
|
|
1112
|
-
const
|
|
1113
|
-
if (
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1177
|
+
const t = e.map((o) => N(o));
|
|
1178
|
+
if (t.some((o) => o === null)) return null;
|
|
1179
|
+
const n = t[0].format;
|
|
1180
|
+
if (t.some((o) => o?.format !== n)) return null;
|
|
1181
|
+
const s = t.map((o) => o.value), r = s[1] - s[0];
|
|
1182
|
+
for (let o = 2; o < s.length; o += 1)
|
|
1183
|
+
if (s[o] - s[o - 1] !== r) return null;
|
|
1184
|
+
return { score: 80, step: r, state: { format: n } };
|
|
1118
1185
|
},
|
|
1119
|
-
createIterator(e,
|
|
1120
|
-
|
|
1186
|
+
createIterator(e, t) {
|
|
1187
|
+
const n = N(e[e.length - 1] ?? ""), s = t.state?.format ?? "numeric";
|
|
1188
|
+
let r = n?.value ?? 0;
|
|
1121
1189
|
return {
|
|
1122
1190
|
next() {
|
|
1123
|
-
|
|
1191
|
+
if (r += t.step, r <= 0 || !Number.isFinite(r))
|
|
1192
|
+
return { value: void 0, done: !0 };
|
|
1193
|
+
if (s === "word") {
|
|
1194
|
+
const o = v(r);
|
|
1195
|
+
return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
|
|
1196
|
+
}
|
|
1197
|
+
return { value: `${r}${p(r)}`, done: !1 };
|
|
1124
1198
|
}
|
|
1125
1199
|
};
|
|
1126
1200
|
}
|
|
1127
|
-
},
|
|
1128
|
-
for (const
|
|
1129
|
-
e.register(
|
|
1130
|
-
},
|
|
1131
|
-
e.registerMatch(
|
|
1132
|
-
},
|
|
1133
|
-
const
|
|
1134
|
-
return
|
|
1135
|
-
},
|
|
1136
|
-
let
|
|
1201
|
+
}, Je = (e) => {
|
|
1202
|
+
for (const t of $e)
|
|
1203
|
+
e.register(t);
|
|
1204
|
+
}, Re = (e) => {
|
|
1205
|
+
e.registerMatch(Ve);
|
|
1206
|
+
}, De = (e) => {
|
|
1207
|
+
const t = e ?? ["en", "ja"], n = new z({ langs: t });
|
|
1208
|
+
return Je(n), Re(n), n;
|
|
1209
|
+
}, Ke = (e) => {
|
|
1210
|
+
let t = 0;
|
|
1137
1211
|
return {
|
|
1138
1212
|
next() {
|
|
1139
1213
|
if (e.length === 0)
|
|
1140
1214
|
return { value: void 0, done: !0 };
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1215
|
+
const n = e[t % e.length];
|
|
1216
|
+
return t += 1, { value: n, done: !1 };
|
|
1143
1217
|
}
|
|
1144
1218
|
};
|
|
1145
1219
|
};
|
|
1146
|
-
class
|
|
1147
|
-
constructor(...
|
|
1148
|
-
const
|
|
1149
|
-
this.seed =
|
|
1220
|
+
class m {
|
|
1221
|
+
constructor(...t) {
|
|
1222
|
+
const n = t;
|
|
1223
|
+
this.seed = n, this.kind = n.length === 1 ? "copy" : "seed-repeat", this.iterator = Ke(n);
|
|
1150
1224
|
}
|
|
1151
|
-
static fromSeed(
|
|
1152
|
-
const r = new
|
|
1153
|
-
return r.kind =
|
|
1225
|
+
static fromSeed(t, n, s) {
|
|
1226
|
+
const r = new m(...t);
|
|
1227
|
+
return r.kind = n, r.iterator = s, r;
|
|
1154
1228
|
}
|
|
1155
1229
|
next() {
|
|
1156
1230
|
return this.iterator.next();
|
|
@@ -1159,74 +1233,114 @@ class f {
|
|
|
1159
1233
|
return this;
|
|
1160
1234
|
}
|
|
1161
1235
|
}
|
|
1162
|
-
const
|
|
1236
|
+
const L = 1e-9, ze = 100, Be = (e) => ({
|
|
1163
1237
|
next() {
|
|
1164
1238
|
return { value: e, done: !1 };
|
|
1165
1239
|
}
|
|
1166
|
-
}),
|
|
1167
|
-
let
|
|
1240
|
+
}), I = (e) => {
|
|
1241
|
+
let t = 0;
|
|
1168
1242
|
return {
|
|
1169
1243
|
next() {
|
|
1170
1244
|
if (e.length === 0)
|
|
1171
1245
|
return { value: void 0, done: !0 };
|
|
1172
|
-
const
|
|
1173
|
-
return
|
|
1246
|
+
const n = e[t % e.length];
|
|
1247
|
+
return t += 1, { value: n, done: !1 };
|
|
1174
1248
|
}
|
|
1175
1249
|
};
|
|
1176
|
-
},
|
|
1177
|
-
let
|
|
1250
|
+
}, Ge = (e, t) => {
|
|
1251
|
+
let n = 0;
|
|
1178
1252
|
return {
|
|
1179
1253
|
next() {
|
|
1180
|
-
return
|
|
1254
|
+
return n += 1, { value: e + t * n, done: !1 };
|
|
1181
1255
|
}
|
|
1182
1256
|
};
|
|
1183
|
-
},
|
|
1184
|
-
let
|
|
1257
|
+
}, He = (e, t) => {
|
|
1258
|
+
let n = 0;
|
|
1185
1259
|
return {
|
|
1186
1260
|
next() {
|
|
1187
|
-
return
|
|
1261
|
+
return n += 1, { value: new Date(e.getTime() + t * n), done: !1 };
|
|
1188
1262
|
}
|
|
1189
1263
|
};
|
|
1190
|
-
},
|
|
1191
|
-
let
|
|
1264
|
+
}, Ue = (e, t) => {
|
|
1265
|
+
let n = 0;
|
|
1192
1266
|
return {
|
|
1193
1267
|
next() {
|
|
1194
|
-
return
|
|
1268
|
+
return n += 1, { value: e * t ** n, done: !1 };
|
|
1195
1269
|
}
|
|
1196
1270
|
};
|
|
1197
|
-
},
|
|
1271
|
+
}, Ye = (e, t) => {
|
|
1198
1272
|
if (e.kind === "matcher")
|
|
1199
|
-
return e.matcher.createIterator(
|
|
1200
|
-
const { list:
|
|
1201
|
-
let
|
|
1273
|
+
return e.matcher.createIterator(t, { step: e.step, state: e.state });
|
|
1274
|
+
const { list: n, startIndex: s, step: r } = e, o = n.items.length;
|
|
1275
|
+
let u = s;
|
|
1202
1276
|
return {
|
|
1203
1277
|
next() {
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
return
|
|
1278
|
+
if (n.mode === "finite") {
|
|
1279
|
+
const i = u + r;
|
|
1280
|
+
return i >= o ? { value: void 0, done: !0 } : (u = i, { value: n.items[u], done: !1 });
|
|
1207
1281
|
}
|
|
1208
|
-
return
|
|
1282
|
+
return u = (u + r) % o, { value: n.items[u], done: !1 };
|
|
1209
1283
|
}
|
|
1210
1284
|
};
|
|
1211
|
-
},
|
|
1212
|
-
const
|
|
1213
|
-
if (!
|
|
1285
|
+
}, qe = (e) => e.every((t) => typeof t == "number" && Number.isFinite(t)), Xe = (e) => e.every((t) => t instanceof Date && !Number.isNaN(t.getTime())), Qe = (e) => e.every((t) => typeof t == "string"), Ze = (e) => {
|
|
1286
|
+
const t = /^(.*?)(-?\d+)([^0-9]*)$/.exec(e);
|
|
1287
|
+
if (!t)
|
|
1214
1288
|
return null;
|
|
1215
|
-
const
|
|
1289
|
+
const n = t[1] ?? "", s = t[2] ?? "", r = t[3] ?? "", o = Number(s);
|
|
1216
1290
|
if (!Number.isFinite(o))
|
|
1217
1291
|
return null;
|
|
1218
|
-
const
|
|
1219
|
-
return { prefix:
|
|
1220
|
-
},
|
|
1292
|
+
const u = s.replace("-", "").length;
|
|
1293
|
+
return { prefix: n, num: o, width: u, suffix: r };
|
|
1294
|
+
}, _e = (e) => {
|
|
1295
|
+
const t = /^(.*?)(\d+)(st|nd|rd|th)([^0-9]*)$/i.exec(e);
|
|
1296
|
+
if (t) {
|
|
1297
|
+
const r = Number(t[2]);
|
|
1298
|
+
if (!Number.isFinite(r) || r <= 0) return null;
|
|
1299
|
+
const o = t[3]?.toLowerCase();
|
|
1300
|
+
return p(r) !== o ? null : {
|
|
1301
|
+
prefix: t[1] ?? "",
|
|
1302
|
+
num: r,
|
|
1303
|
+
suffix: t[4] ?? "",
|
|
1304
|
+
format: "numeric"
|
|
1305
|
+
};
|
|
1306
|
+
}
|
|
1307
|
+
const n = /^(.*?)([A-Za-z-]+)([^A-Za-z]*)$/.exec(e);
|
|
1308
|
+
if (!n) return null;
|
|
1309
|
+
const s = A(n[2] ?? "");
|
|
1310
|
+
return s === null ? null : {
|
|
1311
|
+
prefix: n[1] ?? "",
|
|
1312
|
+
num: s,
|
|
1313
|
+
suffix: n[3] ?? "",
|
|
1314
|
+
format: "word"
|
|
1315
|
+
};
|
|
1316
|
+
}, et = (e, t, n) => {
|
|
1317
|
+
let s = 0;
|
|
1318
|
+
return {
|
|
1319
|
+
next() {
|
|
1320
|
+
s += 1;
|
|
1321
|
+
const r = t + n * s;
|
|
1322
|
+
if (r <= 0 || !Number.isFinite(r))
|
|
1323
|
+
return { value: void 0, done: !0 };
|
|
1324
|
+
if (e.format === "word") {
|
|
1325
|
+
const o = v(r);
|
|
1326
|
+
return o ? { value: `${e.prefix}${o}${e.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1327
|
+
}
|
|
1328
|
+
return {
|
|
1329
|
+
value: `${e.prefix}${r}${p(r)}${e.suffix}`,
|
|
1330
|
+
done: !1
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
}, tt = (e, t, n) => {
|
|
1221
1335
|
let s = 0;
|
|
1222
1336
|
return {
|
|
1223
1337
|
next() {
|
|
1224
1338
|
s += 1;
|
|
1225
|
-
const r =
|
|
1226
|
-
return { value: `${e.prefix}${o}${
|
|
1339
|
+
const r = t + n * s, o = r < 0 ? "-" : "", u = Math.abs(r).toString().padStart(e.width, "0");
|
|
1340
|
+
return { value: `${e.prefix}${o}${u}${e.suffix}`, done: !1 };
|
|
1227
1341
|
}
|
|
1228
1342
|
};
|
|
1229
|
-
},
|
|
1343
|
+
}, E = [
|
|
1230
1344
|
["C", 100],
|
|
1231
1345
|
["XC", 90],
|
|
1232
1346
|
["L", 50],
|
|
@@ -1236,62 +1350,62 @@ const I = 1e-9, Oe = 100, Pe = (e) => ({
|
|
|
1236
1350
|
["V", 5],
|
|
1237
1351
|
["IV", 4],
|
|
1238
1352
|
["I", 1]
|
|
1239
|
-
],
|
|
1240
|
-
if (e < 1 || e >
|
|
1353
|
+
], j = (e) => {
|
|
1354
|
+
if (e < 1 || e > ze)
|
|
1241
1355
|
return null;
|
|
1242
|
-
let
|
|
1243
|
-
for (const [s, r] of
|
|
1244
|
-
for (;
|
|
1245
|
-
|
|
1246
|
-
return
|
|
1247
|
-
},
|
|
1356
|
+
let t = e, n = "";
|
|
1357
|
+
for (const [s, r] of E)
|
|
1358
|
+
for (; t >= r; )
|
|
1359
|
+
n += s, t -= r;
|
|
1360
|
+
return n;
|
|
1361
|
+
}, W = (e) => {
|
|
1248
1362
|
if (e.length === 0 || e !== e.toUpperCase())
|
|
1249
1363
|
return null;
|
|
1250
|
-
let
|
|
1251
|
-
for (const [r, o] of
|
|
1252
|
-
for (;
|
|
1253
|
-
|
|
1254
|
-
if (
|
|
1364
|
+
let t = e, n = 0;
|
|
1365
|
+
for (const [r, o] of E)
|
|
1366
|
+
for (; t.startsWith(r); )
|
|
1367
|
+
n += o, t = t.slice(r.length);
|
|
1368
|
+
if (t.length > 0)
|
|
1255
1369
|
return null;
|
|
1256
|
-
const s =
|
|
1257
|
-
return !s || s !== e ? null :
|
|
1258
|
-
},
|
|
1259
|
-
let
|
|
1370
|
+
const s = j(n);
|
|
1371
|
+
return !s || s !== e ? null : n;
|
|
1372
|
+
}, nt = (e, t) => {
|
|
1373
|
+
let n = 0;
|
|
1260
1374
|
return {
|
|
1261
1375
|
next() {
|
|
1262
|
-
|
|
1263
|
-
const s = e +
|
|
1376
|
+
n += 1;
|
|
1377
|
+
const s = e + t * n, r = j(s);
|
|
1264
1378
|
return r ? { value: r, done: !1 } : { value: void 0, done: !0 };
|
|
1265
1379
|
}
|
|
1266
1380
|
};
|
|
1267
|
-
},
|
|
1268
|
-
const
|
|
1269
|
-
let
|
|
1381
|
+
}, st = (e) => new RegExp("\\p{White_Space}", "u").test(e) ? "space" : new RegExp("\\p{P}", "u").test(e) ? "punct" : new RegExp("\\p{S}", "u").test(e) ? "symbol" : new RegExp("\\p{Script=Latin}", "u").test(e) ? "latin" : new RegExp("\\p{Script=Han}", "u").test(e) ? "han" : new RegExp("\\p{Script=Hiragana}", "u").test(e) ? "hiragana" : new RegExp("\\p{Script=Katakana}", "u").test(e) ? "katakana" : new RegExp("\\p{N}", "u").test(e) ? "number" : "other", rt = (e) => {
|
|
1382
|
+
const t = [];
|
|
1383
|
+
let n = "", s = null;
|
|
1270
1384
|
for (const r of e) {
|
|
1271
|
-
const o =
|
|
1385
|
+
const o = st(r);
|
|
1272
1386
|
if (s === o) {
|
|
1273
|
-
|
|
1387
|
+
n += r;
|
|
1274
1388
|
continue;
|
|
1275
1389
|
}
|
|
1276
|
-
s !== null &&
|
|
1390
|
+
s !== null && t.push({ value: n, group: s }), n = r, s = o;
|
|
1277
1391
|
}
|
|
1278
|
-
return s !== null &&
|
|
1279
|
-
},
|
|
1280
|
-
const
|
|
1281
|
-
if (
|
|
1392
|
+
return s !== null && t.push({ value: n, group: s }), t;
|
|
1393
|
+
}, it = (e) => {
|
|
1394
|
+
const t = rt(e), n = t.map((i, a) => ({ index: a, num: W(i.value) })).filter((i) => i.num !== null);
|
|
1395
|
+
if (n.length !== 1)
|
|
1282
1396
|
return null;
|
|
1283
|
-
const s =
|
|
1284
|
-
return { prefix: o, num: r, suffix:
|
|
1285
|
-
},
|
|
1397
|
+
const s = n[0].index, r = n[0].num, o = t.slice(0, s).map((i) => i.value).join(""), u = t.slice(s + 1).map((i) => i.value).join("");
|
|
1398
|
+
return { prefix: o, num: r, suffix: u };
|
|
1399
|
+
}, ot = (e, t, n) => {
|
|
1286
1400
|
let s = 0;
|
|
1287
1401
|
return {
|
|
1288
1402
|
next() {
|
|
1289
1403
|
s += 1;
|
|
1290
|
-
const r =
|
|
1404
|
+
const r = t + n * s, o = j(r);
|
|
1291
1405
|
return o ? { value: `${e.prefix}${o}${e.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1292
1406
|
}
|
|
1293
1407
|
};
|
|
1294
|
-
},
|
|
1408
|
+
}, b = {
|
|
1295
1409
|
一: 1,
|
|
1296
1410
|
二: 2,
|
|
1297
1411
|
三: 3,
|
|
@@ -1301,7 +1415,7 @@ const I = 1e-9, Oe = 100, Pe = (e) => ({
|
|
|
1301
1415
|
七: 7,
|
|
1302
1416
|
八: 8,
|
|
1303
1417
|
九: 9
|
|
1304
|
-
},
|
|
1418
|
+
}, S = {
|
|
1305
1419
|
壱: 1,
|
|
1306
1420
|
弐: 2,
|
|
1307
1421
|
参: 3,
|
|
@@ -1311,253 +1425,276 @@ const I = 1e-9, Oe = 100, Pe = (e) => ({
|
|
|
1311
1425
|
柒: 7,
|
|
1312
1426
|
捌: 8,
|
|
1313
1427
|
玖: 9
|
|
1314
|
-
},
|
|
1428
|
+
}, C = {
|
|
1315
1429
|
十: 10,
|
|
1316
1430
|
拾: 10,
|
|
1317
1431
|
百: 100,
|
|
1318
1432
|
佰: 100,
|
|
1319
1433
|
千: 1e3,
|
|
1320
1434
|
仟: 1e3
|
|
1321
|
-
},
|
|
1435
|
+
}, O = {
|
|
1322
1436
|
万: 1e4,
|
|
1323
1437
|
萬: 1e4
|
|
1324
|
-
},
|
|
1325
|
-
...Object.keys(
|
|
1326
|
-
...Object.keys(
|
|
1327
|
-
...Object.keys(
|
|
1328
|
-
...Object.keys(
|
|
1329
|
-
]),
|
|
1438
|
+
}, at = /* @__PURE__ */ new Set([
|
|
1439
|
+
...Object.keys(b),
|
|
1440
|
+
...Object.keys(S),
|
|
1441
|
+
...Object.keys(C),
|
|
1442
|
+
...Object.keys(O)
|
|
1443
|
+
]), ut = (e) => at.has(e), lt = (e) => /[壱弐参肆伍陸柒捌玖拾萬佰仟]/.test(e) ? "traditional" : "modern", $ = (e) => {
|
|
1330
1444
|
if (!e)
|
|
1331
1445
|
return null;
|
|
1332
|
-
const
|
|
1446
|
+
const t = lt(e);
|
|
1333
1447
|
if (e.includes("万") || e.includes("萬")) {
|
|
1334
|
-
const
|
|
1335
|
-
if (!
|
|
1448
|
+
const i = /^([一二三四五六七八九壱弐参肆伍陸柒捌玖])?(万|萬)$/.exec(e);
|
|
1449
|
+
if (!i)
|
|
1336
1450
|
return null;
|
|
1337
|
-
const
|
|
1338
|
-
return
|
|
1451
|
+
const a = i[1];
|
|
1452
|
+
return a ? (b[a] ?? S[a]) !== 1 ? null : { num: 1e4, style: t } : { num: 1e4, style: t };
|
|
1339
1453
|
}
|
|
1340
|
-
let s = 0, r = 0, o = Number.POSITIVE_INFINITY,
|
|
1341
|
-
for (const
|
|
1342
|
-
const
|
|
1343
|
-
if (
|
|
1344
|
-
if (
|
|
1454
|
+
let s = 0, r = 0, o = Number.POSITIVE_INFINITY, u = !1;
|
|
1455
|
+
for (const i of e) {
|
|
1456
|
+
const a = b[i] ?? S[i];
|
|
1457
|
+
if (a) {
|
|
1458
|
+
if (u)
|
|
1345
1459
|
return null;
|
|
1346
|
-
r =
|
|
1460
|
+
r = a, u = !0;
|
|
1347
1461
|
continue;
|
|
1348
1462
|
}
|
|
1349
|
-
const l =
|
|
1463
|
+
const l = C[i];
|
|
1350
1464
|
if (l) {
|
|
1351
1465
|
if (l >= o)
|
|
1352
1466
|
return null;
|
|
1353
|
-
r === 0 && (r = 1), s += r * l, r = 0, o = l,
|
|
1467
|
+
r === 0 && (r = 1), s += r * l, r = 0, o = l, u = !1;
|
|
1354
1468
|
continue;
|
|
1355
1469
|
}
|
|
1356
|
-
return
|
|
1470
|
+
return O[i], null;
|
|
1357
1471
|
}
|
|
1358
|
-
return s += r, s <= 0 || s > 1e4 ? null : { num: s, style:
|
|
1359
|
-
},
|
|
1360
|
-
const
|
|
1361
|
-
let
|
|
1472
|
+
return s += r, s <= 0 || s > 1e4 ? null : { num: s, style: t };
|
|
1473
|
+
}, ct = (e) => {
|
|
1474
|
+
const t = [];
|
|
1475
|
+
let n = "", s = 0, r = 0;
|
|
1362
1476
|
for (const l of e)
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
const o =
|
|
1477
|
+
ut(l) ? (n || (s = r), n += l) : n && (t.push({ start: s, end: r, text: n }), n = ""), r += l.length;
|
|
1478
|
+
n && t.push({ start: s, end: r, text: n });
|
|
1479
|
+
const o = t.map((l) => ({ run: l, parsed: $(l.text) })).filter((l) => l.parsed !== null);
|
|
1366
1480
|
if (o.length !== 1)
|
|
1367
1481
|
return null;
|
|
1368
|
-
const
|
|
1482
|
+
const u = o[0], i = e.slice(0, u.run.start), a = e.slice(u.run.end);
|
|
1369
1483
|
return {
|
|
1370
|
-
prefix:
|
|
1371
|
-
num:
|
|
1372
|
-
suffix:
|
|
1373
|
-
style:
|
|
1484
|
+
prefix: i,
|
|
1485
|
+
num: u.parsed.num,
|
|
1486
|
+
suffix: a,
|
|
1487
|
+
style: u.parsed.style
|
|
1374
1488
|
};
|
|
1375
|
-
},
|
|
1489
|
+
}, F = (e, t) => {
|
|
1376
1490
|
if (!Number.isFinite(e) || e <= 0 || e > 1e4)
|
|
1377
1491
|
return null;
|
|
1378
|
-
const
|
|
1492
|
+
const n = t === "traditional" ? ["", "壱", "弐", "参", "肆", "伍", "陸", "柒", "捌", "玖"] : ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"], s = t === "traditional" ? "拾" : "十", r = t === "traditional" ? "萬" : "万";
|
|
1379
1493
|
if (e === 1e4)
|
|
1380
|
-
return `${
|
|
1381
|
-
let o = e,
|
|
1382
|
-
const
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1494
|
+
return `${n[1]}${r}`;
|
|
1495
|
+
let o = e, u = "";
|
|
1496
|
+
const i = Math.floor(o / 1e3);
|
|
1497
|
+
i > 0 && (i > 1 && (u += n[i]), u += "千", o %= 1e3);
|
|
1498
|
+
const a = Math.floor(o / 100);
|
|
1499
|
+
a > 0 && (a > 1 && (u += n[a]), u += "百", o %= 100);
|
|
1386
1500
|
const l = Math.floor(o / 10);
|
|
1387
|
-
return l > 0 && (l > 1 && (
|
|
1388
|
-
},
|
|
1501
|
+
return l > 0 && (l > 1 && (u += n[l]), u += s, o %= 10), o > 0 && (u += n[o]), u || null;
|
|
1502
|
+
}, ft = (e, t, n) => {
|
|
1389
1503
|
let s = 0;
|
|
1390
1504
|
return {
|
|
1391
1505
|
next() {
|
|
1392
1506
|
s += 1;
|
|
1393
|
-
const r = e +
|
|
1507
|
+
const r = e + t * s, o = F(r, n);
|
|
1394
1508
|
return o ? { value: o, done: !1 } : { value: void 0, done: !0 };
|
|
1395
1509
|
}
|
|
1396
1510
|
};
|
|
1397
|
-
},
|
|
1511
|
+
}, dt = (e, t, n) => {
|
|
1398
1512
|
let s = 0;
|
|
1399
1513
|
return {
|
|
1400
1514
|
next() {
|
|
1401
1515
|
s += 1;
|
|
1402
|
-
const r =
|
|
1516
|
+
const r = t + n * s, o = F(r, e.style);
|
|
1403
1517
|
return o ? { value: `${e.prefix}${o}${e.suffix}`, done: !1 } : { value: void 0, done: !0 };
|
|
1404
1518
|
}
|
|
1405
1519
|
};
|
|
1406
|
-
},
|
|
1520
|
+
}, h = (e) => {
|
|
1407
1521
|
if (e.length < 2)
|
|
1408
1522
|
return null;
|
|
1409
|
-
const
|
|
1410
|
-
for (let
|
|
1411
|
-
if (Math.abs(e[
|
|
1523
|
+
const t = e[1] - e[0];
|
|
1524
|
+
for (let n = 2; n < e.length; n += 1)
|
|
1525
|
+
if (Math.abs(e[n] - e[n - 1] - t) > L)
|
|
1412
1526
|
return null;
|
|
1413
|
-
return
|
|
1414
|
-
},
|
|
1527
|
+
return t;
|
|
1528
|
+
}, mt = (e) => {
|
|
1415
1529
|
if (e.length < 2 || e[0] === 0)
|
|
1416
1530
|
return null;
|
|
1417
|
-
const
|
|
1418
|
-
for (let
|
|
1419
|
-
if (e[
|
|
1531
|
+
const t = e[1] / e[0];
|
|
1532
|
+
for (let n = 2; n < e.length; n += 1)
|
|
1533
|
+
if (e[n - 1] === 0 || Math.abs(e[n] / e[n - 1] - t) > L)
|
|
1420
1534
|
return null;
|
|
1421
|
-
return
|
|
1422
|
-
},
|
|
1423
|
-
const
|
|
1535
|
+
return t;
|
|
1536
|
+
}, ht = (e) => {
|
|
1537
|
+
const t = e.map((i) => _e(i));
|
|
1538
|
+
if (t.every((i) => i !== null)) {
|
|
1539
|
+
const i = t, a = i[0];
|
|
1540
|
+
if (i.every(
|
|
1541
|
+
(c) => c.prefix === a.prefix && c.suffix === a.suffix && c.format === a.format
|
|
1542
|
+
)) {
|
|
1543
|
+
const c = i.map((d) => d.num), f = h(c);
|
|
1544
|
+
if (f !== null) {
|
|
1545
|
+
const d = i[i.length - 1];
|
|
1546
|
+
return {
|
|
1547
|
+
kind: "arithmetic",
|
|
1548
|
+
iterator: et(
|
|
1549
|
+
{ prefix: a.prefix, suffix: a.suffix, format: a.format },
|
|
1550
|
+
d.num,
|
|
1551
|
+
f
|
|
1552
|
+
)
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
const n = e.map((i) => Ze(i));
|
|
1424
1558
|
if (n.every(Boolean)) {
|
|
1425
1559
|
const i = n[0], a = n[n.length - 1];
|
|
1426
1560
|
if (n.every(
|
|
1427
|
-
(
|
|
1561
|
+
(c) => c?.prefix === i.prefix && c?.suffix === i.suffix
|
|
1428
1562
|
)) {
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1563
|
+
const c = n.map((d) => d?.num ?? 0), f = h(c);
|
|
1564
|
+
if (f !== null)
|
|
1431
1565
|
return {
|
|
1432
1566
|
kind: "arithmetic",
|
|
1433
|
-
iterator:
|
|
1567
|
+
iterator: tt(
|
|
1434
1568
|
{ prefix: a.prefix, suffix: a.suffix, width: a.width },
|
|
1435
1569
|
a.num,
|
|
1436
|
-
|
|
1570
|
+
f
|
|
1437
1571
|
)
|
|
1438
1572
|
};
|
|
1439
1573
|
}
|
|
1440
1574
|
}
|
|
1441
|
-
const
|
|
1442
|
-
if (
|
|
1443
|
-
const i =
|
|
1575
|
+
const s = e.map((i) => W(i));
|
|
1576
|
+
if (s.every((i) => i !== null)) {
|
|
1577
|
+
const i = s, a = h(i);
|
|
1444
1578
|
if (a !== null) {
|
|
1445
|
-
const
|
|
1579
|
+
const l = i[i.length - 1];
|
|
1446
1580
|
return {
|
|
1447
1581
|
kind: "arithmetic",
|
|
1448
|
-
iterator:
|
|
1582
|
+
iterator: nt(l, a)
|
|
1449
1583
|
};
|
|
1450
1584
|
}
|
|
1451
1585
|
}
|
|
1452
|
-
const
|
|
1453
|
-
if (
|
|
1454
|
-
const i =
|
|
1455
|
-
if (i.every((
|
|
1456
|
-
const
|
|
1457
|
-
if (
|
|
1458
|
-
const
|
|
1586
|
+
const r = e.map((i) => $(i));
|
|
1587
|
+
if (r.every((i) => i !== null)) {
|
|
1588
|
+
const i = r, a = i[0].style;
|
|
1589
|
+
if (i.every((l) => l.style === a)) {
|
|
1590
|
+
const l = i.map((f) => f.num), c = h(l);
|
|
1591
|
+
if (c !== null) {
|
|
1592
|
+
const f = i[i.length - 1];
|
|
1459
1593
|
return {
|
|
1460
1594
|
kind: "arithmetic",
|
|
1461
|
-
iterator:
|
|
1595
|
+
iterator: ft(f.num, c, f.style)
|
|
1462
1596
|
};
|
|
1463
1597
|
}
|
|
1464
1598
|
}
|
|
1465
1599
|
}
|
|
1466
|
-
const
|
|
1467
|
-
if (
|
|
1468
|
-
const i =
|
|
1600
|
+
const o = e.map((i) => it(i));
|
|
1601
|
+
if (o.every((i) => i !== null)) {
|
|
1602
|
+
const i = o, a = i[0];
|
|
1469
1603
|
if (i.every(
|
|
1470
|
-
(
|
|
1604
|
+
(c) => c.prefix === a.prefix && c.suffix === a.suffix
|
|
1471
1605
|
)) {
|
|
1472
|
-
const
|
|
1473
|
-
if (
|
|
1474
|
-
const d =
|
|
1606
|
+
const c = i.map((d) => d.num), f = h(c);
|
|
1607
|
+
if (f !== null) {
|
|
1608
|
+
const d = c[c.length - 1];
|
|
1475
1609
|
return {
|
|
1476
1610
|
kind: "arithmetic",
|
|
1477
|
-
iterator:
|
|
1611
|
+
iterator: ot(
|
|
1478
1612
|
{ prefix: a.prefix, suffix: a.suffix },
|
|
1479
1613
|
d,
|
|
1480
|
-
|
|
1614
|
+
f
|
|
1481
1615
|
)
|
|
1482
1616
|
};
|
|
1483
1617
|
}
|
|
1484
1618
|
}
|
|
1485
1619
|
}
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
const i =
|
|
1620
|
+
const u = e.map((i) => ct(i));
|
|
1621
|
+
if (u.every((i) => i !== null)) {
|
|
1622
|
+
const i = u, a = i[0];
|
|
1489
1623
|
if (i.every(
|
|
1490
|
-
(
|
|
1624
|
+
(c) => c.prefix === a.prefix && c.suffix === a.suffix && c.style === a.style
|
|
1491
1625
|
)) {
|
|
1492
|
-
const
|
|
1493
|
-
if (
|
|
1626
|
+
const c = i.map((d) => d.num), f = h(c);
|
|
1627
|
+
if (f !== null) {
|
|
1494
1628
|
const d = i[i.length - 1];
|
|
1495
1629
|
return {
|
|
1496
1630
|
kind: "arithmetic",
|
|
1497
|
-
iterator:
|
|
1631
|
+
iterator: dt(
|
|
1498
1632
|
{ prefix: a.prefix, suffix: a.suffix, style: a.style },
|
|
1499
1633
|
d.num,
|
|
1500
|
-
|
|
1634
|
+
f
|
|
1501
1635
|
)
|
|
1502
1636
|
};
|
|
1503
1637
|
}
|
|
1504
1638
|
}
|
|
1505
1639
|
}
|
|
1506
1640
|
return null;
|
|
1507
|
-
},
|
|
1508
|
-
const
|
|
1509
|
-
return
|
|
1641
|
+
}, gt = (e, t) => {
|
|
1642
|
+
const n = t.match(e);
|
|
1643
|
+
return n ? {
|
|
1510
1644
|
kind: "list",
|
|
1511
|
-
iterator:
|
|
1645
|
+
iterator: Ye(n, e)
|
|
1512
1646
|
} : null;
|
|
1513
1647
|
};
|
|
1514
|
-
function
|
|
1515
|
-
const
|
|
1648
|
+
function pt(e, t) {
|
|
1649
|
+
const n = t?.registry ?? De();
|
|
1516
1650
|
if (e.length === 0)
|
|
1517
|
-
return
|
|
1651
|
+
return m.fromSeed(e, "seed-repeat", I(e));
|
|
1518
1652
|
if (e.length === 1)
|
|
1519
|
-
return
|
|
1520
|
-
if (
|
|
1521
|
-
const s =
|
|
1653
|
+
return m.fromSeed(e, "copy", Be(e[0]));
|
|
1654
|
+
if (Qe(e)) {
|
|
1655
|
+
const s = gt(e, n);
|
|
1522
1656
|
if (s)
|
|
1523
|
-
return
|
|
1524
|
-
const r =
|
|
1657
|
+
return m.fromSeed(e, s.kind, s.iterator);
|
|
1658
|
+
const r = ht(e);
|
|
1525
1659
|
if (r)
|
|
1526
|
-
return
|
|
1660
|
+
return m.fromSeed(e, r.kind, r.iterator);
|
|
1527
1661
|
}
|
|
1528
|
-
if (
|
|
1529
|
-
const s =
|
|
1662
|
+
if (qe(e)) {
|
|
1663
|
+
const s = h(e);
|
|
1530
1664
|
if (s !== null)
|
|
1531
|
-
return
|
|
1665
|
+
return m.fromSeed(
|
|
1532
1666
|
e,
|
|
1533
1667
|
"arithmetic",
|
|
1534
|
-
|
|
1668
|
+
Ge(e[e.length - 1], s)
|
|
1535
1669
|
);
|
|
1536
|
-
const r =
|
|
1670
|
+
const r = mt(e);
|
|
1537
1671
|
if (r !== null)
|
|
1538
|
-
return
|
|
1672
|
+
return m.fromSeed(
|
|
1539
1673
|
e,
|
|
1540
1674
|
"geometric",
|
|
1541
|
-
|
|
1675
|
+
Ue(e[e.length - 1], r)
|
|
1542
1676
|
);
|
|
1543
1677
|
}
|
|
1544
|
-
if (
|
|
1545
|
-
const s = e.map((o) => o.getTime()), r =
|
|
1678
|
+
if (Xe(e)) {
|
|
1679
|
+
const s = e.map((o) => o.getTime()), r = h(s);
|
|
1546
1680
|
if (r !== null)
|
|
1547
|
-
return
|
|
1681
|
+
return m.fromSeed(
|
|
1548
1682
|
e,
|
|
1549
1683
|
"arithmetic",
|
|
1550
|
-
|
|
1684
|
+
He(e[e.length - 1], r)
|
|
1551
1685
|
);
|
|
1552
1686
|
}
|
|
1553
|
-
return
|
|
1687
|
+
return m.fromSeed(e, "seed-repeat", I(e));
|
|
1554
1688
|
}
|
|
1555
1689
|
export {
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1690
|
+
m as Sequence,
|
|
1691
|
+
z as SequenceRegistry,
|
|
1692
|
+
De as createBuiltInRegistry,
|
|
1693
|
+
v as formatEnglishOrdinalWord,
|
|
1694
|
+
pt as inferSequence,
|
|
1695
|
+
p as ordinalSuffix,
|
|
1696
|
+
A as parseEnglishOrdinalWord,
|
|
1697
|
+
Je as registerBuiltInLists,
|
|
1698
|
+
Re as registerBuiltInMatchers
|
|
1562
1699
|
};
|
|
1563
1700
|
//# sourceMappingURL=index.js.map
|