UNPKG

reactfire

Version:
4 lines 46.9 kB
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("firebase/auth"),require("firebase/app"),require("firebase/database"),require("firebase/firestore"),require("use-sync-external-store/shim"),require("firebase/functions"),require("firebase/remote-config"),require("firebase/storage")):typeof define==`function`&&define.amd?define([`exports`,`react`,`firebase/auth`,`firebase/app`,`firebase/database`,`firebase/firestore`,`use-sync-external-store/shim`,`firebase/functions`,`firebase/remote-config`,`firebase/storage`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ReactFire={},e.React,e.firebase_auth,e.firebase_app,e.firebase_database,e.firebase_firestore,e.use_sync_external_store_shim,e.firebase_functions,e.firebase_remote_config,e.firebase_storage))})(this,function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=Object.create,d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,m=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,ee=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=p(t),a=0,o=i.length,s;a<o;a++)s=i[a],!h.call(e,s)&&s!==n&&d(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=f(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:u(m(e)),ee(t||!e||!e.__esModule?d(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var te=function(e,t){return te=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])},te(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`);te(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function ne(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 re(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 ie(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 ae(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 oe(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)}}function x(e){return typeof e==`function`}function se(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ce=se(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(e,t){return t+1+`) `+e.toString()}).join(` `):``,this.name=`UnsubscriptionError`,this.errors=t}});function le(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}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 ce?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{fe(f)}catch(e){i??=[],e instanceof ce?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 ce(i)}},e.prototype.add=function(t){if(t&&t!==this)if(this.closed)fe(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)&&le(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&le(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e}(),ue=S.EMPTY;function de(e){return e instanceof S||e&&`closed`in e&&x(e.remove)&&x(e.add)&&x(e.unsubscribe)}function fe(e){x(e)?e():e.unsubscribe()}var C={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},pe={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=pe.delegate;return i?.setTimeout?i.setTimeout.apply(i,y([e,t],v(n))):setTimeout.apply(void 0,y([e,t],v(n)))},clearTimeout:function(e){return(pe.delegate?.clearTimeout||clearTimeout)(e)},delegate:void 0};function me(e){pe.setTimeout(function(){var t=C.onUnhandledError;if(t)t(e);else throw e})}function he(){}var ge=(function(){return ye(`C`,void 0,void 0)})();function _e(e){return ye(`E`,void 0,e)}function ve(e){return ye(`N`,e,void 0)}function ye(e,t,n){return{kind:e,value:t,error:n}}var w=null;function be(e){if(C.useDeprecatedSynchronousErrorHandling){var t=!w;if(t&&(w={errorThrown:!1,error:null}),e(),t){var n=w,r=n.errorThrown,i=n.error;if(w=null,r)throw i}}else e()}function xe(e){C.useDeprecatedSynchronousErrorHandling&&w&&(w.errorThrown=!0,w.error=e)}var Se=function(e){g(t,e);function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,de(t)&&t.add(n)):n.destination=ke,n}return t.create=function(e,t,n){return new T(e,t,n)},t.prototype.next=function(e){this.isStopped?Oe(ve(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?Oe(_e(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?Oe(ge,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),Ce=Function.prototype.bind;function we(e,t){return Ce.call(e,t)}var Te=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){Ee(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Ee(e)}else Ee(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Ee(e)}},e}(),T=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&&we(t.next,o),error:t.error&&we(t.error,o),complete:t.complete&&we(t.complete,o)}):a=t}return i.destination=new Te(a),i}return t}(Se);function Ee(e){C.useDeprecatedSynchronousErrorHandling?xe(e):me(e)}function De(e){throw e}function Oe(e,t){var n=C.onStoppedNotification;n&&pe.setTimeout(function(){return n(e,t)})}var ke={closed:!0,next:he,error:De,complete:he},Ae=(function(){return typeof Symbol==`function`&&Symbol.observable||`@@observable`})();function E(e){return e}function je(e){return e.length===0?E:e.length===1?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}var D=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=Pe(e)?e:new T(e,t,n);return be(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=Me(t),new t(function(t,r){var i=new T({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[Ae]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return je(e)(this)},e.prototype.toPromise=function(e){var t=this;return e=Me(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 Me(e){return e??C.Promise??Promise}function Ne(e){return e&&x(e.next)&&x(e.error)&&x(e.complete)}function Pe(e){return e&&e instanceof Se||Ne(e)&&de(e)}function Fe(e){return x(e?.lift)}function O(e){return function(t){if(Fe(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function k(e,t,n,r,i){return new Ie(e,t,n,r,i)}var Ie=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}(Se),Le=se(function(e){return function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`}}),A=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 Re(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Le},t.prototype.next=function(e){var t=this;be(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;be(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;be(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?ue:(this.currentObservers=null,a.push(e),new S(function(){t.currentObservers=null,le(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 D;return e.source=this,e},t.create=function(e,t){return new Re(e,t)},t}(D),Re=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)??ue},t}(A),ze={now:function(){return(ze.delegate||Date).now()},delegate:void 0},Be=function(e){g(t,e);function t(t,n,r){t===void 0&&(t=1/0),n===void 0&&(n=1/0),r===void 0&&(r=ze);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,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<1/0&&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}(A),Ve=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),j={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=j.delegate;return i?.setInterval?i.setInterval.apply(i,y([e,t],v(n))):setInterval.apply(void 0,y([e,t],v(n)))},clearInterval:function(e){return(j.delegate?.clearInterval||clearInterval)(e)},delegate:void 0},He=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),j.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&&j.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return 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||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,le(i,this),n!=null&&(this.id=this.recycleAsyncId(r,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(Ve),Ue=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=ze.now,e}(),We=new(function(e){g(t,e);function t(t,n){n===void 0&&(n=Ue.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}(Ue))(He),Ge=We,Ke=new D(function(e){return e.complete()});function qe(e){return e?Je(e):Ke}function Je(e){return new D(function(t){return e.schedule(function(){return t.complete()})})}function Ye(e){return e&&x(e.schedule)}function Xe(e){return e[e.length-1]}function Ze(e){return Ye(Xe(e))?e.pop():void 0}function Qe(e,t){return typeof Xe(e)==`number`?e.pop():t}var $e=(function(e){return e&&typeof e.length==`number`&&typeof e!=`function`});function et(e){return x(e?.then)}function tt(e){return x(e[Ae])}function nt(e){return Symbol.asyncIterator&&x(e?.[Symbol.asyncIterator])}function rt(e){return 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.`)}function it(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}var at=it();function ot(e){return x(e?.[at])}function st(e){return ae(this,arguments,function(){var t,n,r,i;return ie(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 ct(e){return x(e?.getReader)}function M(e){if(e instanceof D)return e;if(e!=null){if(tt(e))return lt(e);if($e(e))return ut(e);if(et(e))return dt(e);if(nt(e))return pt(e);if(ot(e))return ft(e);if(ct(e))return mt(e)}throw rt(e)}function lt(e){return new D(function(t){var n=e[Ae]();if(x(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function ut(e){return new D(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function dt(e){return new D(function(t){e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,me)})}function ft(e){return new D(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 pt(e){return new D(function(t){ht(e,t).catch(function(e){return t.error(e)})})}function mt(e){return pt(st(e))}function ht(e,t){var n,r,i,a;return re(this,void 0,void 0,function(){var o,s;return ie(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=oe(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]}})})}function N(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}function gt(e,t){return t===void 0&&(t=0),O(function(n,r){n.subscribe(k(r,function(n){return N(r,e,function(){return r.next(n)},t)},function(){return N(r,e,function(){return r.complete()},t)},function(n){return N(r,e,function(){return r.error(n)},t)}))})}function _t(e,t){return t===void 0&&(t=0),O(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function vt(e,t){return M(e).pipe(_t(t),gt(t))}function yt(e,t){return M(e).pipe(_t(t),gt(t))}function bt(e,t){return new D(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function xt(e,t){return new D(function(n){var r;return N(n,t,function(){r=e[at](),N(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()}})}function St(e,t){if(!e)throw Error(`Iterable cannot be null`);return new D(function(n){N(n,t,function(){var r=e[Symbol.asyncIterator]();N(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function Ct(e,t){return St(st(e),t)}function wt(e,t){if(e!=null){if(tt(e))return vt(e,t);if($e(e))return bt(e,t);if(et(e))return yt(e,t);if(nt(e))return St(e,t);if(ot(e))return xt(e,t);if(ct(e))return Ct(e,t)}throw rt(e)}function P(e,t){return t?wt(e,t):M(e)}function Tt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return P(e,Ze(e))}var Et=se(function(e){return function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`}});function Dt(e){return e instanceof Date&&!isNaN(e)}function F(e,t){return O(function(n,r){var i=0;n.subscribe(k(r,function(n){r.next(e.call(t,n,i++))}))})}function Ot(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;M(n(e,u++)).subscribe(k(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?N(t,o,function(){return m(e)}):m(e)};c.length&&l<r;)e();f()}catch(e){t.error(e)}}))};return e.subscribe(k(t,p,function(){d=!0,f()})),function(){s?.()}}function kt(e,t,n){return n===void 0&&(n=1/0),x(t)?kt(function(n,r){return F(function(e,i){return t(n,e,r,i)})(M(e(n,r)))},n):(typeof t==`number`&&(n=t),O(function(t,r){return Ot(t,r,e,n)}))}function At(e){return e===void 0&&(e=1/0),kt(E,e)}function jt(){return At(1)}function Mt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return jt()(P(e,Ze(e)))}function Nt(e){return new D(function(t){M(e()).subscribe(t)})}function Pt(e,t,n){e===void 0&&(e=0),n===void 0&&(n=Ge);var r=-1;return t!=null&&(Ye(t)?n=t:r=t),new D(function(t){var i=Dt(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)})}function Ft(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ze(e),r=Qe(e,1/0),i=e;return i.length?i.length===1?M(i[0]):At(r)(P(i,n)):Ke}function It(e,t){return O(function(n,r){var i=0;n.subscribe(k(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function Lt(e){return O(function(t,n){var r=null,i=!1,a;r=t.subscribe(k(n,void 0,void 0,function(o){a=M(e(o,Lt(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function Rt(e,t,n,r,i){return function(a,o){var s=n,c=t,l=0;a.subscribe(k(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()})))}}function zt(e){return O(function(t,n){var r=!1;t.subscribe(k(n,function(e){r=!0,n.next(e)},function(){r||n.next(e),n.complete()}))})}function Bt(e){return e<=0?function(){return Ke}:O(function(t,n){var r=0;t.subscribe(k(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function Vt(){return O(function(e,t){e.subscribe(k(t,he))})}function Ht(e){return F(function(){return e})}function Ut(e,t){return t?function(n){return Mt(t.pipe(Bt(1),Vt()),n.pipe(Ut(e)))}:kt(function(t,n){return M(e(t,n)).pipe(Bt(1),Ht(t))})}function Wt(e,t){t===void 0&&(t=We);var n=Pt(e,t);return Ut(function(){return n})}function Gt(e,t){return t===void 0&&(t=E),e??=Kt,O(function(n,r){var i,a=!0;n.subscribe(k(r,function(n){var o=t(n);(a||!e(i,o))&&(a=!1,i=o,r.next(n))}))})}function Kt(e,t){return e===t}function qt(e){return e===void 0&&(e=Jt),O(function(t,n){var r=!1;t.subscribe(k(n,function(e){r=!0,n.next(e)},function(){return r?n.complete():n.error(e())}))})}function Jt(){return new Et}function Yt(e,t){var n=arguments.length>=2;return function(r){return r.pipe(e?It(function(t,n){return e(t,n,r)}):E,Bt(1),n?zt(t):qt(function(){return new Et}))}}function Xt(e,t){return O(Rt(e,t,arguments.length>=2,!0))}function Zt(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new A}: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 O(function(e,m){s++,!u&&!l&&d();var h=a??=n();m.add(function(){s--,s===0&&!u&&!l&&(r=Qt(p,c))}),h.subscribe(m),!t&&s>0&&(t=new T({next:function(e){return h.next(e)},error:function(e){u=!0,d(),r=Qt(f,i,e),h.error(e)},complete:function(){l=!0,d(),r=Qt(f,o),h.complete()}}),M(e).subscribe(t))})(e)}}function Qt(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(t===!0){e();return}if(t!==!1){var i=new T({next:function(){i.unsubscribe(),e()}});return M(t.apply(void 0,y([],v(n)))).subscribe(i)}}function $t(e,t,n){var r,i,a,o,s=!1;return e&&typeof e==`object`?(r=e.bufferSize,o=r===void 0?1/0:r,i=e.windowTime,t=i===void 0?1/0:i,a=e.refCount,s=a===void 0?!1:a,n=e.scheduler):o=e??1/0,Zt({connector:function(){return new Be(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function en(e,t){return O(function(n,r){var i=null,a=0,o=!1,s=function(){return o&&!i&&r.complete()};n.subscribe(k(r,function(n){i?.unsubscribe();var o=0,c=a++;M(e(n,c)).subscribe(i=k(r,function(e){return r.next(t?t(n,e,c,o++):e)},function(){i=null,s()}))},function(){o=!0,s()}))})}function tn(e,t,n){var r=x(e)||t||n?{next:e,error:t,complete:n}:e;return r?O(function(e,t){var n;(n=r.subscribe)==null||n.call(r);var i=!0;e.subscribe(k(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)}))}):E}function nn(e){return new D(function(t){return{unsubscribe:(0,n.onIdTokenChanged)(e,t.next.bind(t),t.error.bind(t),t.complete.bind(t))}})}var rn=`[DEFAULT]`,an=t.createContext(void 0),on=t.createContext(!1),sn=`4.2.6`,cn=(e,t)=>e===t||[...Object.keys(e),...Object.keys(t)].every(n=>e[n]===t[n]);function ln(e){let{firebaseConfig:n,appName:i,suspense:a}=e,o=t.useMemo(()=>{if(e.firebaseApp)return e.firebaseApp;let a=(0,r.getApps)().find(e=>e.name===(i||rn));if(a){if(n&&cn(a.options,n))return a;throw Error(`Does not match the options already provided to the ${i||`default`} firebase app instance, give this new instance a different appName.`)}else{if(!n)throw Error(`No firebaseConfig provided`);return(0,r.registerVersion)(`react`,t.version||`unknown`),(0,r.registerVersion)(`reactfire`,sn),(0,r.initializeApp)(n,i)}},[e.firebaseApp,n,i]);return t.createElement(an.Provider,{value:o},t.createElement(on.Provider,Object.assign({value:a??!1},e)))}function un(){return t.useContext(on)??!1}function I(e){let n=t.useContext(on);return e===void 0?n:e}function dn(){let e=t.useContext(an);if(!e)throw Error(`Cannot call useFirebaseApp unless your component is within a FirebaseAppProvider`);return e}function fn(e){return re(this,void 0,void 0,function*(){let t=yield e();return V(nn(t),`auth:user:${t.name}`).toPromise()})}function pn(e){let t=Rr(),n=`auth:user:${t.name}`,r=nn(t),i=Object.assign({},e);return t.currentUser&&!(`initialData`in i)&&!(`startWithValue`in i)&&(i.initialData=t.currentUser),H(n,r,i)}function mn(e,t=!1,n){if(!e)throw Error(`you must provide a user`);return H(`auth:idTokenResult:${e.uid}:forceRefresh=${t}`,Nt(()=>P(e.getIdTokenResult(t))),n)}function hn(e){if(e?.hasOwnProperty(`requiredClaims`)&&e?.hasOwnProperty(`validateCustomClaims`))throw Error(`Cannot have both "requiredClaims" and "validateCustomClaims". Use one or the other.`);let t=Rr(),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=nn(t).pipe(en(t=>t?e&&(e.hasOwnProperty(`requiredClaims`)||e.hasOwnProperty(`validateCustomClaims`))?P(t.getIdTokenResult(e?.forceRefresh??!1)).pipe(F(n=>{let r;r=e.hasOwnProperty(`requiredClaims`)?gn(e.requiredClaims):e.validateCustomClaims;let{hasRequiredClaims:i,errors:a}=r(n.claims);return{signedIn:!0,hasRequiredClaims:i,errors:a,user:t}})):Tt({signedIn:!0,hasRequiredClaims:!0,errors:{},user:t}):Tt({signedIn:!1,hasRequiredClaims:!1,errors:{},user:null})));return H(n,r,e)}function gn(e){return function(t){let n={};return Object.keys(e).forEach(r=>{e[r]!==t[r]&&(n[r]=[new ti(`auth/missing-claim`,`Expected "${e[r]}", but user has "${t[r]}" instead`)])}),{hasRequiredClaims:Object.keys(n).length===0,errors:n}}}function _n({user:e,fallback:n,children:r,requiredClaims:i}){let{data:a,status:o,error:s}=mn(e,!1);if(o===`loading`)throw Error(`ClaimsCheck must be run in Suspense mode`);if(o===`error`)throw s;let{claims:c}=a,l={};return I()||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?t.createElement(t.Fragment,null,r):t.createElement(t.Fragment,null,n)}function vn({fallback:e,children:n,requiredClaims:r}){let{data:i}=pn();return I()||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?t.createElement(_n,{user:i,fallback:e,requiredClaims:r},n):t.createElement(t.Fragment,null,n):t.createElement(t.Fragment,null,e)}var L,R;(function(e){e.added=`child_added`,e.removed=`child_removed`,e.changed=`child_changed`,e.moved=`child_moved`,e.value=`value`})(R||={});var yn=Object.freeze((L={},L[R.added]=i.onChildAdded,L[R.removed]=i.onChildRemoved,L[R.changed]=i.onChildChanged,L[R.moved]=i.onChildMoved,L[R.value]=i.onValue,L));function bn(e,t){return new D(function(n){var r=yn[t](e,function(e,r){n.next({snapshot:e,prevKey:r,event:t})},n.error.bind(n));return{unsubscribe:function(){(0,i.off)(e,t,r)}}}).pipe(Wt(0))}var xn=function(){return xn=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},xn.apply(this,arguments)};function Sn(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 Cn(e){return(e==null||e.length===0)&&(e=[R.added,R.removed,R.changed,R.moved]),e}function wn(e){return bn(e,R.value)}function Tn(e,t){return t===void 0&&(t={}),bn(e,R.value).pipe(F(function(e){return En(e,t)}))}function En(e,t){var n;t===void 0&&(t={});var r=e.snapshot.val();return!e.snapshot.exists()||typeof r!=`object`?r:xn(xn({},r),t.keyField?(n={},n[t.keyField]=e.snapshot.key,n):null)}function Dn(e){return P((0,i.get)(e)).pipe(F(function(e){return{snapshot:e,prevKey:null,event:R.value}}))}function On(e,t){t===void 0&&(t={});var n=Cn(t.events);return Dn(e).pipe(en(function(t){var r=[Tt(t)];return n.forEach(function(t){r.push(bn(e,t))}),Ft.apply(void 0,r).pipe(Xt(Mn,[]))}),Gt())}function kn(e,t){return t===void 0&&(t={}),On(e).pipe(F(function(e){return e.map(function(e){return En(e,t)})}))}function An(e,t){for(var n=e.length,r=0;r<n;r++)if(e[r].snapshot.key===t)return r;return-1}function jn(e,t){if(t==null)return 0;var n=An(e,t);return n===-1?e.length:n+1}function Mn(e,t){var n=t.snapshot,r=t.prevKey,i=t.event,a=n.key,o=An(e,a),s=jn(e,r||void 0);switch(i){case R.value:if(t.snapshot&&t.snapshot.exists()){var c=null;t.snapshot.forEach(function(t){var n={snapshot:t,event:R.value,prevKey:c};return c=t.key,e=Sn(Sn([],e,!0),[n],!1),!1})}return e;case R.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 Sn([t],e,!0);else e=e.slice(),e.splice(s,0,t);return e;case R.removed:return e.filter(function(e){return e.snapshot.key!==n.key});case R.changed:return e.map(function(e){return e.snapshot.key===a?t:e});case R.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}}var Nn=globalThis._reactFireDatabaseCachedQueries||[];globalThis._reactFireDatabaseCachedQueries||(globalThis._reactFireDatabaseCachedQueries=Nn);function Pn(e){let t=Nn.findIndex(t=>t.isEqual(e));return t>-1?t:Nn.push(e)-1}function Fn(e,t){return H(`database:object:${e.toString()}`,wn(e),t)}function In(e,t){let n=t?$(t):void 0;return H(`database:objectVal:${e.toString()}:idField=${JSON.stringify(n)}`,Tn(e,{keyField:n}),t)}function Ln(e,t){return H(`database:list:${Pn(e)}`,On(e),t)}function Rn(e,t){let n=t?$(t):void 0;return H(`database:listVal:${Pn(e)}:idField=${JSON.stringify(n)}`,kn(e,{keyField:n}),t)}var zn=function(){return zn=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},zn.apply(this,arguments)},Bn={includeMetadataChanges:!1};function Vn(e,t){return t===void 0&&(t=Bn),new D(function(n){return{unsubscribe:(0,a.onSnapshot)(e,t,{next:n.next.bind(n),error:n.error.bind(n),complete:n.complete.bind(n)})}})}function z(e){return Vn(e,{includeMetadataChanges:!0})}function Hn(e,t){return t===void 0&&(t={}),z(e).pipe(F(function(e){return Un(e,t)}))}function Un(e,t){var n;t===void 0&&(t={});var r=e.data(t);return!e.exists()||typeof r!=`object`||!r||!t.idField?r:zn(zn({},r),(n={},n[t.idField]=e.id,n))}function Wn(e){return Vn(e,{includeMetadataChanges:!0}).pipe(F(function(e){return e.docs}))}function Gn(e,t){return t===void 0&&(t={}),Wn(e).pipe(F(function(e){return e.map(function(e){return Un(e,t)})}))}var Kn=class extends A{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(tn({next:e=>{this._next(e)},error:e=>{this._error=e,this._resolveFirstEmission(),this._updateImmutableStatus()},complete:()=>{this._isComplete=!0,this._updateImmutableStatus()}}),Lt(()=>qe()),$t(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}},qn=3e4,B=globalThis._reactFirePreloadedObservables||new Map;globalThis._reactFirePreloadedObservables||(globalThis._reactFirePreloadedObservables=B);function V(e,t,n=!1){if(B.has(t))return B.get(t);{let r=new Kn(e,qn,n);return B.set(t,r),r}}function H(e,n,r={}){if(!e)throw Error(`cannot call useObservable without an observableId`);let i=I(r.suspense),a=V(n,e,i),s=r.hasOwnProperty(`initialData`)||r.hasOwnProperty(`startWithValue`),c=a.hasValue||s;if(i===!0&&!c)throw a.firstEmission;let l=(0,o.useSyncExternalStore)(t.useCallback(e=>{let t=a.subscribe({next:()=>{e()},error:t=>{throw e(),t},complete:()=>{e()}});return()=>{t.unsubscribe()}},[a]),t.useCallback(()=>a.immutableStatus,[a]));if(!a.hasValue&&c){let e=r?.initialData??r?.startWithValue;if(i&&l.error)throw l.error;return Object.assign(Object.assign({},l),{data:e,status:`success`,hasEmitted:!0})}if(l.error)throw l.error;return l}var Jn=globalThis._reactFireFirestoreQueryCache||[];globalThis._reactFireFirestoreQueryCache||(globalThis._reactFireFirestoreQueryCache=Jn);function Yn(e){let t=Jn.findIndex(t=>(0,a.queryEqual)(t,e));return t>-1?t:Jn.push(e)-1}function Xn(e){return re(this,void 0,void 0,function*(){let t=yield e();return V(z(t),Zn(t))})}function Zn(e){return`firestore:doc:${e.firestore.app.name}:${e.path}`}function Qn(e,t){return H(Zn(e),z(e),t)}function $n(e,t){return H(`firestore:docOnce:${e.firestore.app.name}:${e.path}`,z(e).pipe(Yt()),t)}function er(e,t){let n=t?$(t):void 0;return H(`firestore:docData:${e.firestore.app.name}:${e.path}:idField=${JSON.stringify(n)}`,Hn(e,{idField:n}),t)}function tr(e,t){let n=t?$(t):void 0;return H(`firestore:docDataOnce:${e.firestore.app.name}:${e.path}:idField=${JSON.stringify(n)}`,Hn(e,{idField:n}).pipe(Yt()),t)}function nr(e,t){return H(`firestore:collection:${Yn(e)}`,Vn(e),t)}function rr(e,t){let n=t?$(t):void 0;return H(`firestore:collectionData:${Yn(e)}:idField=${JSON.stringify(n)}`,Gn(e,{idField:n}),t)}function ir(e,t,n){var r=(0,s.httpsCallable)(e,t,n);return function(e){return P(r(e)).pipe(F(function(e){return e.data}))}}function ar(e,t){let n=Hr(),r=`functions:callableResponse:${e}:${JSON.stringify(t?.data)}:${JSON.stringify(t?.httpsCallableOptions)}`,i=ir(n,e,t?.httpsCallableOptions);return H(r,Nt(()=>i(t?.data)),t)}function or({children:e,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 t.createElement(t.Suspense,{fallback:t.createElement(()=>(t.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)}},[]),t.createElement(t.Fragment,null,r)),null)},e)}function U(e){var t=e.remoteConfig,n=e.key,r=e.getter;return new D(function(e){(0,c.ensureInitialized)(t).then(function(){var i=r.bind(t);e.next(i(t,n))})})}function sr(e,t){return U({remoteConfig:e,key:t,getter:c.getValue})}function cr(e,t){return U({remoteConfig:e,key:t,getter:c.getString})}function lr(e,t){return U({remoteConfig:e,key:t,getter:c.getNumber})}function ur(e,t){return U({remoteConfig:e,key:t,getter:c.getBoolean})}function dr(e){return U({remoteConfig:e,key:``,getter:c.getAll})}function W(e,t){let n=Gr(),r=n.app.name,i=t(n,e);return H(`remoteConfig:${e}:${t.name}:${r}`,i)}function fr(e){return W(e,sr)}function pr(e){return W(e,cr)}function mr(e){return W(e,lr)}function hr(e){return W(e,ur)}function gr(e){return W(e,dr)}function _r(e){return new D(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(P(e).subscribe({next:o,error:function(e){i=!0,a=e,c()},complete:function(){r=!0,c()}}))})}function vr(e){return P((0,l.getDownloadURL)(e))}function yr(e,t,n){return H(`storage:task:${t.toString()}`,_r(e),n)}function br(e,t){return H(`storage:downloadUrl:${e.toString()}`,Nt(()=>vr(e)),t)}function xr(e){let n=Wr();return e=Object.assign(Object.assign({},e),{storage:n}),t.createElement(Sr,Object.assign({},e))}function Sr(e){let{storage:n,storagePath:r,suspense:i,placeHolder:a}=e,o=ne(e,[`storage`,`storagePath`,`suspense`,`placeHolder`]),s={suspense:I(i)};if(!n)throw Error(`Storage was not passed to component INTERNALStorageImage. This should not be possible`);let{status:c,data:u}=br((0,l.ref)(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`),t.createElement(`img`,Object.assign({src:u,alt:o.alt},o))):a??t.createElement(t.Fragment,null,`''`)}function Cr(e){let{storage:n}=e;return n?t.createElement(Sr,Object.assign({},e)):t.createElement(xr,Object.assign({},e))}var G=t.createContext(void 0),K=t.createContext(void 0),q=t.createContext(void 0),J=t.createContext(void 0),Y=t.createContext(void 0),wr=t.createContext(void 0),Tr=t.createContext(void 0),Er=t.createContext(void 0),Dr=t.createContext(void 0);function X(e){return function(n){if(!n.sdk)throw Error(`no sdk provided`);let r=dn().name;if(n?.sdk?.app?.name!==r)throw Error(`sdk was initialized with a different firebase app`);return t.createElement(e.Provider,Object.assign({value:n.sdk},n))}}function Z(e){let n=t.useContext(e);if(!n)throw Error(`SDK not found. useSdk must be called from within a provider`);return n}function Q(e,n,r,i){let a=dn();if(t.useContext(n))throw Error(`Cannot initialize SDK ${e} because it already exists in Context`);let o=t.useMemo(()=>r(a),[a]);return H(`firebase-sdk:${e}:${a.name}`,P(o),i)}var Or=X(G),kr=X(K),Ar=X(q),jr=X(J),Mr=X(Y),Nr=X(wr),Pr=X(Er),Fr=X(Tr),Ir=X(Dr),Lr=()=>Z(G),Rr=()=>Z(K),zr=()=>Z(q),Br=()=>Z(J),Vr=()=>Z(Y),Hr=()=>Z(wr),Ur=()=>Z(Er),Wr=()=>Z(Tr),Gr=()=>Z(Dr),Kr=(e,t)=>Q(`appcheck`,G,e,t),qr=(e,t)=>Q(`auth`,K,e,t),Jr=(e,t)=>Q(`analytics`,q,e,t),Yr=(e,t)=>Q(`database`,J,e,t),Xr=(e,t)=>Q(`firestore`,Y,e,t),Zr=(e,t)=>Q(`functions`,wr,e,t),Qr=(e,t)=>Q(`performance`,Er,e,t),$r=(e,t)=>Q(`remoteconfig`,Dr,e,t),ei=(e,t)=>Q(`storage`,Tr,e,t),ti=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 ni(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 ri(e){return ni(e,`initialData`)}function $(e){return ni(e,`idField`)}e.AnalyticsProvider=Ar,e.AnalyticsSdkContext=q,e.AppCheckProvider=Or,e.AppCheckSdkContext=G,e.AuthCheck=vn,e.AuthProvider=kr,e.AuthSdkContext=K,e.ClaimsCheck=_n,e.DatabaseProvider=jr,e.DatabaseSdkContext=J,e.FirebaseAppProvider=ln,e.FirestoreProvider=Mr,e.FirestoreSdkContext=Y,e.FunctionsProvider=Nr,e.FunctionsSdkContext=wr,e.PerformanceProvider=Pr,e.PerformanceSdkContext=Er,e.ReactFireError=ti,e.RemoteConfigProvider=Ir,e.RemoteConfigSdkContext=Dr,e.StorageImage=Cr,e.StorageProvider=Fr,e.StorageSdkContext=Tr,e.SuspenseWithPerf=or,e.checkIdField=$,e.checkOptions=ni,e.checkinitialData=ri,e.preloadFirestoreDoc=Xn,e.preloadObservable=V,e.preloadUser=fn,e.useAnalytics=zr,e.useAppCheck=Lr,e.useAuth=Rr,e.useCallableFunctionResponse=ar,e.useDatabase=Br,e.useDatabaseList=Ln,e.useDatabaseListData=Rn,e.useDatabaseObject=Fn,e.useDatabaseObjectData=In,e.useFirebaseApp=dn,e.useFirestore=Vr,e.useFirestoreCollection=nr,e.useFirestoreCollectionData=rr,e.useFirestoreDoc=Qn,e.useFirestoreDocData=er,e.useFirestoreDocDataOnce=tr,e.useFirestoreDocOnce=$n,e.useFunctions=Hr,e.useIdTokenResult=mn,e.useInitAnalytics=Jr,e.useInitAppCheck=Kr,e.useInitAuth=qr,e.useInitDatabase=Yr,e.useInitFirestore=Xr,e.useInitFunctions=Zr,e.useInitPerformance=Qr,e.useInitRemoteConfig=$r,e.useInitStorage=ei,e.useIsSuspenseEnabled=un,e.useObservable=H,e.usePerformance=Ur,e.useRemoteConfig=Gr,e.useRemoteConfigAll=gr,e.useRemoteConfigBoolean=hr,e.useRemoteConfigNumber=mr,e.useRemoteConfigString=pr,e.useRemoteConfigValue=fr,e.useSigninCheck=hn,e.useStorage=Wr,e.useStorageDownloadURL=br,e.useStorageTask=yr,e.useSuspenseEnabledFromConfigAndContext=I,e.useUser=pn,e.version=sn}); //# sourceMappingURL=index.umd.cjs.map