reactfire 4.0.0-exp.e80fc49 → 4.0.0-exp.eb1428b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("rxfire/auth"),r=require("rxjs"),n=require("rxjs/operators"),o=require("firebase/app"),i=require("rxfire/database"),a=require("rxfire/firestore"),u=require("firebase/firestore"),s=require("firebase/remote-config"),c=require("rxfire/storage"),l=require("firebase/storage");function f(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){f(i,n,o,a,u,"next",e)}function u(e){f(i,n,o,a,u,"throw",e)}a(void 0)}))}}function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,m(e,t)}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function b(e,t,r){return(b=g()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&m(o,r.prototype),o}).apply(null,arguments)}function y(e){var t="function"==typeof Map?new Map:void 0;return(y=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return b(e,arguments,v(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),m(r,e)})(e)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var x,_=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new E(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(e,r,i),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function p(){}function h(){}var d={};u(d,o,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(C([])));m&&m!==t&&r.call(m,o)&&(d=m);var g=h.prototype=f.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,u){var s=c(e[o],e,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,u)}))}u(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=h,u(g,"constructor",h),u(h,"constructor",p),p.displayName=u(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),u(y.prototype,i,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new y(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),u(g,a,"Generator"),u(g,o,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=C,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(x={exports:{}}),x.exports),E=e.createContext(void 0),C=e.createContext(!1);function O(t){var r=e.useContext(C);return void 0!==t?t:r}function k(){var t=e.useContext(E);if(!t)throw new Error("Cannot call useFirebaseApp unless your component is within a FirebaseAppProvider");return t}function F(){return(F=p(_.mark((function e(r){var n,o;return _.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r();case 2:return o=q(t.user(n=e.sent),"auth:user:"+n.name),e.abrupt("return",o.toPromise());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e){var r,n,o=he(),i="auth:user:"+o.name,a=t.user(o),u=o.currentUser;return!u&&(null!=(r=null==e?void 0:e.initialData)?r:null==e?void 0:e.startWithValue)&&(u=null!=(n=e.initialData)?n:e.startWithValue),T(i,a,h({},e,{initialData:u}))}function P(e,t,n){if(void 0===t&&(t=!1),!e)throw new Error("you must provide a user");return T("auth:idTokenResult:"+e.uid+":forceRefresh="+t,r.from(e.getIdTokenResult(t)),n)}function S(t){var r=t.fallback,n=t.children,o=t.requiredClaims,i=P(t.user,!1).data.claims,a={};return O()||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."),o&&Object.keys(o).forEach((function(e){var t;o[e]!==i[e]&&(a[e]={expected:o[e],actual:null==(t=i[e])?void 0:t.toString()})})),0===Object.keys(a).length?e.createElement(e.Fragment,null,n):e.createElement(e.Fragment,null,r)}var R=globalThis._reactFireDatabaseCachedQueries||[];function j(e){var t=R.findIndex((function(t){return t.isEqual(e)}));return t>-1?t:R.push(e)-1}globalThis._reactFireDatabaseCachedQueries||(globalThis._reactFireDatabaseCachedQueries=R);var L=function(e){function t(t,o){var i;return(i=e.call(this)||this)._timeoutWindow=void 0,i._value=void 0,i._hasValue=!1,i._timeoutHandler=void 0,i._firstEmission=void 0,i._error=void 0,i._innerObservable=void 0,i._warmupSubscription=void 0,i._innerSubscriber=void 0,i._resolveFirstEmission=void 0,i._timeoutWindow=o,i._firstEmission=new Promise((function(e){return i._resolveFirstEmission=e})),i._innerObservable=t.pipe(n.tap({next:function(e){i._next(e)},error:function(e){i._error=e,i._resolveFirstEmission()}}),n.catchError((function(){return r.empty()})),n.shareReplay(1)),i._warmupSubscription=i._innerObservable.subscribe(),i._timeoutHandler=setTimeout(i._reset.bind(w(i)),i._timeoutWindow),i}d(t,e);var o,i=t.prototype;return i._next=function(e){this._hasValue=!0,this._value=e,this._resolveFirstEmission()},i._reset=function(){var e=this;this._warmupSubscription&&this._warmupSubscription.unsubscribe(),this._hasValue=!1,this._value=void 0,this._error=void 0,this._firstEmission=new Promise((function(t){return e._resolveFirstEmission=t}))},i._subscribe=function(e){return this._timeoutHandler&&clearTimeout(this._timeoutHandler),this._innerSubscriber=this._innerObservable.subscribe(e),this._innerSubscriber},(o=[{key:"hasValue",get:function(){return this._hasValue||!!this._error}},{key:"value",get:function(){if(this._error)throw this._error;return this._value}},{key:"firstEmission",get:function(){return this._firstEmission}},{key:"ourError",get:function(){return this._error}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,o),t}(r.Subject),I=globalThis._reactFirePreloadedObservables||new Map;function q(e,t){if(I.has(t))return I.get(t);var r=new L(e,3e4);return I.set(t,r),r}function T(t,r,n){var o,i,a;if(void 0===n&&(n={}),!t)throw new Error("cannot call useObservable without an observableId");var u=q(r,t),s=n.hasOwnProperty("initialData")||n.hasOwnProperty("startWithValue");if(!0===O(n.suspense)&&!u.hasValue&&(null!=(o=!(null!=(i=n)&&i.initialData))?o:null==(a=n)||!a.startWithValue))throw u.firstEmission;var c=e.useState((function(){var e;return u.hasValue?u.value:null!=(e=n.initialData)?e:n.startWithValue})),l=c[0],f=c[1],p=e.useState(!1),h=p[0],d=p[1],v=e.useState(!1),m=v[0],g=v[1];return e.useEffect((function(){var e=u.subscribe({next:function(e){f((function(){return e}))},error:function(e){throw g(!0),e},complete:function(){d(!0)}});return function(){return e.unsubscribe()}}),[u]),{status:m?"error":u.hasValue||s?"success":"loading",hasEmitted:u.hasValue||s,isComplete:h,data:l,error:u.ourError,firstValuePromise:u.firstEmission}}globalThis._reactFirePreloadedObservables||(globalThis._reactFirePreloadedObservables=I);var N=globalThis._reactFireFirestoreQueryCache||[];function A(e){var t=N.findIndex((function(t){return u.queryEqual(t,e)}));return t>-1?t:N.push(e)-1}function V(){return(V=p(_.mark((function e(t){var r;return _.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return e.abrupt("return",q(a.doc(r=e.sent),U(r)));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(e){return"firestore:doc:"+e.firestore.app.name+":"+e.path}function M(e){var t=e.remoteConfig,n=e.key,o=e.getter;return new r.Observable((function(e){s.ensureInitialized(t).then((function(){e.next(o.bind(t)(n))}))}))}function W(e,t){return M({remoteConfig:e,key:t,getter:function(){return s.getValue(e,t)}})}function G(e,t){return M({remoteConfig:e,key:t,getter:function(){return s.getString(e,t)}})}function B(e,t){return M({remoteConfig:e,key:t,getter:function(){return s.getNumber(e,t)}})}function H(e,t){return M({remoteConfig:e,key:t,getter:function(){return s.getBoolean(e,t)}})}function Q(e){return M({remoteConfig:e,key:"",getter:function(){return s.getAll(e)}})}function z(e,t){var r,n=ve(),o=null==(r=n._storage)?void 0:r.appName,i=t(n,e);return T("remoteConfig:"+e+":"+t.name+":"+o,i)}globalThis._reactFireFirestoreQueryCache||(globalThis._reactFireFirestoreQueryCache=N);var J=["storage","storagePath","suspense","placeHolder"];function K(e,t){return T("storage:downloadUrl:"+e.toString(),c.getDownloadURL(e),t)}function Y(t){return t=h({},t,{storage:de()}),e.createElement(X,h({},t))}function X(t){var r=t.storage,n=t.storagePath,o=t.suspense,i=t.placeHolder,a=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(t,J),u={suspense:O(o)};if(!r)throw new Error("Storage was not passed to component INTERNALStorageImage. This should not be possible");var s=K(l.ref(r,n),u),c=s.data;return"success"===s.status?(a.alt||""===a.alt||console.warn('No alt prop provided for StorageImage with storagePath "'+n+'"',"img elements must have an alt prop, either with meaningful text, or an empty string for decorative images"),e.createElement("img",h({src:c,alt:a.alt},a))):null!=i?i:e.createElement(e.Fragment,null,"''")}var Z=e.createContext(void 0),$=e.createContext(void 0),ee=e.createContext(void 0),te=e.createContext(void 0),re=e.createContext(void 0),ne=e.createContext(void 0);function oe(t){return function(r){var n,o=k().name;if(r.sdk.app?n=r.sdk.app.name:r.sdk.name&&(n=r.sdk.name),n!==o)throw new Error("sdk was initialized with a different firebase app");if(!r.sdk)throw new Error("no sdk provided");return e.createElement(t.Provider,h({value:r.sdk},r))}}function ie(t){var r=e.useContext(t);if(!r)throw new Error("SDK not found. useSdk must be called from within a provider");return r}function ae(t,n,o,i){var a=k();if(e.useContext(n))throw new Error("Cannot initialize SDK "+t+" because it already exists in Context");var u=e.useMemo((function(){return o(a)}),[a]);return T("firebase-sdk:"+t+":"+a.name,r.from(u),i)}var ue=oe(Z),se=oe($),ce=oe(ee),le=oe(re),fe=oe(te),pe=oe(ne),he=function(){return ie(Z)},de=function(){return ie(te)},ve=function(){return ie(ne)},me=function(e){function t(r,n,o){var i;return(i=e.call(this,n)||this).code=void 0,i.customData=void 0,i.name="ReactFireError",i.code=r,i.customData=o,Object.setPrototypeOf(w(i),t.prototype),i}return d(t,e),t}(y(Error));function ge(e,t){if("idField"===t||"initialData"===t||"suspense"===t)return e?e[t]:void 0;throw new Error('Field "'+t+'" is not a valid key in ReactFireOptions')}function be(e){return ge(e,"idField")}exports.AuthCheck=function(t){var r=t.fallback,n=t.children,o=t.requiredClaims,i=D().data;return O()||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?o?e.createElement(S,{user:i,fallback:r,requiredClaims:o},n):e.createElement(e.Fragment,null,n):e.createElement(e.Fragment,null,r)},exports.AuthProvider=ue,exports.ClaimsCheck=S,exports.DatabaseProvider=se,exports.FirebaseAppProvider=function(t){var r=t.firebaseConfig,n=t.appName,i=t.suspense,a=e.useMemo((function(){if(t.firebaseApp)return t.firebaseApp;var i,a,u=o.getApps().find((function(e){return e.name===(n||"[DEFAULT]")}));if(u){if(r&&((i=u.options)===(a=r)||[].concat(Object.keys(i),Object.keys(a)).every((function(e){return i[e]===a[e]}))))return u;throw new Error("Does not match the options already provided to the "+(n||"default")+" firebase app instance, give this new instance a different appName.")}if(!r)throw new Error("No firebaseConfig provided");return o.registerVersion("react",e.version||"unknown"),o.registerVersion("reactfire","4.0.0-exp.e80fc49"),o.initializeApp(r,n)}),[t.firebaseApp,r,n]);return e.createElement(E.Provider,{value:a},e.createElement(C.Provider,h({value:null!=i&&i},t)))},exports.FirestoreProvider=ce,exports.PerformanceProvider=le,exports.ReactFireError=me,exports.RemoteConfigProvider=pe,exports.StorageImage=function(t){return e.createElement(t.storage?X:Y,h({},t))},exports.StorageProvider=fe,exports.SuspenseWithPerf=function(t){var r,n=t.children,o=t.traceId,i=t.fallback,a=(null==(r=performance)||null==r.getEntriesByName?void 0:r.getEntriesByName(o,"measure"))||[],u="_"+o+"Start["+a.length+"]",s="_"+o+"End["+a.length+"]";return e.createElement(e.Suspense,{fallback:e.createElement((function(){return e.useLayoutEffect((function(){var e;return null==(e=performance)||null==e.mark||e.mark(u),function(){var e,t;null==(e=performance)||null==e.mark||e.mark(s),null==(t=performance)||null==t.measure||t.measure(o,u,s)}}),[]),e.createElement(e.Fragment,null,i)}),null)},n)},exports.checkIdField=be,exports.checkOptions=ge,exports.checkinitialData=function(e){return ge(e,"initialData")},exports.preloadFirestoreDoc=function(e){return V.apply(this,arguments)},exports.preloadObservable=q,exports.preloadUser=function(e){return F.apply(this,arguments)},exports.useAuth=he,exports.useDatabase=function(){return ie($)},exports.useDatabaseList=function(e,t){return T("database:list:"+j(e),i.list(e),t)},exports.useDatabaseListData=function(e,t){var r=t?be(t):"NO_ID_FIELD";return T("database:listVal:"+j(e)+":idField="+r,i.listVal(e,r),t)},exports.useDatabaseObject=function(e,t){return T("database:object:"+e.toString(),i.object(e),t)},exports.useDatabaseObjectData=function(e,t){var r,o=t?be(t):"NO_ID_FIELD";return T("database:objectVal:"+e.toString()+":idField="+o,(r=o,i.object(e).pipe(n.map((function(e){return function(e,t){var r,n=e.snapshot.val();return"object"!=typeof n?n:h({},e.snapshot.val(),t?((r={})[t]=e.snapshot.key,r):null)}(e,r)})))),t)},exports.useFirebaseApp=k,exports.useFirestore=function(){return ie(ee)},exports.useFirestoreCollection=function(e,t){return T("firestore:collection:"+A(e),a.fromRef(e),t)},exports.useFirestoreCollectionData=function(e,t){var r=t?be(t):"NO_ID_FIELD";return T("firestore:collectionData:"+A(e)+":idField="+r,a.collectionData(e,r),t)},exports.useFirestoreDoc=function(e,t){return T(U(e),a.doc(e),t)},exports.useFirestoreDocData=function(e,t){var r=t?be(t):"NO_ID_FIELD";return T("firestore:docData:"+e.firestore.app.name+":"+e.path+":idField="+r,a.docData(e,r),t)},exports.useFirestoreDocDataOnce=function(e,t){var r=t?be(t):"NO_ID_FIELD";return T("firestore:docDataOnce:"+e.firestore.app.name+":"+e.path+":idField="+r,a.docData(e,r).pipe(n.first()),t)},exports.useFirestoreDocOnce=function(e,t){return T("firestore:docOnce:"+e.firestore.app.name+":"+e.path,a.doc(e).pipe(n.first()),t)},exports.useIdTokenResult=P,exports.useInitAuth=function(e,t){return ae("auth",Z,e,t)},exports.useInitDatabase=function(e,t){return ae("database",$,e,t)},exports.useInitFirestore=function(e,t){return ae("firestore",ee,e,t)},exports.useInitPerformance=function(e,t){return ae("performance",re,e,t)},exports.useInitRemoteConfig=function(e,t){return ae("remoteconfig",ne,e,t)},exports.useInitStorage=function(e,t){return ae("storage",te,e,t)},exports.useIsSuspenseEnabled=function(){var t=e.useContext(C);return null!=t&&t},exports.useObservable=T,exports.usePerformance=function(){return ie(re)},exports.useRemoteConfig=ve,exports.useRemoteConfigAll=function(e){return z(e,Q)},exports.useRemoteConfigBoolean=function(e){return z(e,H)},exports.useRemoteConfigNumber=function(e){return z(e,B)},exports.useRemoteConfigString=function(e){return z(e,G)},exports.useRemoteConfigValue=function(e){return z(e,W)},exports.useSigninCheck=function(e){if(null!=e&&e.hasOwnProperty("requiredClaims")&&null!=e&&e.hasOwnProperty("validateCustomClaims"))throw new Error('Cannot have both "requiredClaims" and "validateCustomClaims". Use one or the other.');var o=he(),i="auth:signInCheck:"+o.name+"::forceRefresh:"+!(null==e||!e.forceRefresh);return null!=e&&e.forceRefresh&&(i=i+":forceRefresh:"+e.forceRefresh),null!=e&&e.hasOwnProperty("requiredClaims")?i=i+":requiredClaims:"+JSON.stringify(e.requiredClaims):null!=e&&e.hasOwnProperty("validateCustomClaims")&&(i=i+":validateCustomClaims:"+JSON.stringify(e.validateCustomClaims)),T(i,t.user(o).pipe(n.switchMap((function(t){var o;return t?e&&(e.hasOwnProperty("requiredClaims")||e.hasOwnProperty("validateCustomClaims"))?r.from(t.getIdTokenResult(null!=(o=null==e?void 0:e.forceRefresh)&&o)).pipe(n.map((function(r){var n,o;e.hasOwnProperty("requiredClaims")?(o=e.requiredClaims,n=function(e){var t={};return Object.keys(o).forEach((function(r){o[r]!==e[r]&&(t[r]=[new me("auth/missing-claim",'Expected "'+o[r]+'", but user has "'+e[r]+'" instead')])})),{hasRequiredClaims:0===Object.keys(t).length,errors:t}}):n=e.validateCustomClaims;var i=n(r.claims);return{signedIn:!0,hasRequiredClaims:i.hasRequiredClaims,errors:i.errors,user:t}}))):r.of({signedIn:!0,hasRequiredClaims:!0,errors:{},user:t}):r.of({signedIn:!1,hasRequiredClaims:!1,errors:{},user:null})}))))},exports.useStorage=de,exports.useStorageDownloadURL=K,exports.useStorageTask=function(e,t,n){return T("storage:task:"+t.toString(),function(e){return new r.Observable((function(t){e.on("state_changed",(function(e){return t.next(e)}),(function(e){return t.error(e)}),(function(){return t.complete()}))}))}(e),n)},exports.useSuspenseEnabledFromConfigAndContext=O,exports.useUser=D,exports.version="4.0.0-exp.e80fc49";
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("rxfire/auth"),r=require("rxjs"),n=require("rxjs/operators"),o=require("firebase/app"),i=require("rxfire/database"),a=require("rxfire/firestore"),s=require("firebase/firestore"),u=require("rxfire/functions"),c=require("rxfire/remote-config"),l=require("rxfire/storage"),f=require("firebase/storage");function p(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){p(i,n,o,a,s,"next",e)}function s(e){p(i,n,o,a,s,"throw",e)}a(void 0)}))}}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,g(e,t)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function y(e,t,r){return(y=b()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&g(o,r.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return y(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g(r,e)})(e)}function w(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var C,E=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=Object.create((t&&t.prototype instanceof f?t:f).prototype),i=new E(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=x(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=c(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(e,r,i),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function f(){}function p(){}function h(){}var d={};s(d,o,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(_([])));m&&m!==t&&r.call(m,o)&&(d=m);var g=h.prototype=f.prototype=Object.create(d);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,s){var u=c(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function x(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function _(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:F}}function F(){return{value:void 0,done:!0}}return p.prototype=h,s(g,"constructor",h),s(h,"constructor",p),p.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,i,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new y(u(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,a,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=_,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:_(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(C={exports:{}}),C.exports),_=e.createContext(void 0),F=e.createContext(!1);function O(t){var r=e.useContext(F);return void 0!==t?t:r}function k(){var t=e.useContext(_);if(!t)throw new Error("Cannot call useFirebaseApp unless your component is within a FirebaseAppProvider");return t}function S(){return(S=h(E.mark((function e(r){var n,o;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r();case 2:return o=q(t.user(n=e.sent),"auth:user:"+n.name),e.abrupt("return",o.toPromise());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e){var r,n=de(),o="auth:user:"+n.name,i=t.user(n),a=null!=(r=d({},e))?r:{};return void 0!==n.currentUser&&(a.initialData=n.currentUser,a.startWithValue=n.currentUser),T(o,i,a)}function D(e,t,n){if(void 0===t&&(t=!1),!e)throw new Error("you must provide a user");return T("auth:idTokenResult:"+e.uid+":forceRefresh="+t,r.from(e.getIdTokenResult(t)),n)}function R(t){var r=t.fallback,n=t.children,o=t.requiredClaims,i=D(t.user,!1).data.claims,a={};return O()||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."),o&&Object.keys(o).forEach((function(e){var t;o[e]!==i[e]&&(a[e]={expected:o[e],actual:null==(t=i[e])?void 0:t.toString()})})),0===Object.keys(a).length?e.createElement(e.Fragment,null,n):e.createElement(e.Fragment,null,r)}var j=globalThis._reactFireDatabaseCachedQueries||[];function L(e){var t=j.findIndex((function(t){return t.isEqual(e)}));return t>-1?t:j.push(e)-1}globalThis._reactFireDatabaseCachedQueries||(globalThis._reactFireDatabaseCachedQueries=j);var I=function(e){function t(t,o){var i;return(i=e.call(this)||this)._timeoutWindow=void 0,i._value=void 0,i._hasValue=!1,i._timeoutHandler=void 0,i._firstEmission=void 0,i._error=void 0,i._innerObservable=void 0,i._warmupSubscription=void 0,i._innerSubscriber=void 0,i._resolveFirstEmission=void 0,i._timeoutWindow=o,i._firstEmission=new Promise((function(e){return i._resolveFirstEmission=e})),i._innerObservable=t.pipe(n.tap({next:function(e){i._next(e)},error:function(e){i._error=e,i._resolveFirstEmission()}}),n.catchError((function(){return r.empty()})),n.shareReplay(1)),i._warmupSubscription=i._innerObservable.subscribe(),i._timeoutHandler=setTimeout(i._reset.bind(w(i)),i._timeoutWindow),i}v(t,e);var o,i=t.prototype;return i._next=function(e){this._hasValue=!0,this._value=e,this._resolveFirstEmission()},i._reset=function(){var e=this;this._warmupSubscription&&this._warmupSubscription.unsubscribe(),this._hasValue=!1,this._value=void 0,this._error=void 0,this._firstEmission=new Promise((function(t){return e._resolveFirstEmission=t}))},i._subscribe=function(e){return this._timeoutHandler&&clearTimeout(this._timeoutHandler),this._innerSubscriber=this._innerObservable.subscribe(e),this._innerSubscriber},(o=[{key:"hasValue",get:function(){return this._hasValue||!!this._error}},{key:"value",get:function(){if(this._error)throw this._error;if(!this.hasValue)throw Error("Can only get value if SuspenseSubject has a value");return this._value}},{key:"firstEmission",get:function(){return this._firstEmission}},{key:"ourError",get:function(){return this._error}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,o),t}(r.Subject),A=globalThis._reactFirePreloadedObservables||new Map;function q(e,t){if(A.has(t))return A.get(t);var r=new I(e,3e4);return A.set(t,r),r}function T(t,r,n){var o,i,a;if(void 0===n&&(n={}),!t)throw new Error("cannot call useObservable without an observableId");var s=q(r,t),u=n.hasOwnProperty("initialData")||n.hasOwnProperty("startWithValue"),c=s.hasValue||u;if(!0===O(n.suspense)&&!c)throw s.firstEmission;var l={status:c?"success":"loading",hasEmitted:c,isComplete:!1,data:s.hasValue?s.value:null!=(o=null==(i=n)?void 0:i.initialData)?o:null==(a=n)?void 0:a.startWithValue,error:s.ourError,firstValuePromise:s.firstEmission},f=e.useReducer(function(e){return function(t,r){var n=d({},t,{hasEmitted:t.hasEmitted||e.hasValue,error:e.ourError,firstValuePromise:e.firstEmission});switch(e.hasValue&&(n.data=e.value),r){case"value":return n.status="success",n;case"error":return n.status="error",n;case"complete":return n.isComplete=!0,n;default:throw new Error('invalid action "'+r+'"')}}}(s),l),p=f[0],h=f[1];return e.useEffect((function(){var e=s.subscribe({next:function(){h("value")},error:function(e){throw h("error"),e},complete:function(){h("complete")}});return function(){return e.unsubscribe()}}),[s]),p}globalThis._reactFirePreloadedObservables||(globalThis._reactFirePreloadedObservables=A);var N=globalThis._reactFireFirestoreQueryCache||[];function V(e){var t=N.findIndex((function(t){return s.queryEqual(t,e)}));return t>-1?t:N.push(e)-1}function U(){return(U=h(E.mark((function e(t){var r;return E.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return e.abrupt("return",q(a.doc(r=e.sent),M(r)));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(e){return"firestore:doc:"+e.firestore.app.name+":"+e.path}function G(e,t){var r=ge(),n=r.app.name,o=t(r,e);return T("remoteConfig:"+e+":"+t.name+":"+n,o)}globalThis._reactFireFirestoreQueryCache||(globalThis._reactFireFirestoreQueryCache=N);var W=["storage","storagePath","suspense","placeHolder"];function B(e,t){return T("storage:downloadUrl:"+e.toString(),l.getDownloadURL(e),t)}function H(t){return t=d({},t,{storage:me()}),e.createElement(Q,d({},t))}function Q(t){var r=t.storage,n=t.storagePath,o=t.suspense,i=t.placeHolder,a=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(t,W),s={suspense:O(o)};if(!r)throw new Error("Storage was not passed to component INTERNALStorageImage. This should not be possible");var u=B(f.ref(r,n),s),c=u.data;return"success"===u.status?(a.alt||""===a.alt||console.warn('No alt prop provided for StorageImage with storagePath "'+n+'"',"img elements must have an alt prop, either with meaningful text, or an empty string for decorative images"),e.createElement("img",d({src:c,alt:a.alt},a))):null!=i?i:e.createElement(e.Fragment,null,"''")}var J=e.createContext(void 0),z=e.createContext(void 0),K=e.createContext(void 0),Y=e.createContext(void 0),X=e.createContext(void 0),Z=e.createContext(void 0),$=e.createContext(void 0),ee=e.createContext(void 0),te=e.createContext(void 0);function re(t){return function(r){var n,o;if(!r.sdk)throw new Error("no sdk provided");var i=k().name;if((null==r||null==(n=r.sdk)||null==(o=n.app)?void 0:o.name)!==i)throw new Error("sdk was initialized with a different firebase app");return e.createElement(t.Provider,d({value:r.sdk},r))}}function ne(t){var r=e.useContext(t);if(!r)throw new Error("SDK not found. useSdk must be called from within a provider");return r}function oe(t,n,o,i){var a=k();if(e.useContext(n))throw new Error("Cannot initialize SDK "+t+" because it already exists in Context");var s=e.useMemo((function(){return o(a)}),[a]);return T("firebase-sdk:"+t+":"+a.name,r.from(s),i)}var ie=re(J),ae=re(z),se=re(K),ue=re(Y),ce=re(X),le=re(Z),fe=re(ee),pe=re($),he=re(te),de=function(){return ne(z)},ve=function(){return ne(Z)},me=function(){return ne($)},ge=function(){return ne(te)},be=function(e){function t(r,n,o){var i;return(i=e.call(this,n)||this).code=void 0,i.customData=void 0,i.name="ReactFireError",i.code=r,i.customData=o,Object.setPrototypeOf(w(i),t.prototype),i}return v(t,e),t}(x(Error));function ye(e,t){if("idField"===t||"initialData"===t||"suspense"===t)return e?e[t]:void 0;throw new Error('Field "'+t+'" is not a valid key in ReactFireOptions')}function xe(e){return ye(e,"idField")}exports.AnalyticsProvider=se,exports.AnalyticsSdkContext=K,exports.AppCheckProvider=ie,exports.AppCheckSdkContext=J,exports.AuthCheck=function(t){var r=t.fallback,n=t.children,o=t.requiredClaims,i=P().data;return O()||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?o?e.createElement(R,{user:i,fallback:r,requiredClaims:o},n):e.createElement(e.Fragment,null,n):e.createElement(e.Fragment,null,r)},exports.AuthProvider=ae,exports.AuthSdkContext=z,exports.ClaimsCheck=R,exports.DatabaseProvider=ue,exports.DatabaseSdkContext=Y,exports.FirebaseAppProvider=function(t){var r=t.firebaseConfig,n=t.appName,i=t.suspense,a=e.useMemo((function(){if(t.firebaseApp)return t.firebaseApp;var i,a,s=o.getApps().find((function(e){return e.name===(n||"[DEFAULT]")}));if(s){if(r&&((i=s.options)===(a=r)||[].concat(Object.keys(i),Object.keys(a)).every((function(e){return i[e]===a[e]}))))return s;throw new Error("Does not match the options already provided to the "+(n||"default")+" firebase app instance, give this new instance a different appName.")}if(!r)throw new Error("No firebaseConfig provided");return o.registerVersion("react",e.version||"unknown"),o.registerVersion("reactfire","4.0.0-exp.eb1428b"),o.initializeApp(r,n)}),[t.firebaseApp,r,n]);return e.createElement(_.Provider,{value:a},e.createElement(F.Provider,d({value:null!=i&&i},t)))},exports.FirestoreProvider=ce,exports.FirestoreSdkContext=X,exports.FunctionsProvider=le,exports.FunctionsSdkContext=Z,exports.PerformanceProvider=fe,exports.PerformanceSdkContext=ee,exports.ReactFireError=be,exports.RemoteConfigProvider=he,exports.RemoteConfigSdkContext=te,exports.StorageImage=function(t){return e.createElement(t.storage?Q:H,d({},t))},exports.StorageProvider=pe,exports.StorageSdkContext=$,exports.SuspenseWithPerf=function(t){var r,n=t.children,o=t.traceId,i=t.fallback,a=(null==(r=performance)||null==r.getEntriesByName?void 0:r.getEntriesByName(o,"measure"))||[],s="_"+o+"Start["+a.length+"]",u="_"+o+"End["+a.length+"]";return e.createElement(e.Suspense,{fallback:e.createElement((function(){return e.useLayoutEffect((function(){var e;return null==(e=performance)||null==e.mark||e.mark(s),function(){var e,t;null==(e=performance)||null==e.mark||e.mark(u),null==(t=performance)||null==t.measure||t.measure(o,s,u)}}),[]),e.createElement(e.Fragment,null,i)}),null)},n)},exports.checkIdField=xe,exports.checkOptions=ye,exports.checkinitialData=function(e){return ye(e,"initialData")},exports.preloadFirestoreDoc=function(e){return U.apply(this,arguments)},exports.preloadObservable=q,exports.preloadUser=function(e){return S.apply(this,arguments)},exports.useAnalytics=function(){return ne(K)},exports.useAppCheck=function(){return ne(J)},exports.useAuth=de,exports.useCallableFunctionResponse=function(e,t){var r=ve();return T("functions:callableResponse:"+e+":"+JSON.stringify(null==t?void 0:t.data)+":"+JSON.stringify(null==t?void 0:t.httpsCallableOptions),u.httpsCallable(r,e,null==t?void 0:t.httpsCallableOptions)(null==t?void 0:t.data),t)},exports.useDatabase=function(){return ne(Y)},exports.useDatabaseList=function(e,t){return T("database:list:"+L(e),i.list(e),t)},exports.useDatabaseListData=function(e,t){var r=t?xe(t):"NO_ID_FIELD";return T("database:listVal:"+L(e)+":idField="+r,i.listVal(e,{keyField:r}),t)},exports.useDatabaseObject=function(e,t){return T("database:object:"+e.toString(),i.object(e),t)},exports.useDatabaseObjectData=function(e,t){var r=t?xe(t):"NO_ID_FIELD";return T("database:objectVal:"+e.toString()+":idField="+r,i.objectVal(e,{keyField:r}),t)},exports.useFirebaseApp=k,exports.useFirestore=function(){return ne(X)},exports.useFirestoreCollection=function(e,t){return T("firestore:collection:"+V(e),a.fromRef(e),t)},exports.useFirestoreCollectionData=function(e,t){var r=t?xe(t):"NO_ID_FIELD";return T("firestore:collectionData:"+V(e)+":idField="+r,a.collectionData(e,{idField:r}),t)},exports.useFirestoreDoc=function(e,t){return T(M(e),a.doc(e),t)},exports.useFirestoreDocData=function(e,t){var r=t?xe(t):"NO_ID_FIELD";return T("firestore:docData:"+e.firestore.app.name+":"+e.path+":idField="+r,a.docData(e,{idField:r}),t)},exports.useFirestoreDocDataOnce=function(e,t){var r=t?xe(t):"NO_ID_FIELD";return T("firestore:docDataOnce:"+e.firestore.app.name+":"+e.path+":idField="+r,a.docData(e,{idField:r}).pipe(n.first()),t)},exports.useFirestoreDocOnce=function(e,t){return T("firestore:docOnce:"+e.firestore.app.name+":"+e.path,a.doc(e).pipe(n.first()),t)},exports.useFunctions=ve,exports.useIdTokenResult=D,exports.useInitAnalytics=function(e,t){return oe("analytics",K,e,t)},exports.useInitAppCheck=function(e,t){return oe("appcheck",J,e,t)},exports.useInitAuth=function(e,t){return oe("auth",z,e,t)},exports.useInitDatabase=function(e,t){return oe("database",Y,e,t)},exports.useInitFirestore=function(e,t){return oe("firestore",X,e,t)},exports.useInitFunctions=function(e,t){return oe("functions",Z,e,t)},exports.useInitPerformance=function(e,t){return oe("performance",ee,e,t)},exports.useInitRemoteConfig=function(e,t){return oe("remoteconfig",te,e,t)},exports.useInitStorage=function(e,t){return oe("storage",$,e,t)},exports.useIsSuspenseEnabled=function(){var t=e.useContext(F);return null!=t&&t},exports.useObservable=T,exports.usePerformance=function(){return ne(ee)},exports.useRemoteConfig=ge,exports.useRemoteConfigAll=function(e){return G(e,c.getAll)},exports.useRemoteConfigBoolean=function(e){return G(e,c.getBoolean)},exports.useRemoteConfigNumber=function(e){return G(e,c.getNumber)},exports.useRemoteConfigString=function(e){return G(e,c.getString)},exports.useRemoteConfigValue=function(e){return G(e,c.getValue)},exports.useSigninCheck=function(e){if(null!=e&&e.hasOwnProperty("requiredClaims")&&null!=e&&e.hasOwnProperty("validateCustomClaims"))throw new Error('Cannot have both "requiredClaims" and "validateCustomClaims". Use one or the other.');var o=de(),i="auth:signInCheck:"+o.name+"::forceRefresh:"+!(null==e||!e.forceRefresh);return null!=e&&e.forceRefresh&&(i=i+":forceRefresh:"+e.forceRefresh),null!=e&&e.hasOwnProperty("requiredClaims")?i=i+":requiredClaims:"+JSON.stringify(e.requiredClaims):null!=e&&e.hasOwnProperty("validateCustomClaims")&&(i=i+":validateCustomClaims:"+JSON.stringify(e.validateCustomClaims)),T(i,t.user(o).pipe(n.switchMap((function(t){var o;return t?e&&(e.hasOwnProperty("requiredClaims")||e.hasOwnProperty("validateCustomClaims"))?r.from(t.getIdTokenResult(null!=(o=null==e?void 0:e.forceRefresh)&&o)).pipe(n.map((function(r){var n,o;e.hasOwnProperty("requiredClaims")?(o=e.requiredClaims,n=function(e){var t={};return Object.keys(o).forEach((function(r){o[r]!==e[r]&&(t[r]=[new be("auth/missing-claim",'Expected "'+o[r]+'", but user has "'+e[r]+'" instead')])})),{hasRequiredClaims:0===Object.keys(t).length,errors:t}}):n=e.validateCustomClaims;var i=n(r.claims);return{signedIn:!0,hasRequiredClaims:i.hasRequiredClaims,errors:i.errors,user:t}}))):r.of({signedIn:!0,hasRequiredClaims:!0,errors:{},user:t}):r.of({signedIn:!1,hasRequiredClaims:!1,errors:{},user:null})}))))},exports.useStorage=me,exports.useStorageDownloadURL=B,exports.useStorageTask=function(e,t,r){return T("storage:task:"+t.toString(),l.fromTask(e),r)},exports.useSuspenseEnabledFromConfigAndContext=O,exports.useUser=P,exports.version="4.0.0-exp.eb1428b";
2
2
  //# sourceMappingURL=reactfire.cjs.production.min.js.map