reactfire
Version:
Firebase library for React
2,169 lines • 63.9 kB
JavaScript
import * as e from "react";
import { onIdTokenChanged as t } from "firebase/auth";
import { getApps as n, initializeApp as r, registerVersion as i } from "firebase/app";
import { get as a, off as o, onChildAdded as s, onChildChanged as c, onChildMoved as l, onChildRemoved as u, onValue as d } from "firebase/database";
import { onSnapshot as f, queryEqual as p } from "firebase/firestore";
import { useSyncExternalStore as m } from "use-sync-external-store/shim";
import { httpsCallable as h } from "firebase/functions";
import { ensureInitialized as ee, getAll as te, getBoolean as ne, getNumber as re, getString as ie, getValue as ae } from "firebase/remote-config";
import { getDownloadURL as oe, ref as se } from "firebase/storage";
//#region node_modules/tslib/tslib.es6.mjs
var ce = function(e, t) {
return ce = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, t) {
e.__proto__ = t;
} || function(e, t) {
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
}, ce(e, t);
};
function g(e, t) {
if (typeof t != "function" && t !== null) throw TypeError("Class extends value " + String(t) + " is not a constructor or null");
ce(e, t);
function n() {
this.constructor = e;
}
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
function le(e, t) {
var n = {};
for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, r = Object.getOwnPropertySymbols(e); i < r.length; i++) t.indexOf(r[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[i]) && (n[r[i]] = e[r[i]]);
return n;
}
function ue(e, t, n, r) {
function i(e) {
return e instanceof n ? e : new n(function(t) {
t(e);
});
}
return new (n ||= Promise)(function(n, a) {
function o(e) {
try {
c(r.next(e));
} catch (e) {
a(e);
}
}
function s(e) {
try {
c(r.throw(e));
} catch (e) {
a(e);
}
}
function c(e) {
e.done ? n(e.value) : i(e.value).then(o, s);
}
c((r = r.apply(e, t || [])).next());
});
}
function de(e, t) {
var n = {
label: 0,
sent: function() {
if (a[0] & 1) throw a[1];
return a[1];
},
trys: [],
ops: []
}, r, i, a, o;
return o = {
next: s(0),
throw: s(1),
return: s(2)
}, typeof Symbol == "function" && (o[Symbol.iterator] = function() {
return this;
}), o;
function s(e) {
return function(t) {
return c([e, t]);
};
}
function c(s) {
if (r) throw TypeError("Generator is already executing.");
for (; o && (o = 0, s[0] && (n = 0)), n;) try {
if (r = 1, i && (a = s[0] & 2 ? i.return : s[0] ? i.throw || ((a = i.return) && a.call(i), 0) : i.next) && !(a = a.call(i, s[1])).done) return a;
switch (i = 0, a && (s = [s[0] & 2, a.value]), s[0]) {
case 0:
case 1:
a = s;
break;
case 4: return n.label++, {
value: s[1],
done: !1
};
case 5:
n.label++, i = s[1], s = [0];
continue;
case 7:
s = n.ops.pop(), n.trys.pop();
continue;
default:
if ((a = n.trys, !(a = a.length > 0 && a[a.length - 1])) && (s[0] === 6 || s[0] === 2)) {
n = 0;
continue;
}
if (s[0] === 3 && (!a || s[1] > a[0] && s[1] < a[3])) {
n.label = s[1];
break;
}
if (s[0] === 6 && n.label < a[1]) {
n.label = a[1], a = s;
break;
}
if (a && n.label < a[2]) {
n.label = a[2], n.ops.push(s);
break;
}
a[2] && n.ops.pop(), n.trys.pop();
continue;
}
s = t.call(e, n);
} catch (e) {
s = [6, e], i = 0;
} finally {
r = a = 0;
}
if (s[0] & 5) throw s[1];
return {
value: s[0] ? s[1] : void 0,
done: !0
};
}
}
function _(e) {
var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], r = 0;
if (n) return n.call(e);
if (e && typeof e.length == "number") return { next: function() {
return e && r >= e.length && (e = void 0), {
value: e && e[r++],
done: !e
};
} };
throw TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function v(e, t) {
var n = typeof Symbol == "function" && e[Symbol.iterator];
if (!n) return e;
var r = n.call(e), i, a = [], o;
try {
for (; (t === void 0 || t-- > 0) && !(i = r.next()).done;) a.push(i.value);
} catch (e) {
o = { error: e };
} finally {
try {
i && !i.done && (n = r.return) && n.call(r);
} finally {
if (o) throw o.error;
}
}
return a;
}
function y(e, t, n) {
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
return e.concat(a || Array.prototype.slice.call(t));
}
function b(e) {
return this instanceof b ? (this.v = e, this) : new b(e);
}
function fe(e, t, n) {
if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
var r = n.apply(e, t || []), i, a = [];
return i = {}, o("next"), o("throw"), o("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i;
function o(e) {
r[e] && (i[e] = function(t) {
return new Promise(function(n, r) {
a.push([
e,
t,
n,
r
]) > 1 || s(e, t);
});
});
}
function s(e, t) {
try {
c(r[e](t));
} catch (e) {
d(a[0][3], e);
}
}
function c(e) {
e.value instanceof b ? Promise.resolve(e.value.v).then(l, u) : d(a[0][2], e);
}
function l(e) {
s("next", e);
}
function u(e) {
s("throw", e);
}
function d(e, t) {
e(t), a.shift(), a.length && s(a[0][0], a[0][1]);
}
}
function pe(e) {
if (!Symbol.asyncIterator) throw TypeError("Symbol.asyncIterator is not defined.");
var t = e[Symbol.asyncIterator], n;
return t ? t.call(e) : (e = typeof _ == "function" ? _(e) : e[Symbol.iterator](), n = {}, r("next"), r("throw"), r("return"), n[Symbol.asyncIterator] = function() {
return this;
}, n);
function r(t) {
n[t] = e[t] && function(n) {
return new Promise(function(r, a) {
n = e[t](n), i(r, a, n.done, n.value);
});
};
}
function i(e, t, n, r) {
Promise.resolve(r).then(function(t) {
e({
value: t,
done: n
});
}, t);
}
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isFunction.js
function x(e) {
return typeof e == "function";
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
function me(e) {
var t = e(function(e) {
Error.call(e), e.stack = (/* @__PURE__ */ Error()).stack;
});
return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
var he = me(function(e) {
return function(t) {
e(this), this.message = t ? t.length + " errors occurred during unsubscription:\n" + t.map(function(e, t) {
return t + 1 + ") " + e.toString();
}).join("\n ") : "", this.name = "UnsubscriptionError", this.errors = t;
};
});
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
function ge(e, t) {
if (e) {
var n = e.indexOf(t);
0 <= n && e.splice(n, 1);
}
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/Subscription.js
var S = function() {
function e(e) {
this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
}
return e.prototype.unsubscribe = function() {
var e, t, n, r, i;
if (!this.closed) {
this.closed = !0;
var a = this._parentage;
if (a) if (this._parentage = null, Array.isArray(a)) try {
for (var o = _(a), s = o.next(); !s.done; s = o.next()) s.value.remove(this);
} catch (t) {
e = { error: t };
} finally {
try {
s && !s.done && (t = o.return) && t.call(o);
} finally {
if (e) throw e.error;
}
}
else a.remove(this);
var c = this.initialTeardown;
if (x(c)) try {
c();
} catch (e) {
i = e instanceof he ? e.errors : [e];
}
var l = this._finalizers;
if (l) {
this._finalizers = null;
try {
for (var u = _(l), d = u.next(); !d.done; d = u.next()) {
var f = d.value;
try {
ye(f);
} catch (e) {
i ??= [], e instanceof he ? i = y(y([], v(i)), v(e.errors)) : i.push(e);
}
}
} catch (e) {
n = { error: e };
} finally {
try {
d && !d.done && (r = u.return) && r.call(u);
} finally {
if (n) throw n.error;
}
}
}
if (i) throw new he(i);
}
}, e.prototype.add = function(t) {
if (t && t !== this) if (this.closed) ye(t);
else {
if (t instanceof e) {
if (t.closed || t._hasParent(this)) return;
t._addParent(this);
}
(this._finalizers = this._finalizers ?? []).push(t);
}
}, e.prototype._hasParent = function(e) {
var t = this._parentage;
return t === e || Array.isArray(t) && t.includes(e);
}, e.prototype._addParent = function(e) {
var t = this._parentage;
this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
}, e.prototype._removeParent = function(e) {
var t = this._parentage;
t === e ? this._parentage = null : Array.isArray(t) && ge(t, e);
}, e.prototype.remove = function(t) {
var n = this._finalizers;
n && ge(n, t), t instanceof e && t._removeParent(this);
}, e.EMPTY = (function() {
var t = new e();
return t.closed = !0, t;
})(), e;
}(), _e = S.EMPTY;
function ve(e) {
return e instanceof S || e && "closed" in e && x(e.remove) && x(e.add) && x(e.unsubscribe);
}
function ye(e) {
x(e) ? e() : e.unsubscribe();
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/config.js
var C = {
onUnhandledError: null,
onStoppedNotification: null,
Promise: void 0,
useDeprecatedSynchronousErrorHandling: !1,
useDeprecatedNextContext: !1
}, w = {
setTimeout: function(e, t) {
var n = [...arguments].slice(2), r = w.delegate;
return r?.setTimeout ? r.setTimeout.apply(r, y([e, t], v(n))) : setTimeout.apply(void 0, y([e, t], v(n)));
},
clearTimeout: function(e) {
return (w.delegate?.clearTimeout || clearTimeout)(e);
},
delegate: void 0
};
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
function be(e) {
w.setTimeout(function() {
var t = C.onUnhandledError;
if (t) t(e);
else throw e;
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/noop.js
function xe() {}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
var Se = (function() {
return Te("C", void 0, void 0);
})();
function Ce(e) {
return Te("E", void 0, e);
}
function we(e) {
return Te("N", e, void 0);
}
function Te(e, t, n) {
return {
kind: e,
value: t,
error: n
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/errorContext.js
var T = null;
function E(e) {
if (C.useDeprecatedSynchronousErrorHandling) {
var t = !T;
if (t && (T = {
errorThrown: !1,
error: null
}), e(), t) {
var n = T, r = n.errorThrown, i = n.error;
if (T = null, r) throw i;
}
} else e();
}
function Ee(e) {
C.useDeprecatedSynchronousErrorHandling && T && (T.errorThrown = !0, T.error = e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/Subscriber.js
var De = function(e) {
g(t, e);
function t(t) {
var n = e.call(this) || this;
return n.isStopped = !1, t ? (n.destination = t, ve(t) && t.add(n)) : n.destination = Ne, n;
}
return t.create = function(e, t, n) {
return new D(e, t, n);
}, t.prototype.next = function(e) {
this.isStopped ? Me(we(e), this) : this._next(e);
}, t.prototype.error = function(e) {
this.isStopped ? Me(Ce(e), this) : (this.isStopped = !0, this._error(e));
}, t.prototype.complete = function() {
this.isStopped ? Me(Se, this) : (this.isStopped = !0, this._complete());
}, t.prototype.unsubscribe = function() {
this.closed || (this.isStopped = !0, e.prototype.unsubscribe.call(this), this.destination = null);
}, t.prototype._next = function(e) {
this.destination.next(e);
}, t.prototype._error = function(e) {
try {
this.destination.error(e);
} finally {
this.unsubscribe();
}
}, t.prototype._complete = function() {
try {
this.destination.complete();
} finally {
this.unsubscribe();
}
}, t;
}(S), Oe = Function.prototype.bind;
function ke(e, t) {
return Oe.call(e, t);
}
var Ae = function() {
function e(e) {
this.partialObserver = e;
}
return e.prototype.next = function(e) {
var t = this.partialObserver;
if (t.next) try {
t.next(e);
} catch (e) {
O(e);
}
}, e.prototype.error = function(e) {
var t = this.partialObserver;
if (t.error) try {
t.error(e);
} catch (e) {
O(e);
}
else O(e);
}, e.prototype.complete = function() {
var e = this.partialObserver;
if (e.complete) try {
e.complete();
} catch (e) {
O(e);
}
}, e;
}(), D = function(e) {
g(t, e);
function t(t, n, r) {
var i = e.call(this) || this, a;
if (x(t) || !t) a = {
next: t ?? void 0,
error: n ?? void 0,
complete: r ?? void 0
};
else {
var o;
i && C.useDeprecatedNextContext ? (o = Object.create(t), o.unsubscribe = function() {
return i.unsubscribe();
}, a = {
next: t.next && ke(t.next, o),
error: t.error && ke(t.error, o),
complete: t.complete && ke(t.complete, o)
}) : a = t;
}
return i.destination = new Ae(a), i;
}
return t;
}(De);
function O(e) {
C.useDeprecatedSynchronousErrorHandling ? Ee(e) : be(e);
}
function je(e) {
throw e;
}
function Me(e, t) {
var n = C.onStoppedNotification;
n && w.setTimeout(function() {
return n(e, t);
});
}
var Ne = {
closed: !0,
next: xe,
error: je,
complete: xe
}, Pe = (function() {
return typeof Symbol == "function" && Symbol.observable || "@@observable";
})();
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/identity.js
function k(e) {
return e;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/pipe.js
function Fe(e) {
return e.length === 0 ? k : e.length === 1 ? e[0] : function(t) {
return e.reduce(function(e, t) {
return t(e);
}, t);
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/Observable.js
var A = function() {
function e(e) {
e && (this._subscribe = e);
}
return e.prototype.lift = function(t) {
var n = new e();
return n.source = this, n.operator = t, n;
}, e.prototype.subscribe = function(e, t, n) {
var r = this, i = Re(e) ? e : new D(e, t, n);
return E(function() {
var e = r, t = e.operator, n = e.source;
i.add(t ? t.call(i, n) : n ? r._subscribe(i) : r._trySubscribe(i));
}), i;
}, e.prototype._trySubscribe = function(e) {
try {
return this._subscribe(e);
} catch (t) {
e.error(t);
}
}, e.prototype.forEach = function(e, t) {
var n = this;
return t = Ie(t), new t(function(t, r) {
var i = new D({
next: function(t) {
try {
e(t);
} catch (e) {
r(e), i.unsubscribe();
}
},
error: r,
complete: t
});
n.subscribe(i);
});
}, e.prototype._subscribe = function(e) {
return this.source?.subscribe(e);
}, e.prototype[Pe] = function() {
return this;
}, e.prototype.pipe = function() {
return Fe([...arguments])(this);
}, e.prototype.toPromise = function(e) {
var t = this;
return e = Ie(e), new e(function(e, n) {
var r;
t.subscribe(function(e) {
return r = e;
}, function(e) {
return n(e);
}, function() {
return e(r);
});
});
}, e.create = function(t) {
return new e(t);
}, e;
}();
function Ie(e) {
return e ?? C.Promise ?? Promise;
}
function Le(e) {
return e && x(e.next) && x(e.error) && x(e.complete);
}
function Re(e) {
return e && e instanceof De || Le(e) && ve(e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/lift.js
function ze(e) {
return x(e?.lift);
}
function j(e) {
return function(t) {
if (ze(t)) return t.lift(function(t) {
try {
return e(t, this);
} catch (e) {
this.error(e);
}
});
throw TypeError("Unable to lift unknown Observable type");
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
function M(e, t, n, r, i) {
return new Be(e, t, n, r, i);
}
var Be = function(e) {
g(t, e);
function t(t, n, r, i, a, o) {
var s = e.call(this, t) || this;
return s.onFinalize = a, s.shouldUnsubscribe = o, s._next = n ? function(e) {
try {
n(e);
} catch (e) {
t.error(e);
}
} : e.prototype._next, s._error = i ? function(e) {
try {
i(e);
} catch (e) {
t.error(e);
} finally {
this.unsubscribe();
}
} : e.prototype._error, s._complete = r ? function() {
try {
r();
} catch (e) {
t.error(e);
} finally {
this.unsubscribe();
}
} : e.prototype._complete, s;
}
return t.prototype.unsubscribe = function() {
var t;
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
var n = this.closed;
e.prototype.unsubscribe.call(this), !n && ((t = this.onFinalize) == null || t.call(this));
}
}, t;
}(De), Ve = me(function(e) {
return function() {
e(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
};
}), He = function(e) {
g(t, e);
function t() {
var t = e.call(this) || this;
return t.closed = !1, t.currentObservers = null, t.observers = [], t.isStopped = !1, t.hasError = !1, t.thrownError = null, t;
}
return t.prototype.lift = function(e) {
var t = new Ue(this, this);
return t.operator = e, t;
}, t.prototype._throwIfClosed = function() {
if (this.closed) throw new Ve();
}, t.prototype.next = function(e) {
var t = this;
E(function() {
var n, r;
if (t._throwIfClosed(), !t.isStopped) {
t.currentObservers ||= Array.from(t.observers);
try {
for (var i = _(t.currentObservers), a = i.next(); !a.done; a = i.next()) a.value.next(e);
} catch (e) {
n = { error: e };
} finally {
try {
a && !a.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
}
});
}, t.prototype.error = function(e) {
var t = this;
E(function() {
if (t._throwIfClosed(), !t.isStopped) {
t.hasError = t.isStopped = !0, t.thrownError = e;
for (var n = t.observers; n.length;) n.shift().error(e);
}
});
}, t.prototype.complete = function() {
var e = this;
E(function() {
if (e._throwIfClosed(), !e.isStopped) {
e.isStopped = !0;
for (var t = e.observers; t.length;) t.shift().complete();
}
});
}, t.prototype.unsubscribe = function() {
this.isStopped = this.closed = !0, this.observers = this.currentObservers = null;
}, Object.defineProperty(t.prototype, "observed", {
get: function() {
return this.observers?.length > 0;
},
enumerable: !1,
configurable: !0
}), t.prototype._trySubscribe = function(t) {
return this._throwIfClosed(), e.prototype._trySubscribe.call(this, t);
}, t.prototype._subscribe = function(e) {
return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
}, t.prototype._innerSubscribe = function(e) {
var t = this, n = this, r = n.hasError, i = n.isStopped, a = n.observers;
return r || i ? _e : (this.currentObservers = null, a.push(e), new S(function() {
t.currentObservers = null, ge(a, e);
}));
}, t.prototype._checkFinalizedStatuses = function(e) {
var t = this, n = t.hasError, r = t.thrownError, i = t.isStopped;
n ? e.error(r) : i && e.complete();
}, t.prototype.asObservable = function() {
var e = new A();
return e.source = this, e;
}, t.create = function(e, t) {
return new Ue(e, t);
}, t;
}(A), Ue = function(e) {
g(t, e);
function t(t, n) {
var r = e.call(this) || this;
return r.destination = t, r.source = n, r;
}
return t.prototype.next = function(e) {
var t, n;
(n = (t = this.destination)?.next) == null || n.call(t, e);
}, t.prototype.error = function(e) {
var t, n;
(n = (t = this.destination)?.error) == null || n.call(t, e);
}, t.prototype.complete = function() {
var e, t;
(t = (e = this.destination)?.complete) == null || t.call(e);
}, t.prototype._subscribe = function(e) {
return this.source?.subscribe(e) ?? _e;
}, t;
}(He), We = {
now: function() {
return (We.delegate || Date).now();
},
delegate: void 0
}, Ge = function(e) {
g(t, e);
function t(t, n, r) {
t === void 0 && (t = Infinity), n === void 0 && (n = Infinity), r === void 0 && (r = We);
var i = e.call(this) || this;
return i._bufferSize = t, i._windowTime = n, i._timestampProvider = r, i._buffer = [], i._infiniteTimeWindow = !0, i._infiniteTimeWindow = n === Infinity, i._bufferSize = Math.max(1, t), i._windowTime = Math.max(1, n), i;
}
return t.prototype.next = function(t) {
var n = this, r = n.isStopped, i = n._buffer, a = n._infiniteTimeWindow, o = n._timestampProvider, s = n._windowTime;
r || (i.push(t), !a && i.push(o.now() + s)), this._trimBuffer(), e.prototype.next.call(this, t);
}, t.prototype._subscribe = function(e) {
this._throwIfClosed(), this._trimBuffer();
for (var t = this._innerSubscribe(e), n = this, r = n._infiniteTimeWindow, i = n._buffer.slice(), a = 0; a < i.length && !e.closed; a += r ? 1 : 2) e.next(i[a]);
return this._checkFinalizedStatuses(e), t;
}, t.prototype._trimBuffer = function() {
var e = this, t = e._bufferSize, n = e._timestampProvider, r = e._buffer, i = e._infiniteTimeWindow, a = (i ? 1 : 2) * t;
if (t < Infinity && a < r.length && r.splice(0, r.length - a), !i) {
for (var o = n.now(), s = 0, c = 1; c < r.length && r[c] <= o; c += 2) s = c;
s && r.splice(0, s + 1);
}
}, t;
}(He), Ke = function(e) {
g(t, e);
function t(t, n) {
return e.call(this) || this;
}
return t.prototype.schedule = function(e, t) {
return t === void 0 && (t = 0), this;
}, t;
}(S), N = {
setInterval: function(e, t) {
var n = [...arguments].slice(2), r = N.delegate;
return r?.setInterval ? r.setInterval.apply(r, y([e, t], v(n))) : setInterval.apply(void 0, y([e, t], v(n)));
},
clearInterval: function(e) {
return (N.delegate?.clearInterval || clearInterval)(e);
},
delegate: void 0
}, qe = function(e) {
g(t, e);
function t(t, n) {
var r = e.call(this, t, n) || this;
return r.scheduler = t, r.work = n, r.pending = !1, r;
}
return t.prototype.schedule = function(e, t) {
if (t === void 0 && (t = 0), this.closed) return this;
this.state = e;
var n = this.id, r = this.scheduler;
return n != null && (this.id = this.recycleAsyncId(r, n, t)), this.pending = !0, this.delay = t, this.id = this.id ?? this.requestAsyncId(r, this.id, t), this;
}, t.prototype.requestAsyncId = function(e, t, n) {
return n === void 0 && (n = 0), N.setInterval(e.flush.bind(e, this), n);
}, t.prototype.recycleAsyncId = function(e, t, n) {
if (n === void 0 && (n = 0), n != null && this.delay === n && this.pending === !1) return t;
t != null && N.clearInterval(t);
}, t.prototype.execute = function(e, t) {
if (this.closed) return /* @__PURE__ */ Error("executing a cancelled action");
this.pending = !1;
var n = this._execute(e, t);
if (n) return n;
this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
}, t.prototype._execute = function(e, t) {
var n = !1, r;
try {
this.work(e);
} catch (e) {
n = !0, r = e || /* @__PURE__ */ Error("Scheduled action threw falsy error");
}
if (n) return this.unsubscribe(), r;
}, t.prototype.unsubscribe = function() {
if (!this.closed) {
var t = this, n = t.id, r = t.scheduler, i = r.actions;
this.work = this.state = this.scheduler = null, this.pending = !1, ge(i, this), n != null && (this.id = this.recycleAsyncId(r, n, null)), this.delay = null, e.prototype.unsubscribe.call(this);
}
}, t;
}(Ke), Je = function() {
function e(t, n) {
n === void 0 && (n = e.now), this.schedulerActionCtor = t, this.now = n;
}
return e.prototype.schedule = function(e, t, n) {
return t === void 0 && (t = 0), new this.schedulerActionCtor(this, e).schedule(n, t);
}, e.now = We.now, e;
}(), Ye = new (function(e) {
g(t, e);
function t(t, n) {
n === void 0 && (n = Je.now);
var r = e.call(this, t, n) || this;
return r.actions = [], r._active = !1, r;
}
return t.prototype.flush = function(e) {
var t = this.actions;
if (this._active) {
t.push(e);
return;
}
var n;
this._active = !0;
do
if (n = e.execute(e.state, e.delay)) break;
while (e = t.shift());
if (this._active = !1, n) {
for (; e = t.shift();) e.unsubscribe();
throw n;
}
}, t;
}(Je))(qe), Xe = Ye, Ze = new A(function(e) {
return e.complete();
});
function Qe(e) {
return e ? $e(e) : Ze;
}
function $e(e) {
return new A(function(t) {
return e.schedule(function() {
return t.complete();
});
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isScheduler.js
function et(e) {
return e && x(e.schedule);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/args.js
function tt(e) {
return e[e.length - 1];
}
function nt(e) {
return et(tt(e)) ? e.pop() : void 0;
}
function rt(e, t) {
return typeof tt(e) == "number" ? e.pop() : t;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js
var it = (function(e) {
return e && typeof e.length == "number" && typeof e != "function";
});
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isPromise.js
function at(e) {
return x(e?.then);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js
function ot(e) {
return x(e[Pe]);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js
function st(e) {
return Symbol.asyncIterator && x(e?.[Symbol.asyncIterator]);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js
function ct(e) {
return /* @__PURE__ */ TypeError("You provided " + (typeof e == "object" && e ? "an invalid object" : "'" + e + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/symbol/iterator.js
function lt() {
return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
}
var ut = lt();
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isIterable.js
function dt(e) {
return x(e?.[ut]);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js
function ft(e) {
return fe(this, arguments, function() {
var t, n, r, i;
return de(this, function(a) {
switch (a.label) {
case 0: t = e.getReader(), a.label = 1;
case 1: a.trys.push([
1,
,
9,
10
]), a.label = 2;
case 2: return [4, b(t.read())];
case 3: return n = a.sent(), r = n.value, i = n.done, i ? [4, b(void 0)] : [3, 5];
case 4: return [2, a.sent()];
case 5: return [4, b(r)];
case 6: return [4, a.sent()];
case 7: return a.sent(), [3, 2];
case 8: return [3, 10];
case 9: return t.releaseLock(), [7];
case 10: return [2];
}
});
});
}
function pt(e) {
return x(e?.getReader);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/innerFrom.js
function P(e) {
if (e instanceof A) return e;
if (e != null) {
if (ot(e)) return mt(e);
if (it(e)) return ht(e);
if (at(e)) return gt(e);
if (st(e)) return vt(e);
if (dt(e)) return _t(e);
if (pt(e)) return yt(e);
}
throw ct(e);
}
function mt(e) {
return new A(function(t) {
var n = e[Pe]();
if (x(n.subscribe)) return n.subscribe(t);
throw TypeError("Provided object does not correctly implement Symbol.observable");
});
}
function ht(e) {
return new A(function(t) {
for (var n = 0; n < e.length && !t.closed; n++) t.next(e[n]);
t.complete();
});
}
function gt(e) {
return new A(function(t) {
e.then(function(e) {
t.closed || (t.next(e), t.complete());
}, function(e) {
return t.error(e);
}).then(null, be);
});
}
function _t(e) {
return new A(function(t) {
var n, r;
try {
for (var i = _(e), a = i.next(); !a.done; a = i.next()) {
var o = a.value;
if (t.next(o), t.closed) return;
}
} catch (e) {
n = { error: e };
} finally {
try {
a && !a.done && (r = i.return) && r.call(i);
} finally {
if (n) throw n.error;
}
}
t.complete();
});
}
function vt(e) {
return new A(function(t) {
bt(e, t).catch(function(e) {
return t.error(e);
});
});
}
function yt(e) {
return vt(ft(e));
}
function bt(e, t) {
var n, r, i, a;
return ue(this, void 0, void 0, function() {
var o, s;
return de(this, function(c) {
switch (c.label) {
case 0: c.trys.push([
0,
5,
6,
11
]), n = pe(e), c.label = 1;
case 1: return [4, n.next()];
case 2:
if (r = c.sent(), r.done) return [3, 4];
if (o = r.value, t.next(o), t.closed) return [2];
c.label = 3;
case 3: return [3, 1];
case 4: return [3, 11];
case 5: return s = c.sent(), i = { error: s }, [3, 11];
case 6: return c.trys.push([
6,
,
9,
10
]), r && !r.done && (a = n.return) ? [4, a.call(n)] : [3, 8];
case 7: c.sent(), c.label = 8;
case 8: return [3, 10];
case 9:
if (i) throw i.error;
return [7];
case 10: return [7];
case 11: return t.complete(), [2];
}
});
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/executeSchedule.js
function F(e, t, n, r, i) {
r === void 0 && (r = 0), i === void 0 && (i = !1);
var a = t.schedule(function() {
n(), i ? e.add(this.schedule(null, r)) : this.unsubscribe();
}, r);
if (e.add(a), !i) return a;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/observeOn.js
function xt(e, t) {
return t === void 0 && (t = 0), j(function(n, r) {
n.subscribe(M(r, function(n) {
return F(r, e, function() {
return r.next(n);
}, t);
}, function() {
return F(r, e, function() {
return r.complete();
}, t);
}, function(n) {
return F(r, e, function() {
return r.error(n);
}, t);
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/subscribeOn.js
function St(e, t) {
return t === void 0 && (t = 0), j(function(n, r) {
r.add(e.schedule(function() {
return n.subscribe(r);
}, t));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js
function Ct(e, t) {
return P(e).pipe(St(t), xt(t));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js
function wt(e, t) {
return P(e).pipe(St(t), xt(t));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js
function Tt(e, t) {
return new A(function(n) {
var r = 0;
return t.schedule(function() {
r === e.length ? n.complete() : (n.next(e[r++]), n.closed || this.schedule());
});
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js
function Et(e, t) {
return new A(function(n) {
var r;
return F(n, t, function() {
r = e[ut](), F(n, t, function() {
var e, t, i;
try {
e = r.next(), t = e.value, i = e.done;
} catch (e) {
n.error(e);
return;
}
i ? n.complete() : n.next(t);
}, 0, !0);
}), function() {
return x(r?.return) && r.return();
};
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js
function Dt(e, t) {
if (!e) throw Error("Iterable cannot be null");
return new A(function(n) {
F(n, t, function() {
var r = e[Symbol.asyncIterator]();
F(n, t, function() {
r.next().then(function(e) {
e.done ? n.complete() : n.next(e.value);
});
}, 0, !0);
});
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js
function Ot(e, t) {
return Dt(ft(e), t);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js
function kt(e, t) {
if (e != null) {
if (ot(e)) return Ct(e, t);
if (it(e)) return Tt(e, t);
if (at(e)) return wt(e, t);
if (st(e)) return Dt(e, t);
if (dt(e)) return Et(e, t);
if (pt(e)) return Ot(e, t);
}
throw ct(e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/from.js
function I(e, t) {
return t ? kt(e, t) : P(e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/of.js
function At() {
var e = [...arguments];
return I(e, nt(e));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/EmptyError.js
var jt = me(function(e) {
return function() {
e(this), this.name = "EmptyError", this.message = "no elements in sequence";
};
});
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/util/isDate.js
function Mt(e) {
return e instanceof Date && !isNaN(e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/map.js
function L(e, t) {
return j(function(n, r) {
var i = 0;
n.subscribe(M(r, function(n) {
r.next(e.call(t, n, i++));
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/mergeInternals.js
function Nt(e, t, n, r, i, a, o, s) {
var c = [], l = 0, u = 0, d = !1, f = function() {
d && !c.length && !l && t.complete();
}, p = function(e) {
return l < r ? m(e) : c.push(e);
}, m = function(e) {
a && t.next(e), l++;
var s = !1;
P(n(e, u++)).subscribe(M(t, function(e) {
i?.(e), a ? p(e) : t.next(e);
}, function() {
s = !0;
}, void 0, function() {
if (s) try {
l--;
for (var e = function() {
var e = c.shift();
o ? F(t, o, function() {
return m(e);
}) : m(e);
}; c.length && l < r;) e();
f();
} catch (e) {
t.error(e);
}
}));
};
return e.subscribe(M(t, p, function() {
d = !0, f();
})), function() {
s?.();
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/mergeMap.js
function Pt(e, t, n) {
return n === void 0 && (n = Infinity), x(t) ? Pt(function(n, r) {
return L(function(e, i) {
return t(n, e, r, i);
})(P(e(n, r)));
}, n) : (typeof t == "number" && (n = t), j(function(t, r) {
return Nt(t, r, e, n);
}));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/mergeAll.js
function Ft(e) {
return e === void 0 && (e = Infinity), Pt(k, e);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/concatAll.js
function It() {
return Ft(1);
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/concat.js
function Lt() {
var e = [...arguments];
return It()(I(e, nt(e)));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/defer.js
function Rt(e) {
return new A(function(t) {
P(e()).subscribe(t);
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/timer.js
function zt(e, t, n) {
e === void 0 && (e = 0), n === void 0 && (n = Xe);
var r = -1;
return t != null && (et(t) ? n = t : r = t), new A(function(t) {
var i = Mt(e) ? +e - n.now() : e;
i < 0 && (i = 0);
var a = 0;
return n.schedule(function() {
t.closed || (t.next(a++), 0 <= r ? this.schedule(void 0, r) : t.complete());
}, i);
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/observable/merge.js
function Bt() {
var e = [...arguments], t = nt(e), n = rt(e, Infinity), r = e;
return r.length ? r.length === 1 ? P(r[0]) : Ft(n)(I(r, t)) : Ze;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/filter.js
function Vt(e, t) {
return j(function(n, r) {
var i = 0;
n.subscribe(M(r, function(n) {
return e.call(t, n, i++) && r.next(n);
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/catchError.js
function Ht(e) {
return j(function(t, n) {
var r = null, i = !1, a;
r = t.subscribe(M(n, void 0, void 0, function(o) {
a = P(e(o, Ht(e)(t))), r ? (r.unsubscribe(), r = null, a.subscribe(n)) : i = !0;
})), i && (r.unsubscribe(), r = null, a.subscribe(n));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/scanInternals.js
function Ut(e, t, n, r, i) {
return function(a, o) {
var s = n, c = t, l = 0;
a.subscribe(M(o, function(t) {
var n = l++;
c = s ? e(c, t, n) : (s = !0, t), r && o.next(c);
}, i && (function() {
s && o.next(c), o.complete();
})));
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/defaultIfEmpty.js
function Wt(e) {
return j(function(t, n) {
var r = !1;
t.subscribe(M(n, function(e) {
r = !0, n.next(e);
}, function() {
r || n.next(e), n.complete();
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/take.js
function Gt(e) {
return e <= 0 ? function() {
return Ze;
} : j(function(t, n) {
var r = 0;
t.subscribe(M(n, function(t) {
++r <= e && (n.next(t), e <= r && n.complete());
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/ignoreElements.js
function Kt() {
return j(function(e, t) {
e.subscribe(M(t, xe));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/mapTo.js
function qt(e) {
return L(function() {
return e;
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/delayWhen.js
function Jt(e, t) {
return t ? function(n) {
return Lt(t.pipe(Gt(1), Kt()), n.pipe(Jt(e)));
} : Pt(function(t, n) {
return P(e(t, n)).pipe(Gt(1), qt(t));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/delay.js
function Yt(e, t) {
t === void 0 && (t = Ye);
var n = zt(e, t);
return Jt(function() {
return n;
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/distinctUntilChanged.js
function Xt(e, t) {
return t === void 0 && (t = k), e ??= Zt, j(function(n, r) {
var i, a = !0;
n.subscribe(M(r, function(n) {
var o = t(n);
(a || !e(i, o)) && (a = !1, i = o, r.next(n));
}));
});
}
function Zt(e, t) {
return e === t;
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/throwIfEmpty.js
function Qt(e) {
return e === void 0 && (e = $t), j(function(t, n) {
var r = !1;
t.subscribe(M(n, function(e) {
r = !0, n.next(e);
}, function() {
return r ? n.complete() : n.error(e());
}));
});
}
function $t() {
return new jt();
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/first.js
function en(e, t) {
var n = arguments.length >= 2;
return function(r) {
return r.pipe(e ? Vt(function(t, n) {
return e(t, n, r);
}) : k, Gt(1), n ? Wt(t) : Qt(function() {
return new jt();
}));
};
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/scan.js
function tn(e, t) {
return j(Ut(e, t, arguments.length >= 2, !0));
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/share.js
function nn(e) {
e === void 0 && (e = {});
var t = e.connector, n = t === void 0 ? function() {
return new He();
} : t, r = e.resetOnError, i = r === void 0 ? !0 : r, a = e.resetOnComplete, o = a === void 0 ? !0 : a, s = e.resetOnRefCountZero, c = s === void 0 ? !0 : s;
return function(e) {
var t, r, a, s = 0, l = !1, u = !1, d = function() {
r?.unsubscribe(), r = void 0;
}, f = function() {
d(), t = a = void 0, l = u = !1;
}, p = function() {
var e = t;
f(), e?.unsubscribe();
};
return j(function(e, m) {
s++, !u && !l && d();
var h = a ??= n();
m.add(function() {
s--, s === 0 && !u && !l && (r = rn(p, c));
}), h.subscribe(m), !t && s > 0 && (t = new D({
next: function(e) {
return h.next(e);
},
error: function(e) {
u = !0, d(), r = rn(f, i, e), h.error(e);
},
complete: function() {
l = !0, d(), r = rn(f, o), h.complete();
}
}), P(e).subscribe(t));
})(e);
};
}
function rn(e, t) {
var n = [...arguments].slice(2);
if (t === !0) {
e();
return;
}
if (t !== !1) {
var r = new D({ next: function() {
r.unsubscribe(), e();
} });
return P(t.apply(void 0, y([], v(n)))).subscribe(r);
}
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/shareReplay.js
function an(e, t, n) {
var r, i, a, o, s = !1;
return e && typeof e == "object" ? (r = e.bufferSize, o = r === void 0 ? Infinity : r, i = e.windowTime, t = i === void 0 ? Infinity : i, a = e.refCount, s = a === void 0 ? !1 : a, n = e.scheduler) : o = e ?? Infinity, nn({
connector: function() {
return new Ge(o, t, n);
},
resetOnError: !0,
resetOnComplete: !1,
resetOnRefCountZero: s
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/switchMap.js
function on(e, t) {
return j(function(n, r) {
var i = null, a = 0, o = !1, s = function() {
return o && !i && r.complete();
};
n.subscribe(M(r, function(n) {
i?.unsubscribe();
var o = 0, c = a++;
P(e(n, c)).subscribe(i = M(r, function(e) {
return r.next(t ? t(n, e, c, o++) : e);
}, function() {
i = null, s();
}));
}, function() {
o = !0, s();
}));
});
}
//#endregion
//#region node_modules/rxjs/dist/esm5/internal/operators/tap.js
function sn(e, t, n) {
var r = x(e) || t || n ? {
next: e,
error: t,
complete: n
} : e;
return r ? j(function(e, t) {
var n;
(n = r.subscribe) == null || n.call(r);
var i = !0;
e.subscribe(M(t, function(e) {
var n;
(n = r.next) == null || n.call(r, e), t.next(e);
}, function() {
var e;
i = !1, (e = r.complete) == null || e.call(r), t.complete();
}, function(e) {
var n;
i = !1, (n = r.error) == null || n.call(r, e), t.error(e);
}, function() {
var e, t;
i && ((e = r.unsubscribe) == null || e.call(r)), (t = r.finalize) == null || t.call(r);
}));
}) : k;
}
//#endregion
//#region node_modules/rxfire/auth/index.esm.js
function cn(e) {
return new A(function(n) {
return { unsubscribe: t(e, n.next.bind(n), n.error.bind(n), n.complete.bind(n)) };
});
}
//#endregion
//#region src/firebaseApp.tsx
var ln = "[DEFAULT]", un = e.createContext(void 0), dn = e.createContext(!1), fn = "4.2.6", pn = (e, t) => e === t || [...Object.keys(e), ...Object.keys(t)].every((n) => e[n] === t[n]);
function mn(t) {
let { firebaseConfig: a, appName: o, suspense: s } = t, c = e.useMemo(() => {
if (t.firebaseApp) return t.firebaseApp;
let s = n().find((e) => e.name === (o || ln));
if (s) {
if (a && pn(s.options, a)) return s;
throw Error(`Does not match the options already provided to the ${o || "default"} firebase app instance, give this new instance a different appName.`);
} else {
if (!a) throw Error("No firebaseConfig provided");
return i("react", e.version || "unknown"), i("reactfire", fn), r(a, o);
}
}, [
t.firebaseApp,
a,
o
]);
return e.createElement(un.Provider, { value: c }, e.createElement(dn.Provider, Object.assign({ value: s ?? !1 }, t)));
}
function hn() {
return e.useContext(dn) ?? !1;
}
function R(t) {
let n = e.useContext(dn);
return t === void 0 ? n : t;
}
function gn() {
let t = e.useContext(un);
if (!t) throw Error("Cannot call useFirebaseApp unless your component is within a FirebaseAppProvider");
return t;
}
//#endregion
//#region src/auth.tsx
function _n(e) {
return ue(this, void 0, void 0, function* () {
let t = yield e();
return G(cn(t), `auth:user:${t.name}`).toPromise();
});
}
function vn(e) {
let t = Gr(), n = `auth:user:${t.name}`, r = cn(t), i = Object.assign({}, e);
return t.currentUser && !("initialData" in i) && !("startWithValue" in i) && (i.initialData = t.currentUser), K(n, r, i);
}
function yn(e, t = !1, n) {
if (!e) throw Error("you must provide a user");
return K(`auth:idTokenResult:${e.uid}:forceRefresh=${t}`, Rt(() => I(e.getIdTokenResult(t))), n);
}
function bn(e) {
if (e?.hasOwnProperty("requiredClaims") && e?.hasOwnProperty("validateCustomClaims")) throw Error("Cannot have both \"requiredClaims\" and \"validateCustomClaims\". Use one or the other.");
let t = Gr(), n = `auth:signInCheck:${t.name}::forceRefresh:${!!e?.forceRefresh}`;
e?.forceRefresh && (n = `${n}:forceRefresh:${e.forceRefresh}`), e?.hasOwnProperty("requiredClaims") ? n = `${n}:requiredClaims:${JSON.stringify(e.requiredClaims)}` : e?.hasOwnProperty("validateCustomClaims") && (n = `${n}:validateCustomClaims:${JSON.stringify(e.validateCustomClaims)}`);
let r = cn(t).pipe(on((t) => t ? e && (e.hasOwnProperty("requiredClaims") || e.hasOwnProperty("validateCustomClaims")) ? I(t.getIdTokenResult(e?.forceRefresh ?? !1)).pipe(L((n) => {
let r;
r = e.hasOwnProperty("requiredClaims") ? xn(e.requiredClaims) : e.validateCustomClaims;
let { hasRequiredClaims: i, errors: a } = r(n.claims);
return {
signedIn: !0,
hasRequiredClaims: i,
errors: a,
user: t
};
})) : At({
signedIn: !0,
hasRequiredClaims: !0,
errors: {},
user: t
}) : At({
signedIn: !1,
hasRequiredClaims: !1,
errors: {},
user: null
})));
return K(n, r, e);
}
function xn(e) {
return function(t) {
let n = {};
return Object.keys(e).forEach((r) => {
e[r] !== t[r] && (n[r] = [new ci("auth/missing-claim", `Expected "${e[r]}", but user has "${t[r]}" instead`)]);
}), {
hasRequiredClaims: Object.keys(n).length === 0,
errors: n
};
};
}
function Sn({ user: t, fallback: n, children: r, requiredClaims: i }) {
let { data: a, status: o, error: s } = yn(t, !1);
if (o === "loading") throw Error("ClaimsCheck must be run in Suspense mode");
if (o === "error") throw s;
let { claims: c } = a, l = {};
return R() || console.warn("ClaimsCheck is deprecated and only works when ReactFire is in experimental Suspense Mode. Use useSigninCheck or set suspense={true} in FirebaseAppProvider if you want to use this component."), i && Object.keys(i).forEach((e) => {
i[e] !== c[e] && (l[e] = {
expected: i[e],
actual: c[e]?.toString()
});
}), Object.keys(l).length === 0 ? e.createElement(e.Fragment, null, r) : e.createElement(e.Fragment, null, n);
}
function Cn({ fallback: t, children: n, requiredClaims: r }) {
let { data: i } = vn();
return R() || console.warn("AuthCheck is deprecated and only works when ReactFire is in experimental Suspense Mode. Use useSigninCheck or set suspense={true} in FirebaseAppProvider if you want to use this component."), i ? r ? e.createElement(Sn, {
user: i,
fallback: t,
requiredClaims: r
}, n) : e.createElement(e.Fragment, null, n) : e.createElement(e.Fragment, null, t);
}
//#endregion
//#region node_modules/rxfire/database/index.esm.js
var z, B;
(function(e) {
e.added = "child_added", e.removed = "child_removed", e.changed = "child_changed", e.moved = "child_moved", e.value = "value";
})(B ||= {});
var wn = Object.freeze((z = {}, z[B.added] = s, z[B.removed] = u, z[B.changed] = c, z[B.moved] = l, z[B.value] = d, z));
function Tn(e, t) {
return new A(function(n) {
var r = wn[t](e, function(e, r) {
n.next({
snapshot: e,
prevKey: r,
event: t
});
}, n.error.bind(n));
return { unsubscribe: function() {
o(e, t, r);
} };
}).pipe(Yt(0));
}
var V = function() {
return V = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
return e;
}, V.apply(this, arguments);
};
function En(e, t, n) {
if (n || arguments.length === 2) for (var r = 0, i = t.length, a; r < i; r++) (a || !(r in t)) && (a ||= Array.prototype.slice.call(t, 0, r), a[r] = t[r]);
return e.concat(a || Array.prototype.slice.call(t));
}
function Dn(e) {
return (e == null || e.length === 0) && (e = [
B.added,
B.removed,
B.changed,
B.moved
]), e;
}
function On(e) {
return Tn(e, B.value);
}
function kn(e, t) {
return t === void 0 && (t = {}), Tn(e, B.value).pipe(L(function(e) {
return An(e, t);
}));
}
function An(e, t) {
var n;
t === void 0 && (t = {});
var r = e.snapshot.val();
return !e.snapshot.exists() || typeof r != "object" ? r : V(V({}, r), t.keyField ? (n = {}, n[t.keyField] = e.snapshot.key, n) : null);
}
function jn(e) {
return I(a(e)).pipe(L(function(e) {
return {
snapshot: e,
prevKey: null,
event: B.value
};
}));
}
function Mn(e, t) {
t === void 0 && (t = {});
var n = Dn(t.events);
return jn(e).pipe(on(function(t) {
var r = [At(t)];
return n.forEach(function(t) {
r.push(Tn(e, t));
}), Bt.apply(void 0, r).pipe(tn(In, []));
}), Xt());
}
function Nn(e, t) {
return t === void 0 && (t = {}), Mn(e).pipe(L(function(e) {
return e.map(function(e) {
return An(e, t);
});
}));
}
function Pn(e, t) {
for (var n = e.length, r = 0; r < n; r++) if (e[r].snapshot.key === t) return r;
return -1;
}
function Fn(e, t) {
if (t == null) return 0;
var n = Pn(e, t);
return n === -1 ? e.length : n + 1;
}
function In(e, t) {
var n = t.snapshot, r = t.prevKey, i = t.event, a = n.key, o = Pn(e, a), s = Fn(e, r || void 0);
switch (i) {
case B.value:
if (t.snapshot && t.snapshot.exists()) {
var c = null;
t.snapshot.forEach(function(t) {
var n = {
snapshot: t,
event: B.value,
prevKey: c
};
return c = t.key, e = En(En([], e, !0), [n], !1), !1;
});
}
return e;
case B.added:
if (o > -1) {
var l = e[o - 1];
(l && l.snapshot.key || null) !== r && (e = e.filter(function(e) {
return e.snapshot.key !== n.key;
}), e.splice(s, 0, t));
} else if (r == null) return En([t], e, !0);
else e = e.slice(), e.splice(s, 0, t);
return e;
case B.removed: return e.filter(function(e) {
return e.snapshot.key !== n.key;
});
case B.changed: return e.map(function(e) {
return e.snapshot.key === a ? t : e;
});
case B.moved:
if (o > -1) {
var u = e.splice(o, 1)[0];
return e = e.slice(), e.splice(s, 0, u), e;
}
return e;
default: return e;
}
}
//#endregion
//#region src/database.tsx
var Ln = globalThis._reactFireDatabaseCachedQueries || [];
globalThis._reactFireDatabaseCachedQueries || (globalThis._reactFireDatabaseCachedQueries = Ln);
function Rn(e) {
let t = Ln.findIndex((t) => t.isEqual(e));
return t > -1 ? t : Ln.push(e) - 1;
}
function zn(e, t) {
return K(`database:object:${e.toString()}`, On(e), t);
}
function Bn(e, t) {
let n = t ? $(t) : void 0;
return K(`database:objectVal:${e.toString()}:idField=${JSON.stringify(n)}`, kn(e, { keyField: n }), t);
}
function Vn(e, t) {
return K(`database:list:${Rn(e)}`, Mn(e), t);
}
function Hn(e, t) {
let n = t ? $(t) : void 0;
return K(`database:listVal:${Rn(e)}:idField=${JSON.stringify(n)}`, Nn(e, { keyField: n }), t);
}
//#endregion
//#region node_modules/rxfire/firestore/index.esm.js
var H = function() {
return H = Object.assign || function(e) {
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n], t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
return e;
}, H.apply(this, arguments);
}, Un = { includeMetadataChanges: !1 };
function Wn(e, t) {
return t === void 0 && (t = Un), new A(function(n) {
return { unsubscribe: f(e, t, {
next: n.next.bind(n),
error: n.error.bind(n),
complete: n.complete.bind(n)
}) };
});
}
function U(e) {
return Wn(e, { includeMetadataChanges: !0 });
}
function Gn(e, t) {
return t === void 0 && (t = {}), U(e).pipe(L(function(e) {
return Kn(e, t);
}));
}
function Kn(e, t) {
var n;
t === void 0 && (t = {});
var r = e.data(t);
return !e.exists() || typeof r != "object" || !r || !t.idField ? r : H(H({}, r), (n = {}, n[t.idField] = e.id, n));
}
function qn(e) {
return Wn(e, { includeMetadataChanges: !0 }).pipe(L(function(e) {
return e.docs;
}));
}
function Jn(e, t) {
return t === void 0 && (t = {}), qn(e).pipe(L(function(e) {
return e.map(function(e) {
return Kn(e, t);
});
}));
}
//#endregion
//#region src/SuspenseSubject.ts
var Yn = class extends He {
constructor(e, t, n) {
super(), this._timeoutWindow = t, this._suspenseEnabled = n, this._hasValue = !1, this._error = void 0, this._isComplete = !1, this._firstEmission = new Promise((e) => this._resolveFirstEmission = e), this._immutableStatus = {
status: "loading",
hasEmitted: !1,
isComplete: !1,
data: void 0,
error: void 0,
firstValuePromise: this._firstEmission
}, this._innerObservable = e.pipe(sn({
next: (e) => {
this._next(e);
},
error: (e) => {
this._error = e, this._resolveFirstEmission(), this._updateImmutableStatus();
},
complete: () => {
this._isComplete = !0, this._updateImmutableStatus();
}
}), Ht(() => Qe()), an(1)), this._warmupSubscription = this._innerObservable.subscribe(), this._suspenseEnabled ? this._timeoutHandler = setTimeout(() => {}, this._timeoutWindow) : this._timeoutHandler = setTimeout(this._reset.bind(this), this._timeoutWindow);
}
get hasValue() {
return this._hasValue || !!this._error;
}
get value() {
if (this._error) throw this._error;
if (!this.hasValue) throw Error("Can only get value if SuspenseSubject has a value");
return this._value;
}
get firstEmission() {
return this._firstEmission;
}
_updateImmutableStatus() {
this._immutableStatus = {
status: this._error ? "error" : this._hasValue ? "success" : "loading",
hasEmitted: this._hasValue,
isComplete: this._isComplete,
data: this._value,
error: this._error,
firstValuePromise: this._firstEmission
};
}
_next(e) {
this._hasValue = !0, this._value = e, this._resolveFirstEmission(), this._updateImmutableStatus();
}
_reset() {
this._warmupSubscription && this._warmupSubscription.unsubscribe(), this._hasValue = !1, this._value = void 0, this._error = void 0, this._firstEmission = new Promise((e) => this._resolveFirstEmission = e), this._updateImmutableStatus();
}
_subscribe(e) {
return this._timeoutHandler && clearTimeout(this._timeoutHandler), this._innerSubscriber = this._innerObservable.subscribe(e), this._innerSubscriber;
}
get ourError() {
return this._error;
}
get immutableStatus() {
return this._immutableStatus;
}
}, Xn = 3e4, W = globalThis._reactFirePreloadedObservables || /* @__PURE__ */ new Map();
globalThis._reactFirePreloadedObservables || (globalThis._reactFirePreloadedObservables = W);
function G(e, t, n = !1) {
if (W.has(t)) return W.get(t);
{
let r = new Yn(e, Xn, n);
return W.set(t, r), r;
}
}
function K(t, n, r = {}) {
if (!t) throw Error("cannot call useObservable without an observableId");
let i = R(r.suspense), a = G(n, t, i), o = r.hasOwnProperty("initialData") || r.hasOwnProperty("startWithValue"), s = a.hasValue || o;
if (i === !0 && !s) throw a.firstEmission;
let c = m(e.useCallback((e) => {
let t = a.subscribe({
next: () => {
e();
},
error: (t) => {
throw e(), t;
},
complete: () => {
e();
}
});
return () => {
t.unsubscribe();
};
}, [a]), e.useCallback(() => a.immutableStatus, [a]));
if (!a.hasValue && s) {
let e = r?.initialData ?? r?.startWithValue;
if (i && c.error) throw c.error;
return Object.assign(Object.assign({}, c), {
data: e,
status: "success",
hasEmitted: !0
});
}
if (c.error) throw c.error;
return c;
}
//#endregion
//#region src/firestore.tsx
var Zn = globalThis._reactFireFirestoreQueryCache || [];
globalThis._reactFireFirestoreQueryCache || (globalThis._reactFireFirestoreQueryCache = Zn);
function Qn(e) {
let t = Zn.findIndex((t) => p(t, e));
return t > -1 ? t : Zn.push(e) - 1;
}
function $n(e) {
return ue(this, void 0, void 0, function* () {
let t = yield e();
return G(U(t), er(t));
});
}
function er(e) {
return `firestore:doc:${e.firestore.app.name}:${e.path}`;
}
function tr(e, t) {
return K(er(e), U(e), t);
}
function nr(e, t) {
return K(`firestore:docOnce:${e.firestore.app.name}:${e.path}`, U(e).pipe(en()), t);
}
function rr(e, t) {
let n = t ? $(t) : void 0;
return K(`firestore:docData:${e.firestore.app.name}:${e.path}:idField=${JSON.stringify(n)}`, Gn(e, { idField: n }), t);
}
function ir(e, t) {
let n = t ? $(t) : void 0;
return K(`firestore:docDataOnce:${e.firestore.app.name}:${e.path}:idField=${JSON.stringify(n)}`, Gn(e, { idField: n }).pipe(en()), t);
}
function ar(e, t) {
return K(`firestore:collection:${Qn(e)}`, Wn(e), t);
}
function or(e, t) {
let n = t ? $(t) : void 0;
return K(`firestore:collectionData:${Qn(e)}:idField=${JSON.stringify(n)}`, Jn(e, { idField: n }), t);
}
//#endregion
//#region node_modules/rxfire/functions/index.esm.js
function sr(e, t, n) {
var r = h(e, t, n);
return function(e) {
return I(r(e)).pipe(L(function(e) {
return e.data;
}));
};
}
//#endregion
//#region src/functions.tsx
function cr(e, t) {
let n = Yr(), r = `functions:callableResponse:${e}:${JSON.stringify(t?.data)}:${JSON.stringify(t?.httpsCallableOptions)}`, i = sr(n, e, t?.httpsCallableOptions);
return K(r, Rt(() => i(t?.data)), t);
}
//#endregion
//#region src/performance.tsx
function lr({ children: t, traceId: n, fallback: r }) {
let i = typeof globalThis < "u" ? globalThis.performance : void 0, a = (i?.getEntriesByName)?.call(i, n, "measure") || [], o = `_${n}Start[${a.length}]`, s = `_${n}End[${a.length}]`;
return e.createElement(e.Suspense, { fallback: e.createElement(() => (e.useEffect(() => {
var e;
return (e = i?.mark) == null || e.call(i, o), () => {
var e, t;
(e = i?.mark) == null || e.call(i, s), (t = i?.measure) == null || t.call(i, n, o, s);
};
}, []), e.createElement(e.Fragment, null, r)), null) }, t);
}
//#endregion
//#region node_modules/rxfire/remote-config/index.esm.js
function q(e) {
var t = e.remoteConfig, n = e.key, r = e.getter;
return new A(function(e) {
ee(t).then(function() {
var i = r.bind(t);
e.next(i(t, n));
});
});
}
function ur(e, t) {
return q({
remoteConfig: e,
key: t,
getter: ae
});
}
function dr(e, t) {
return q({
remoteConfig: e,
key: t,
getter: ie
});
}
function fr(e, t) {
return q({
remoteConfig: e,
key: t,
getter: re
});
}
function pr(e, t) {
return q({
remoteConfig: e,
key: t,
getter: ne
});
}
function mr(e) {
return q({
remoteConfig: e,
key: "",
getter: te
});
}
//#endregion
//#region src/remote-config.tsx
function J(e, t) {
let n = Qr(), r = n.app.name, i = t(n, e);
return K(`remoteConfig:${e}:${t.name}:${r}`, i);
}
function hr(e) {
return J(e, ur);
}
function gr(e) {
return J(e, dr);
}
function _r(e) {
return J(e, fr);
}
function vr(e) {
return J(e, pr);
}
function yr(e) {
return J(e, mr);
}
//#endregion
//#region node_modules/rxfire/storage/index.esm.js
function br(e) {
return new A(function(t) {
var n = null, r = !1, i = !1, a = null, o = function(e) {
n = e, c();
}, s = null, c = function() {
s ||= setTimeout(function() {
s = null, n && t.next(n), r && t.complete(), i && t.error(a);
});
};
t.add(function() {
s && clearTimeout(s);
}), o(e.snapshot), t.add(e.on("state_changed", o)), t.add(I(e).subscribe({
next: o,
error: function(e) {
i = !0, a = e, c();
},
complete: function() {
r = !0, c();
}
}));
});
}
function xr(e) {
return I(oe(e));
}
//#endregion
//#region src/storage.tsx
function Sr(e, t, n) {
return K(`storage:task:${t.toString()}`, br(e), n);
}
function Cr(e, t) {
return K(`storage:downloadUrl:${e.toString()}`, Rt(() => xr(e)), t);
}
function wr(t) {
let n = Zr();
return t = Object.assign(Object.assign({}, t), { storage: n }), e.createElement(Tr, Object.assign({}, t));
}
function Tr(t) {
let { storage: n, storagePath: r, suspense: i, placeHolder: a } = t, o = le(t, [
"storage",
"storagePath",
"suspense",
"placeHolder"
]), s = { suspense: R(i) };
if (!n) throw Error("Storage was not passed to component INTERNALStorageImage. This should not be possible");
let { status: c, data: l } = Cr(se(n, r), s);
return c === "success" ? (o.alt || o.alt === "" || console.warn(`No alt prop provided for StorageImage with storagePath "${r}"`, "img elements must have an alt prop, either with meaningful text, or an empty string for decorative images"), e.createElement("img", Object.assign({
src: l,
alt: o.alt
}, o))) : a ?? e.createElement(e.Fragment, null, "''");
}
function Er(t) {
let { storage: n } = t;
return n ? e.createElement(Tr, Object.assign({}, t)) : e.createElement(wr, Object.assign({}, t));
}
//#endregion
//#region src/sdk.tsx
var Dr = e.createContext(void 0), Or = e.createContext(void 0), kr = e.createContext(void 0), Ar = e.createContext(void 0), Y = e.createContext(void 0), jr = e.createContext(void 0), Mr = e.createContext(void 0), Nr = e.createContext(void 0), Pr = e.createContext(void 0);
function X(t) {
return function(n) {
if (!n.sdk) throw Error("no sdk provided");
let r = gn().name;
if (n?.sdk?.app?.name !== r) throw Error("sdk was initialized with a different firebase app");
return e.createElement(t.Provider, Object.assign({ value: n.sdk }, n));
};
}
function Z(t) {
let n = e.useContext(t);
if (!n) throw Error("SDK not found. useSdk must be called from within a provider");
return n;
}
function Q(t, n, r, i) {
let a = gn();
if (e.useContext(n)) throw Error(`Cannot initialize SDK ${t} because it already exists in Context`);
let o = e.useMemo(() => r(a), [a]);
return K(`firebase-sdk:${t}:${a.name}`, I(o), i);
}
var Fr = X(Dr), Ir = X(Or), Lr = X(kr), Rr = X(Ar), zr = X(Y), Br = X(jr), Vr = X(Nr), Hr = X(Mr), Ur = X(Pr), Wr = () => Z(Dr), Gr = () => Z(Or), Kr = () => Z(kr), qr = () => Z(Ar), Jr = () => Z(Y), Yr = () => Z(jr), Xr = () => Z(Nr), Zr = () => Z(Mr), Qr = () => Z(Pr), $r = (e, t) => Q("appcheck", Dr, e, t), ei = (e, t) => Q("auth", Or, e, t), ti = (e, t) => Q("analytics", kr, e, t), ni = (e, t) => Q("database", Ar, e, t), ri = (e, t) => Q("firestore", Y, e, t), ii = (e, t) => Q("functions", jr, e, t), ai = (e, t) => Q("performance", Nr, e, t), oi = (e, t) => Q("remoteconfig", Pr, e, t), si = (e, t) => Q("storage", Mr, e, t), ci = class e extends Error {
constructor(t, n, r) {
super(n), this.code = t, this.customData = r, this.name = "ReactFireError", Object.setPrototypeOf(this, e.prototype);
}
};
function li(e, t) {
if (t === "idField" || t === "initialData" || t === "suspense") return e ? e[t] : void 0;
throw Error(`Field "${t}" is not a valid key in ReactFireOptions`);
}
function ui(e) {
return li(e, "initialData");
}
function $(e) {
return li(e, "idField");
}
//#endregion
export { Lr as AnalyticsProvider, kr as AnalyticsSdkContext, Fr as AppCheckProvider, Dr as AppCheckSdkContext, Cn as AuthCheck, Ir as AuthProvider, Or as AuthSdkContext, Sn as ClaimsCheck, Rr as DatabaseProvider, Ar as DatabaseSdkContext, mn as FirebaseAppProvider, zr as FirestoreProvider, Y as FirestoreSdkContext, Br as FunctionsProvider, jr as FunctionsSdkContext, Vr as PerformanceProvider, Nr as PerformanceSdkContext, ci as ReactFireError, Ur as RemoteConfigProvider, Pr as RemoteConfigSdkContext, Er as StorageImage, Hr as StorageProvider, Mr as StorageSdkContext, lr as SuspenseWithPerf, $ as checkIdField, li as checkOptions, ui as checkinitialData, $n as preloadFirestoreDoc, G as preloadObservable, _n as preloadUser, Kr as useAnalytics, Wr as useAppCheck, Gr as useAuth, cr as useCallableFunctionResponse, qr as useDatabase, Vn as useDatabaseList, Hn as useDatabaseListData, zn as useDatabaseObject, Bn as useDatabaseObjectData, gn as useFirebaseApp, Jr as useFirestore, ar as useFirestoreCollection, or as useFirestoreCollectionData, tr as useFirestoreDoc, rr as useFirestoreDocData, ir as useFirestoreDocDataOnce, nr as useFirestoreDocOnce, Yr as useFunctions, yn as useIdTokenResult, ti as useInitAnalytics, $r as useInitAppCheck, ei as useInitAuth, ni as useInitDatabase, ri as useInitFirestore, ii as useInitFunctions, ai as useInitPerformance, oi as useInitRemoteConfig, si as useInitStorage, hn as useIsSuspenseEnabled, K as useObservable, Xr as usePerformance, Qr as useRemoteConfig, yr as useRemoteConfigAll, vr as useRemoteConfigBoolean, _r as useRemoteConfigNumber, gr as useRemoteConfigString, hr as useRemoteConfigValue, bn as useSigninCheck, Zr as useStorage, Cr as useStorageDownloadURL, Sr as useStorageTask, R as useSuspenseEnabledFromConfigAndContext, vn as useUser, fn as version };
//# sourceMappingURL=index.js.map