@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
1,459 lines • 131 kB
JavaScript
import { jsxs as ye, jsx as T, Fragment as Ot } from "react/jsx-runtime";
import { useTranslations as ct } from "next-intl";
import { useState as Nt } from "react";
import { B as dt } from "./Button-CvQ4tVYH.mjs";
import { S as Rt, a as Dt } from "./SeparatorText-CqJDc7kH.mjs";
import "./index-D1kF7Ir3.mjs";
import { c as qe } from "./index-2NvaPZWc.mjs";
import { u as Zt, b as ut, a as Ge } from "./FormError-DjJ1kCLa.mjs";
import { I as Je } from "./Input-DDoaYMbN.mjs";
const Bt = () => {
};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const lt = function(r) {
const e = [];
let t = 0;
for (let n = 0; n < r.length; n++) {
let s = r.charCodeAt(n);
s < 128 ? e[t++] = s : s < 2048 ? (e[t++] = s >> 6 | 192, e[t++] = s & 63 | 128) : (s & 64512) === 55296 && n + 1 < r.length && (r.charCodeAt(n + 1) & 64512) === 56320 ? (s = 65536 + ((s & 1023) << 10) + (r.charCodeAt(++n) & 1023), e[t++] = s >> 18 | 240, e[t++] = s >> 12 & 63 | 128, e[t++] = s >> 6 & 63 | 128, e[t++] = s & 63 | 128) : (e[t++] = s >> 12 | 224, e[t++] = s >> 6 & 63 | 128, e[t++] = s & 63 | 128);
}
return e;
}, Mt = function(r) {
const e = [];
let t = 0, n = 0;
for (; t < r.length; ) {
const s = r[t++];
if (s < 128)
e[n++] = String.fromCharCode(s);
else if (s > 191 && s < 224) {
const a = r[t++];
e[n++] = String.fromCharCode((s & 31) << 6 | a & 63);
} else if (s > 239 && s < 365) {
const a = r[t++], i = r[t++], o = r[t++], c = ((s & 7) << 18 | (a & 63) << 12 | (i & 63) << 6 | o & 63) - 65536;
e[n++] = String.fromCharCode(55296 + (c >> 10)), e[n++] = String.fromCharCode(56320 + (c & 1023));
} else {
const a = r[t++], i = r[t++];
e[n++] = String.fromCharCode((s & 15) << 12 | (a & 63) << 6 | i & 63);
}
}
return e.join("");
}, ft = {
/**
* Maps bytes to characters.
*/
byteToCharMap_: null,
/**
* Maps characters to bytes.
*/
charToByteMap_: null,
/**
* Maps bytes to websafe characters.
* @private
*/
byteToCharMapWebSafe_: null,
/**
* Maps websafe characters to bytes.
* @private
*/
charToByteMapWebSafe_: null,
/**
* Our default alphabet, shared between
* ENCODED_VALS and ENCODED_VALS_WEBSAFE
*/
ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
/**
* Our default alphabet. Value 64 (=) is special; it means "nothing."
*/
get ENCODED_VALS() {
return this.ENCODED_VALS_BASE + "+/=";
},
/**
* Our websafe alphabet.
*/
get ENCODED_VALS_WEBSAFE() {
return this.ENCODED_VALS_BASE + "-_.";
},
/**
* Whether this browser supports the atob and btoa functions. This extension
* started at Mozilla but is now implemented by many browsers. We use the
* ASSUME_* variables to avoid pulling in the full useragent detection library
* but still allowing the standard per-browser compilations.
*
*/
HAS_NATIVE_SUPPORT: typeof atob == "function",
/**
* Base64-encode an array of bytes.
*
* @param input An array of bytes (numbers with
* value in [0, 255]) to encode.
* @param webSafe Boolean indicating we should use the
* alternative alphabet.
* @return The base64 encoded string.
*/
encodeByteArray(r, e) {
if (!Array.isArray(r))
throw Error("encodeByteArray takes an array as a parameter");
this.init_();
const t = e ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, n = [];
for (let s = 0; s < r.length; s += 3) {
const a = r[s], i = s + 1 < r.length, o = i ? r[s + 1] : 0, c = s + 2 < r.length, d = c ? r[s + 2] : 0, p = a >> 2, b = (a & 3) << 4 | o >> 4;
let D = (o & 15) << 2 | d >> 6, $ = d & 63;
c || ($ = 64, i || (D = 64)), n.push(t[p], t[b], t[D], t[$]);
}
return n.join("");
},
/**
* Base64-encode a string.
*
* @param input A string to encode.
* @param webSafe If true, we should use the
* alternative alphabet.
* @return The base64 encoded string.
*/
encodeString(r, e) {
return this.HAS_NATIVE_SUPPORT && !e ? btoa(r) : this.encodeByteArray(lt(r), e);
},
/**
* Base64-decode a string.
*
* @param input to decode.
* @param webSafe True if we should use the
* alternative alphabet.
* @return string representing the decoded value.
*/
decodeString(r, e) {
return this.HAS_NATIVE_SUPPORT && !e ? atob(r) : Mt(this.decodeStringToByteArray(r, e));
},
/**
* Base64-decode a string.
*
* In base-64 decoding, groups of four characters are converted into three
* bytes. If the encoder did not apply padding, the input length may not
* be a multiple of 4.
*
* In this case, the last group will have fewer than 4 characters, and
* padding will be inferred. If the group has one or two characters, it decodes
* to one byte. If the group has three characters, it decodes to two bytes.
*
* @param input Input to decode.
* @param webSafe True if we should use the web-safe alphabet.
* @return bytes representing the decoded value.
*/
decodeStringToByteArray(r, e) {
this.init_();
const t = e ? this.charToByteMapWebSafe_ : this.charToByteMap_, n = [];
for (let s = 0; s < r.length; ) {
const a = t[r.charAt(s++)], o = s < r.length ? t[r.charAt(s)] : 0;
++s;
const d = s < r.length ? t[r.charAt(s)] : 64;
++s;
const b = s < r.length ? t[r.charAt(s)] : 64;
if (++s, a == null || o == null || d == null || b == null)
throw new jt();
const D = a << 2 | o >> 4;
if (n.push(D), d !== 64) {
const $ = o << 4 & 240 | d >> 2;
if (n.push($), b !== 64) {
const It = d << 6 & 192 | b;
n.push(It);
}
}
}
return n;
},
/**
* Lazy static initialization function. Called before
* accessing any of the static map variables.
* @private
*/
init_() {
if (!this.byteToCharMap_) {
this.byteToCharMap_ = {}, this.charToByteMap_ = {}, this.byteToCharMapWebSafe_ = {}, this.charToByteMapWebSafe_ = {};
for (let r = 0; r < this.ENCODED_VALS.length; r++)
this.byteToCharMap_[r] = this.ENCODED_VALS.charAt(r), this.charToByteMap_[this.byteToCharMap_[r]] = r, this.byteToCharMapWebSafe_[r] = this.ENCODED_VALS_WEBSAFE.charAt(r), this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]] = r, r >= this.ENCODED_VALS_BASE.length && (this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)] = r, this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)] = r);
}
}
};
class jt extends Error {
constructor() {
super(...arguments), this.name = "DecodeBase64StringError";
}
}
const $t = function(r) {
const e = lt(r);
return ft.encodeByteArray(e, !0);
}, ht = function(r) {
return $t(r).replace(/\./g, "");
}, Pt = function(r) {
try {
return ft.decodeString(r, !0);
} catch (e) {
console.error("base64Decode failed: ", e);
}
return null;
};
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function Vt() {
if (typeof self < "u")
return self;
if (typeof window < "u")
return window;
if (typeof global < "u")
return global;
throw new Error("Unable to locate global object.");
}
/**
* @license
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Lt = () => Vt().__FIREBASE_DEFAULTS__, Ft = () => {
if (typeof process > "u" || typeof process.env > "u")
return;
const r = process.env.__FIREBASE_DEFAULTS__;
if (r)
return JSON.parse(r);
}, Ut = () => {
if (typeof document > "u")
return;
let r;
try {
r = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
} catch {
return;
}
const e = r && Pt(r[1]);
return e && JSON.parse(e);
}, Ht = () => {
try {
return Bt() || Lt() || Ft() || Ut();
} catch (r) {
console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`);
return;
}
}, Es = (r) => {
var e;
return (e = Ht()) === null || e === void 0 ? void 0 : e[`_${r}`];
};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function zt() {
return typeof navigator < "u" && typeof navigator.userAgent == "string" ? navigator.userAgent : "";
}
function Ss() {
return typeof window < "u" && // @ts-ignore Setting up an broadly applicable index signature for Window
// just to deal with this case would probably be a bad idea.
!!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(zt());
}
function Ts() {
return typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers";
}
function Cs() {
const r = typeof chrome == "object" ? chrome.runtime : typeof browser == "object" ? browser.runtime : void 0;
return typeof r == "object" && r.id !== void 0;
}
function As() {
return typeof navigator == "object" && navigator.product === "ReactNative";
}
function Wt() {
try {
return typeof indexedDB == "object";
} catch {
return !1;
}
}
function qt() {
return new Promise((r, e) => {
try {
let t = !0;
const n = "validate-browser-context-for-indexeddb-analytics-module", s = self.indexedDB.open(n);
s.onsuccess = () => {
s.result.close(), t || self.indexedDB.deleteDatabase(n), r(!0);
}, s.onupgradeneeded = () => {
t = !1;
}, s.onerror = () => {
var a;
e(((a = s.error) === null || a === void 0 ? void 0 : a.message) || "");
};
} catch (t) {
e(t);
}
});
}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Gt = "FirebaseError";
class V extends Error {
constructor(e, t, n) {
super(t), this.code = e, this.customData = n, this.name = Gt, Object.setPrototypeOf(this, V.prototype), Error.captureStackTrace && Error.captureStackTrace(this, pt.prototype.create);
}
}
class pt {
constructor(e, t, n) {
this.service = e, this.serviceName = t, this.errors = n;
}
create(e, ...t) {
const n = t[0] || {}, s = `${this.service}/${e}`, a = this.errors[e], i = a ? Jt(a, n) : "Error", o = `${this.serviceName}: ${i} (${s}).`;
return new V(s, o, n);
}
}
function Jt(r, e) {
return r.replace(Yt, (t, n) => {
const s = e[n];
return s != null ? String(s) : `<${n}?>`;
});
}
const Yt = /\{\$([^}]+)}/g;
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function Is(r) {
const e = [];
for (const [t, n] of Object.entries(r))
Array.isArray(n) ? n.forEach((s) => {
e.push(encodeURIComponent(t) + "=" + encodeURIComponent(s));
}) : e.push(encodeURIComponent(t) + "=" + encodeURIComponent(n));
return e.length ? "&" + e.join("&") : "";
}
function Os(r, e) {
const t = new Kt(r, e);
return t.subscribe.bind(t);
}
class Kt {
/**
* @param executor Function which can make calls to a single Observer
* as a proxy.
* @param onNoObservers Callback when count of Observers goes to zero.
*/
constructor(e, t) {
this.observers = [], this.unsubscribes = [], this.observerCount = 0, this.task = Promise.resolve(), this.finalized = !1, this.onNoObservers = t, this.task.then(() => {
e(this);
}).catch((n) => {
this.error(n);
});
}
next(e) {
this.forEachObserver((t) => {
t.next(e);
});
}
error(e) {
this.forEachObserver((t) => {
t.error(e);
}), this.close(e);
}
complete() {
this.forEachObserver((e) => {
e.complete();
}), this.close();
}
/**
* Subscribe function that can be used to add an Observer to the fan-out list.
*
* - We require that no event is sent to a subscriber synchronously to their
* call to subscribe().
*/
subscribe(e, t, n) {
let s;
if (e === void 0 && t === void 0 && n === void 0)
throw new Error("Missing Observer.");
Xt(e, [
"next",
"error",
"complete"
]) ? s = e : s = {
next: e,
error: t,
complete: n
}, s.next === void 0 && (s.next = Ce), s.error === void 0 && (s.error = Ce), s.complete === void 0 && (s.complete = Ce);
const a = this.unsubscribeOne.bind(this, this.observers.length);
return this.finalized && this.task.then(() => {
try {
this.finalError ? s.error(this.finalError) : s.complete();
} catch {
}
}), this.observers.push(s), a;
}
// Unsubscribe is synchronous - we guarantee that no events are sent to
// any unsubscribed Observer.
unsubscribeOne(e) {
this.observers === void 0 || this.observers[e] === void 0 || (delete this.observers[e], this.observerCount -= 1, this.observerCount === 0 && this.onNoObservers !== void 0 && this.onNoObservers(this));
}
forEachObserver(e) {
if (!this.finalized)
for (let t = 0; t < this.observers.length; t++)
this.sendOne(t, e);
}
// Call the Observer via one of it's callback function. We are careful to
// confirm that the observe has not been unsubscribed since this asynchronous
// function had been queued.
sendOne(e, t) {
this.task.then(() => {
if (this.observers !== void 0 && this.observers[e] !== void 0)
try {
t(this.observers[e]);
} catch (n) {
typeof console < "u" && console.error && console.error(n);
}
});
}
close(e) {
this.finalized || (this.finalized = !0, e !== void 0 && (this.finalError = e), this.task.then(() => {
this.observers = void 0, this.onNoObservers = void 0;
}));
}
}
function Xt(r, e) {
if (typeof r != "object" || r === null)
return !1;
for (const t of e)
if (t in r && typeof r[t] == "function")
return !0;
return !1;
}
function Ce() {
}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function Ns(r) {
return r && r._delegate ? r._delegate : r;
}
class Be {
/**
*
* @param name The public service name, e.g. app, auth, firestore, database
* @param instanceFactory Service factory responsible for creating the public interface
* @param type whether the service provided by the component is public or private
*/
constructor(e, t, n) {
this.name = e, this.instanceFactory = t, this.type = n, this.multipleInstances = !1, this.serviceProps = {}, this.instantiationMode = "LAZY", this.onInstanceCreated = null;
}
setInstantiationMode(e) {
return this.instantiationMode = e, this;
}
setMultipleInstances(e) {
return this.multipleInstances = e, this;
}
setServiceProps(e) {
return this.serviceProps = e, this;
}
setInstanceCreatedCallback(e) {
return this.onInstanceCreated = e, this;
}
}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var x;
(function(r) {
r[r.DEBUG = 0] = "DEBUG", r[r.VERBOSE = 1] = "VERBOSE", r[r.INFO = 2] = "INFO", r[r.WARN = 3] = "WARN", r[r.ERROR = 4] = "ERROR", r[r.SILENT = 5] = "SILENT";
})(x || (x = {}));
const Qt = {
debug: x.DEBUG,
verbose: x.VERBOSE,
info: x.INFO,
warn: x.WARN,
error: x.ERROR,
silent: x.SILENT
}, er = x.INFO, tr = {
[x.DEBUG]: "log",
[x.VERBOSE]: "log",
[x.INFO]: "info",
[x.WARN]: "warn",
[x.ERROR]: "error"
}, rr = (r, e, ...t) => {
if (e < r.logLevel)
return;
const n = (/* @__PURE__ */ new Date()).toISOString(), s = tr[e];
if (s)
console[s](`[${n}] ${r.name}:`, ...t);
else
throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);
};
class nr {
/**
* Gives you an instance of a Logger to capture messages according to
* Firebase's logging scheme.
*
* @param name The name that the logs will be associated with
*/
constructor(e) {
this.name = e, this._logLevel = er, this._logHandler = rr, this._userLogHandler = null;
}
get logLevel() {
return this._logLevel;
}
set logLevel(e) {
if (!(e in x))
throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);
this._logLevel = e;
}
// Workaround for setter/getter having to be the same type.
setLogLevel(e) {
this._logLevel = typeof e == "string" ? Qt[e] : e;
}
get logHandler() {
return this._logHandler;
}
set logHandler(e) {
if (typeof e != "function")
throw new TypeError("Value assigned to `logHandler` must be a function");
this._logHandler = e;
}
get userLogHandler() {
return this._userLogHandler;
}
set userLogHandler(e) {
this._userLogHandler = e;
}
/**
* The functions below are all based on the `console` interface
*/
debug(...e) {
this._userLogHandler && this._userLogHandler(this, x.DEBUG, ...e), this._logHandler(this, x.DEBUG, ...e);
}
log(...e) {
this._userLogHandler && this._userLogHandler(this, x.VERBOSE, ...e), this._logHandler(this, x.VERBOSE, ...e);
}
info(...e) {
this._userLogHandler && this._userLogHandler(this, x.INFO, ...e), this._logHandler(this, x.INFO, ...e);
}
warn(...e) {
this._userLogHandler && this._userLogHandler(this, x.WARN, ...e), this._logHandler(this, x.WARN, ...e);
}
error(...e) {
this._userLogHandler && this._userLogHandler(this, x.ERROR, ...e), this._logHandler(this, x.ERROR, ...e);
}
}
const sr = (r, e) => e.some((t) => r instanceof t);
let Ye, Ke;
function ar() {
return Ye || (Ye = [
IDBDatabase,
IDBObjectStore,
IDBIndex,
IDBCursor,
IDBTransaction
]);
}
function ir() {
return Ke || (Ke = [
IDBCursor.prototype.advance,
IDBCursor.prototype.continue,
IDBCursor.prototype.continuePrimaryKey
]);
}
const mt = /* @__PURE__ */ new WeakMap(), Me = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), Ae = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap();
function or(r) {
const e = new Promise((t, n) => {
const s = () => {
r.removeEventListener("success", a), r.removeEventListener("error", i);
}, a = () => {
t(P(r.result)), s();
}, i = () => {
n(r.error), s();
};
r.addEventListener("success", a), r.addEventListener("error", i);
});
return e.then((t) => {
t instanceof IDBCursor && mt.set(t, r);
}).catch(() => {
}), He.set(e, r), e;
}
function cr(r) {
if (Me.has(r))
return;
const e = new Promise((t, n) => {
const s = () => {
r.removeEventListener("complete", a), r.removeEventListener("error", i), r.removeEventListener("abort", i);
}, a = () => {
t(), s();
}, i = () => {
n(r.error || new DOMException("AbortError", "AbortError")), s();
};
r.addEventListener("complete", a), r.addEventListener("error", i), r.addEventListener("abort", i);
});
Me.set(r, e);
}
let je = {
get(r, e, t) {
if (r instanceof IDBTransaction) {
if (e === "done")
return Me.get(r);
if (e === "objectStoreNames")
return r.objectStoreNames || gt.get(r);
if (e === "store")
return t.objectStoreNames[1] ? void 0 : t.objectStore(t.objectStoreNames[0]);
}
return P(r[e]);
},
set(r, e, t) {
return r[e] = t, !0;
},
has(r, e) {
return r instanceof IDBTransaction && (e === "done" || e === "store") ? !0 : e in r;
}
};
function dr(r) {
je = r(je);
}
function ur(r) {
return r === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(e, ...t) {
const n = r.call(Ie(this), e, ...t);
return gt.set(n, e.sort ? e.sort() : [e]), P(n);
} : ir().includes(r) ? function(...e) {
return r.apply(Ie(this), e), P(mt.get(this));
} : function(...e) {
return P(r.apply(Ie(this), e));
};
}
function lr(r) {
return typeof r == "function" ? ur(r) : (r instanceof IDBTransaction && cr(r), sr(r, ar()) ? new Proxy(r, je) : r);
}
function P(r) {
if (r instanceof IDBRequest)
return or(r);
if (Ae.has(r))
return Ae.get(r);
const e = lr(r);
return e !== r && (Ae.set(r, e), He.set(e, r)), e;
}
const Ie = (r) => He.get(r);
function fr(r, e, { blocked: t, upgrade: n, blocking: s, terminated: a } = {}) {
const i = indexedDB.open(r, e), o = P(i);
return n && i.addEventListener("upgradeneeded", (c) => {
n(P(i.result), c.oldVersion, c.newVersion, P(i.transaction), c);
}), t && i.addEventListener("blocked", (c) => t(
// Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
c.oldVersion,
c.newVersion,
c
)), o.then((c) => {
a && c.addEventListener("close", () => a()), s && c.addEventListener("versionchange", (d) => s(d.oldVersion, d.newVersion, d));
}).catch(() => {
}), o;
}
const hr = ["get", "getKey", "getAll", "getAllKeys", "count"], pr = ["put", "add", "delete", "clear"], Oe = /* @__PURE__ */ new Map();
function Xe(r, e) {
if (!(r instanceof IDBDatabase && !(e in r) && typeof e == "string"))
return;
if (Oe.get(e))
return Oe.get(e);
const t = e.replace(/FromIndex$/, ""), n = e !== t, s = pr.includes(t);
if (
// Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
!(t in (n ? IDBIndex : IDBObjectStore).prototype) || !(s || hr.includes(t))
)
return;
const a = async function(i, ...o) {
const c = this.transaction(i, s ? "readwrite" : "readonly");
let d = c.store;
return n && (d = d.index(o.shift())), (await Promise.all([
d[t](...o),
s && c.done
]))[0];
};
return Oe.set(e, a), a;
}
dr((r) => ({
...r,
get: (e, t, n) => Xe(e, t) || r.get(e, t, n),
has: (e, t) => !!Xe(e, t) || r.has(e, t)
}));
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class mr {
constructor(e) {
this.container = e;
}
// In initial implementation, this will be called by installations on
// auth token refresh, and installations will send this string.
getPlatformInfoString() {
return this.container.getProviders().map((t) => {
if (gr(t)) {
const n = t.getImmediate();
return `${n.library}/${n.version}`;
} else
return null;
}).filter((t) => t).join(" ");
}
}
function gr(r) {
const e = r.getComponent();
return (e == null ? void 0 : e.type) === "VERSION";
}
const $e = "@firebase/app", Qe = "0.11.4";
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const M = new nr("@firebase/app"), _r = "@firebase/app-compat", yr = "@firebase/analytics-compat", vr = "@firebase/analytics", br = "@firebase/app-check-compat", xr = "@firebase/app-check", wr = "@firebase/auth", kr = "@firebase/auth-compat", Er = "@firebase/database", Sr = "@firebase/data-connect", Tr = "@firebase/database-compat", Cr = "@firebase/functions", Ar = "@firebase/functions-compat", Ir = "@firebase/installations", Or = "@firebase/installations-compat", Nr = "@firebase/messaging", Rr = "@firebase/messaging-compat", Dr = "@firebase/performance", Zr = "@firebase/performance-compat", Br = "@firebase/remote-config", Mr = "@firebase/remote-config-compat", jr = "@firebase/storage", $r = "@firebase/storage-compat", Pr = "@firebase/firestore", Vr = "@firebase/vertexai", Lr = "@firebase/firestore-compat", Fr = "firebase", Ur = "11.6.0", Hr = {
[$e]: "fire-core",
[_r]: "fire-core-compat",
[vr]: "fire-analytics",
[yr]: "fire-analytics-compat",
[xr]: "fire-app-check",
[br]: "fire-app-check-compat",
[wr]: "fire-auth",
[kr]: "fire-auth-compat",
[Er]: "fire-rtdb",
[Sr]: "fire-data-connect",
[Tr]: "fire-rtdb-compat",
[Cr]: "fire-fn",
[Ar]: "fire-fn-compat",
[Ir]: "fire-iid",
[Or]: "fire-iid-compat",
[Nr]: "fire-fcm",
[Rr]: "fire-fcm-compat",
[Dr]: "fire-perf",
[Zr]: "fire-perf-compat",
[Br]: "fire-rc",
[Mr]: "fire-rc-compat",
[jr]: "fire-gcs",
[$r]: "fire-gcs-compat",
[Pr]: "fire-fst",
[Lr]: "fire-fst-compat",
[Vr]: "fire-vertex",
"fire-js": "fire-js",
// Platform identifier for JS SDK.
[Fr]: "fire-js-all"
};
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const zr = /* @__PURE__ */ new Map(), Wr = /* @__PURE__ */ new Map(), et = /* @__PURE__ */ new Map();
function tt(r, e) {
try {
r.container.addComponent(e);
} catch (t) {
M.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`, t);
}
}
function Pe(r) {
const e = r.name;
if (et.has(e))
return M.debug(`There were multiple attempts to register component ${e}.`), !1;
et.set(e, r);
for (const t of zr.values())
tt(t, r);
for (const t of Wr.values())
tt(t, r);
return !0;
}
function Rs(r) {
return r == null ? !1 : r.settings !== void 0;
}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const qr = {
"no-app": "No Firebase App '{$appName}' has been created - call initializeApp() first",
"bad-app-name": "Illegal App name: '{$appName}'",
"duplicate-app": "Firebase App named '{$appName}' already exists with different options or config",
"app-deleted": "Firebase App named '{$appName}' already deleted",
"server-app-deleted": "Firebase Server App has been deleted",
"no-options": "Need to provide options, when not being deployed to hosting via source.",
"invalid-app-argument": "firebase.{$appName}() takes either no argument or a Firebase App instance.",
"invalid-log-argument": "First argument to `onLog` must be null or a function.",
"idb-open": "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",
"idb-get": "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
"idb-set": "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",
"idb-delete": "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",
"finalization-registry-not-supported": "FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",
"invalid-server-app-environment": "FirebaseServerApp is not for use in browser environments."
}, ze = new pt("app", "Firebase", qr);
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Ds = Ur;
function Ne(r, e, t) {
var n;
let s = (n = Hr[r]) !== null && n !== void 0 ? n : r;
t && (s += `-${t}`);
const a = s.match(/\s|\//), i = e.match(/\s|\//);
if (a || i) {
const o = [
`Unable to register library "${s}" with version "${e}":`
];
a && o.push(`library name "${s}" contains illegal characters (whitespace or "/")`), a && i && o.push("and"), i && o.push(`version name "${e}" contains illegal characters (whitespace or "/")`), M.warn(o.join(" "));
return;
}
Pe(new Be(
`${s}-version`,
() => ({ library: s, version: e }),
"VERSION"
/* ComponentType.VERSION */
));
}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Gr = "firebase-heartbeat-database", Jr = 1, ne = "firebase-heartbeat-store";
let Re = null;
function _t() {
return Re || (Re = fr(Gr, Jr, {
upgrade: (r, e) => {
switch (e) {
case 0:
try {
r.createObjectStore(ne);
} catch (t) {
console.warn(t);
}
}
}
}).catch((r) => {
throw ze.create("idb-open", {
originalErrorMessage: r.message
});
})), Re;
}
async function Yr(r) {
try {
const t = (await _t()).transaction(ne), n = await t.objectStore(ne).get(yt(r));
return await t.done, n;
} catch (e) {
if (e instanceof V)
M.warn(e.message);
else {
const t = ze.create("idb-get", {
originalErrorMessage: e == null ? void 0 : e.message
});
M.warn(t.message);
}
}
}
async function rt(r, e) {
try {
const n = (await _t()).transaction(ne, "readwrite");
await n.objectStore(ne).put(e, yt(r)), await n.done;
} catch (t) {
if (t instanceof V)
M.warn(t.message);
else {
const n = ze.create("idb-set", {
originalErrorMessage: t == null ? void 0 : t.message
});
M.warn(n.message);
}
}
}
function yt(r) {
return `${r.name}!${r.options.appId}`;
}
/**
* @license
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const Kr = 1024, Xr = 30;
class Qr {
constructor(e) {
this.container = e, this._heartbeatsCache = null;
const t = this.container.getProvider("app").getImmediate();
this._storage = new tn(t), this._heartbeatsCachePromise = this._storage.read().then((n) => (this._heartbeatsCache = n, n));
}
/**
* Called to report a heartbeat. The function will generate
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
* to IndexedDB.
* Note that we only store one heartbeat per day. So if a heartbeat for today is
* already logged, subsequent calls to this function in the same day will be ignored.
*/
async triggerHeartbeat() {
var e, t;
try {
const s = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), a = nt();
if (((e = this._heartbeatsCache) === null || e === void 0 ? void 0 : e.heartbeats) == null && (this._heartbeatsCache = await this._heartbeatsCachePromise, ((t = this._heartbeatsCache) === null || t === void 0 ? void 0 : t.heartbeats) == null) || this._heartbeatsCache.lastSentHeartbeatDate === a || this._heartbeatsCache.heartbeats.some((i) => i.date === a))
return;
if (this._heartbeatsCache.heartbeats.push({ date: a, agent: s }), this._heartbeatsCache.heartbeats.length > Xr) {
const i = rn(this._heartbeatsCache.heartbeats);
this._heartbeatsCache.heartbeats.splice(i, 1);
}
return this._storage.overwrite(this._heartbeatsCache);
} catch (n) {
M.warn(n);
}
}
/**
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
* It also clears all heartbeats from memory as well as in IndexedDB.
*
* NOTE: Consuming product SDKs should not send the header if this method
* returns an empty string.
*/
async getHeartbeatsHeader() {
var e;
try {
if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, ((e = this._heartbeatsCache) === null || e === void 0 ? void 0 : e.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0)
return "";
const t = nt(), { heartbeatsToSend: n, unsentEntries: s } = en(this._heartbeatsCache.heartbeats), a = ht(JSON.stringify({ version: 2, heartbeats: n }));
return this._heartbeatsCache.lastSentHeartbeatDate = t, s.length > 0 ? (this._heartbeatsCache.heartbeats = s, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), a;
} catch (t) {
return M.warn(t), "";
}
}
}
function nt() {
return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
}
function en(r, e = Kr) {
const t = [];
let n = r.slice();
for (const s of r) {
const a = t.find((i) => i.agent === s.agent);
if (a) {
if (a.dates.push(s.date), st(t) > e) {
a.dates.pop();
break;
}
} else if (t.push({
agent: s.agent,
dates: [s.date]
}), st(t) > e) {
t.pop();
break;
}
n = n.slice(1);
}
return {
heartbeatsToSend: t,
unsentEntries: n
};
}
class tn {
constructor(e) {
this.app = e, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
}
async runIndexedDBEnvironmentCheck() {
return Wt() ? qt().then(() => !0).catch(() => !1) : !1;
}
/**
* Read all heartbeats.
*/
async read() {
if (await this._canUseIndexedDBPromise) {
const t = await Yr(this.app);
return t != null && t.heartbeats ? t : { heartbeats: [] };
} else
return { heartbeats: [] };
}
// overwrite the storage with the provided heartbeats
async overwrite(e) {
var t;
if (await this._canUseIndexedDBPromise) {
const s = await this.read();
return rt(this.app, {
lastSentHeartbeatDate: (t = e.lastSentHeartbeatDate) !== null && t !== void 0 ? t : s.lastSentHeartbeatDate,
heartbeats: e.heartbeats
});
} else
return;
}
// add heartbeats
async add(e) {
var t;
if (await this._canUseIndexedDBPromise) {
const s = await this.read();
return rt(this.app, {
lastSentHeartbeatDate: (t = e.lastSentHeartbeatDate) !== null && t !== void 0 ? t : s.lastSentHeartbeatDate,
heartbeats: [
...s.heartbeats,
...e.heartbeats
]
});
} else
return;
}
}
function st(r) {
return ht(
// heartbeatsCache wrapper properties
JSON.stringify({ version: 2, heartbeats: r })
).length;
}
function rn(r) {
if (r.length === 0)
return -1;
let e = 0, t = r[0].date;
for (let n = 1; n < r.length; n++)
r[n].date < t && (t = r[n].date, e = n);
return e;
}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function nn(r) {
Pe(new Be(
"platform-logger",
(e) => new mr(e),
"PRIVATE"
/* ComponentType.PRIVATE */
)), Pe(new Be(
"heartbeat",
(e) => new Qr(e),
"PRIVATE"
/* ComponentType.PRIVATE */
)), Ne($e, Qe, r), Ne($e, Qe, "esm2017"), Ne("fire-js", "");
}
nn("");
var v;
(function(r) {
r.assertEqual = (s) => s;
function e(s) {
}
r.assertIs = e;
function t(s) {
throw new Error();
}
r.assertNever = t, r.arrayToEnum = (s) => {
const a = {};
for (const i of s)
a[i] = i;
return a;
}, r.getValidEnumValues = (s) => {
const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
for (const o of a)
i[o] = s[o];
return r.objectValues(i);
}, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
return s[a];
}), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
const a = [];
for (const i in s)
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
return a;
}, r.find = (s, a) => {
for (const i of s)
if (a(i))
return i;
}, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
function n(s, a = " | ") {
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
}
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
})(v || (v = {}));
var Ve;
(function(r) {
r.mergeShapes = (e, t) => ({
...e,
...t
// second overwrites first
});
})(Ve || (Ve = {}));
const f = v.arrayToEnum([
"string",
"nan",
"number",
"integer",
"float",
"boolean",
"date",
"bigint",
"symbol",
"function",
"undefined",
"null",
"array",
"object",
"unknown",
"promise",
"void",
"never",
"map",
"set"
]), B = (r) => {
switch (typeof r) {
case "undefined":
return f.undefined;
case "string":
return f.string;
case "number":
return isNaN(r) ? f.nan : f.number;
case "boolean":
return f.boolean;
case "function":
return f.function;
case "bigint":
return f.bigint;
case "symbol":
return f.symbol;
case "object":
return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
default:
return f.unknown;
}
}, u = v.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite"
]), sn = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
class S extends Error {
get errors() {
return this.issues;
}
constructor(e) {
super(), this.issues = [], this.addIssue = (n) => {
this.issues = [...this.issues, n];
}, this.addIssues = (n = []) => {
this.issues = [...this.issues, ...n];
};
const t = new.target.prototype;
Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
}
format(e) {
const t = e || function(a) {
return a.message;
}, n = { _errors: [] }, s = (a) => {
for (const i of a.issues)
if (i.code === "invalid_union")
i.unionErrors.map(s);
else if (i.code === "invalid_return_type")
s(i.returnTypeError);
else if (i.code === "invalid_arguments")
s(i.argumentsError);
else if (i.path.length === 0)
n._errors.push(t(i));
else {
let o = n, c = 0;
for (; c < i.path.length; ) {
const d = i.path[c];
c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
}
}
};
return s(this), n;
}
static assert(e) {
if (!(e instanceof S))
throw new Error(`Not a ZodError: ${e}`);
}
toString() {
return this.message;
}
get message() {
return JSON.stringify(this.issues, v.jsonStringifyReplacer, 2);
}
get isEmpty() {
return this.issues.length === 0;
}
flatten(e = (t) => t.message) {
const t = {}, n = [];
for (const s of this.issues)
s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : n.push(e(s));
return { formErrors: n, fieldErrors: t };
}
get formErrors() {
return this.flatten();
}
}
S.create = (r) => new S(r);
const X = (r, e) => {
let t;
switch (r.code) {
case u.invalid_type:
r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
break;
case u.invalid_literal:
t = `Invalid literal value, expected ${JSON.stringify(r.expected, v.jsonStringifyReplacer)}`;
break;
case u.unrecognized_keys:
t = `Unrecognized key(s) in object: ${v.joinValues(r.keys, ", ")}`;
break;
case u.invalid_union:
t = "Invalid input";
break;
case u.invalid_union_discriminator:
t = `Invalid discriminator value. Expected ${v.joinValues(r.options)}`;
break;
case u.invalid_enum_value:
t = `Invalid enum value. Expected ${v.joinValues(r.options)}, received '${r.received}'`;
break;
case u.invalid_arguments:
t = "Invalid function arguments";
break;
case u.invalid_return_type:
t = "Invalid function return type";
break;
case u.invalid_date:
t = "Invalid date";
break;
case u.invalid_string:
typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : v.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
break;
case u.too_small:
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
break;
case u.too_big:
r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
break;
case u.custom:
t = "Invalid input";
break;
case u.invalid_intersection_types:
t = "Intersection results could not be merged";
break;
case u.not_multiple_of:
t = `Number must be a multiple of ${r.multipleOf}`;
break;
case u.not_finite:
t = "Number must be finite";
break;
default:
t = e.defaultError, v.assertNever(r);
}
return { message: t };
};
let vt = X;
function an(r) {
vt = r;
}
function ve() {
return vt;
}
const be = (r) => {
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
...s,
path: a
};
if (s.message !== void 0)
return {
...s,
path: a,
message: s.message
};
let o = "";
const c = n.filter((d) => !!d).slice().reverse();
for (const d of c)
o = d(i, { data: e, defaultError: o }).message;
return {
...s,
path: a,
message: o
};
}, on = [];
functi