@fewangsit/wangsvue-fats 1.0.1-alpha.50 → 1.0.1-alpha.51
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/basecalendar/index.es.js +270 -261
- package/package.json +1 -1
- package/stats.html +1 -1
- package/style.css +1 -1
- package/vendor/luxon/src/datetime.es.js +1845 -0
- package/vendor/luxon/src/duration.es.js +734 -0
- package/vendor/luxon/src/errors.es.js +40 -0
- package/vendor/luxon/src/impl/conversions.es.js +92 -0
- package/vendor/luxon/src/impl/diff.es.js +36 -0
- package/vendor/luxon/src/impl/digits.es.js +77 -0
- package/vendor/luxon/src/impl/english.es.js +132 -0
- package/vendor/luxon/src/impl/formats.es.js +150 -0
- package/vendor/luxon/src/impl/formatter.es.js +274 -0
- package/vendor/luxon/src/impl/invalid.es.js +11 -0
- package/vendor/luxon/src/impl/locale.es.js +293 -0
- package/vendor/luxon/src/impl/regexParser.es.js +202 -0
- package/vendor/luxon/src/impl/tokenParser.es.js +344 -0
- package/vendor/luxon/src/impl/util.es.js +217 -0
- package/vendor/luxon/src/impl/zoneUtil.es.js +19 -0
- package/vendor/luxon/src/info.es.js +180 -0
- package/vendor/luxon/src/interval.es.js +477 -0
- package/vendor/luxon/src/luxon.es.js +2 -0
- package/vendor/luxon/src/settings.es.js +150 -0
- package/vendor/luxon/src/zone.es.js +88 -0
- package/vendor/luxon/src/zones/IANAZone.es.js +181 -0
- package/vendor/luxon/src/zones/fixedOffsetZone.es.js +125 -0
- package/vendor/luxon/src/zones/invalidZone.es.js +41 -0
- package/vendor/luxon/src/zones/systemZone.es.js +47 -0
- package/wangsvue-fats.esm.browser.js +21318 -15799
- package/wangsvue-fats.system.js +73 -73
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { e as M, m as F, w as S, a as g } from "./english.es.js";
|
|
2
|
+
import { t as p, r as _, o as k, m as w, s as L, q as I, n as O, l as Z, k as d, j as H, i as W, h as N, g as v, f as A, e as G, T as C, d as U, c as b, a as q, D as R } from "./formats.es.js";
|
|
3
|
+
import { p as z } from "./util.es.js";
|
|
4
|
+
function E(D, e) {
|
|
5
|
+
let r = "";
|
|
6
|
+
for (const t of D)
|
|
7
|
+
t.literal ? r += t.val : r += e(t.val);
|
|
8
|
+
return r;
|
|
9
|
+
}
|
|
10
|
+
const x = {
|
|
11
|
+
D: R,
|
|
12
|
+
DD: q,
|
|
13
|
+
DDD: b,
|
|
14
|
+
DDDD: U,
|
|
15
|
+
t: C,
|
|
16
|
+
tt: G,
|
|
17
|
+
ttt: A,
|
|
18
|
+
tttt: v,
|
|
19
|
+
T: N,
|
|
20
|
+
TT: W,
|
|
21
|
+
TTT: H,
|
|
22
|
+
TTTT: d,
|
|
23
|
+
f: Z,
|
|
24
|
+
ff: O,
|
|
25
|
+
fff: I,
|
|
26
|
+
ffff: L,
|
|
27
|
+
F: w,
|
|
28
|
+
FF: k,
|
|
29
|
+
FFF: _,
|
|
30
|
+
FFFF: p
|
|
31
|
+
};
|
|
32
|
+
class T {
|
|
33
|
+
static create(e, r = {}) {
|
|
34
|
+
return new T(e, r);
|
|
35
|
+
}
|
|
36
|
+
static parseFormat(e) {
|
|
37
|
+
let r = null, t = "", a = !1;
|
|
38
|
+
const n = [];
|
|
39
|
+
for (let o = 0; o < e.length; o++) {
|
|
40
|
+
const u = e.charAt(o);
|
|
41
|
+
u === "'" ? ((t.length > 0 || a) && n.push({
|
|
42
|
+
literal: a || /^\s+$/.test(t),
|
|
43
|
+
val: t === "" ? "'" : t
|
|
44
|
+
}), r = null, t = "", a = !a) : a || u === r ? t += u : (t.length > 0 && n.push({ literal: /^\s+$/.test(t), val: t }), t = u, r = u);
|
|
45
|
+
}
|
|
46
|
+
return t.length > 0 && n.push({ literal: a || /^\s+$/.test(t), val: t }), n;
|
|
47
|
+
}
|
|
48
|
+
static macroTokenToFormatOpts(e) {
|
|
49
|
+
return x[e];
|
|
50
|
+
}
|
|
51
|
+
constructor(e, r) {
|
|
52
|
+
this.opts = r, this.loc = e, this.systemLoc = null;
|
|
53
|
+
}
|
|
54
|
+
formatWithSystemDefault(e, r) {
|
|
55
|
+
return this.systemLoc === null && (this.systemLoc = this.loc.redefaultToSystem()), this.systemLoc.dtFormatter(e, { ...this.opts, ...r }).format();
|
|
56
|
+
}
|
|
57
|
+
dtFormatter(e, r = {}) {
|
|
58
|
+
return this.loc.dtFormatter(e, { ...this.opts, ...r });
|
|
59
|
+
}
|
|
60
|
+
formatDateTime(e, r) {
|
|
61
|
+
return this.dtFormatter(e, r).format();
|
|
62
|
+
}
|
|
63
|
+
formatDateTimeParts(e, r) {
|
|
64
|
+
return this.dtFormatter(e, r).formatToParts();
|
|
65
|
+
}
|
|
66
|
+
formatInterval(e, r) {
|
|
67
|
+
return this.dtFormatter(e.start, r).dtf.formatRange(e.start.toJSDate(), e.end.toJSDate());
|
|
68
|
+
}
|
|
69
|
+
resolvedOptions(e, r) {
|
|
70
|
+
return this.dtFormatter(e, r).resolvedOptions();
|
|
71
|
+
}
|
|
72
|
+
num(e, r = 0, t = void 0) {
|
|
73
|
+
if (this.opts.forceSimple)
|
|
74
|
+
return z(e, r);
|
|
75
|
+
const a = { ...this.opts };
|
|
76
|
+
return r > 0 && (a.padTo = r), t && (a.signDisplay = t), this.loc.numberFormatter(a).format(e);
|
|
77
|
+
}
|
|
78
|
+
formatDateTimeFromString(e, r) {
|
|
79
|
+
const t = this.loc.listingMode() === "en", a = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", n = (s, m) => this.loc.extract(e, s, m), o = (s) => e.isOffsetFixed && e.offset === 0 && s.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, s.format) : "", u = () => t ? g(e) : n({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), i = (s, m) => t ? F(e, s) : n(m ? { month: s } : { month: s, day: "numeric" }, "month"), h = (s, m) => t ? S(e, s) : n(
|
|
80
|
+
m ? { weekday: s } : { weekday: s, month: "long", day: "numeric" },
|
|
81
|
+
"weekday"
|
|
82
|
+
), c = (s) => {
|
|
83
|
+
const m = T.macroTokenToFormatOpts(s);
|
|
84
|
+
return m ? this.formatWithSystemDefault(e, m) : s;
|
|
85
|
+
}, l = (s) => t ? M(e, s) : n({ era: s }, "era"), f = (s) => {
|
|
86
|
+
switch (s) {
|
|
87
|
+
// ms
|
|
88
|
+
case "S":
|
|
89
|
+
return this.num(e.millisecond);
|
|
90
|
+
case "u":
|
|
91
|
+
// falls through
|
|
92
|
+
case "SSS":
|
|
93
|
+
return this.num(e.millisecond, 3);
|
|
94
|
+
// seconds
|
|
95
|
+
case "s":
|
|
96
|
+
return this.num(e.second);
|
|
97
|
+
case "ss":
|
|
98
|
+
return this.num(e.second, 2);
|
|
99
|
+
// fractional seconds
|
|
100
|
+
case "uu":
|
|
101
|
+
return this.num(Math.floor(e.millisecond / 10), 2);
|
|
102
|
+
case "uuu":
|
|
103
|
+
return this.num(Math.floor(e.millisecond / 100));
|
|
104
|
+
// minutes
|
|
105
|
+
case "m":
|
|
106
|
+
return this.num(e.minute);
|
|
107
|
+
case "mm":
|
|
108
|
+
return this.num(e.minute, 2);
|
|
109
|
+
// hours
|
|
110
|
+
case "h":
|
|
111
|
+
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12);
|
|
112
|
+
case "hh":
|
|
113
|
+
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12, 2);
|
|
114
|
+
case "H":
|
|
115
|
+
return this.num(e.hour);
|
|
116
|
+
case "HH":
|
|
117
|
+
return this.num(e.hour, 2);
|
|
118
|
+
// offset
|
|
119
|
+
case "Z":
|
|
120
|
+
return o({ format: "narrow", allowZ: this.opts.allowZ });
|
|
121
|
+
case "ZZ":
|
|
122
|
+
return o({ format: "short", allowZ: this.opts.allowZ });
|
|
123
|
+
case "ZZZ":
|
|
124
|
+
return o({ format: "techie", allowZ: this.opts.allowZ });
|
|
125
|
+
case "ZZZZ":
|
|
126
|
+
return e.zone.offsetName(e.ts, { format: "short", locale: this.loc.locale });
|
|
127
|
+
case "ZZZZZ":
|
|
128
|
+
return e.zone.offsetName(e.ts, { format: "long", locale: this.loc.locale });
|
|
129
|
+
// zone
|
|
130
|
+
case "z":
|
|
131
|
+
return e.zoneName;
|
|
132
|
+
// meridiems
|
|
133
|
+
case "a":
|
|
134
|
+
return u();
|
|
135
|
+
// dates
|
|
136
|
+
case "d":
|
|
137
|
+
return a ? n({ day: "numeric" }, "day") : this.num(e.day);
|
|
138
|
+
case "dd":
|
|
139
|
+
return a ? n({ day: "2-digit" }, "day") : this.num(e.day, 2);
|
|
140
|
+
// weekdays - standalone
|
|
141
|
+
case "c":
|
|
142
|
+
return this.num(e.weekday);
|
|
143
|
+
case "ccc":
|
|
144
|
+
return h("short", !0);
|
|
145
|
+
case "cccc":
|
|
146
|
+
return h("long", !0);
|
|
147
|
+
case "ccccc":
|
|
148
|
+
return h("narrow", !0);
|
|
149
|
+
// weekdays - format
|
|
150
|
+
case "E":
|
|
151
|
+
return this.num(e.weekday);
|
|
152
|
+
case "EEE":
|
|
153
|
+
return h("short", !1);
|
|
154
|
+
case "EEEE":
|
|
155
|
+
return h("long", !1);
|
|
156
|
+
case "EEEEE":
|
|
157
|
+
return h("narrow", !1);
|
|
158
|
+
// months - standalone
|
|
159
|
+
case "L":
|
|
160
|
+
return a ? n({ month: "numeric", day: "numeric" }, "month") : this.num(e.month);
|
|
161
|
+
case "LL":
|
|
162
|
+
return a ? n({ month: "2-digit", day: "numeric" }, "month") : this.num(e.month, 2);
|
|
163
|
+
case "LLL":
|
|
164
|
+
return i("short", !0);
|
|
165
|
+
case "LLLL":
|
|
166
|
+
return i("long", !0);
|
|
167
|
+
case "LLLLL":
|
|
168
|
+
return i("narrow", !0);
|
|
169
|
+
// months - format
|
|
170
|
+
case "M":
|
|
171
|
+
return a ? n({ month: "numeric" }, "month") : this.num(e.month);
|
|
172
|
+
case "MM":
|
|
173
|
+
return a ? n({ month: "2-digit" }, "month") : this.num(e.month, 2);
|
|
174
|
+
case "MMM":
|
|
175
|
+
return i("short", !1);
|
|
176
|
+
case "MMMM":
|
|
177
|
+
return i("long", !1);
|
|
178
|
+
case "MMMMM":
|
|
179
|
+
return i("narrow", !1);
|
|
180
|
+
// years
|
|
181
|
+
case "y":
|
|
182
|
+
return a ? n({ year: "numeric" }, "year") : this.num(e.year);
|
|
183
|
+
case "yy":
|
|
184
|
+
return a ? n({ year: "2-digit" }, "year") : this.num(e.year.toString().slice(-2), 2);
|
|
185
|
+
case "yyyy":
|
|
186
|
+
return a ? n({ year: "numeric" }, "year") : this.num(e.year, 4);
|
|
187
|
+
case "yyyyyy":
|
|
188
|
+
return a ? n({ year: "numeric" }, "year") : this.num(e.year, 6);
|
|
189
|
+
// eras
|
|
190
|
+
case "G":
|
|
191
|
+
return l("short");
|
|
192
|
+
case "GG":
|
|
193
|
+
return l("long");
|
|
194
|
+
case "GGGGG":
|
|
195
|
+
return l("narrow");
|
|
196
|
+
case "kk":
|
|
197
|
+
return this.num(e.weekYear.toString().slice(-2), 2);
|
|
198
|
+
case "kkkk":
|
|
199
|
+
return this.num(e.weekYear, 4);
|
|
200
|
+
case "W":
|
|
201
|
+
return this.num(e.weekNumber);
|
|
202
|
+
case "WW":
|
|
203
|
+
return this.num(e.weekNumber, 2);
|
|
204
|
+
case "n":
|
|
205
|
+
return this.num(e.localWeekNumber);
|
|
206
|
+
case "nn":
|
|
207
|
+
return this.num(e.localWeekNumber, 2);
|
|
208
|
+
case "ii":
|
|
209
|
+
return this.num(e.localWeekYear.toString().slice(-2), 2);
|
|
210
|
+
case "iiii":
|
|
211
|
+
return this.num(e.localWeekYear, 4);
|
|
212
|
+
case "o":
|
|
213
|
+
return this.num(e.ordinal);
|
|
214
|
+
case "ooo":
|
|
215
|
+
return this.num(e.ordinal, 3);
|
|
216
|
+
case "q":
|
|
217
|
+
return this.num(e.quarter);
|
|
218
|
+
case "qq":
|
|
219
|
+
return this.num(e.quarter, 2);
|
|
220
|
+
case "X":
|
|
221
|
+
return this.num(Math.floor(e.ts / 1e3));
|
|
222
|
+
case "x":
|
|
223
|
+
return this.num(e.ts);
|
|
224
|
+
default:
|
|
225
|
+
return c(s);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
return E(T.parseFormat(r), f);
|
|
229
|
+
}
|
|
230
|
+
formatDurationFromString(e, r) {
|
|
231
|
+
const t = this.opts.signMode === "negativeLargestOnly" ? -1 : 1, a = (c) => {
|
|
232
|
+
switch (c[0]) {
|
|
233
|
+
case "S":
|
|
234
|
+
return "milliseconds";
|
|
235
|
+
case "s":
|
|
236
|
+
return "seconds";
|
|
237
|
+
case "m":
|
|
238
|
+
return "minutes";
|
|
239
|
+
case "h":
|
|
240
|
+
return "hours";
|
|
241
|
+
case "d":
|
|
242
|
+
return "days";
|
|
243
|
+
case "w":
|
|
244
|
+
return "weeks";
|
|
245
|
+
case "M":
|
|
246
|
+
return "months";
|
|
247
|
+
case "y":
|
|
248
|
+
return "years";
|
|
249
|
+
default:
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}, n = (c, l) => (f) => {
|
|
253
|
+
const s = a(f);
|
|
254
|
+
if (s) {
|
|
255
|
+
const m = l.isNegativeDuration && s !== l.largestUnit ? t : 1;
|
|
256
|
+
let y;
|
|
257
|
+
return this.opts.signMode === "negativeLargestOnly" && s !== l.largestUnit ? y = "never" : this.opts.signMode === "all" ? y = "always" : y = "auto", this.num(c.get(s) * m, f.length, y);
|
|
258
|
+
} else
|
|
259
|
+
return f;
|
|
260
|
+
}, o = T.parseFormat(r), u = o.reduce(
|
|
261
|
+
(c, { literal: l, val: f }) => l ? c : c.concat(f),
|
|
262
|
+
[]
|
|
263
|
+
), i = e.shiftTo(...u.map(a).filter((c) => c)), h = {
|
|
264
|
+
isNegativeDuration: i < 0,
|
|
265
|
+
// this relies on "collapsed" being based on "shiftTo", which builds up the object
|
|
266
|
+
// in order
|
|
267
|
+
largestUnit: Object.keys(i.values)[0]
|
|
268
|
+
};
|
|
269
|
+
return E(o, n(i, h));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
T as F
|
|
274
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { v as w, l as F, r as I, p as W, q as D } from "./util.es.js";
|
|
2
|
+
import { f as v, b as x, c as Z, d as L, g as M } from "./english.es.js";
|
|
3
|
+
import { S as c } from "../settings.es.js";
|
|
4
|
+
import { D as l } from "../datetime.es.js";
|
|
5
|
+
import { I as R } from "../zones/IANAZone.es.js";
|
|
6
|
+
let b = {};
|
|
7
|
+
function E(n, e = {}) {
|
|
8
|
+
const t = JSON.stringify([n, e]);
|
|
9
|
+
let s = b[t];
|
|
10
|
+
return s || (s = new Intl.ListFormat(n, e), b[t] = s), s;
|
|
11
|
+
}
|
|
12
|
+
const d = /* @__PURE__ */ new Map();
|
|
13
|
+
function p(n, e = {}) {
|
|
14
|
+
const t = JSON.stringify([n, e]);
|
|
15
|
+
let s = d.get(t);
|
|
16
|
+
return s === void 0 && (s = new Intl.DateTimeFormat(n, e), d.set(t, s)), s;
|
|
17
|
+
}
|
|
18
|
+
const y = /* @__PURE__ */ new Map();
|
|
19
|
+
function P(n, e = {}) {
|
|
20
|
+
const t = JSON.stringify([n, e]);
|
|
21
|
+
let s = y.get(t);
|
|
22
|
+
return s === void 0 && (s = new Intl.NumberFormat(n, e), y.set(t, s)), s;
|
|
23
|
+
}
|
|
24
|
+
const g = /* @__PURE__ */ new Map();
|
|
25
|
+
function z(n, e = {}) {
|
|
26
|
+
const { base: t, ...s } = e, i = JSON.stringify([n, s]);
|
|
27
|
+
let r = g.get(i);
|
|
28
|
+
return r === void 0 && (r = new Intl.RelativeTimeFormat(n, e), g.set(i, r)), r;
|
|
29
|
+
}
|
|
30
|
+
let f = null;
|
|
31
|
+
function $() {
|
|
32
|
+
return f || (f = new Intl.DateTimeFormat().resolvedOptions().locale, f);
|
|
33
|
+
}
|
|
34
|
+
const C = /* @__PURE__ */ new Map();
|
|
35
|
+
function T(n) {
|
|
36
|
+
let e = C.get(n);
|
|
37
|
+
return e === void 0 && (e = new Intl.DateTimeFormat(n).resolvedOptions(), C.set(n, e)), e;
|
|
38
|
+
}
|
|
39
|
+
const k = /* @__PURE__ */ new Map();
|
|
40
|
+
function j(n) {
|
|
41
|
+
let e = k.get(n);
|
|
42
|
+
if (!e) {
|
|
43
|
+
const t = new Intl.Locale(n);
|
|
44
|
+
e = "getWeekInfo" in t ? t.getWeekInfo() : t.weekInfo, "minimalDays" in e || (e = { ...S, ...e }), k.set(n, e);
|
|
45
|
+
}
|
|
46
|
+
return e;
|
|
47
|
+
}
|
|
48
|
+
function J(n) {
|
|
49
|
+
const e = n.indexOf("-x-");
|
|
50
|
+
e !== -1 && (n = n.substring(0, e));
|
|
51
|
+
const t = n.indexOf("-u-");
|
|
52
|
+
if (t === -1)
|
|
53
|
+
return [n];
|
|
54
|
+
{
|
|
55
|
+
let s, i;
|
|
56
|
+
try {
|
|
57
|
+
s = p(n).resolvedOptions(), i = n;
|
|
58
|
+
} catch {
|
|
59
|
+
const u = n.substring(0, t);
|
|
60
|
+
s = p(u).resolvedOptions(), i = u;
|
|
61
|
+
}
|
|
62
|
+
const { numberingSystem: r, calendar: a } = s;
|
|
63
|
+
return [i, r, a];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function U(n, e, t) {
|
|
67
|
+
return (t || e) && (n.includes("-u-") || (n += "-u"), t && (n += `-ca-${t}`), e && (n += `-nu-${e}`)), n;
|
|
68
|
+
}
|
|
69
|
+
function A(n) {
|
|
70
|
+
const e = [];
|
|
71
|
+
for (let t = 1; t <= 12; t++) {
|
|
72
|
+
const s = l.utc(2009, t, 1);
|
|
73
|
+
e.push(n(s));
|
|
74
|
+
}
|
|
75
|
+
return e;
|
|
76
|
+
}
|
|
77
|
+
function G(n) {
|
|
78
|
+
const e = [];
|
|
79
|
+
for (let t = 1; t <= 7; t++) {
|
|
80
|
+
const s = l.utc(2016, 11, 13 + t);
|
|
81
|
+
e.push(n(s));
|
|
82
|
+
}
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
function m(n, e, t, s) {
|
|
86
|
+
const i = n.listingMode();
|
|
87
|
+
return i === "error" ? null : i === "en" ? t(e) : s(e);
|
|
88
|
+
}
|
|
89
|
+
function q(n) {
|
|
90
|
+
return n.numberingSystem && n.numberingSystem !== "latn" ? !1 : n.numberingSystem === "latn" || !n.locale || n.locale.startsWith("en") || T(n.locale).numberingSystem === "latn";
|
|
91
|
+
}
|
|
92
|
+
class K {
|
|
93
|
+
constructor(e, t, s) {
|
|
94
|
+
this.padTo = s.padTo || 0, this.floor = s.floor || !1;
|
|
95
|
+
const { padTo: i, floor: r, ...a } = s;
|
|
96
|
+
if (!t || Object.keys(a).length > 0) {
|
|
97
|
+
const o = { useGrouping: !1, ...s };
|
|
98
|
+
s.padTo > 0 && (o.minimumIntegerDigits = s.padTo), this.inf = P(e, o);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
format(e) {
|
|
102
|
+
if (this.inf) {
|
|
103
|
+
const t = this.floor ? Math.floor(e) : e;
|
|
104
|
+
return this.inf.format(t);
|
|
105
|
+
} else {
|
|
106
|
+
const t = this.floor ? Math.floor(e) : I(e, 3);
|
|
107
|
+
return W(t, this.padTo);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
class B {
|
|
112
|
+
constructor(e, t, s) {
|
|
113
|
+
this.opts = s, this.originalZone = void 0;
|
|
114
|
+
let i;
|
|
115
|
+
if (this.opts.timeZone)
|
|
116
|
+
this.dt = e;
|
|
117
|
+
else if (e.zone.type === "fixed") {
|
|
118
|
+
const a = -1 * (e.offset / 60), o = a >= 0 ? `Etc/GMT+${a}` : `Etc/GMT${a}`;
|
|
119
|
+
e.offset !== 0 && R.create(o).valid ? (i = o, this.dt = e) : (i = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
|
|
120
|
+
} else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, i = e.zone.name) : (i = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
|
|
121
|
+
const r = { ...this.opts };
|
|
122
|
+
r.timeZone = r.timeZone || i, this.dtf = p(t, r);
|
|
123
|
+
}
|
|
124
|
+
format() {
|
|
125
|
+
return this.originalZone ? this.formatToParts().map(({ value: e }) => e).join("") : this.dtf.format(this.dt.toJSDate());
|
|
126
|
+
}
|
|
127
|
+
formatToParts() {
|
|
128
|
+
const e = this.dtf.formatToParts(this.dt.toJSDate());
|
|
129
|
+
return this.originalZone ? e.map((t) => {
|
|
130
|
+
if (t.type === "timeZoneName") {
|
|
131
|
+
const s = this.originalZone.offsetName(this.dt.ts, {
|
|
132
|
+
locale: this.dt.locale,
|
|
133
|
+
format: this.opts.timeZoneName
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
...t,
|
|
137
|
+
value: s
|
|
138
|
+
};
|
|
139
|
+
} else
|
|
140
|
+
return t;
|
|
141
|
+
}) : e;
|
|
142
|
+
}
|
|
143
|
+
resolvedOptions() {
|
|
144
|
+
return this.dtf.resolvedOptions();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class H {
|
|
148
|
+
constructor(e, t, s) {
|
|
149
|
+
this.opts = { style: "long", ...s }, !t && D() && (this.rtf = z(e, s));
|
|
150
|
+
}
|
|
151
|
+
format(e, t) {
|
|
152
|
+
return this.rtf ? this.rtf.format(e, t) : v(t, e, this.opts.numeric, this.opts.style !== "long");
|
|
153
|
+
}
|
|
154
|
+
formatToParts(e, t) {
|
|
155
|
+
return this.rtf ? this.rtf.formatToParts(e, t) : [];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const S = {
|
|
159
|
+
firstDay: 1,
|
|
160
|
+
minimalDays: 4,
|
|
161
|
+
weekend: [6, 7]
|
|
162
|
+
};
|
|
163
|
+
class h {
|
|
164
|
+
static fromOpts(e) {
|
|
165
|
+
return h.create(
|
|
166
|
+
e.locale,
|
|
167
|
+
e.numberingSystem,
|
|
168
|
+
e.outputCalendar,
|
|
169
|
+
e.weekSettings,
|
|
170
|
+
e.defaultToEN
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
static create(e, t, s, i, r = !1) {
|
|
174
|
+
const a = e || c.defaultLocale, o = a || (r ? "en-US" : $()), u = t || c.defaultNumberingSystem, N = s || c.defaultOutputCalendar, O = w(i) || c.defaultWeekSettings;
|
|
175
|
+
return new h(o, u, N, O, a);
|
|
176
|
+
}
|
|
177
|
+
static resetCache() {
|
|
178
|
+
f = null, d.clear(), y.clear(), g.clear(), C.clear(), k.clear();
|
|
179
|
+
}
|
|
180
|
+
static fromObject({ locale: e, numberingSystem: t, outputCalendar: s, weekSettings: i } = {}) {
|
|
181
|
+
return h.create(e, t, s, i);
|
|
182
|
+
}
|
|
183
|
+
constructor(e, t, s, i, r) {
|
|
184
|
+
const [a, o, u] = J(e);
|
|
185
|
+
this.locale = a, this.numberingSystem = t || o || null, this.outputCalendar = s || u || null, this.weekSettings = i, this.intl = U(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = r, this.fastNumbersCached = null;
|
|
186
|
+
}
|
|
187
|
+
get fastNumbers() {
|
|
188
|
+
return this.fastNumbersCached == null && (this.fastNumbersCached = q(this)), this.fastNumbersCached;
|
|
189
|
+
}
|
|
190
|
+
listingMode() {
|
|
191
|
+
const e = this.isEnglish(), t = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
|
|
192
|
+
return e && t ? "en" : "intl";
|
|
193
|
+
}
|
|
194
|
+
clone(e) {
|
|
195
|
+
return !e || Object.getOwnPropertyNames(e).length === 0 ? this : h.create(
|
|
196
|
+
e.locale || this.specifiedLocale,
|
|
197
|
+
e.numberingSystem || this.numberingSystem,
|
|
198
|
+
e.outputCalendar || this.outputCalendar,
|
|
199
|
+
w(e.weekSettings) || this.weekSettings,
|
|
200
|
+
e.defaultToEN || !1
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
redefaultToEN(e = {}) {
|
|
204
|
+
return this.clone({ ...e, defaultToEN: !0 });
|
|
205
|
+
}
|
|
206
|
+
redefaultToSystem(e = {}) {
|
|
207
|
+
return this.clone({ ...e, defaultToEN: !1 });
|
|
208
|
+
}
|
|
209
|
+
months(e, t = !1) {
|
|
210
|
+
return m(this, e, x, () => {
|
|
211
|
+
const s = this.intl === "ja" || this.intl.startsWith("ja-");
|
|
212
|
+
t &= !s;
|
|
213
|
+
const i = t ? { month: e, day: "numeric" } : { month: e }, r = t ? "format" : "standalone";
|
|
214
|
+
if (!this.monthsCache[r][e]) {
|
|
215
|
+
const a = s ? (o) => this.dtFormatter(o, i).format() : (o) => this.extract(o, i, "month");
|
|
216
|
+
this.monthsCache[r][e] = A(a);
|
|
217
|
+
}
|
|
218
|
+
return this.monthsCache[r][e];
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
weekdays(e, t = !1) {
|
|
222
|
+
return m(this, e, Z, () => {
|
|
223
|
+
const s = t ? { weekday: e, year: "numeric", month: "long", day: "numeric" } : { weekday: e }, i = t ? "format" : "standalone";
|
|
224
|
+
return this.weekdaysCache[i][e] || (this.weekdaysCache[i][e] = G(
|
|
225
|
+
(r) => this.extract(r, s, "weekday")
|
|
226
|
+
)), this.weekdaysCache[i][e];
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
meridiems() {
|
|
230
|
+
return m(
|
|
231
|
+
this,
|
|
232
|
+
void 0,
|
|
233
|
+
() => L,
|
|
234
|
+
() => {
|
|
235
|
+
if (!this.meridiemCache) {
|
|
236
|
+
const e = { hour: "numeric", hourCycle: "h12" };
|
|
237
|
+
this.meridiemCache = [l.utc(2016, 11, 13, 9), l.utc(2016, 11, 13, 19)].map(
|
|
238
|
+
(t) => this.extract(t, e, "dayperiod")
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return this.meridiemCache;
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
eras(e) {
|
|
246
|
+
return m(this, e, M, () => {
|
|
247
|
+
const t = { era: e };
|
|
248
|
+
return this.eraCache[e] || (this.eraCache[e] = [l.utc(-40, 1, 1), l.utc(2017, 1, 1)].map(
|
|
249
|
+
(s) => this.extract(s, t, "era")
|
|
250
|
+
)), this.eraCache[e];
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
extract(e, t, s) {
|
|
254
|
+
const i = this.dtFormatter(e, t), r = i.formatToParts(), a = r.find((o) => o.type.toLowerCase() === s);
|
|
255
|
+
return a ? a.value : null;
|
|
256
|
+
}
|
|
257
|
+
numberFormatter(e = {}) {
|
|
258
|
+
return new K(this.intl, e.forceSimple || this.fastNumbers, e);
|
|
259
|
+
}
|
|
260
|
+
dtFormatter(e, t = {}) {
|
|
261
|
+
return new B(e, this.intl, t);
|
|
262
|
+
}
|
|
263
|
+
relFormatter(e = {}) {
|
|
264
|
+
return new H(this.intl, this.isEnglish(), e);
|
|
265
|
+
}
|
|
266
|
+
listFormatter(e = {}) {
|
|
267
|
+
return E(this.intl, e);
|
|
268
|
+
}
|
|
269
|
+
isEnglish() {
|
|
270
|
+
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || T(this.intl).locale.startsWith("en-us");
|
|
271
|
+
}
|
|
272
|
+
getWeekSettings() {
|
|
273
|
+
return this.weekSettings ? this.weekSettings : F() ? j(this.locale) : S;
|
|
274
|
+
}
|
|
275
|
+
getStartOfWeek() {
|
|
276
|
+
return this.getWeekSettings().firstDay;
|
|
277
|
+
}
|
|
278
|
+
getMinDaysInFirstWeek() {
|
|
279
|
+
return this.getWeekSettings().minimalDays;
|
|
280
|
+
}
|
|
281
|
+
getWeekendDays() {
|
|
282
|
+
return this.getWeekSettings().weekend;
|
|
283
|
+
}
|
|
284
|
+
equals(e) {
|
|
285
|
+
return this.locale === e.locale && this.numberingSystem === e.numberingSystem && this.outputCalendar === e.outputCalendar;
|
|
286
|
+
}
|
|
287
|
+
toString() {
|
|
288
|
+
return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
export {
|
|
292
|
+
h as L
|
|
293
|
+
};
|