@vecrea/oid4vc-verifier-endpoint-core
Version:
Core library for OID4VC Verifier Endpoint implementation
1,777 lines • 553 kB
JavaScript
var du = Object.defineProperty;
var ca = (t) => {
throw TypeError(t);
};
var hu = (t, e, r) => e in t ? du(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
var h = (t, e, r) => hu(t, typeof e != "symbol" ? e + "" : e, r), ua = (t, e, r) => e.has(t) || ca("Cannot " + r);
var F = (t, e, r) => (ua(t, e, "read from private field"), r ? r.call(t) : e.get(t)), G = (t, e, r) => e.has(t) ? ca("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), ve = (t, e, r, n) => (ua(t, e, "write to private field"), n ? n.call(t, r) : e.set(t, r), r);
const fu = (t) => t === void 0 ? "undefined" : t === null ? "null" : typeof t == "string" ? t : t instanceof Error ? t.message : JSON.stringify(t), lo = (t) => t instanceof Error ? t : new Error(fu(t));
class Be {
/**
* Constructs a new instance of the Result class.
* @param {T | undefined} value The value associated with the result, if successful.
* @param {Error | undefined} error The error associated with the result, if failed.
* @throws {Error} If both value and error are provided.
*/
constructor(e, r) {
if (this.value = e, this.error = r, e && r)
throw new Error("Result cannot be both success and failure");
}
/**
* Creates a successful result with the specified value.
* @template T The type of the value.
* @param {T} value The value to be wrapped in the successful result.
* @returns {Result<T>} A successful result containing the value.
*/
static success(e) {
return new Be(e, void 0);
}
/**
* Creates a failure result with the specified error.
* @template T The type of the value.
* @param {Error} error The error to be wrapped in the failure result.
* @returns {Result<T>} A failure result containing the error.
*/
static failure(e) {
return new Be(void 0, e);
}
/**
* Checks if the result is successful.
* @returns {this is { value: T }} True if the result is successful, false otherwise.
*/
isSuccess() {
return this.error === void 0;
}
/**
* Checks if the result is a failure.
* @returns {this is { error: Error }} True if the result is a failure, false otherwise.
*/
isFailure() {
return !this.isSuccess();
}
/**
* Returns the value if the result is successful, or throws the error if it is a failure.
* @returns {T} The value, if the result is successful.
* @throws {Error} The error, if the result is a failure.
*/
getOrThrow() {
if (this.isSuccess())
return this.value;
throw this.error;
}
/**
* Returns the value if the result is successful, or the specified default value if it is a failure.
*
* @param {T} defaultValue - The default value to return if the result is a failure.
* @returns {T} The value if the result is successful, or the default value if it is a failure.
*/
getOrDefault(e) {
return this.isSuccess() ? this.value : e;
}
/**
* Returns the value if the result is successful, or the result of the transfer function if it is a failure.
* @param {(error: Error) => T} transfer A function that transfers the error to a value.
* @returns {T} The value, if the result is successful, or the result of the transfer function if it is a failure.
*/
getOrElse(e) {
return this.isSuccess() ? this.value : e(this.error);
}
/**
* Executes the specified function if the result is successful.
* @param {(value: T) => void} f A function to be executed if the result is successful.
* @returns {Result<T>} The current result instance.
*/
onSuccess(e) {
return this.isSuccess() && e(this.value), this;
}
/**
* Executes the specified function if the result is a failure.
* @param {(error: Error) => void} f A function to be executed if the result is a failure.
* @returns {Result<T>} The current result instance.
*/
onFailure(e) {
return this.isFailure() && e(this.error), this;
}
/**
* Recovers from a failure by applying the specified transform function.
* @param {(error: Error) => T} transform A function that transforms the error to a value.
* @returns {Result<T>} A new successful result with the transformed value if the current result is a failure, or the current result if it is already successful.
*/
recover(e) {
return this.isFailure() ? Rn(() => e(this.error)) : this;
}
/**
* Recovers from a failure by applying the specified asynchronous transform function.
* @param {(error: Error) => Promise<T>} transform An asynchronous function that transforms the error to a value.
* @returns {Promise<Result<T>>} A promise that resolves to a new successful result with the transformed value if the current result is a failure, or the current result if it is already successful.
*/
async recoverAsync(e) {
return this.isFailure() ? rt(() => e(this.error)) : this;
}
}
const Rn = (t, ...e) => {
try {
const r = t(...e);
return r instanceof Be ? r : Be.success(r);
} catch (r) {
return Be.failure(lo(r));
}
}, rt = async (t, ...e) => {
try {
const r = await t(...e);
return r instanceof Be ? r : Be.success(r);
} catch (r) {
return Be.failure(lo(r));
}
}, la = "{RESPONSE_CODE}", pu = () => mu, mu = (t, e) => Rn(() => {
if (!t.includes(la))
throw new Error(
"Expected response_code place holder not found in template"
);
const r = t.replace(
la,
e.value
);
return new URL(r);
});
class Ut extends Error {
}
class yu extends Ut {
constructor(e) {
super(`Invalid DateTime: ${e.toMessage()}`);
}
}
class gu extends Ut {
constructor(e) {
super(`Invalid Interval: ${e.toMessage()}`);
}
}
class vu extends Ut {
constructor(e) {
super(`Invalid Duration: ${e.toMessage()}`);
}
}
class Qt extends Ut {
}
class ho extends Ut {
constructor(e) {
super(`Invalid unit ${e}`);
}
}
class oe extends Ut {
}
class nt extends Ut {
constructor() {
super("Zone is an abstract class");
}
}
const v = "numeric", Re = "short", ye = "long", Dn = {
year: v,
month: v,
day: v
}, fo = {
year: v,
month: Re,
day: v
}, _u = {
year: v,
month: Re,
day: v,
weekday: Re
}, po = {
year: v,
month: ye,
day: v
}, mo = {
year: v,
month: ye,
day: v,
weekday: ye
}, yo = {
hour: v,
minute: v
}, go = {
hour: v,
minute: v,
second: v
}, vo = {
hour: v,
minute: v,
second: v,
timeZoneName: Re
}, _o = {
hour: v,
minute: v,
second: v,
timeZoneName: ye
}, wo = {
hour: v,
minute: v,
hourCycle: "h23"
}, bo = {
hour: v,
minute: v,
second: v,
hourCycle: "h23"
}, So = {
hour: v,
minute: v,
second: v,
hourCycle: "h23",
timeZoneName: Re
}, ko = {
hour: v,
minute: v,
second: v,
hourCycle: "h23",
timeZoneName: ye
}, Eo = {
year: v,
month: v,
day: v,
hour: v,
minute: v
}, xo = {
year: v,
month: v,
day: v,
hour: v,
minute: v,
second: v
}, Oo = {
year: v,
month: Re,
day: v,
hour: v,
minute: v
}, To = {
year: v,
month: Re,
day: v,
hour: v,
minute: v,
second: v
}, wu = {
year: v,
month: Re,
day: v,
weekday: Re,
hour: v,
minute: v
}, Ao = {
year: v,
month: ye,
day: v,
hour: v,
minute: v,
timeZoneName: Re
}, No = {
year: v,
month: ye,
day: v,
hour: v,
minute: v,
second: v,
timeZoneName: Re
}, Io = {
year: v,
month: ye,
day: v,
weekday: ye,
hour: v,
minute: v,
timeZoneName: ye
}, Co = {
year: v,
month: ye,
day: v,
weekday: ye,
hour: v,
minute: v,
second: v,
timeZoneName: ye
};
class ln {
/**
* The type of zone
* @abstract
* @type {string}
*/
get type() {
throw new nt();
}
/**
* The name of this zone.
* @abstract
* @type {string}
*/
get name() {
throw new nt();
}
/**
* The IANA name of this zone.
* Defaults to `name` if not overwritten by a subclass.
* @abstract
* @type {string}
*/
get ianaName() {
return this.name;
}
/**
* Returns whether the offset is known to be fixed for the whole year.
* @abstract
* @type {boolean}
*/
get isUniversal() {
throw new nt();
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(e, r) {
throw new nt();
}
/**
* Returns the offset's value as a string
* @abstract
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, r) {
throw new nt();
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @abstract
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(e) {
throw new nt();
}
/**
* Return whether this Zone is equal to another zone
* @abstract
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
throw new nt();
}
/**
* Return whether this Zone is valid.
* @abstract
* @type {boolean}
*/
get isValid() {
throw new nt();
}
}
let Zs = null;
class Es extends ln {
/**
* Get a singleton instance of the local zone
* @return {SystemZone}
*/
static get instance() {
return Zs === null && (Zs = new Es()), Zs;
}
/** @override **/
get type() {
return "system";
}
/** @override **/
get name() {
return new Intl.DateTimeFormat().resolvedOptions().timeZone;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName(e, { format: r, locale: n }) {
return Uo(e, r, n);
}
/** @override **/
formatOffset(e, r) {
return Dr(this.offset(e), r);
}
/** @override **/
offset(e) {
return -new Date(e).getTimezoneOffset();
}
/** @override **/
equals(e) {
return e.type === "system";
}
/** @override **/
get isValid() {
return !0;
}
}
let En = {};
function bu(t) {
return En[t] || (En[t] = new Intl.DateTimeFormat("en-US", {
hour12: !1,
timeZone: t,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
era: "short"
})), En[t];
}
const Su = {
year: 0,
month: 1,
day: 2,
era: 3,
hour: 4,
minute: 5,
second: 6
};
function ku(t, e) {
const r = t.format(e).replace(/\u200E/g, ""), n = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(r), [, s, i, a, o, c, u, l] = n;
return [a, s, i, o, c, u, l];
}
function Eu(t, e) {
const r = t.formatToParts(e), n = [];
for (let s = 0; s < r.length; s++) {
const { type: i, value: a } = r[s], o = Su[i];
i === "era" ? n[o] = a : C(o) || (n[o] = parseInt(a, 10));
}
return n;
}
let gn = {};
class Ye extends ln {
/**
* @param {string} name - Zone name
* @return {IANAZone}
*/
static create(e) {
return gn[e] || (gn[e] = new Ye(e)), gn[e];
}
/**
* Reset local caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCache() {
gn = {}, En = {};
}
/**
* Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that.
* @param {string} s - The string to check validity on
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
* @deprecated For backward compatibility, this forwards to isValidZone, better use `isValidZone()` directly instead.
* @return {boolean}
*/
static isValidSpecifier(e) {
return this.isValidZone(e);
}
/**
* Returns whether the provided string identifies a real zone
* @param {string} zone - The string to check
* @example IANAZone.isValidZone("America/New_York") //=> true
* @example IANAZone.isValidZone("Fantasia/Castle") //=> false
* @example IANAZone.isValidZone("Sport~~blorp") //=> false
* @return {boolean}
*/
static isValidZone(e) {
if (!e)
return !1;
try {
return new Intl.DateTimeFormat("en-US", { timeZone: e }).format(), !0;
} catch {
return !1;
}
}
constructor(e) {
super(), this.zoneName = e, this.valid = Ye.isValidZone(e);
}
/**
* The type of zone. `iana` for all instances of `IANAZone`.
* @override
* @type {string}
*/
get type() {
return "iana";
}
/**
* The name of this zone (i.e. the IANA zone name).
* @override
* @type {string}
*/
get name() {
return this.zoneName;
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns false for all IANA zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !1;
}
/**
* Returns the offset's common name (such as EST) at the specified timestamp
* @override
* @param {number} ts - Epoch milliseconds for which to get the name
* @param {Object} opts - Options to affect the format
* @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'.
* @param {string} opts.locale - What locale to return the offset name in.
* @return {string}
*/
offsetName(e, { format: r, locale: n }) {
return Uo(e, r, n, this.name);
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, r) {
return Dr(this.offset(e), r);
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
* @override
* @param {number} ts - Epoch milliseconds for which to compute the offset
* @return {number}
*/
offset(e) {
const r = new Date(e);
if (isNaN(r)) return NaN;
const n = bu(this.name);
let [s, i, a, o, c, u, l] = n.formatToParts ? Eu(n, r) : ku(n, r);
o === "BC" && (s = -Math.abs(s) + 1);
const S = Os({
year: s,
month: i,
day: a,
hour: c === 24 ? 0 : c,
minute: u,
second: l,
millisecond: 0
});
let p = +r;
const x = p % 1e3;
return p -= x >= 0 ? x : 1e3 + x, (S - p) / (60 * 1e3);
}
/**
* Return whether this Zone is equal to another zone
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
return e.type === "iana" && e.name === this.name;
}
/**
* Return whether this Zone is valid.
* @override
* @type {boolean}
*/
get isValid() {
return this.valid;
}
}
let da = {};
function xu(t, e = {}) {
const r = JSON.stringify([t, e]);
let n = da[r];
return n || (n = new Intl.ListFormat(t, e), da[r] = n), n;
}
let ei = {};
function ti(t, e = {}) {
const r = JSON.stringify([t, e]);
let n = ei[r];
return n || (n = new Intl.DateTimeFormat(t, e), ei[r] = n), n;
}
let ri = {};
function Ou(t, e = {}) {
const r = JSON.stringify([t, e]);
let n = ri[r];
return n || (n = new Intl.NumberFormat(t, e), ri[r] = n), n;
}
let ni = {};
function Tu(t, e = {}) {
const { base: r, ...n } = e, s = JSON.stringify([t, n]);
let i = ni[s];
return i || (i = new Intl.RelativeTimeFormat(t, e), ni[s] = i), i;
}
let Or = null;
function Au() {
return Or || (Or = new Intl.DateTimeFormat().resolvedOptions().locale, Or);
}
let ha = {};
function Nu(t) {
let e = ha[t];
if (!e) {
const r = new Intl.Locale(t);
e = "getWeekInfo" in r ? r.getWeekInfo() : r.weekInfo, ha[t] = e;
}
return e;
}
function Iu(t) {
const e = t.indexOf("-x-");
e !== -1 && (t = t.substring(0, e));
const r = t.indexOf("-u-");
if (r === -1)
return [t];
{
let n, s;
try {
n = ti(t).resolvedOptions(), s = t;
} catch {
const c = t.substring(0, r);
n = ti(c).resolvedOptions(), s = c;
}
const { numberingSystem: i, calendar: a } = n;
return [s, i, a];
}
}
function Cu(t, e, r) {
return (r || e) && (t.includes("-u-") || (t += "-u"), r && (t += `-ca-${r}`), e && (t += `-nu-${e}`)), t;
}
function Ru(t) {
const e = [];
for (let r = 1; r <= 12; r++) {
const n = R.utc(2009, r, 1);
e.push(t(n));
}
return e;
}
function Du(t) {
const e = [];
for (let r = 1; r <= 7; r++) {
const n = R.utc(2016, 11, 13 + r);
e.push(t(n));
}
return e;
}
function vn(t, e, r, n) {
const s = t.listingMode();
return s === "error" ? null : s === "en" ? r(e) : n(e);
}
function Mu(t) {
return t.numberingSystem && t.numberingSystem !== "latn" ? !1 : t.numberingSystem === "latn" || !t.locale || t.locale.startsWith("en") || new Intl.DateTimeFormat(t.intl).resolvedOptions().numberingSystem === "latn";
}
class Pu {
constructor(e, r, n) {
this.padTo = n.padTo || 0, this.floor = n.floor || !1;
const { padTo: s, floor: i, ...a } = n;
if (!r || Object.keys(a).length > 0) {
const o = { useGrouping: !1, ...n };
n.padTo > 0 && (o.minimumIntegerDigits = n.padTo), this.inf = Ou(e, o);
}
}
format(e) {
if (this.inf) {
const r = this.floor ? Math.floor(e) : e;
return this.inf.format(r);
} else {
const r = this.floor ? Math.floor(e) : Zi(e, 3);
return te(r, this.padTo);
}
}
}
class Ju {
constructor(e, r, n) {
this.opts = n, this.originalZone = void 0;
let s;
if (this.opts.timeZone)
this.dt = e;
else if (e.zone.type === "fixed") {
const a = -1 * (e.offset / 60), o = a >= 0 ? `Etc/GMT+${a}` : `Etc/GMT${a}`;
e.offset !== 0 && Ye.create(o).valid ? (s = o, this.dt = e) : (s = "UTC", this.dt = e.offset === 0 ? e : e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
} else e.zone.type === "system" ? this.dt = e : e.zone.type === "iana" ? (this.dt = e, s = e.zone.name) : (s = "UTC", this.dt = e.setZone("UTC").plus({ minutes: e.offset }), this.originalZone = e.zone);
const i = { ...this.opts };
i.timeZone = i.timeZone || s, this.dtf = ti(r, i);
}
format() {
return this.originalZone ? this.formatToParts().map(({ value: e }) => e).join("") : this.dtf.format(this.dt.toJSDate());
}
formatToParts() {
const e = this.dtf.formatToParts(this.dt.toJSDate());
return this.originalZone ? e.map((r) => {
if (r.type === "timeZoneName") {
const n = this.originalZone.offsetName(this.dt.ts, {
locale: this.dt.locale,
format: this.opts.timeZoneName
});
return {
...r,
value: n
};
} else
return r;
}) : e;
}
resolvedOptions() {
return this.dtf.resolvedOptions();
}
}
class $u {
constructor(e, r, n) {
this.opts = { style: "long", ...n }, !r && Wo() && (this.rtf = Tu(e, n));
}
format(e, r) {
return this.rtf ? this.rtf.format(e, r) : al(r, e, this.opts.numeric, this.opts.style !== "long");
}
formatToParts(e, r) {
return this.rtf ? this.rtf.formatToParts(e, r) : [];
}
}
const Wu = {
firstDay: 1,
minimalDays: 4,
weekend: [6, 7]
};
class q {
static fromOpts(e) {
return q.create(
e.locale,
e.numberingSystem,
e.outputCalendar,
e.weekSettings,
e.defaultToEN
);
}
static create(e, r, n, s, i = !1) {
const a = e || X.defaultLocale, o = a || (i ? "en-US" : Au()), c = r || X.defaultNumberingSystem, u = n || X.defaultOutputCalendar, l = si(s) || X.defaultWeekSettings;
return new q(o, c, u, l, a);
}
static resetCache() {
Or = null, ei = {}, ri = {}, ni = {};
}
static fromObject({ locale: e, numberingSystem: r, outputCalendar: n, weekSettings: s } = {}) {
return q.create(e, r, n, s);
}
constructor(e, r, n, s, i) {
const [a, o, c] = Iu(e);
this.locale = a, this.numberingSystem = r || o || null, this.outputCalendar = n || c || null, this.weekSettings = s, this.intl = Cu(this.locale, this.numberingSystem, this.outputCalendar), this.weekdaysCache = { format: {}, standalone: {} }, this.monthsCache = { format: {}, standalone: {} }, this.meridiemCache = null, this.eraCache = {}, this.specifiedLocale = i, this.fastNumbersCached = null;
}
get fastNumbers() {
return this.fastNumbersCached == null && (this.fastNumbersCached = Mu(this)), this.fastNumbersCached;
}
listingMode() {
const e = this.isEnglish(), r = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
return e && r ? "en" : "intl";
}
clone(e) {
return !e || Object.getOwnPropertyNames(e).length === 0 ? this : q.create(
e.locale || this.specifiedLocale,
e.numberingSystem || this.numberingSystem,
e.outputCalendar || this.outputCalendar,
si(e.weekSettings) || this.weekSettings,
e.defaultToEN || !1
);
}
redefaultToEN(e = {}) {
return this.clone({ ...e, defaultToEN: !0 });
}
redefaultToSystem(e = {}) {
return this.clone({ ...e, defaultToEN: !1 });
}
months(e, r = !1) {
return vn(this, e, Fo, () => {
const n = r ? { month: e, day: "numeric" } : { month: e }, s = r ? "format" : "standalone";
return this.monthsCache[s][e] || (this.monthsCache[s][e] = Ru((i) => this.extract(i, n, "month"))), this.monthsCache[s][e];
});
}
weekdays(e, r = !1) {
return vn(this, e, Ho, () => {
const n = r ? { weekday: e, year: "numeric", month: "long", day: "numeric" } : { weekday: e }, s = r ? "format" : "standalone";
return this.weekdaysCache[s][e] || (this.weekdaysCache[s][e] = Du(
(i) => this.extract(i, n, "weekday")
)), this.weekdaysCache[s][e];
});
}
meridiems() {
return vn(
this,
void 0,
() => Ko,
() => {
if (!this.meridiemCache) {
const e = { hour: "numeric", hourCycle: "h12" };
this.meridiemCache = [R.utc(2016, 11, 13, 9), R.utc(2016, 11, 13, 19)].map(
(r) => this.extract(r, e, "dayperiod")
);
}
return this.meridiemCache;
}
);
}
eras(e) {
return vn(this, e, Bo, () => {
const r = { era: e };
return this.eraCache[e] || (this.eraCache[e] = [R.utc(-40, 1, 1), R.utc(2017, 1, 1)].map(
(n) => this.extract(n, r, "era")
)), this.eraCache[e];
});
}
extract(e, r, n) {
const s = this.dtFormatter(e, r), i = s.formatToParts(), a = i.find((o) => o.type.toLowerCase() === n);
return a ? a.value : null;
}
numberFormatter(e = {}) {
return new Pu(this.intl, e.forceSimple || this.fastNumbers, e);
}
dtFormatter(e, r = {}) {
return new Ju(e, this.intl, r);
}
relFormatter(e = {}) {
return new $u(this.intl, this.isEnglish(), e);
}
listFormatter(e = {}) {
return xu(this.intl, e);
}
isEnglish() {
return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
}
getWeekSettings() {
return this.weekSettings ? this.weekSettings : Zo() ? Nu(this.locale) : Wu;
}
getStartOfWeek() {
return this.getWeekSettings().firstDay;
}
getMinDaysInFirstWeek() {
return this.getWeekSettings().minimalDays;
}
getWeekendDays() {
return this.getWeekSettings().weekend;
}
equals(e) {
return this.locale === e.locale && this.numberingSystem === e.numberingSystem && this.outputCalendar === e.outputCalendar;
}
toString() {
return `Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`;
}
}
let Us = null;
class de extends ln {
/**
* Get a singleton instance of UTC
* @return {FixedOffsetZone}
*/
static get utcInstance() {
return Us === null && (Us = new de(0)), Us;
}
/**
* Get an instance with a specified offset
* @param {number} offset - The offset in minutes
* @return {FixedOffsetZone}
*/
static instance(e) {
return e === 0 ? de.utcInstance : new de(e);
}
/**
* Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6"
* @param {string} s - The offset string to parse
* @example FixedOffsetZone.parseSpecifier("UTC+6")
* @example FixedOffsetZone.parseSpecifier("UTC+06")
* @example FixedOffsetZone.parseSpecifier("UTC-6:00")
* @return {FixedOffsetZone}
*/
static parseSpecifier(e) {
if (e) {
const r = e.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
if (r)
return new de(Ts(r[1], r[2]));
}
return null;
}
constructor(e) {
super(), this.fixed = e;
}
/**
* The type of zone. `fixed` for all instances of `FixedOffsetZone`.
* @override
* @type {string}
*/
get type() {
return "fixed";
}
/**
* The name of this zone.
* All fixed zones' names always start with "UTC" (plus optional offset)
* @override
* @type {string}
*/
get name() {
return this.fixed === 0 ? "UTC" : `UTC${Dr(this.fixed, "narrow")}`;
}
/**
* The IANA name of this zone, i.e. `Etc/UTC` or `Etc/GMT+/-nn`
*
* @override
* @type {string}
*/
get ianaName() {
return this.fixed === 0 ? "Etc/UTC" : `Etc/GMT${Dr(-this.fixed, "narrow")}`;
}
/**
* Returns the offset's common name at the specified timestamp.
*
* For fixed offset zones this equals to the zone name.
* @override
*/
offsetName() {
return this.name;
}
/**
* Returns the offset's value as a string
* @override
* @param {number} ts - Epoch milliseconds for which to get the offset
* @param {string} format - What style of offset to return.
* Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively
* @return {string}
*/
formatOffset(e, r) {
return Dr(this.fixed, r);
}
/**
* Returns whether the offset is known to be fixed for the whole year:
* Always returns true for all fixed offset zones.
* @override
* @type {boolean}
*/
get isUniversal() {
return !0;
}
/**
* Return the offset in minutes for this zone at the specified timestamp.
*
* For fixed offset zones, this is constant and does not depend on a timestamp.
* @override
* @return {number}
*/
offset() {
return this.fixed;
}
/**
* Return whether this Zone is equal to another zone (i.e. also fixed and same offset)
* @override
* @param {Zone} otherZone - the zone to compare
* @return {boolean}
*/
equals(e) {
return e.type === "fixed" && e.fixed === this.fixed;
}
/**
* Return whether this Zone is valid:
* All fixed offset zones are valid.
* @override
* @type {boolean}
*/
get isValid() {
return !0;
}
}
class Zu extends ln {
constructor(e) {
super(), this.zoneName = e;
}
/** @override **/
get type() {
return "invalid";
}
/** @override **/
get name() {
return this.zoneName;
}
/** @override **/
get isUniversal() {
return !1;
}
/** @override **/
offsetName() {
return null;
}
/** @override **/
formatOffset() {
return "";
}
/** @override **/
offset() {
return NaN;
}
/** @override **/
equals() {
return !1;
}
/** @override **/
get isValid() {
return !1;
}
}
function dt(t, e) {
if (C(t) || t === null)
return e;
if (t instanceof ln)
return t;
if (qu(t)) {
const r = t.toLowerCase();
return r === "default" ? e : r === "local" || r === "system" ? Es.instance : r === "utc" || r === "gmt" ? de.utcInstance : de.parseSpecifier(r) || Ye.create(t);
} else return pt(t) ? de.instance(t) : typeof t == "object" && "offset" in t && typeof t.offset == "function" ? t : new Zu(t);
}
const Pi = {
arab: "[٠-٩]",
arabext: "[۰-۹]",
bali: "[᭐-᭙]",
beng: "[০-৯]",
deva: "[०-९]",
fullwide: "[0-9]",
gujr: "[૦-૯]",
hanidec: "[〇|一|二|三|四|五|六|七|八|九]",
khmr: "[០-៩]",
knda: "[೦-೯]",
laoo: "[໐-໙]",
limb: "[᥆-᥏]",
mlym: "[൦-൯]",
mong: "[᠐-᠙]",
mymr: "[၀-၉]",
orya: "[୦-୯]",
tamldec: "[௦-௯]",
telu: "[౦-౯]",
thai: "[๐-๙]",
tibt: "[༠-༩]",
latn: "\\d"
}, fa = {
arab: [1632, 1641],
arabext: [1776, 1785],
bali: [6992, 7001],
beng: [2534, 2543],
deva: [2406, 2415],
fullwide: [65296, 65303],
gujr: [2790, 2799],
khmr: [6112, 6121],
knda: [3302, 3311],
laoo: [3792, 3801],
limb: [6470, 6479],
mlym: [3430, 3439],
mong: [6160, 6169],
mymr: [4160, 4169],
orya: [2918, 2927],
tamldec: [3046, 3055],
telu: [3174, 3183],
thai: [3664, 3673],
tibt: [3872, 3881]
}, Uu = Pi.hanidec.replace(/[\[|\]]/g, "").split("");
function Vu(t) {
let e = parseInt(t, 10);
if (isNaN(e)) {
e = "";
for (let r = 0; r < t.length; r++) {
const n = t.charCodeAt(r);
if (t[r].search(Pi.hanidec) !== -1)
e += Uu.indexOf(t[r]);
else
for (const s in fa) {
const [i, a] = fa[s];
n >= i && n <= a && (e += n - i);
}
}
return parseInt(e, 10);
} else
return e;
}
let Kt = {};
function Lu() {
Kt = {};
}
function xe({ numberingSystem: t }, e = "") {
const r = t || "latn";
return Kt[r] || (Kt[r] = {}), Kt[r][e] || (Kt[r][e] = new RegExp(`${Pi[r]}${e}`)), Kt[r][e];
}
let pa = () => Date.now(), ma = "system", ya = null, ga = null, va = null, _a = 60, wa, ba = null;
class X {
/**
* Get the callback for returning the current timestamp.
* @type {function}
*/
static get now() {
return pa;
}
/**
* Set the callback for returning the current timestamp.
* The function should return a number, which will be interpreted as an Epoch millisecond count
* @type {function}
* @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future
* @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time
*/
static set now(e) {
pa = e;
}
/**
* Set the default time zone to create DateTimes in. Does not affect existing instances.
* Use the value "system" to reset this value to the system's time zone.
* @type {string}
*/
static set defaultZone(e) {
ma = e;
}
/**
* Get the default time zone object currently used to create DateTimes. Does not affect existing instances.
* The default value is the system's time zone (the one set on the machine that runs this code).
* @type {Zone}
*/
static get defaultZone() {
return dt(ma, Es.instance);
}
/**
* Get the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultLocale() {
return ya;
}
/**
* Set the default locale to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultLocale(e) {
ya = e;
}
/**
* Get the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultNumberingSystem() {
return ga;
}
/**
* Set the default numbering system to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultNumberingSystem(e) {
ga = e;
}
/**
* Get the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static get defaultOutputCalendar() {
return va;
}
/**
* Set the default output calendar to create DateTimes with. Does not affect existing instances.
* @type {string}
*/
static set defaultOutputCalendar(e) {
va = e;
}
/**
* @typedef {Object} WeekSettings
* @property {number} firstDay
* @property {number} minimalDays
* @property {number[]} weekend
*/
/**
* @return {WeekSettings|null}
*/
static get defaultWeekSettings() {
return ba;
}
/**
* Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
* how many days are required in the first week of a year.
* Does not affect existing instances.
*
* @param {WeekSettings|null} weekSettings
*/
static set defaultWeekSettings(e) {
ba = si(e);
}
/**
* Get the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
*/
static get twoDigitCutoffYear() {
return _a;
}
/**
* Set the cutoff year for whether a 2-digit year string is interpreted in the current or previous century. Numbers higher than the cutoff will be considered to mean 19xx and numbers lower or equal to the cutoff will be considered 20xx.
* @type {number}
* @example Settings.twoDigitCutoffYear = 0 // all 'yy' are interpreted as 20th century
* @example Settings.twoDigitCutoffYear = 99 // all 'yy' are interpreted as 21st century
* @example Settings.twoDigitCutoffYear = 50 // '49' -> 2049; '50' -> 1950
* @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
* @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
*/
static set twoDigitCutoffYear(e) {
_a = e % 100;
}
/**
* Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static get throwOnInvalid() {
return wa;
}
/**
* Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals
* @type {boolean}
*/
static set throwOnInvalid(e) {
wa = e;
}
/**
* Reset Luxon's global caches. Should only be necessary in testing scenarios.
* @return {void}
*/
static resetCaches() {
q.resetCache(), Ye.resetCache(), R.resetCache(), Lu();
}
}
class Ae {
constructor(e, r) {
this.reason = e, this.explanation = r;
}
toMessage() {
return this.explanation ? `${this.reason}: ${this.explanation}` : this.reason;
}
}
const Ro = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], Do = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
function we(t, e) {
return new Ae(
"unit out of range",
`you specified ${e} (of type ${typeof e}) as a ${t}, which is invalid`
);
}
function Ji(t, e, r) {
const n = new Date(Date.UTC(t, e - 1, r));
t < 100 && t >= 0 && n.setUTCFullYear(n.getUTCFullYear() - 1900);
const s = n.getUTCDay();
return s === 0 ? 7 : s;
}
function Mo(t, e, r) {
return r + (dn(t) ? Do : Ro)[e - 1];
}
function Po(t, e) {
const r = dn(t) ? Do : Ro, n = r.findIndex((i) => i < e), s = e - r[n];
return { month: n + 1, day: s };
}
function $i(t, e) {
return (t - e + 7) % 7 + 1;
}
function Mn(t, e = 4, r = 1) {
const { year: n, month: s, day: i } = t, a = Mo(n, s, i), o = $i(Ji(n, s, i), r);
let c = Math.floor((a - o + 14 - e) / 7), u;
return c < 1 ? (u = n - 1, c = Ur(u, e, r)) : c > Ur(n, e, r) ? (u = n + 1, c = 1) : u = n, { weekYear: u, weekNumber: c, weekday: o, ...As(t) };
}
function Sa(t, e = 4, r = 1) {
const { weekYear: n, weekNumber: s, weekday: i } = t, a = $i(Ji(n, 1, e), r), o = tr(n);
let c = s * 7 + i - a - 7 + e, u;
c < 1 ? (u = n - 1, c += tr(u)) : c > o ? (u = n + 1, c -= tr(n)) : u = n;
const { month: l, day: m } = Po(u, c);
return { year: u, month: l, day: m, ...As(t) };
}
function Vs(t) {
const { year: e, month: r, day: n } = t, s = Mo(e, r, n);
return { year: e, ordinal: s, ...As(t) };
}
function ka(t) {
const { year: e, ordinal: r } = t, { month: n, day: s } = Po(e, r);
return { year: e, month: n, day: s, ...As(t) };
}
function Ea(t, e) {
if (!C(t.localWeekday) || !C(t.localWeekNumber) || !C(t.localWeekYear)) {
if (!C(t.weekday) || !C(t.weekNumber) || !C(t.weekYear))
throw new Qt(
"Cannot mix locale-based week fields with ISO-based week fields"
);
return C(t.localWeekday) || (t.weekday = t.localWeekday), C(t.localWeekNumber) || (t.weekNumber = t.localWeekNumber), C(t.localWeekYear) || (t.weekYear = t.localWeekYear), delete t.localWeekday, delete t.localWeekNumber, delete t.localWeekYear, {
minDaysInFirstWeek: e.getMinDaysInFirstWeek(),
startOfWeek: e.getStartOfWeek()
};
} else
return { minDaysInFirstWeek: 4, startOfWeek: 1 };
}
function Fu(t, e = 4, r = 1) {
const n = xs(t.weekYear), s = be(
t.weekNumber,
1,
Ur(t.weekYear, e, r)
), i = be(t.weekday, 1, 7);
return n ? s ? i ? !1 : we("weekday", t.weekday) : we("week", t.weekNumber) : we("weekYear", t.weekYear);
}
function ju(t) {
const e = xs(t.year), r = be(t.ordinal, 1, tr(t.year));
return e ? r ? !1 : we("ordinal", t.ordinal) : we("year", t.year);
}
function Jo(t) {
const e = xs(t.year), r = be(t.month, 1, 12), n = be(t.day, 1, Pn(t.year, t.month));
return e ? r ? n ? !1 : we("day", t.day) : we("month", t.month) : we("year", t.year);
}
function $o(t) {
const { hour: e, minute: r, second: n, millisecond: s } = t, i = be(e, 0, 23) || e === 24 && r === 0 && n === 0 && s === 0, a = be(r, 0, 59), o = be(n, 0, 59), c = be(s, 0, 999);
return i ? a ? o ? c ? !1 : we("millisecond", s) : we("second", n) : we("minute", r) : we("hour", e);
}
function C(t) {
return typeof t > "u";
}
function pt(t) {
return typeof t == "number";
}
function xs(t) {
return typeof t == "number" && t % 1 === 0;
}
function qu(t) {
return typeof t == "string";
}
function Hu(t) {
return Object.prototype.toString.call(t) === "[object Date]";
}
function Wo() {
try {
return typeof Intl < "u" && !!Intl.RelativeTimeFormat;
} catch {
return !1;
}
}
function Zo() {
try {
return typeof Intl < "u" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
} catch {
return !1;
}
}
function Ku(t) {
return Array.isArray(t) ? t : [t];
}
function xa(t, e, r) {
if (t.length !== 0)
return t.reduce((n, s) => {
const i = [e(s), s];
return n && r(n[0], i[0]) === n[0] ? n : i;
}, null)[1];
}
function Bu(t, e) {
return e.reduce((r, n) => (r[n] = t[n], r), {});
}
function ar(t, e) {
return Object.prototype.hasOwnProperty.call(t, e);
}
function si(t) {
if (t == null)
return null;
if (typeof t != "object")
throw new oe("Week settings must be an object");
if (!be(t.firstDay, 1, 7) || !be(t.minimalDays, 1, 7) || !Array.isArray(t.weekend) || t.weekend.some((e) => !be(e, 1, 7)))
throw new oe("Invalid week settings");
return {
firstDay: t.firstDay,
minimalDays: t.minimalDays,
weekend: Array.from(t.weekend)
};
}
function be(t, e, r) {
return xs(t) && t >= e && t <= r;
}
function zu(t, e) {
return t - e * Math.floor(t / e);
}
function te(t, e = 2) {
const r = t < 0;
let n;
return r ? n = "-" + ("" + -t).padStart(e, "0") : n = ("" + t).padStart(e, "0"), n;
}
function ct(t) {
if (!(C(t) || t === null || t === ""))
return parseInt(t, 10);
}
function St(t) {
if (!(C(t) || t === null || t === ""))
return parseFloat(t);
}
function Wi(t) {
if (!(C(t) || t === null || t === "")) {
const e = parseFloat("0." + t) * 1e3;
return Math.floor(e);
}
}
function Zi(t, e, r = !1) {
const n = 10 ** e;
return (r ? Math.trunc : Math.round)(t * n) / n;
}
function dn(t) {
return t % 4 === 0 && (t % 100 !== 0 || t % 400 === 0);
}
function tr(t) {
return dn(t) ? 366 : 365;
}
function Pn(t, e) {
const r = zu(e - 1, 12) + 1, n = t + (e - r) / 12;
return r === 2 ? dn(n) ? 29 : 28 : [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][r - 1];
}
function Os(t) {
let e = Date.UTC(
t.year,
t.month - 1,
t.day,
t.hour,
t.minute,
t.second,
t.millisecond
);
return t.year < 100 && t.year >= 0 && (e = new Date(e), e.setUTCFullYear(t.year, t.month - 1, t.day)), +e;
}
function Oa(t, e, r) {
return -$i(Ji(t, 1, e), r) + e - 1;
}
function Ur(t, e = 4, r = 1) {
const n = Oa(t, e, r), s = Oa(t + 1, e, r);
return (tr(t) - n + s) / 7;
}
function ii(t) {
return t > 99 ? t : t > X.twoDigitCutoffYear ? 1900 + t : 2e3 + t;
}
function Uo(t, e, r, n = null) {
const s = new Date(t), i = {
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit"
};
n && (i.timeZone = n);
const a = { timeZoneName: e, ...i }, o = new Intl.DateTimeFormat(r, a).formatToParts(s).find((c) => c.type.toLowerCase() === "timezonename");
return o ? o.value : null;
}
function Ts(t, e) {
let r = parseInt(t, 10);
Number.isNaN(r) && (r = 0);
const n = parseInt(e, 10) || 0, s = r < 0 || Object.is(r, -0) ? -n : n;
return r * 60 + s;
}
function Vo(t) {
const e = Number(t);
if (typeof t == "boolean" || t === "" || Number.isNaN(e))
throw new oe(`Invalid unit value ${t}`);
return e;
}
function Jn(t, e) {
const r = {};
for (const n in t)
if (ar(t, n)) {
const s = t[n];
if (s == null) continue;
r[e(n)] = Vo(s);
}
return r;
}
function Dr(t, e) {
const r = Math.trunc(Math.abs(t / 60)), n = Math.trunc(Math.abs(t % 60)), s = t >= 0 ? "+" : "-";
switch (e) {
case "short":
return `${s}${te(r, 2)}:${te(n, 2)}`;
case "narrow":
return `${s}${r}${n > 0 ? `:${n}` : ""}`;
case "techie":
return `${s}${te(r, 2)}${te(n, 2)}`;
default:
throw new RangeError(`Value format ${e} is out of range for property format`);
}
}
function As(t) {
return Bu(t, ["hour", "minute", "second", "millisecond"]);
}
const Gu = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
], Lo = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
], Yu = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
function Fo(t) {
switch (t) {
case "narrow":
return [...Yu];
case "short":
return [...Lo];
case "long":
return [...Gu];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
case "2-digit":
return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
default:
return null;
}
}
const jo = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday"
], qo = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Xu = ["M", "T", "W", "T", "F", "S", "S"];
function Ho(t) {
switch (t) {
case "narrow":
return [...Xu];
case "short":
return [...qo];
case "long":
return [...jo];
case "numeric":
return ["1", "2", "3", "4", "5", "6", "7"];
default:
return null;
}
}
const Ko = ["AM", "PM"], Qu = ["Before Christ", "Anno Domini"], el = ["BC", "AD"], tl = ["B", "A"];
function Bo(t) {
switch (t) {
case "narrow":
return [...tl];
case "short":
return [...el];
case "long":
return [...Qu];
default:
return null;
}
}
function rl(t) {
return Ko[t.hour < 12 ? 0 : 1];
}
function nl(t, e) {
return Ho(e)[t.weekday - 1];
}
function sl(t, e) {
return Fo(e)[t.month - 1];
}
function il(t, e) {
return Bo(e)[t.year < 0 ? 0 : 1];
}
function al(t, e, r = "always", n = !1) {
const s = {
years: ["year", "yr."],
quarters: ["quarter", "qtr."],
months: ["month", "mo."],
weeks: ["week", "wk."],
days: ["day", "day", "days"],
hours: ["hour", "hr."],
minutes: ["minute", "min."],
seconds: ["second", "sec."]
}, i = ["hours", "minutes", "seconds"].indexOf(t) === -1;
if (r === "auto" && i) {
const m = t === "days";
switch (e) {
case 1:
return m ? "tomorrow" : `next ${s[t][0]}`;
case -1:
return m ? "yesterday" : `last ${s[t][0]}`;
case 0:
return m ? "today" : `this ${s[t][0]}`;
}
}
const a = Object.is(e, -0) || e < 0, o = Math.abs(e), c = o === 1, u = s[t], l = n ? c ? u[1] : u[2] || u[1] : c ? s[t][0] : t;
return a ? `${o} ${l} ago` : `in ${o} ${l}`;
}
function Ta(t, e) {
let r = "";
for (const n of t)
n.literal ? r += n.val : r += e(n.val);
return r;
}
const ol = {
D: Dn,
DD: fo,
DDD: po,
DDDD: mo,
t: yo,
tt: go,
ttt: vo,
tttt: _o,
T: wo,
TT: bo,
TTT: So,
TTTT: ko,
f: Eo,
ff: Oo,
fff: Ao,
ffff: Io,
F: xo,
FF: To,
FFF: No,
FFFF: Co
};
class ce {
static create(e, r = {}) {
return new ce(e, r);
}
static parseFormat(e) {
let r = null, n = "", s = !1;
const i = [];
for (let a = 0; a < e.length; a++) {
const o = e.charAt(a);
o === "'" ? (n.length > 0 && i.push({ literal: s || /^\s+$/.test(n), val: n }), r = null, n = "", s = !s) : s || o === r ? n += o : (n.length > 0 && i.push({ literal: /^\s+$/.test(n), val: n }), n = o, r = o);
}
return n.length > 0 && i.push({ literal: s || /^\s+$/.test(n), val: n }), i;
}
static macroTokenToFormatOpts(e) {
return ol[e];
}
constructor(e, r) {
this.opts = r, this.loc = e, this.systemLoc = null;
}
formatWithSystemDefault(e, r) {
return this.systemLoc === null && (this.systemLoc = this.loc.redefaultToSystem()), this.systemLoc.dtFormatter(e, { ...this.opts, ...r }).format();
}
dtFormatter(e, r = {}) {
return this.loc.dtFormatter(e, { ...this.opts, ...r });
}
formatDateTime(e, r) {
return this.dtFormatter(e, r).format();
}
formatDateTimeParts(e, r) {
return this.dtFormatter(e, r).formatToParts();
}
formatInterval(e, r) {
return this.dtFormatter(e.start, r).dtf.formatRange(e.start.toJSDate(), e.end.toJSDate());
}
resolvedOptions(e, r) {
return this.dtFormatter(e, r).resolvedOptions();
}
num(e, r = 0) {
if (this.opts.forceSimple)
return te(e, r);
const n = { ...this.opts };
return r > 0 && (n.padTo = r), this.loc.numberFormatter(n).format(e);
}
formatDateTimeFromString(e, r) {
const n = this.loc.listingMode() === "en", s = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", i = (p, x) => this.loc.extract(e, p, x), a = (p) => e.isOffsetFixed && e.offset === 0 && p.allowZ ? "Z" : e.isValid ? e.zone.formatOffset(e.ts, p.format) : "", o = () => n ? rl(e) : i({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), c = (p, x) => n ? sl(e, p) : i(x ? { month: p } : { month: p, day: "numeric" }, "month"), u = (p, x) => n ? nl(e, p) : i(
x ? { weekday: p } : { weekday: p, month: "long", day: "numeric" },
"weekday"
), l = (p) => {
const x = ce.macroTokenToFormatOpts(p);
return x ? this.formatWithSystemDefault(e, x) : p;
}, m = (p) => n ? il(e, p) : i({ era: p }, "era"), S = (p) => {
switch (p) {
case "S":
return this.num(e.millisecond);
case "u":
case "SSS":
return this.num(e.millisecond, 3);
case "s":
return this.num(e.second);
case "ss":
return this.num(e.second, 2);
case "uu":
return this.num(Math.floor(e.millisecond / 10), 2);
case "uuu":
return this.num(Math.floor(e.millisecond / 100));
case "m":
return this.num(e.minute);
case "mm":
return this.num(e.minute, 2);
case "h":
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12);
case "hh":
return this.num(e.hour % 12 === 0 ? 12 : e.hour % 12, 2);
case "H":
return this.num(e.hour);
case "HH":
return this.num(e.hour, 2);
case "Z":
return a({ format: "narrow", allowZ: this.opts.allowZ });
case "ZZ":
return a({ format: "short", allowZ: this.opts.allowZ });
case "ZZZ":
return a({ format: "techie", allowZ: this.opts.allowZ });
case "ZZZZ":
return e.zone.offsetName(e.ts, { format: "short", locale: this.loc.locale });
case "ZZZZZ":
return e.zone.offsetName(e.ts, { format: "long", locale: this.loc.locale });
case "z":
return e.zoneName;
case "a":
return o();
case "d":
return s ? i({ day: "numeric" }, "day") : this.num(e.day);
case "dd":
return s ? i({ day: "2-digit" }, "day") : this.num(e.day, 2);
case "c":
return this.num(e.weekday);
case "ccc":
return u("short", !0);
case "cccc":
return u("long", !0);
case "ccccc":
return u("narrow", !0);
case "E":
return this.num(e.weekday);
case "EEE":
return u("short", !1);
case "EEEE":
return u("long", !1);
case "EEEEE":
return u("narrow", !1);
case "L":
return s ? i({ month: "numeric", day: "numeric" }, "month") : this.num(e.month);
case "LL":
return s ? i({ month: "2-digit", day: "numeric" }, "month") : this.num(e.month, 2);
case "LLL":
return c("short", !0);
case "LLLL":
return c("long", !0);
case "LLLLL":
return c("narrow", !0);
case "M":
return s ? i({ month: "numeric" }, "month") : this.num(e.month);
case "MM":
return s ? i({ month: "2-digit" }, "month") : this.num(e.month, 2);
case "MMM":
return c("short", !1);
case "MMMM":
return c("long", !1);
case "MMMMM":
return c("narrow", !1);
case "y":
return s ? i({ year: "numeric" }, "year") : this.num(e.year);
case "yy":
return s ? i({ year: "2-digit" }, "year") : this.num(e.year.toString().slice(-2), 2);
case "yyyy":
return s ? i({ year: "numeric" }, "year") : thi