@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
1,466 lines • 104 kB
JavaScript
import { jsxs as L, jsx as I, Fragment as Dt } from "react/jsx-runtime";
import { useTranslations as Ge } from "next-intl";
import { useState as Tt } from "react";
import { B as qe } from "./Button-nH76KtOO.mjs";
import { c as _e } from "./index-2NvaPZWc.mjs";
import { S as Ct, a as Pt } from "./SeparatorText-JZL1YX52.mjs";
import "./Toaster-BOgUkztH.mjs";
import { $ as u, e as K, n as le, g as de, b as Rt, c as Nt, d as Xe, f as be, i as Ye, h as g, j as he, k as V, s as Bt, l as jt, m as R, o as Qe, p as Ft, q as et, r as xt, t as tt, v as ne, w as re, x as ve, y as j, z as p, A as Ut, B as Mt, C as ye, D as Lt, E as Vt, _ as Ht, G as Jt, H as Wt, I as Kt, J as Gt, K as qt, L as Xt, M as Yt, N as Qt, O as en, P as tn, Q as nn, R as rn, S as on, T as sn, U as an, V as cn, W as un, X as fn, Y as ln, Z as dn, a0 as nt, u as hn, a as rt, F as we } from "./FormError-DWMWtHfu.mjs";
import { I as $e } from "./Input--4rYD9Q2.mjs";
const pn = () => {
};
const ot = function(e) {
const t = [];
let n = 0;
for (let r = 0; r < e.length; r++) {
let o = e.charCodeAt(r);
o < 128 ? t[n++] = o : o < 2048 ? (t[n++] = o >> 6 | 192, t[n++] = o & 63 | 128) : (o & 64512) === 55296 && r + 1 < e.length && (e.charCodeAt(r + 1) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (e.charCodeAt(++r) & 1023), t[n++] = o >> 18 | 240, t[n++] = o >> 12 & 63 | 128, t[n++] = o >> 6 & 63 | 128, t[n++] = o & 63 | 128) : (t[n++] = o >> 12 | 224, t[n++] = o >> 6 & 63 | 128, t[n++] = o & 63 | 128);
}
return t;
}, mn = function(e) {
const t = [];
let n = 0, r = 0;
for (; n < e.length; ) {
const o = e[n++];
if (o < 128)
t[r++] = String.fromCharCode(o);
else if (o > 191 && o < 224) {
const a = e[n++];
t[r++] = String.fromCharCode((o & 31) << 6 | a & 63);
} else if (o > 239 && o < 365) {
const a = e[n++], s = e[n++], i = e[n++], c = ((o & 7) << 18 | (a & 63) << 12 | (s & 63) << 6 | i & 63) - 65536;
t[r++] = String.fromCharCode(55296 + (c >> 10)), t[r++] = String.fromCharCode(56320 + (c & 1023));
} else {
const a = e[n++], s = e[n++];
t[r++] = String.fromCharCode((o & 15) << 12 | (a & 63) << 6 | s & 63);
}
}
return t.join("");
}, st = {
/**
* 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(e, t) {
if (!Array.isArray(e))
throw Error("encodeByteArray takes an array as a parameter");
this.init_();
const n = t ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, r = [];
for (let o = 0; o < e.length; o += 3) {
const a = e[o], s = o + 1 < e.length, i = s ? e[o + 1] : 0, c = o + 2 < e.length, f = c ? e[o + 2] : 0, l = a >> 2, m = (a & 3) << 4 | i >> 4;
let h = (i & 15) << 2 | f >> 6, d = f & 63;
c || (d = 64, s || (h = 64)), r.push(n[l], n[m], n[h], n[d]);
}
return r.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(e, t) {
return this.HAS_NATIVE_SUPPORT && !t ? btoa(e) : this.encodeByteArray(ot(e), t);
},
/**
* 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(e, t) {
return this.HAS_NATIVE_SUPPORT && !t ? atob(e) : mn(this.decodeStringToByteArray(e, t));
},
/**
* 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(e, t) {
this.init_();
const n = t ? this.charToByteMapWebSafe_ : this.charToByteMap_, r = [];
for (let o = 0; o < e.length; ) {
const a = n[e.charAt(o++)], i = o < e.length ? n[e.charAt(o)] : 0;
++o;
const f = o < e.length ? n[e.charAt(o)] : 64;
++o;
const m = o < e.length ? n[e.charAt(o)] : 64;
if (++o, a == null || i == null || f == null || m == null)
throw new gn();
const h = a << 2 | i >> 4;
if (r.push(h), f !== 64) {
const d = i << 4 & 240 | f >> 2;
if (r.push(d), m !== 64) {
const $ = f << 6 & 192 | m;
r.push($);
}
}
}
return r;
},
/**
* 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 e = 0; e < this.ENCODED_VALS.length; e++)
this.byteToCharMap_[e] = this.ENCODED_VALS.charAt(e), this.charToByteMap_[this.byteToCharMap_[e]] = e, this.byteToCharMapWebSafe_[e] = this.ENCODED_VALS_WEBSAFE.charAt(e), this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]] = e, e >= this.ENCODED_VALS_BASE.length && (this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)] = e, this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)] = e);
}
}
};
class gn extends Error {
constructor() {
super(...arguments), this.name = "DecodeBase64StringError";
}
}
const _n = function(e) {
const t = ot(e);
return st.encodeByteArray(t, !0);
}, at = function(e) {
return _n(e).replace(/\./g, "");
}, bn = function(e) {
try {
return st.decodeString(e, !0);
} catch (t) {
console.error("base64Decode failed: ", t);
}
return null;
};
function vn() {
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.");
}
const yn = () => vn().__FIREBASE_DEFAULTS__, wn = () => {
if (typeof process > "u" || typeof process.env > "u")
return;
const e = process.env.__FIREBASE_DEFAULTS__;
if (e)
return JSON.parse(e);
}, $n = () => {
if (typeof document > "u")
return;
let e;
try {
e = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
} catch {
return;
}
const t = e && bn(e[1]);
return t && JSON.parse(t);
}, zn = () => {
try {
return pn() || yn() || wn() || $n();
} catch (e) {
console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);
return;
}
}, Hi = (e) => zn()?.[`_${e}`];
function Ji(e) {
try {
return (e.startsWith("http://") || e.startsWith("https://") ? new URL(e).hostname : e).endsWith(".cloudworkstations.dev");
} catch {
return !1;
}
}
function Sn() {
return typeof navigator < "u" && typeof navigator.userAgent == "string" ? navigator.userAgent : "";
}
function Wi() {
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(Sn());
}
function Ki() {
return typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers";
}
function Gi() {
const e = typeof chrome == "object" ? chrome.runtime : typeof browser == "object" ? browser.runtime : void 0;
return typeof e == "object" && e.id !== void 0;
}
function qi() {
return typeof navigator == "object" && navigator.product === "ReactNative";
}
function En() {
try {
return typeof indexedDB == "object";
} catch {
return !1;
}
}
function kn() {
return new Promise((e, t) => {
try {
let n = !0;
const r = "validate-browser-context-for-indexeddb-analytics-module", o = self.indexedDB.open(r);
o.onsuccess = () => {
o.result.close(), n || self.indexedDB.deleteDatabase(r), e(!0);
}, o.onupgradeneeded = () => {
n = !1;
}, o.onerror = () => {
t(o.error?.message || "");
};
} catch (n) {
t(n);
}
});
}
const In = "FirebaseError";
class P extends Error {
constructor(t, n, r) {
super(n), this.code = t, this.customData = r, this.name = In, Object.setPrototypeOf(this, P.prototype), Error.captureStackTrace && Error.captureStackTrace(this, it.prototype.create);
}
}
class it {
constructor(t, n, r) {
this.service = t, this.serviceName = n, this.errors = r;
}
create(t, ...n) {
const r = n[0] || {}, o = `${this.service}/${t}`, a = this.errors[t], s = a ? Zn(a, r) : "Error", i = `${this.serviceName}: ${s} (${o}).`;
return new P(o, i, r);
}
}
function Zn(e, t) {
return e.replace(On, (n, r) => {
const o = t[r];
return o != null ? String(o) : `<${r}?>`;
});
}
const On = /\{\$([^}]+)}/g;
function Xi(e) {
const t = [];
for (const [n, r] of Object.entries(e))
Array.isArray(r) ? r.forEach((o) => {
t.push(encodeURIComponent(n) + "=" + encodeURIComponent(o));
}) : t.push(encodeURIComponent(n) + "=" + encodeURIComponent(r));
return t.length ? "&" + t.join("&") : "";
}
function Yi(e, t) {
const n = new An(e, t);
return n.subscribe.bind(n);
}
class An {
/**
* @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(t, n) {
this.observers = [], this.unsubscribes = [], this.observerCount = 0, this.task = Promise.resolve(), this.finalized = !1, this.onNoObservers = n, this.task.then(() => {
t(this);
}).catch((r) => {
this.error(r);
});
}
next(t) {
this.forEachObserver((n) => {
n.next(t);
});
}
error(t) {
this.forEachObserver((n) => {
n.error(t);
}), this.close(t);
}
complete() {
this.forEachObserver((t) => {
t.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(t, n, r) {
let o;
if (t === void 0 && n === void 0 && r === void 0)
throw new Error("Missing Observer.");
Dn(t, [
"next",
"error",
"complete"
]) ? o = t : o = {
next: t,
error: n,
complete: r
}, o.next === void 0 && (o.next = q), o.error === void 0 && (o.error = q), o.complete === void 0 && (o.complete = q);
const a = this.unsubscribeOne.bind(this, this.observers.length);
return this.finalized && this.task.then(() => {
try {
this.finalError ? o.error(this.finalError) : o.complete();
} catch {
}
}), this.observers.push(o), a;
}
// Unsubscribe is synchronous - we guarantee that no events are sent to
// any unsubscribed Observer.
unsubscribeOne(t) {
this.observers === void 0 || this.observers[t] === void 0 || (delete this.observers[t], this.observerCount -= 1, this.observerCount === 0 && this.onNoObservers !== void 0 && this.onNoObservers(this));
}
forEachObserver(t) {
if (!this.finalized)
for (let n = 0; n < this.observers.length; n++)
this.sendOne(n, t);
}
// 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(t, n) {
this.task.then(() => {
if (this.observers !== void 0 && this.observers[t] !== void 0)
try {
n(this.observers[t]);
} catch (r) {
typeof console < "u" && console.error && console.error(r);
}
});
}
close(t) {
this.finalized || (this.finalized = !0, t !== void 0 && (this.finalError = t), this.task.then(() => {
this.observers = void 0, this.onNoObservers = void 0;
}));
}
}
function Dn(e, t) {
if (typeof e != "object" || e === null)
return !1;
for (const n of t)
if (n in e && typeof e[n] == "function")
return !0;
return !1;
}
function q() {
}
function Qi(e) {
return e && e._delegate ? e._delegate : e;
}
class oe {
/**
*
* @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(t, n, r) {
this.name = t, this.instanceFactory = n, this.type = r, this.multipleInstances = !1, this.serviceProps = {}, this.instantiationMode = "LAZY", this.onInstanceCreated = null;
}
setInstantiationMode(t) {
return this.instantiationMode = t, this;
}
setMultipleInstances(t) {
return this.multipleInstances = t, this;
}
setServiceProps(t) {
return this.serviceProps = t, this;
}
setInstanceCreatedCallback(t) {
return this.onInstanceCreated = t, this;
}
}
var _;
(function(e) {
e[e.DEBUG = 0] = "DEBUG", e[e.VERBOSE = 1] = "VERBOSE", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.SILENT = 5] = "SILENT";
})(_ || (_ = {}));
const Tn = {
debug: _.DEBUG,
verbose: _.VERBOSE,
info: _.INFO,
warn: _.WARN,
error: _.ERROR,
silent: _.SILENT
}, Cn = _.INFO, Pn = {
[_.DEBUG]: "log",
[_.VERBOSE]: "log",
[_.INFO]: "info",
[_.WARN]: "warn",
[_.ERROR]: "error"
}, Rn = (e, t, ...n) => {
if (t < e.logLevel)
return;
const r = (/* @__PURE__ */ new Date()).toISOString(), o = Pn[t];
if (o)
console[o](`[${r}] ${e.name}:`, ...n);
else
throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);
};
class Nn {
/**
* 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(t) {
this.name = t, this._logLevel = Cn, this._logHandler = Rn, this._userLogHandler = null;
}
get logLevel() {
return this._logLevel;
}
set logLevel(t) {
if (!(t in _))
throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);
this._logLevel = t;
}
// Workaround for setter/getter having to be the same type.
setLogLevel(t) {
this._logLevel = typeof t == "string" ? Tn[t] : t;
}
get logHandler() {
return this._logHandler;
}
set logHandler(t) {
if (typeof t != "function")
throw new TypeError("Value assigned to `logHandler` must be a function");
this._logHandler = t;
}
get userLogHandler() {
return this._userLogHandler;
}
set userLogHandler(t) {
this._userLogHandler = t;
}
/**
* The functions below are all based on the `console` interface
*/
debug(...t) {
this._userLogHandler && this._userLogHandler(this, _.DEBUG, ...t), this._logHandler(this, _.DEBUG, ...t);
}
log(...t) {
this._userLogHandler && this._userLogHandler(this, _.VERBOSE, ...t), this._logHandler(this, _.VERBOSE, ...t);
}
info(...t) {
this._userLogHandler && this._userLogHandler(this, _.INFO, ...t), this._logHandler(this, _.INFO, ...t);
}
warn(...t) {
this._userLogHandler && this._userLogHandler(this, _.WARN, ...t), this._logHandler(this, _.WARN, ...t);
}
error(...t) {
this._userLogHandler && this._userLogHandler(this, _.ERROR, ...t), this._logHandler(this, _.ERROR, ...t);
}
}
const Bn = (e, t) => t.some((n) => e instanceof n);
let ze, Se;
function jn() {
return ze || (ze = [
IDBDatabase,
IDBObjectStore,
IDBIndex,
IDBCursor,
IDBTransaction
]);
}
function Fn() {
return Se || (Se = [
IDBCursor.prototype.advance,
IDBCursor.prototype.continue,
IDBCursor.prototype.continuePrimaryKey
]);
}
const ct = /* @__PURE__ */ new WeakMap(), se = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), pe = /* @__PURE__ */ new WeakMap();
function xn(e) {
const t = new Promise((n, r) => {
const o = () => {
e.removeEventListener("success", a), e.removeEventListener("error", s);
}, a = () => {
n(C(e.result)), o();
}, s = () => {
r(e.error), o();
};
e.addEventListener("success", a), e.addEventListener("error", s);
});
return t.then((n) => {
n instanceof IDBCursor && ct.set(n, e);
}).catch(() => {
}), pe.set(t, e), t;
}
function Un(e) {
if (se.has(e))
return;
const t = new Promise((n, r) => {
const o = () => {
e.removeEventListener("complete", a), e.removeEventListener("error", s), e.removeEventListener("abort", s);
}, a = () => {
n(), o();
}, s = () => {
r(e.error || new DOMException("AbortError", "AbortError")), o();
};
e.addEventListener("complete", a), e.addEventListener("error", s), e.addEventListener("abort", s);
});
se.set(e, t);
}
let ae = {
get(e, t, n) {
if (e instanceof IDBTransaction) {
if (t === "done")
return se.get(e);
if (t === "objectStoreNames")
return e.objectStoreNames || ut.get(e);
if (t === "store")
return n.objectStoreNames[1] ? void 0 : n.objectStore(n.objectStoreNames[0]);
}
return C(e[t]);
},
set(e, t, n) {
return e[t] = n, !0;
},
has(e, t) {
return e instanceof IDBTransaction && (t === "done" || t === "store") ? !0 : t in e;
}
};
function Mn(e) {
ae = e(ae);
}
function Ln(e) {
return e === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(t, ...n) {
const r = e.call(Y(this), t, ...n);
return ut.set(r, t.sort ? t.sort() : [t]), C(r);
} : Fn().includes(e) ? function(...t) {
return e.apply(Y(this), t), C(ct.get(this));
} : function(...t) {
return C(e.apply(Y(this), t));
};
}
function Vn(e) {
return typeof e == "function" ? Ln(e) : (e instanceof IDBTransaction && Un(e), Bn(e, jn()) ? new Proxy(e, ae) : e);
}
function C(e) {
if (e instanceof IDBRequest)
return xn(e);
if (X.has(e))
return X.get(e);
const t = Vn(e);
return t !== e && (X.set(e, t), pe.set(t, e)), t;
}
const Y = (e) => pe.get(e);
function Hn(e, t, { blocked: n, upgrade: r, blocking: o, terminated: a } = {}) {
const s = indexedDB.open(e, t), i = C(s);
return r && s.addEventListener("upgradeneeded", (c) => {
r(C(s.result), c.oldVersion, c.newVersion, C(s.transaction), c);
}), n && s.addEventListener("blocked", (c) => n(
// Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
c.oldVersion,
c.newVersion,
c
)), i.then((c) => {
a && c.addEventListener("close", () => a()), o && c.addEventListener("versionchange", (f) => o(f.oldVersion, f.newVersion, f));
}).catch(() => {
}), i;
}
const Jn = ["get", "getKey", "getAll", "getAllKeys", "count"], Wn = ["put", "add", "delete", "clear"], Q = /* @__PURE__ */ new Map();
function Ee(e, t) {
if (!(e instanceof IDBDatabase && !(t in e) && typeof t == "string"))
return;
if (Q.get(t))
return Q.get(t);
const n = t.replace(/FromIndex$/, ""), r = t !== n, o = Wn.includes(n);
if (
// Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
!(n in (r ? IDBIndex : IDBObjectStore).prototype) || !(o || Jn.includes(n))
)
return;
const a = async function(s, ...i) {
const c = this.transaction(s, o ? "readwrite" : "readonly");
let f = c.store;
return r && (f = f.index(i.shift())), (await Promise.all([
f[n](...i),
o && c.done
]))[0];
};
return Q.set(t, a), a;
}
Mn((e) => ({
...e,
get: (t, n, r) => Ee(t, n) || e.get(t, n, r),
has: (t, n) => !!Ee(t, n) || e.has(t, n)
}));
class Kn {
constructor(t) {
this.container = t;
}
// 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((n) => {
if (Gn(n)) {
const r = n.getImmediate();
return `${r.library}/${r.version}`;
} else
return null;
}).filter((n) => n).join(" ");
}
}
function Gn(e) {
return e.getComponent()?.type === "VERSION";
}
const ie = "@firebase/app", ke = "0.14.9";
const T = new Nn("@firebase/app"), qn = "@firebase/app-compat", Xn = "@firebase/analytics-compat", Yn = "@firebase/analytics", Qn = "@firebase/app-check-compat", er = "@firebase/app-check", tr = "@firebase/auth", nr = "@firebase/auth-compat", rr = "@firebase/database", or = "@firebase/data-connect", sr = "@firebase/database-compat", ar = "@firebase/functions", ir = "@firebase/functions-compat", cr = "@firebase/installations", ur = "@firebase/installations-compat", fr = "@firebase/messaging", lr = "@firebase/messaging-compat", dr = "@firebase/performance", hr = "@firebase/performance-compat", pr = "@firebase/remote-config", mr = "@firebase/remote-config-compat", gr = "@firebase/storage", _r = "@firebase/storage-compat", br = "@firebase/firestore", vr = "@firebase/ai", yr = "@firebase/firestore-compat", wr = "firebase", $r = "12.10.0", zr = {
[ie]: "fire-core",
[qn]: "fire-core-compat",
[Yn]: "fire-analytics",
[Xn]: "fire-analytics-compat",
[er]: "fire-app-check",
[Qn]: "fire-app-check-compat",
[tr]: "fire-auth",
[nr]: "fire-auth-compat",
[rr]: "fire-rtdb",
[or]: "fire-data-connect",
[sr]: "fire-rtdb-compat",
[ar]: "fire-fn",
[ir]: "fire-fn-compat",
[cr]: "fire-iid",
[ur]: "fire-iid-compat",
[fr]: "fire-fcm",
[lr]: "fire-fcm-compat",
[dr]: "fire-perf",
[hr]: "fire-perf-compat",
[pr]: "fire-rc",
[mr]: "fire-rc-compat",
[gr]: "fire-gcs",
[_r]: "fire-gcs-compat",
[br]: "fire-fst",
[yr]: "fire-fst-compat",
[vr]: "fire-vertex",
"fire-js": "fire-js",
// Platform identifier for JS SDK.
[wr]: "fire-js-all"
};
const Sr = /* @__PURE__ */ new Map(), Er = /* @__PURE__ */ new Map(), Ie = /* @__PURE__ */ new Map();
function Ze(e, t) {
try {
e.container.addComponent(t);
} catch (n) {
T.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`, n);
}
}
function ce(e) {
const t = e.name;
if (Ie.has(t))
return T.debug(`There were multiple attempts to register component ${t}.`), !1;
Ie.set(t, e);
for (const n of Sr.values())
Ze(n, e);
for (const n of Er.values())
Ze(n, e);
return !0;
}
function ec(e) {
return e == null ? !1 : e.settings !== void 0;
}
const kr = {
"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."
}, me = new it("app", "Firebase", kr);
const tc = $r;
function ee(e, t, n) {
let r = zr[e] ?? e;
n && (r += `-${n}`);
const o = r.match(/\s|\//), a = t.match(/\s|\//);
if (o || a) {
const s = [
`Unable to register library "${r}" with version "${t}":`
];
o && s.push(`library name "${r}" contains illegal characters (whitespace or "/")`), o && a && s.push("and"), a && s.push(`version name "${t}" contains illegal characters (whitespace or "/")`), T.warn(s.join(" "));
return;
}
ce(new oe(
`${r}-version`,
() => ({ library: r, version: t }),
"VERSION"
/* ComponentType.VERSION */
));
}
const Ir = "firebase-heartbeat-database", Zr = 1, F = "firebase-heartbeat-store";
let te = null;
function ft() {
return te || (te = Hn(Ir, Zr, {
upgrade: (e, t) => {
switch (t) {
case 0:
try {
e.createObjectStore(F);
} catch (n) {
console.warn(n);
}
}
}
}).catch((e) => {
throw me.create("idb-open", {
originalErrorMessage: e.message
});
})), te;
}
async function Or(e) {
try {
const n = (await ft()).transaction(F), r = await n.objectStore(F).get(lt(e));
return await n.done, r;
} catch (t) {
if (t instanceof P)
T.warn(t.message);
else {
const n = me.create("idb-get", {
originalErrorMessage: t?.message
});
T.warn(n.message);
}
}
}
async function Oe(e, t) {
try {
const r = (await ft()).transaction(F, "readwrite");
await r.objectStore(F).put(t, lt(e)), await r.done;
} catch (n) {
if (n instanceof P)
T.warn(n.message);
else {
const r = me.create("idb-set", {
originalErrorMessage: n?.message
});
T.warn(r.message);
}
}
}
function lt(e) {
return `${e.name}!${e.options.appId}`;
}
const Ar = 1024, Dr = 30;
class Tr {
constructor(t) {
this.container = t, this._heartbeatsCache = null;
const n = this.container.getProvider("app").getImmediate();
this._storage = new Pr(n), this._heartbeatsCachePromise = this._storage.read().then((r) => (this._heartbeatsCache = r, r));
}
/**
* 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() {
try {
const n = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), r = Ae();
if (this._heartbeatsCache?.heartbeats == null && (this._heartbeatsCache = await this._heartbeatsCachePromise, this._heartbeatsCache?.heartbeats == null) || this._heartbeatsCache.lastSentHeartbeatDate === r || this._heartbeatsCache.heartbeats.some((o) => o.date === r))
return;
if (this._heartbeatsCache.heartbeats.push({ date: r, agent: n }), this._heartbeatsCache.heartbeats.length > Dr) {
const o = Rr(this._heartbeatsCache.heartbeats);
this._heartbeatsCache.heartbeats.splice(o, 1);
}
return this._storage.overwrite(this._heartbeatsCache);
} catch (t) {
T.warn(t);
}
}
/**
* 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() {
try {
if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, this._heartbeatsCache?.heartbeats == null || this._heartbeatsCache.heartbeats.length === 0)
return "";
const t = Ae(), { heartbeatsToSend: n, unsentEntries: r } = Cr(this._heartbeatsCache.heartbeats), o = at(JSON.stringify({ version: 2, heartbeats: n }));
return this._heartbeatsCache.lastSentHeartbeatDate = t, r.length > 0 ? (this._heartbeatsCache.heartbeats = r, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), o;
} catch (t) {
return T.warn(t), "";
}
}
}
function Ae() {
return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
}
function Cr(e, t = Ar) {
const n = [];
let r = e.slice();
for (const o of e) {
const a = n.find((s) => s.agent === o.agent);
if (a) {
if (a.dates.push(o.date), De(n) > t) {
a.dates.pop();
break;
}
} else if (n.push({
agent: o.agent,
dates: [o.date]
}), De(n) > t) {
n.pop();
break;
}
r = r.slice(1);
}
return {
heartbeatsToSend: n,
unsentEntries: r
};
}
class Pr {
constructor(t) {
this.app = t, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
}
async runIndexedDBEnvironmentCheck() {
return En() ? kn().then(() => !0).catch(() => !1) : !1;
}
/**
* Read all heartbeats.
*/
async read() {
if (await this._canUseIndexedDBPromise) {
const n = await Or(this.app);
return n?.heartbeats ? n : { heartbeats: [] };
} else
return { heartbeats: [] };
}
// overwrite the storage with the provided heartbeats
async overwrite(t) {
if (await this._canUseIndexedDBPromise) {
const r = await this.read();
return Oe(this.app, {
lastSentHeartbeatDate: t.lastSentHeartbeatDate ?? r.lastSentHeartbeatDate,
heartbeats: t.heartbeats
});
} else
return;
}
// add heartbeats
async add(t) {
if (await this._canUseIndexedDBPromise) {
const r = await this.read();
return Oe(this.app, {
lastSentHeartbeatDate: t.lastSentHeartbeatDate ?? r.lastSentHeartbeatDate,
heartbeats: [
...r.heartbeats,
...t.heartbeats
]
});
} else
return;
}
}
function De(e) {
return at(
// heartbeatsCache wrapper properties
JSON.stringify({ version: 2, heartbeats: e })
).length;
}
function Rr(e) {
if (e.length === 0)
return -1;
let t = 0, n = e[0].date;
for (let r = 1; r < e.length; r++)
e[r].date < n && (n = e[r].date, t = r);
return t;
}
function Nr(e) {
ce(new oe(
"platform-logger",
(t) => new Kn(t),
"PRIVATE"
/* ComponentType.PRIVATE */
)), ce(new oe(
"heartbeat",
(t) => new Tr(t),
"PRIVATE"
/* ComponentType.PRIVATE */
)), ee(ie, ke, e), ee(ie, ke, "esm2020"), ee("fire-js", "");
}
Nr("");
const Br = /^[cC][^\s-]{8,}$/, jr = /^[0-9a-z]+$/, Fr = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, xr = /^[0-9a-vA-V]{20}$/, Ur = /^[A-Za-z0-9]{27}$/, Mr = /^[a-zA-Z0-9_-]{21}$/, Lr = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Vr = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Te = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Hr = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Jr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
function Wr() {
return new RegExp(Jr, "u");
}
const Kr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Gr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, qr = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Xr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Yr = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, dt = /^[A-Za-z0-9_-]*$/, Qr = /^\+[1-9]\d{6,14}$/, ht = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", eo = /* @__PURE__ */ new RegExp(`^${ht}$`);
function pt(e) {
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
}
function to(e) {
return new RegExp(`^${pt(e)}$`);
}
function no(e) {
const t = pt({ precision: e.precision }), n = ["Z"];
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
const r = `${t}(?:${n.join("|")})`;
return new RegExp(`^${ht}T(?:${r})$`);
}
const ro = (e) => {
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
return new RegExp(`^${t}$`);
}, oo = /^[^A-Z]*$/, so = /^[^a-z]*$/, D = /* @__PURE__ */ u("$ZodCheck", (e, t) => {
var n;
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
}), ao = /* @__PURE__ */ u("$ZodCheckMaxLength", (e, t) => {
var n;
D.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
const o = r.value;
return !le(o) && o.length !== void 0;
}), e._zod.onattach.push((r) => {
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
t.maximum < o && (r._zod.bag.maximum = t.maximum);
}), e._zod.check = (r) => {
const o = r.value;
if (o.length <= t.maximum)
return;
const s = de(o);
r.issues.push({
origin: s,
code: "too_big",
maximum: t.maximum,
inclusive: !0,
input: o,
inst: e,
continue: !t.abort
});
};
}), io = /* @__PURE__ */ u("$ZodCheckMinLength", (e, t) => {
var n;
D.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
const o = r.value;
return !le(o) && o.length !== void 0;
}), e._zod.onattach.push((r) => {
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
t.minimum > o && (r._zod.bag.minimum = t.minimum);
}), e._zod.check = (r) => {
const o = r.value;
if (o.length >= t.minimum)
return;
const s = de(o);
r.issues.push({
origin: s,
code: "too_small",
minimum: t.minimum,
inclusive: !0,
input: o,
inst: e,
continue: !t.abort
});
};
}), co = /* @__PURE__ */ u("$ZodCheckLengthEquals", (e, t) => {
var n;
D.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
const o = r.value;
return !le(o) && o.length !== void 0;
}), e._zod.onattach.push((r) => {
const o = r._zod.bag;
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
}), e._zod.check = (r) => {
const o = r.value, a = o.length;
if (a === t.length)
return;
const s = de(o), i = a > t.length;
r.issues.push({
origin: s,
...i ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
inclusive: !0,
exact: !0,
input: r.value,
inst: e,
continue: !t.abort
});
};
}), G = /* @__PURE__ */ u("$ZodCheckStringFormat", (e, t) => {
var n, r;
D.init(e, t), e._zod.onattach.push((o) => {
const a = o._zod.bag;
a.format = t.format, t.pattern && (a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(t.pattern));
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
origin: "string",
code: "invalid_format",
format: t.format,
input: o.value,
...t.pattern ? { pattern: t.pattern.toString() } : {},
inst: e,
continue: !t.abort
});
}) : (r = e._zod).check ?? (r.check = () => {
});
}), uo = /* @__PURE__ */ u("$ZodCheckRegex", (e, t) => {
G.init(e, t), e._zod.check = (n) => {
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
origin: "string",
code: "invalid_format",
format: "regex",
input: n.value,
pattern: t.pattern.toString(),
inst: e,
continue: !t.abort
});
};
}), fo = /* @__PURE__ */ u("$ZodCheckLowerCase", (e, t) => {
t.pattern ?? (t.pattern = oo), G.init(e, t);
}), lo = /* @__PURE__ */ u("$ZodCheckUpperCase", (e, t) => {
t.pattern ?? (t.pattern = so), G.init(e, t);
}), ho = /* @__PURE__ */ u("$ZodCheckIncludes", (e, t) => {
D.init(e, t);
const n = K(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
t.pattern = r, e._zod.onattach.push((o) => {
const a = o._zod.bag;
a.patterns ?? (a.patterns = /* @__PURE__ */ new Set()), a.patterns.add(r);
}), e._zod.check = (o) => {
o.value.includes(t.includes, t.position) || o.issues.push({
origin: "string",
code: "invalid_format",
format: "includes",
includes: t.includes,
input: o.value,
inst: e,
continue: !t.abort
});
};
}), po = /* @__PURE__ */ u("$ZodCheckStartsWith", (e, t) => {
D.init(e, t);
const n = new RegExp(`^${K(t.prefix)}.*`);
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
const o = r._zod.bag;
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
}), e._zod.check = (r) => {
r.value.startsWith(t.prefix) || r.issues.push({
origin: "string",
code: "invalid_format",
format: "starts_with",
prefix: t.prefix,
input: r.value,
inst: e,
continue: !t.abort
});
};
}), mo = /* @__PURE__ */ u("$ZodCheckEndsWith", (e, t) => {
D.init(e, t);
const n = new RegExp(`.*${K(t.suffix)}$`);
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
const o = r._zod.bag;
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
}), e._zod.check = (r) => {
r.value.endsWith(t.suffix) || r.issues.push({
origin: "string",
code: "invalid_format",
format: "ends_with",
suffix: t.suffix,
input: r.value,
inst: e,
continue: !t.abort
});
};
}), go = /* @__PURE__ */ u("$ZodCheckOverwrite", (e, t) => {
D.init(e, t), e._zod.check = (n) => {
n.value = t.tx(n.value);
};
});
class _o {
constructor(t = []) {
this.content = [], this.indent = 0, this && (this.args = t);
}
indented(t) {
this.indent += 1, t(this), this.indent -= 1;
}
write(t) {
if (typeof t == "function") {
t(this, { execution: "sync" }), t(this, { execution: "async" });
return;
}
const r = t.split(`
`).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), a = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
for (const s of a)
this.content.push(s);
}
compile() {
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((a) => ` ${a}`)];
return new t(...n, o.join(`
`));
}
}
const bo = {
major: 4,
minor: 3,
patch: 6
}, y = /* @__PURE__ */ u("$ZodType", (e, t) => {
var n;
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = bo;
const r = [...e._zod.def.checks ?? []];
e._zod.traits.has("$ZodCheck") && r.unshift(e);
for (const o of r)
for (const a of o._zod.onattach)
a(e);
if (r.length === 0)
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
e._zod.run = e._zod.parse;
});
else {
const o = (s, i, c) => {
let f = R(s), l;
for (const m of i) {
if (m._zod.def.when) {
if (!m._zod.def.when(s))
continue;
} else if (f)
continue;
const h = s.issues.length, d = m._zod.check(s);
if (d instanceof Promise && c?.async === !1)
throw new V();
if (l || d instanceof Promise)
l = (l ?? Promise.resolve()).then(async () => {
await d, s.issues.length !== h && (f || (f = R(s, h)));
});
else {
if (s.issues.length === h)
continue;
f || (f = R(s, h));
}
}
return l ? l.then(() => s) : s;
}, a = (s, i, c) => {
if (R(s))
return s.aborted = !0, s;
const f = o(i, r, c);
if (f instanceof Promise) {
if (c.async === !1)
throw new V();
return f.then((l) => e._zod.parse(l, c));
}
return e._zod.parse(f, c);
};
e._zod.run = (s, i) => {
if (i.skipChecks)
return e._zod.parse(s, i);
if (i.direction === "backward") {
const f = e._zod.parse({ value: s.value, issues: [] }, { ...i, skipChecks: !0 });
return f instanceof Promise ? f.then((l) => a(l, s, i)) : a(f, s, i);
}
const c = e._zod.parse(s, i);
if (c instanceof Promise) {
if (i.async === !1)
throw new V();
return c.then((f) => o(f, r, i));
}
return o(c, r, i);
};
}
g(e, "~standard", () => ({
validate: (o) => {
try {
const a = Bt(e, o);
return a.success ? { value: a.data } : { issues: a.error?.issues };
} catch {
return jt(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
}
},
vendor: "zod",
version: 1
}));
}), ge = /* @__PURE__ */ u("$ZodString", (e, t) => {
y.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? ro(e._zod.bag), e._zod.parse = (n, r) => {
if (t.coerce)
try {
n.value = String(n.value);
} catch {
}
return typeof n.value == "string" || n.issues.push({
expected: "string",
code: "invalid_type",
input: n.value,
inst: e
}), n;
};
}), b = /* @__PURE__ */ u("$ZodStringFormat", (e, t) => {
G.init(e, t), ge.init(e, t);
}), vo = /* @__PURE__ */ u("$ZodGUID", (e, t) => {
t.pattern ?? (t.pattern = Vr), b.init(e, t);
}), yo = /* @__PURE__ */ u("$ZodUUID", (e, t) => {
if (t.version) {
const r = {
v1: 1,
v2: 2,
v3: 3,
v4: 4,
v5: 5,
v6: 6,
v7: 7,
v8: 8
}[t.version];
if (r === void 0)
throw new Error(`Invalid UUID version: "${t.version}"`);
t.pattern ?? (t.pattern = Te(r));
} else
t.pattern ?? (t.pattern = Te());
b.init(e, t);
}), wo = /* @__PURE__ */ u("$ZodEmail", (e, t) => {
t.pattern ?? (t.pattern = Hr), b.init(e, t);
}), $o = /* @__PURE__ */ u("$ZodURL", (e, t) => {
b.init(e, t), e._zod.check = (n) => {
try {
const r = n.value.trim(), o = new URL(r);
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid hostname",
pattern: t.hostname.source,
input: n.value,
inst: e,
continue: !t.abort
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || n.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid protocol",
pattern: t.protocol.source,
input: n.value,
inst: e,
continue: !t.abort
})), t.normalize ? n.value = o.href : n.value = r;
return;
} catch {
n.issues.push({
code: "invalid_format",
format: "url",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
}), zo = /* @__PURE__ */ u("$ZodEmoji", (e, t) => {
t.pattern ?? (t.pattern = Wr()), b.init(e, t);
}), So = /* @__PURE__ */ u("$ZodNanoID", (e, t) => {
t.pattern ?? (t.pattern = Mr), b.init(e, t);
}), Eo = /* @__PURE__ */ u("$ZodCUID", (e, t) => {
t.pattern ?? (t.pattern = Br), b.init(e, t);
}), ko = /* @__PURE__ */ u("$ZodCUID2", (e, t) => {
t.pattern ?? (t.pattern = jr), b.init(e, t);
}), Io = /* @__PURE__ */ u("$ZodULID", (e, t) => {
t.pattern ?? (t.pattern = Fr), b.init(e, t);
}), Zo = /* @__PURE__ */ u("$ZodXID", (e, t) => {
t.pattern ?? (t.pattern = xr), b.init(e, t);
}), Oo = /* @__PURE__ */ u("$ZodKSUID", (e, t) => {
t.pattern ?? (t.pattern = Ur), b.init(e, t);
}), Ao = /* @__PURE__ */ u("$ZodISODateTime", (e, t) => {
t.pattern ?? (t.pattern = no(t)), b.init(e, t);
}), Do = /* @__PURE__ */ u("$ZodISODate", (e, t) => {
t.pattern ?? (t.pattern = eo), b.init(e, t);
}), To = /* @__PURE__ */ u("$ZodISOTime", (e, t) => {
t.pattern ?? (t.pattern = to(t)), b.init(e, t);
}), Co = /* @__PURE__ */ u("$ZodISODuration", (e, t) => {
t.pattern ?? (t.pattern = Lr), b.init(e, t);
}), Po = /* @__PURE__ */ u("$ZodIPv4", (e, t) => {
t.pattern ?? (t.pattern = Kr), b.init(e, t), e._zod.bag.format = "ipv4";
}), Ro = /* @__PURE__ */ u("$ZodIPv6", (e, t) => {
t.pattern ?? (t.pattern = Gr), b.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
try {
new URL(`http://[${n.value}]`);
} catch {
n.issues.push({
code: "invalid_format",
format: "ipv6",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
}), No = /* @__PURE__ */ u("$ZodCIDRv4", (e, t) => {
t.pattern ?? (t.pattern = qr), b.init(e, t);
}), Bo = /* @__PURE__ */ u("$ZodCIDRv6", (e, t) => {
t.pattern ?? (t.pattern = Xr), b.init(e, t), e._zod.check = (n) => {
const r = n.value.split("/");
try {
if (r.length !== 2)
throw new Error();
const [o, a] = r;
if (!a)
throw new Error();
const s = Number(a);
if (`${s}` !== a)
throw new Error();
if (s < 0 || s > 128)
throw new Error();
new URL(`http://[${o}]`);
} catch {
n.issues.push({
code: "invalid_format",
format: "cidrv6",
input: n.value,
inst: e,
continue: !t.abort
});
}
};
});
function mt(e) {
if (e === "")
return !0;
if (e.length % 4 !== 0)
return !1;
try {
return atob(e), !0;
} catch {
return !1;
}
}
const jo = /* @__PURE__ */ u("$ZodBase64", (e, t) => {
t.pattern ?? (t.pattern = Yr), b.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
mt(n.value) || n.issues.push({
code: "invalid_format",
format: "base64",
input: n.value,
inst: e,
continue: !t.abort
});
};
});
function Fo(e) {
if (!dt.test(e))
return !1;
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
return mt(n);
}
const xo = /* @__PURE__ */ u("$ZodBase64URL", (e, t) => {
t.pattern ?? (t.pattern = dt), b.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
Fo(n.value) || n.issues.push({
code: "invalid_format",
format: "base64url",
input: n.value,
inst: e,
continue: !t.abort
});
};
}), Uo = /* @__PURE__ */ u("$ZodE164", (e, t) => {
t.pattern ?? (t.pattern = Qr), b.init(e, t);
});
function Mo(e, t = null) {
try {
const n = e.split(".");
if (n.length !== 3)
return !1;
const [r] = n;
if (!r)
return !1;
const o = JSON.parse(atob(r));
return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
} catch {
return !1;
}
}
const Lo = /* @__PURE__ */ u("$ZodJWT", (e, t) => {
b.init(e, t), e._zod.check = (n) => {
Mo(n.value, t.alg) || n.issues.push({
code: "invalid_format",
format: "jwt",
input: n.value,
inst: e,
continue: !t.abort
});
};
}), Vo = /* @__PURE__ */ u("$ZodUnknown", (e, t) => {
y.init(e, t), e._zod.parse = (n) => n;
}), Ho = /* @__PURE__ */ u("$ZodNever", (e, t) => {
y.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
expected: "never",
code: "invalid_type",
input: n.value,
inst: e
}), n);
});
function Ce(e, t, n) {
e.issues.length && t.issues.push(...et(n, e.issues)), t.value[n] = e.value;
}
const Jo = /* @__PURE__ */ u("$ZodArray", (e, t) => {
y.init(e, t), e._zod.parse = (n, r) => {
const o = n.value;
if (!Array.isArray(o))
return n.issues.push({
expected: "array",
code: "invalid_type",
input: o,
inst: e
}), n;
n.value = Array(o.length);
const a = [];
for (let s = 0; s < o.length; s++) {
const i = o[s], c = t.element._zod.run({
value: i,
issues: []
}, r);
c instanceof Promise ?