@entropic-bond/firebase 1.13.6 → 1.13.8
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.
- package/lib/auth/firebase-auth.d.ts +2 -3
- package/lib/cloud-functions/firebase-cloud-functions.d.ts +1 -2
- package/lib/cloud-functions/firebase-cloud-functions.spec.d.ts +0 -1
- package/lib/cloud-storage/firebase-cloud-storage.d.ts +1 -2
- package/lib/entropic-bond-firebase.js +8145 -8232
- package/lib/entropic-bond-firebase.js.map +1 -1
- package/lib/entropic-bond-firebase.umd.cjs +382 -272
- package/lib/entropic-bond-firebase.umd.cjs.map +1 -1
- package/lib/firebase-helper.d.ts +0 -1
- package/lib/mocks/test-user.d.ts +0 -1
- package/lib/store/firebase-datasource.d.ts +4 -3
- package/package.json +10 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(xe,mn){typeof exports=="object"&&typeof module<"u"?mn(exports):typeof define=="function"&&define.amd?define(["exports"],mn):(xe=typeof globalThis<"u"?globalThis:xe||self,mn(xe["entropic-bond-firebase"]={}))})(this,function(xe){"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2017 Google LLC
|
|
4
4
|
*
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
29
|
* See the License for the specific language governing permissions and
|
|
30
30
|
* limitations under the License.
|
|
31
|
-
*/const
|
|
31
|
+
*/const mn=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},tp=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],a=n[t++],c=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},ic={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],a=s+1<n.length,c=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,f=i>>2,m=(i&3)<<4|c>>4;let v=(c&15)<<2|d>>6,R=d&63;l||(R=64,a||(v=64)),r.push(t[f],t[m],t[v],t[R])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(mn(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):tp(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const m=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||m==null)throw new np;const v=i<<2|c>>4;if(r.push(v),d!==64){const R=c<<4&240|d>>2;if(r.push(R),m!==64){const S=d<<6&192|m;r.push(S)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class np extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const rp=function(n){const e=mn(n);return ic.encodeByteArray(e,!0)},Yr=function(n){return rp(n).replace(/\./g,"")},oc=function(n){try{return ic.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
|
32
32
|
* @license
|
|
33
33
|
* Copyright 2022 Google LLC
|
|
34
34
|
*
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
44
|
* See the License for the specific language governing permissions and
|
|
45
45
|
* limitations under the License.
|
|
46
|
-
*/function
|
|
46
|
+
*/function sp(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
|
47
47
|
* @license
|
|
48
48
|
* Copyright 2022 Google LLC
|
|
49
49
|
*
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
59
|
* See the License for the specific language governing permissions and
|
|
60
60
|
* limitations under the License.
|
|
61
|
-
*/const
|
|
61
|
+
*/const ip=()=>sp().__FIREBASE_DEFAULTS__,op=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},ap=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&oc(n[1]);return e&&JSON.parse(e)},Jr=()=>{try{return ip()||op()||ap()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},ac=n=>{var e,t;return(t=(e=Jr())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Li=n=>{const e=ac(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},cc=()=>{var n;return(n=Jr())===null||n===void 0?void 0:n.config},uc=n=>{var e;return(e=Jr())===null||e===void 0?void 0:e[`_${n}`]};/**
|
|
62
62
|
* @license
|
|
63
63
|
* Copyright 2017 Google LLC
|
|
64
64
|
*
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
74
|
* See the License for the specific language governing permissions and
|
|
75
75
|
* limitations under the License.
|
|
76
|
-
*/class
|
|
76
|
+
*/class cp{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
|
|
77
77
|
* @license
|
|
78
78
|
* Copyright 2021 Google LLC
|
|
79
79
|
*
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
89
|
* See the License for the specific language governing permissions and
|
|
90
90
|
* limitations under the License.
|
|
91
|
-
*/function
|
|
91
|
+
*/function lc(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},n);return[Yr(JSON.stringify(t)),Yr(JSON.stringify(a)),""].join(".")}/**
|
|
92
92
|
* @license
|
|
93
93
|
* Copyright 2017 Google LLC
|
|
94
94
|
*
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
104
|
* See the License for the specific language governing permissions and
|
|
105
105
|
* limitations under the License.
|
|
106
|
-
*/function
|
|
106
|
+
*/function Ee(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function up(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ee())}function lp(){var n;const e=(n=Jr())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function hp(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function dp(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function fp(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function pp(){const n=Ee();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function mp(){return!lp()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function gp(){try{return typeof indexedDB=="object"}catch{return!1}}function _p(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(t){e(t)}})}/**
|
|
107
107
|
* @license
|
|
108
108
|
* Copyright 2017 Google LLC
|
|
109
109
|
*
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/const
|
|
121
|
+
*/const yp="FirebaseError";class ze extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=yp,Object.setPrototypeOf(this,ze.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Jn.prototype.create)}}class Jn{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],a=i?vp(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new ze(s,c,r)}}function vp(n,e){return n.replace(Ep,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Ep=/\{\$([^}]+)}/g;function Tp(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Zr(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],a=e[s];if(hc(i)&&hc(a)){if(!Zr(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function hc(n){return n!==null&&typeof n=="object"}/**
|
|
122
122
|
* @license
|
|
123
123
|
* Copyright 2017 Google LLC
|
|
124
124
|
*
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
134
|
* See the License for the specific language governing permissions and
|
|
135
135
|
* limitations under the License.
|
|
136
|
-
*/function
|
|
136
|
+
*/function Zn(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function er(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function tr(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function wp(n,e){const t=new Ip(n,e);return t.subscribe.bind(t)}class Ip{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");Ap(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Mi),s.error===void 0&&(s.error=Mi),s.complete===void 0&&(s.complete=Mi);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Ap(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Mi(){}/**
|
|
137
137
|
* @license
|
|
138
138
|
* Copyright 2021 Google LLC
|
|
139
139
|
*
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
149
|
* See the License for the specific language governing permissions and
|
|
150
150
|
* limitations under the License.
|
|
151
|
-
*/function
|
|
151
|
+
*/function X(n){return n&&n._delegate?n._delegate:n}class ht{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
|
|
152
152
|
* @license
|
|
153
153
|
* Copyright 2019 Google LLC
|
|
154
154
|
*
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
164
|
* See the License for the specific language governing permissions and
|
|
165
165
|
* limitations under the License.
|
|
166
|
-
*/const
|
|
166
|
+
*/const Qt="[DEFAULT]";/**
|
|
167
167
|
* @license
|
|
168
168
|
* Copyright 2019 Google LLC
|
|
169
169
|
*
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
179
|
* See the License for the specific language governing permissions and
|
|
180
180
|
* limitations under the License.
|
|
181
|
-
*/class
|
|
181
|
+
*/class Rp{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new cp;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Pp(e))try{this.getOrInitializeService({instanceIdentifier:Qt})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=Qt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Qt){return this.instances.has(e)}getOptions(e=Qt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.resolve(s)}return s}onInit(e,t){var r;const s=this.normalizeInstanceIdentifier(t),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const a=this.instances.get(s);return a&&e(a,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:bp(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Qt){return this.component?this.component.multipleInstances?e:Qt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function bp(n){return n===Qt?void 0:n}function Pp(n){return n.instantiationMode==="EAGER"}/**
|
|
182
182
|
* @license
|
|
183
183
|
* Copyright 2019 Google LLC
|
|
184
184
|
*
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
194
|
* See the License for the specific language governing permissions and
|
|
195
195
|
* limitations under the License.
|
|
196
|
-
*/class
|
|
196
|
+
*/class Sp{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new Rp(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
|
|
197
197
|
* @license
|
|
198
198
|
* Copyright 2017 Google LLC
|
|
199
199
|
*
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
209
|
* See the License for the specific language governing permissions and
|
|
210
210
|
* limitations under the License.
|
|
211
|
-
*/var
|
|
211
|
+
*/var z;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(z||(z={}));const Cp={debug:z.DEBUG,verbose:z.VERBOSE,info:z.INFO,warn:z.WARN,error:z.ERROR,silent:z.SILENT},kp=z.INFO,Np={[z.DEBUG]:"log",[z.VERBOSE]:"log",[z.INFO]:"info",[z.WARN]:"warn",[z.ERROR]:"error"},Dp=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Np[e];if(s)console[s](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Ui{constructor(e){this.name=e,this._logLevel=kp,this._logHandler=Dp,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in z))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Cp[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,z.DEBUG,...e),this._logHandler(this,z.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,z.VERBOSE,...e),this._logHandler(this,z.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,z.INFO,...e),this._logHandler(this,z.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,z.WARN,...e),this._logHandler(this,z.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,z.ERROR,...e),this._logHandler(this,z.ERROR,...e)}}const Op=(n,e)=>e.some(t=>n instanceof t);let dc,fc;function Vp(){return dc||(dc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Lp(){return fc||(fc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const pc=new WeakMap,xi=new WeakMap,mc=new WeakMap,Fi=new WeakMap,Bi=new WeakMap;function Mp(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",a)},i=()=>{t(Rt(n.result)),s()},a=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&pc.set(t,n)}).catch(()=>{}),Bi.set(e,n),e}function Up(n){if(xi.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",a),n.removeEventListener("abort",a)},i=()=>{t(),s()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",a),n.addEventListener("abort",a)});xi.set(n,e)}let ji={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return xi.get(n);if(e==="objectStoreNames")return n.objectStoreNames||mc.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return Rt(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function xp(n){ji=n(ji)}function Fp(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(qi(this),e,...t);return mc.set(r,e.sort?e.sort():[e]),Rt(r)}:Lp().includes(n)?function(...e){return n.apply(qi(this),e),Rt(pc.get(this))}:function(...e){return Rt(n.apply(qi(this),e))}}function Bp(n){return typeof n=="function"?Fp(n):(n instanceof IDBTransaction&&Up(n),Op(n,Vp())?new Proxy(n,ji):n)}function Rt(n){if(n instanceof IDBRequest)return Mp(n);if(Fi.has(n))return Fi.get(n);const e=Bp(n);return e!==n&&(Fi.set(n,e),Bi.set(e,n)),e}const qi=n=>Bi.get(n);function jp(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(n,e),c=Rt(a);return r&&a.addEventListener("upgradeneeded",l=>{r(Rt(a.result),l.oldVersion,l.newVersion,Rt(a.transaction),l)}),t&&a.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{i&&l.addEventListener("close",()=>i()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}const qp=["get","getKey","getAll","getAllKeys","count"],$p=["put","add","delete","clear"],$i=new Map;function gc(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if($i.get(e))return $i.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=$p.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||qp.includes(t)))return;const i=async function(a,...c){const l=this.transaction(a,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[t](...c),s&&l.done]))[0]};return $i.set(e,i),i}xp(n=>({...n,get:(e,t,r)=>gc(e,t)||n.get(e,t,r),has:(e,t)=>!!gc(e,t)||n.has(e,t)}));/**
|
|
212
212
|
* @license
|
|
213
213
|
* Copyright 2019 Google LLC
|
|
214
214
|
*
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
224
|
* See the License for the specific language governing permissions and
|
|
225
225
|
* limitations under the License.
|
|
226
|
-
*/class
|
|
226
|
+
*/class Hp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(zp(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function zp(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Hi="@firebase/app",_c="0.11.1";/**
|
|
227
227
|
* @license
|
|
228
228
|
* Copyright 2019 Google LLC
|
|
229
229
|
*
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
239
|
* See the License for the specific language governing permissions and
|
|
240
240
|
* limitations under the License.
|
|
241
|
-
*/const
|
|
241
|
+
*/const dt=new Ui("@firebase/app"),Wp="@firebase/app-compat",Gp="@firebase/analytics-compat",Kp="@firebase/analytics",Qp="@firebase/app-check-compat",Xp="@firebase/app-check",Yp="@firebase/auth",Jp="@firebase/auth-compat",Zp="@firebase/database",em="@firebase/data-connect",tm="@firebase/database-compat",nm="@firebase/functions",rm="@firebase/functions-compat",sm="@firebase/installations",im="@firebase/installations-compat",om="@firebase/messaging",am="@firebase/messaging-compat",cm="@firebase/performance",um="@firebase/performance-compat",lm="@firebase/remote-config",hm="@firebase/remote-config-compat",dm="@firebase/storage",fm="@firebase/storage-compat",pm="@firebase/firestore",mm="@firebase/vertexai",gm="@firebase/firestore-compat",_m="firebase",ym="11.3.1";/**
|
|
242
242
|
* @license
|
|
243
243
|
* Copyright 2019 Google LLC
|
|
244
244
|
*
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
254
|
* See the License for the specific language governing permissions and
|
|
255
255
|
* limitations under the License.
|
|
256
|
-
*/const
|
|
256
|
+
*/const zi="[DEFAULT]",vm={[Hi]:"fire-core",[Wp]:"fire-core-compat",[Kp]:"fire-analytics",[Gp]:"fire-analytics-compat",[Xp]:"fire-app-check",[Qp]:"fire-app-check-compat",[Yp]:"fire-auth",[Jp]:"fire-auth-compat",[Zp]:"fire-rtdb",[em]:"fire-data-connect",[tm]:"fire-rtdb-compat",[nm]:"fire-fn",[rm]:"fire-fn-compat",[sm]:"fire-iid",[im]:"fire-iid-compat",[om]:"fire-fcm",[am]:"fire-fcm-compat",[cm]:"fire-perf",[um]:"fire-perf-compat",[lm]:"fire-rc",[hm]:"fire-rc-compat",[dm]:"fire-gcs",[fm]:"fire-gcs-compat",[pm]:"fire-fst",[gm]:"fire-fst-compat",[mm]:"fire-vertex","fire-js":"fire-js",[_m]:"fire-js-all"};/**
|
|
257
257
|
* @license
|
|
258
258
|
* Copyright 2019 Google LLC
|
|
259
259
|
*
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
269
|
* See the License for the specific language governing permissions and
|
|
270
270
|
* limitations under the License.
|
|
271
|
-
*/const
|
|
271
|
+
*/const es=new Map,Em=new Map,Wi=new Map;function yc(n,e){try{n.container.addComponent(e)}catch(t){dt.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function bt(n){const e=n.name;if(Wi.has(e))return dt.debug(`There were multiple attempts to register component ${e}.`),!1;Wi.set(e,n);for(const t of es.values())yc(t,n);for(const t of Em.values())yc(t,n);return!0}function nr(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Te(n){return n==null?!1:n.settings!==void 0}/**
|
|
272
272
|
* @license
|
|
273
273
|
* Copyright 2019 Google LLC
|
|
274
274
|
*
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
284
|
* See the License for the specific language governing permissions and
|
|
285
285
|
* limitations under the License.
|
|
286
|
-
*/const
|
|
286
|
+
*/const Tm={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Pt=new Jn("app","Firebase",Tm);/**
|
|
287
287
|
* @license
|
|
288
288
|
* Copyright 2019 Google LLC
|
|
289
289
|
*
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
299
|
* See the License for the specific language governing permissions and
|
|
300
300
|
* limitations under the License.
|
|
301
|
-
*/class
|
|
301
|
+
*/class wm{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new ht("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Pt.create("app-deleted",{appName:this._name})}}/**
|
|
302
302
|
* @license
|
|
303
303
|
* Copyright 2019 Google LLC
|
|
304
304
|
*
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
314
314
|
* See the License for the specific language governing permissions and
|
|
315
315
|
* limitations under the License.
|
|
316
|
-
*/const
|
|
316
|
+
*/const Xt=ym;function vc(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:zi,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw Pt.create("bad-app-name",{appName:String(s)});if(t||(t=cc()),!t)throw Pt.create("no-options");const i=es.get(s);if(i){if(Zr(t,i.options)&&Zr(r,i.config))return i;throw Pt.create("duplicate-app",{appName:s})}const a=new Sp(s);for(const l of Wi.values())a.addComponent(l);const c=new wm(t,r,a);return es.set(s,c),c}function ts(n=zi){const e=es.get(n);if(!e&&n===zi&&cc())return vc();if(!e)throw Pt.create("no-app",{appName:n});return e}function qe(n,e,t){var r;let s=(r=vm[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){const c=[`Unable to register library "${s}" with version "${e}":`];i&&c.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&c.push("and"),a&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),dt.warn(c.join(" "));return}bt(new ht(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
|
|
317
317
|
* @license
|
|
318
318
|
* Copyright 2021 Google LLC
|
|
319
319
|
*
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
329
|
* See the License for the specific language governing permissions and
|
|
330
330
|
* limitations under the License.
|
|
331
|
-
*/const
|
|
331
|
+
*/const Im="firebase-heartbeat-database",Am=1,rr="firebase-heartbeat-store";let Gi=null;function Ec(){return Gi||(Gi=jp(Im,Am,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(rr)}catch(t){console.warn(t)}}}}).catch(n=>{throw Pt.create("idb-open",{originalErrorMessage:n.message})})),Gi}async function Rm(n){try{const t=(await Ec()).transaction(rr),r=await t.objectStore(rr).get(wc(n));return await t.done,r}catch(e){if(e instanceof ze)dt.warn(e.message);else{const t=Pt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});dt.warn(t.message)}}}async function Tc(n,e){try{const r=(await Ec()).transaction(rr,"readwrite");await r.objectStore(rr).put(e,wc(n)),await r.done}catch(t){if(t instanceof ze)dt.warn(t.message);else{const r=Pt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});dt.warn(r.message)}}}function wc(n){return`${n.name}!${n.options.appId}`}/**
|
|
332
332
|
* @license
|
|
333
333
|
* Copyright 2021 Google LLC
|
|
334
334
|
*
|
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
344
|
* See the License for the specific language governing permissions and
|
|
345
345
|
* limitations under the License.
|
|
346
|
-
*/const
|
|
346
|
+
*/const bm=1024,Pm=30;class Sm{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new km(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Ic();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>Pm){const a=Nm(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(a,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){dt.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=Ic(),{heartbeatsToSend:r,unsentEntries:s}=Cm(this._heartbeatsCache.heartbeats),i=Yr(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return dt.warn(t),""}}}function Ic(){return new Date().toISOString().substring(0,10)}function Cm(n,e=bm){const t=[];let r=n.slice();for(const s of n){const i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),Ac(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Ac(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class km{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return gp()?_p().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Rm(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return Tc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return Tc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function Ac(n){return Yr(JSON.stringify({version:2,heartbeats:n})).length}function Nm(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let r=1;r<n.length;r++)n[r].date<t&&(t=n[r].date,e=r);return e}/**
|
|
347
347
|
* @license
|
|
348
348
|
* Copyright 2019 Google LLC
|
|
349
349
|
*
|
|
@@ -358,15 +358,29 @@
|
|
|
358
358
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
359
359
|
* See the License for the specific language governing permissions and
|
|
360
360
|
* limitations under the License.
|
|
361
|
-
*/function ym(n){ft(new Ze("platform-logger",e=>new Op(e),"PRIVATE")),ft(new Ze("heartbeat",e=>new mm(e),"PRIVATE")),Se(Vi,Tc,n),Se(Vi,Tc,"esm2017"),Se("fire-js","")}ym("");var vm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y,Ui=Ui||{},R=vm||self;function Yr(n){var e=typeof n;return e=e!="object"?e:n?Array.isArray(n)?"array":e:"null",e=="array"||e=="object"&&typeof n.length=="number"}function zn(n){var e=typeof n;return e=="object"&&n!=null||e=="function"}function Em(n){return Object.prototype.hasOwnProperty.call(n,Fi)&&n[Fi]||(n[Fi]=++Tm)}var Fi="closure_uid_"+(1e9*Math.random()>>>0),Tm=0;function wm(n,e,t){return n.call.apply(n.bind,arguments)}function Im(n,e,t){if(!n)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var s=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(s,r),n.apply(e,s)}}return function(){return n.apply(e,arguments)}}function ae(n,e,t){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?ae=wm:ae=Im,ae.apply(null,arguments)}function Xr(n,e){var t=Array.prototype.slice.call(arguments,1);return function(){var r=t.slice();return r.push.apply(r,arguments),n.apply(this,r)}}function X(n,e){function t(){}t.prototype=e.prototype,n.$=e.prototype,n.prototype=new t,n.prototype.constructor=n,n.ac=function(r,s,i){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[s].apply(r,o)}}function mt(){this.s=this.s,this.o=this.o}var Am=0;mt.prototype.s=!1,mt.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),Am!=0)&&Em(this)},mt.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const Cc=Array.prototype.indexOf?function(n,e){return Array.prototype.indexOf.call(n,e,void 0)}:function(n,e){if(typeof n=="string")return typeof e!="string"||e.length!=1?-1:n.indexOf(e,0);for(let t=0;t<n.length;t++)if(t in n&&n[t]===e)return t;return-1};function Bi(n){const e=n.length;if(0<e){const t=Array(e);for(let r=0;r<e;r++)t[r]=n[r];return t}return[]}function kc(n,e){for(let t=1;t<arguments.length;t++){const r=arguments[t];if(Yr(r)){const s=n.length||0,i=r.length||0;n.length=s+i;for(let o=0;o<i;o++)n[s+o]=r[o]}else n.push(r)}}function ce(n,e){this.type=n,this.g=this.target=e,this.defaultPrevented=!1}ce.prototype.h=function(){this.defaultPrevented=!0};var Rm=function(){if(!R.addEventListener||!Object.defineProperty)return!1;var n=!1,e=Object.defineProperty({},"passive",{get:function(){n=!0}});try{const t=()=>{};R.addEventListener("test",t,e),R.removeEventListener("test",t,e)}catch{}return n}();function Hn(n){return/^[\s\xa0]*$/.test(n)}function Jr(){var n=R.navigator;return n&&(n=n.userAgent)?n:""}function Be(n){return Jr().indexOf(n)!=-1}function ji(n){return ji[" "](n),n}ji[" "]=function(){};function Pm(n,e){var t=yg;return Object.prototype.hasOwnProperty.call(t,n)?t[n]:t[n]=e(n)}var Sm=Be("Opera"),Zt=Be("Trident")||Be("MSIE"),Dc=Be("Edge"),qi=Dc||Zt,Nc=Be("Gecko")&&!(Jr().toLowerCase().indexOf("webkit")!=-1&&!Be("Edge"))&&!(Be("Trident")||Be("MSIE"))&&!Be("Edge"),bm=Jr().toLowerCase().indexOf("webkit")!=-1&&!Be("Edge");function Oc(){var n=R.document;return n?n.documentMode:void 0}var $i;e:{var zi="",Hi=function(){var n=Jr();if(Nc)return/rv:([^\);]+)(\)|;)/.exec(n);if(Dc)return/Edge\/([\d\.]+)/.exec(n);if(Zt)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(n);if(bm)return/WebKit\/(\S+)/.exec(n);if(Sm)return/(?:Version)[ \/]?(\S+)/.exec(n)}();if(Hi&&(zi=Hi?Hi[1]:""),Zt){var Wi=Oc();if(Wi!=null&&Wi>parseFloat(zi)){$i=String(Wi);break e}}$i=zi}var Gi;if(R.document&&Zt){var Vc=Oc();Gi=Vc||parseInt($i,10)||void 0}else Gi=void 0;var Cm=Gi;function Wn(n,e){if(ce.call(this,n?n.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,n){var t=this.type=n.type,r=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:null;if(this.target=n.target||n.srcElement,this.g=e,e=n.relatedTarget){if(Nc){e:{try{ji(e.nodeName);var s=!0;break e}catch{}s=!1}s||(e=null)}}else t=="mouseover"?e=n.fromElement:t=="mouseout"&&(e=n.toElement);this.relatedTarget=e,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=n.clientX!==void 0?n.clientX:n.pageX,this.clientY=n.clientY!==void 0?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0),this.button=n.button,this.key=n.key||"",this.ctrlKey=n.ctrlKey,this.altKey=n.altKey,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.pointerId=n.pointerId||0,this.pointerType=typeof n.pointerType=="string"?n.pointerType:km[n.pointerType]||"",this.state=n.state,this.i=n,n.defaultPrevented&&Wn.$.h.call(this)}}X(Wn,ce);var km={2:"touch",3:"pen",4:"mouse"};Wn.prototype.h=function(){Wn.$.h.call(this);var n=this.i;n.preventDefault?n.preventDefault():n.returnValue=!1};var Gn="closure_listenable_"+(1e6*Math.random()|0),Dm=0;function Nm(n,e,t,r,s){this.listener=n,this.proxy=null,this.src=e,this.type=t,this.capture=!!r,this.la=s,this.key=++Dm,this.fa=this.ia=!1}function Zr(n){n.fa=!0,n.listener=null,n.proxy=null,n.src=null,n.la=null}function Ki(n,e,t){for(const r in n)e.call(t,n[r],r,n)}function Om(n,e){for(const t in n)e.call(void 0,n[t],t,n)}function Lc(n){const e={};for(const t in n)e[t]=n[t];return e}const Mc="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function xc(n,e){let t,r;for(let s=1;s<arguments.length;s++){r=arguments[s];for(t in r)n[t]=r[t];for(let i=0;i<Mc.length;i++)t=Mc[i],Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t])}}function es(n){this.src=n,this.g={},this.h=0}es.prototype.add=function(n,e,t,r,s){var i=n.toString();n=this.g[i],n||(n=this.g[i]=[],this.h++);var o=Yi(n,e,r,s);return-1<o?(e=n[o],t||(e.ia=!1)):(e=new Nm(e,this.src,i,!!r,s),e.ia=t,n.push(e)),e};function Qi(n,e){var t=e.type;if(t in n.g){var r=n.g[t],s=Cc(r,e),i;(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(Zr(e),n.g[t].length==0&&(delete n.g[t],n.h--))}}function Yi(n,e,t,r){for(var s=0;s<n.length;++s){var i=n[s];if(!i.fa&&i.listener==e&&i.capture==!!t&&i.la==r)return s}return-1}var Xi="closure_lm_"+(1e6*Math.random()|0),Ji={};function Uc(n,e,t,r,s){if(r&&r.once)return Bc(n,e,t,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Uc(n,e[i],t,r,s);return null}return t=no(t),n&&n[Gn]?n.O(e,t,zn(r)?!!r.capture:!!r,s):Fc(n,e,t,!1,r,s)}function Fc(n,e,t,r,s,i){if(!e)throw Error("Invalid event type");var o=zn(s)?!!s.capture:!!s,a=eo(n);if(a||(n[Xi]=a=new es(n)),t=a.add(e,t,r,o,i),t.proxy)return t;if(r=Vm(),t.proxy=r,r.src=n,r.listener=t,n.addEventListener)Rm||(s=o),s===void 0&&(s=!1),n.addEventListener(e.toString(),r,s);else if(n.attachEvent)n.attachEvent(qc(e.toString()),r);else if(n.addListener&&n.removeListener)n.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return t}function Vm(){function n(t){return e.call(n.src,n.listener,t)}const e=Lm;return n}function Bc(n,e,t,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Bc(n,e[i],t,r,s);return null}return t=no(t),n&&n[Gn]?n.P(e,t,zn(r)?!!r.capture:!!r,s):Fc(n,e,t,!0,r,s)}function jc(n,e,t,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)jc(n,e[i],t,r,s);else r=zn(r)?!!r.capture:!!r,t=no(t),n&&n[Gn]?(n=n.i,e=String(e).toString(),e in n.g&&(i=n.g[e],t=Yi(i,t,r,s),-1<t&&(Zr(i[t]),Array.prototype.splice.call(i,t,1),i.length==0&&(delete n.g[e],n.h--)))):n&&(n=eo(n))&&(e=n.g[e.toString()],n=-1,e&&(n=Yi(e,t,r,s)),(t=-1<n?e[n]:null)&&Zi(t))}function Zi(n){if(typeof n!="number"&&n&&!n.fa){var e=n.src;if(e&&e[Gn])Qi(e.i,n);else{var t=n.type,r=n.proxy;e.removeEventListener?e.removeEventListener(t,r,n.capture):e.detachEvent?e.detachEvent(qc(t),r):e.addListener&&e.removeListener&&e.removeListener(r),(t=eo(e))?(Qi(t,n),t.h==0&&(t.src=null,e[Xi]=null)):Zr(n)}}}function qc(n){return n in Ji?Ji[n]:Ji[n]="on"+n}function Lm(n,e){if(n.fa)n=!0;else{e=new Wn(e,this);var t=n.listener,r=n.la||n.src;n.ia&&Zi(n),n=t.call(r,e)}return n}function eo(n){return n=n[Xi],n instanceof es?n:null}var to="__closure_events_fn_"+(1e9*Math.random()>>>0);function no(n){return typeof n=="function"?n:(n[to]||(n[to]=function(e){return n.handleEvent(e)}),n[to])}function J(){mt.call(this),this.i=new es(this),this.S=this,this.J=null}X(J,mt),J.prototype[Gn]=!0,J.prototype.removeEventListener=function(n,e,t,r){jc(this,n,e,t,r)};function ee(n,e){var t,r=n.J;if(r)for(t=[];r;r=r.J)t.push(r);if(n=n.S,r=e.type||e,typeof e=="string")e=new ce(e,n);else if(e instanceof ce)e.target=e.target||n;else{var s=e;e=new ce(r,n),xc(e,s)}if(s=!0,t)for(var i=t.length-1;0<=i;i--){var o=e.g=t[i];s=ts(o,r,!0,e)&&s}if(o=e.g=n,s=ts(o,r,!0,e)&&s,s=ts(o,r,!1,e)&&s,t)for(i=0;i<t.length;i++)o=e.g=t[i],s=ts(o,r,!1,e)&&s}J.prototype.N=function(){if(J.$.N.call(this),this.i){var n=this.i,e;for(e in n.g){for(var t=n.g[e],r=0;r<t.length;r++)Zr(t[r]);delete n.g[e],n.h--}}this.J=null},J.prototype.O=function(n,e,t,r){return this.i.add(String(n),e,!1,t,r)},J.prototype.P=function(n,e,t,r){return this.i.add(String(n),e,!0,t,r)};function ts(n,e,t,r){if(e=n.i.g[String(e)],!e)return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.fa&&o.capture==t){var a=o.listener,c=o.la||o.src;o.ia&&Qi(n.i,o),s=a.call(c,r)!==!1&&s}}return s&&!r.defaultPrevented}var ro=R.JSON.stringify;class Mm{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function xm(){var n=so;let e=null;return n.g&&(e=n.g,n.g=n.g.next,n.g||(n.h=null),e.next=null),e}class Um{constructor(){this.h=this.g=null}add(e,t){const r=$c.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}}var $c=new Mm(()=>new Fm,n=>n.reset());class Fm{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}function Bm(n){var e=1;n=n.split(":");const t=[];for(;0<e&&n.length;)t.push(n.shift()),e--;return n.length&&t.push(n.join(":")),t}function jm(n){R.setTimeout(()=>{throw n},0)}let Kn,Qn=!1,so=new Um,zc=()=>{const n=R.Promise.resolve(void 0);Kn=()=>{n.then(qm)}};var qm=()=>{for(var n;n=xm();){try{n.h.call(n.g)}catch(t){jm(t)}var e=$c;e.j(n),100>e.h&&(e.h++,n.next=e.g,e.g=n)}Qn=!1};function ns(n,e){J.call(this),this.h=n||1,this.g=e||R,this.j=ae(this.qb,this),this.l=Date.now()}X(ns,J),y=ns.prototype,y.ga=!1,y.T=null,y.qb=function(){if(this.ga){var n=Date.now()-this.l;0<n&&n<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-n):(this.T&&(this.g.clearTimeout(this.T),this.T=null),ee(this,"tick"),this.ga&&(io(this),this.start()))}},y.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function io(n){n.ga=!1,n.T&&(n.g.clearTimeout(n.T),n.T=null)}y.N=function(){ns.$.N.call(this),io(this),delete this.g};function oo(n,e,t){if(typeof n=="function")t&&(n=ae(n,t));else if(n&&typeof n.handleEvent=="function")n=ae(n.handleEvent,n);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:R.setTimeout(n,e||0)}function Hc(n){n.g=oo(()=>{n.g=null,n.i&&(n.i=!1,Hc(n))},n.j);const e=n.h;n.h=null,n.m.apply(null,e)}class $m extends mt{constructor(e,t){super(),this.m=e,this.j=t,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:Hc(this)}N(){super.N(),this.g&&(R.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Yn(n){mt.call(this),this.h=n,this.g={}}X(Yn,mt);var Wc=[];function Gc(n,e,t,r){Array.isArray(t)||(t&&(Wc[0]=t.toString()),t=Wc);for(var s=0;s<t.length;s++){var i=Uc(e,t[s],r||n.handleEvent,!1,n.h||n);if(!i)break;n.g[i.key]=i}}function Kc(n){Ki(n.g,function(e,t){this.g.hasOwnProperty(t)&&Zi(e)},n),n.g={}}Yn.prototype.N=function(){Yn.$.N.call(this),Kc(this)},Yn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function rs(){this.g=!0}rs.prototype.Ea=function(){this.g=!1};function zm(n,e,t,r,s,i){n.info(function(){if(n.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&h[1]=="type"?o+(l+"="+u+"&"):o+(l+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+`
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
`,t);return r==-1?ho:(t=Number(e.substring(t,r)),isNaN(t)?ru:(r+=1,r+t>e.length?ho:(e=e.slice(r,r+t),n.o=r+t,e)))}y.cancel=function(){this.J=!0,Vt(this)};function tr(n){n.Y=Date.now()+n.P,au(n,n.P)}function au(n,e){if(n.C!=null)throw Error("WatchDog timer not null");n.C=Jn(ae(n.lb,n),e)}function as(n){n.C&&(R.clearTimeout(n.C),n.C=null)}y.lb=function(){this.C=null;const n=Date.now();0<=n-this.Y?(Wm(this.j,this.B),this.L!=2&&(Xn(),pe(17)),Vt(this),this.s=2,nr(this)):au(this,this.Y-n)};function nr(n){n.l.H==0||n.J||Vu(n.l,n)}function Vt(n){as(n);var e=n.M;e&&typeof e.sa=="function"&&e.sa(),n.M=null,io(n.V),Kc(n.U),n.g&&(e=n.g,n.g=null,e.abort(),e.sa())}function po(n,e){try{var t=n.l;if(t.H!=0&&(t.g==n||mo(t.i,n))){if(!n.K&&mo(t.i,n)&&t.H==3){try{var r=t.Ja.g.parse(e)}catch{r=null}if(Array.isArray(r)&&r.length==3){var s=r;if(s[0]==0){e:if(!t.u){if(t.g)if(t.g.G+3e3<n.G)_s(t),ms(t);else break e;Eo(t),pe(18)}}else t.Fa=s[1],0<t.Fa-t.V&&37500>s[2]&&t.G&&t.A==0&&!t.v&&(t.v=Jn(ae(t.ib,t),6e3));if(1>=_u(t.i)&&t.oa){try{t.oa()}catch{}t.oa=void 0}}else Mt(t,11)}else if((n.K||t.g==n)&&_s(t),!Hn(e))for(s=t.Ja.g.parse(e),e=0;e<s.length;e++){let u=s[e];if(t.V=u[0],u=u[1],t.H==2)if(u[0]=="c"){t.K=u[1],t.pa=u[2];const l=u[3];l!=null&&(t.ra=l,t.l.info("VER="+t.ra));const h=u[4];h!=null&&(t.Ga=h,t.l.info("SVER="+t.Ga));const d=u[5];d!=null&&typeof d=="number"&&0<d&&(r=1.5*d,t.L=r,t.l.info("backChannelRequestTimeoutMs_="+r)),r=t;const f=n.g;if(f){const E=f.g?f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(E){var i=r.i;i.g||E.indexOf("spdy")==-1&&E.indexOf("quic")==-1&&E.indexOf("h2")==-1||(i.j=i.l,i.g=new Set,i.h&&(go(i,i.h),i.h=null))}if(r.F){const T=f.g?f.g.getResponseHeader("X-HTTP-Session-Id"):null;T&&(r.Da=T,j(r.I,r.F,T))}}t.H=3,t.h&&t.h.Ba(),t.ca&&(t.S=Date.now()-n.G,t.l.info("Handshake RTT: "+t.S+"ms")),r=t;var o=n;if(r.wa=xu(r,r.J?r.pa:null,r.Y),o.K){yu(r.i,o);var a=o,c=r.L;c&&a.setTimeout(c),a.C&&(as(a),tr(a)),r.g=o}else Nu(r);0<t.j.length&&gs(t)}else u[0]!="stop"&&u[0]!="close"||Mt(t,7);else t.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Mt(t,7):vo(t):u[0]!="noop"&&t.h&&t.h.Aa(u),t.A=0)}}Xn(4)}catch{}}function Ym(n){if(n.Z&&typeof n.Z=="function")return n.Z();if(typeof Map<"u"&&n instanceof Map||typeof Set<"u"&&n instanceof Set)return Array.from(n.values());if(typeof n=="string")return n.split("");if(Yr(n)){for(var e=[],t=n.length,r=0;r<t;r++)e.push(n[r]);return e}e=[],t=0;for(r in n)e[t++]=n[r];return e}function Xm(n){if(n.ta&&typeof n.ta=="function")return n.ta();if(!n.Z||typeof n.Z!="function"){if(typeof Map<"u"&&n instanceof Map)return Array.from(n.keys());if(!(typeof Set<"u"&&n instanceof Set)){if(Yr(n)||typeof n=="string"){var e=[];n=n.length;for(var t=0;t<n;t++)e.push(t);return e}e=[],t=0;for(const r in n)e[t++]=r;return e}}}function cu(n,e){if(n.forEach&&typeof n.forEach=="function")n.forEach(e,void 0);else if(Yr(n)||typeof n=="string")Array.prototype.forEach.call(n,e,void 0);else for(var t=Xm(n),r=Ym(n),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],t&&t[i],n)}var uu=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Jm(n,e){if(n){n=n.split("&");for(var t=0;t<n.length;t++){var r=n[t].indexOf("="),s=null;if(0<=r){var i=n[t].substring(0,r);s=n[t].substring(r+1)}else i=n[t];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}function Lt(n){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,n instanceof Lt){this.h=n.h,cs(this,n.j),this.s=n.s,this.g=n.g,us(this,n.m),this.l=n.l;var e=n.i,t=new ir;t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),lu(this,t),this.o=n.o}else n&&(e=String(n).match(uu))?(this.h=!1,cs(this,e[1]||"",!0),this.s=rr(e[2]||""),this.g=rr(e[3]||"",!0),us(this,e[4]),this.l=rr(e[5]||"",!0),lu(this,e[6]||"",!0),this.o=rr(e[7]||"")):(this.h=!1,this.i=new ir(null,this.h))}Lt.prototype.toString=function(){var n=[],e=this.j;e&&n.push(sr(e,hu,!0),":");var t=this.g;return(t||e=="file")&&(n.push("//"),(e=this.s)&&n.push(sr(e,hu,!0),"@"),n.push(encodeURIComponent(String(t)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t=this.m,t!=null&&n.push(":",String(t))),(t=this.l)&&(this.g&&t.charAt(0)!="/"&&n.push("/"),n.push(sr(t,t.charAt(0)=="/"?tg:eg,!0))),(t=this.i.toString())&&n.push("?",t),(t=this.o)&&n.push("#",sr(t,rg)),n.join("")};function et(n){return new Lt(n)}function cs(n,e,t){n.j=t?rr(e,!0):e,n.j&&(n.j=n.j.replace(/:$/,""))}function us(n,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);n.m=e}else n.m=null}function lu(n,e,t){e instanceof ir?(n.i=e,sg(n.i,n.h)):(t||(e=sr(e,ng)),n.i=new ir(e,n.h))}function j(n,e,t){n.i.set(e,t)}function ls(n){return j(n,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),n}function rr(n,e){return n?e?decodeURI(n.replace(/%25/g,"%2525")):decodeURIComponent(n):""}function sr(n,e,t){return typeof n=="string"?(n=encodeURI(n).replace(e,Zm),t&&(n=n.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n):null}function Zm(n){return n=n.charCodeAt(0),"%"+(n>>4&15).toString(16)+(n&15).toString(16)}var hu=/[#\/\?@]/g,eg=/[#\?:]/g,tg=/[#\?]/g,ng=/[#\?@]/g,rg=/#/g;function ir(n,e){this.h=this.g=null,this.i=n||null,this.j=!!e}function gt(n){n.g||(n.g=new Map,n.h=0,n.i&&Jm(n.i,function(e,t){n.add(decodeURIComponent(e.replace(/\+/g," ")),t)}))}y=ir.prototype,y.add=function(n,e){gt(this),this.i=null,n=tn(this,n);var t=this.g.get(n);return t||this.g.set(n,t=[]),t.push(e),this.h+=1,this};function du(n,e){gt(n),e=tn(n,e),n.g.has(e)&&(n.i=null,n.h-=n.g.get(e).length,n.g.delete(e))}function fu(n,e){return gt(n),e=tn(n,e),n.g.has(e)}y.forEach=function(n,e){gt(this),this.g.forEach(function(t,r){t.forEach(function(s){n.call(e,s,r,this)},this)},this)},y.ta=function(){gt(this);const n=Array.from(this.g.values()),e=Array.from(this.g.keys()),t=[];for(let r=0;r<e.length;r++){const s=n[r];for(let i=0;i<s.length;i++)t.push(e[r])}return t},y.Z=function(n){gt(this);let e=[];if(typeof n=="string")fu(this,n)&&(e=e.concat(this.g.get(tn(this,n))));else{n=Array.from(this.g.values());for(let t=0;t<n.length;t++)e=e.concat(n[t])}return e},y.set=function(n,e){return gt(this),this.i=null,n=tn(this,n),fu(this,n)&&(this.h-=this.g.get(n).length),this.g.set(n,[e]),this.h+=1,this},y.get=function(n,e){return n?(n=this.Z(n),0<n.length?String(n[0]):e):e};function pu(n,e,t){du(n,e),0<t.length&&(n.i=null,n.g.set(tn(n,e),Bi(t)),n.h+=t.length)}y.toString=function(){if(this.i)return this.i;if(!this.g)return"";const n=[],e=Array.from(this.g.keys());for(var t=0;t<e.length;t++){var r=e[t];const i=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var s=i;o[r]!==""&&(s+="="+encodeURIComponent(String(o[r]))),n.push(s)}}return this.i=n.join("&")};function tn(n,e){return e=String(e),n.j&&(e=e.toLowerCase()),e}function sg(n,e){e&&!n.j&&(gt(n),n.i=null,n.g.forEach(function(t,r){var s=r.toLowerCase();r!=s&&(du(this,r),pu(this,s,t))},n)),n.j=e}var ig=class{constructor(n,e){this.g=n,this.map=e}};function mu(n){this.l=n||og,R.PerformanceNavigationTiming?(n=R.performance.getEntriesByType("navigation"),n=0<n.length&&(n[0].nextHopProtocol=="hq"||n[0].nextHopProtocol=="h2")):n=!!(R.g&&R.g.Ka&&R.g.Ka()&&R.g.Ka().dc),this.j=n?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var og=10;function gu(n){return n.h?!0:n.g?n.g.size>=n.j:!1}function _u(n){return n.h?1:n.g?n.g.size:0}function mo(n,e){return n.h?n.h==e:n.g?n.g.has(e):!1}function go(n,e){n.g?n.g.add(e):n.h=e}function yu(n,e){n.h&&n.h==e?n.h=null:n.g&&n.g.has(e)&&n.g.delete(e)}mu.prototype.cancel=function(){if(this.i=vu(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const n of this.g.values())n.cancel();this.g.clear()}};function vu(n){if(n.h!=null)return n.i.concat(n.h.F);if(n.g!=null&&n.g.size!==0){let e=n.i;for(const t of n.g.values())e=e.concat(t.F);return e}return Bi(n.i)}var ag=class{stringify(n){return R.JSON.stringify(n,void 0)}parse(n){return R.JSON.parse(n,void 0)}};function cg(){this.g=new ag}function ug(n,e,t){const r=t||"";try{cu(n,function(s,i){let o=s;zn(s)&&(o=ro(s)),e.push(r+i+"="+encodeURIComponent(o))})}catch(s){throw e.push(r+"type="+encodeURIComponent("_badmap")),s}}function lg(n,e){const t=new rs;if(R.Image){const r=new Image;r.onload=Xr(hs,t,r,"TestLoadImage: loaded",!0,e),r.onerror=Xr(hs,t,r,"TestLoadImage: error",!1,e),r.onabort=Xr(hs,t,r,"TestLoadImage: abort",!1,e),r.ontimeout=Xr(hs,t,r,"TestLoadImage: timeout",!1,e),R.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=n}else e(!1)}function hs(n,e,t,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch{}}function ds(n){this.l=n.ec||null,this.j=n.ob||!1}X(ds,ao),ds.prototype.g=function(){return new fs(this.l,this.j)},ds.prototype.i=function(n){return function(){return n}}({});function fs(n,e){J.call(this),this.F=n,this.u=e,this.m=void 0,this.readyState=_o,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}X(fs,J);var _o=0;y=fs.prototype,y.open=function(n,e){if(this.readyState!=_o)throw this.abort(),Error("Error reopening a connection");this.C=n,this.B=e,this.readyState=1,ar(this)},y.send=function(n){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};n&&(e.body=n),(this.F||R).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},y.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,or(this)),this.readyState=_o},y.$a=function(n){if(this.g&&(this.l=n,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=n.headers,this.readyState=2,ar(this)),this.g&&(this.readyState=3,ar(this),this.g)))if(this.responseType==="arraybuffer")n.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof R.ReadableStream<"u"&&"body"in n){if(this.j=n.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Eu(this)}else n.text().then(this.Za.bind(this),this.ka.bind(this))};function Eu(n){n.j.read().then(n.Xa.bind(n)).catch(n.ka.bind(n))}y.Xa=function(n){if(this.g){if(this.u&&n.value)this.response.push(n.value);else if(!this.u){var e=n.value?n.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!n.done}))&&(this.response=this.responseText+=e)}n.done?or(this):ar(this),this.readyState==3&&Eu(this)}},y.Za=function(n){this.g&&(this.response=this.responseText=n,or(this))},y.Ya=function(n){this.g&&(this.response=n,or(this))},y.ka=function(){this.g&&or(this)};function or(n){n.readyState=4,n.l=null,n.j=null,n.A=null,ar(n)}y.setRequestHeader=function(n,e){this.v.append(n,e)},y.getResponseHeader=function(n){return this.h&&this.h.get(n.toLowerCase())||""},y.getAllResponseHeaders=function(){if(!this.h)return"";const n=[],e=this.h.entries();for(var t=e.next();!t.done;)t=t.value,n.push(t[0]+": "+t[1]),t=e.next();return n.join(`\r
|
|
367
|
-
|
|
368
|
-
`);for(let r=0;r<n.length;r++){if(Hn(n[r]))continue;var t=Bm(n[r]);const s=t[0];if(t=t[1],typeof t!="string")continue;t=t.trim();const i=e[s]||[];e[s]=i,i.push(t)}Om(e,function(r){return r.join(", ")})}y.Ia=function(){return this.m},y.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function Su(n){let e="";return Ki(n,function(t,r){e+=r,e+=":",e+=t,e+=`\r
|
|
369
|
-
`}),e}function yo(n,e,t){e:{for(r in t){var r=!1;break e}r=!0}r||(t=Su(t),typeof n=="string"?t!=null&&encodeURIComponent(String(t)):j(n,e,t))}function cr(n,e,t){return t&&t.internalChannelParams&&t.internalChannelParams[n]||e}function bu(n){this.Ga=0,this.j=[],this.l=new rs,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=cr("failFast",!1,n),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=cr("baseRetryDelayMs",5e3,n),this.hb=cr("retryDelaySeedMs",1e4,n),this.eb=cr("forwardChannelMaxRetries",2,n),this.xa=cr("forwardChannelRequestTimeoutMs",2e4,n),this.va=n&&n.xmlHttpFactory||void 0,this.Ha=n&&n.useFetchStreams||!1,this.L=void 0,this.J=n&&n.supportsCrossDomainXhr||!1,this.K="",this.i=new mu(n&&n.concurrentRequestLimit),this.Ja=new cg,this.P=n&&n.fastHandshake||!1,this.O=n&&n.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=n&&n.bc||!1,n&&n.Ea&&this.l.Ea(),n&&n.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&n&&n.detectBufferingProxy||!1,this.qa=void 0,n&&n.longPollingTimeout&&0<n.longPollingTimeout&&(this.qa=n.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}y=bu.prototype,y.ra=8,y.H=1;function vo(n){if(Cu(n),n.H==3){var e=n.W++,t=et(n.I);if(j(t,"SID",n.K),j(t,"RID",e),j(t,"TYPE","terminate"),ur(n,t),e=new er(n,n.l,e),e.L=2,e.A=ls(et(t)),t=!1,R.navigator&&R.navigator.sendBeacon)try{t=R.navigator.sendBeacon(e.A.toString(),"")}catch{}!t&&R.Image&&(new Image().src=e.A,t=!0),t||(e.g=Uu(e.l,null),e.g.ha(e.A)),e.G=Date.now(),tr(e)}Mu(n)}function ms(n){n.g&&(To(n),n.g.cancel(),n.g=null)}function Cu(n){ms(n),n.u&&(R.clearTimeout(n.u),n.u=null),_s(n),n.i.cancel(),n.m&&(typeof n.m=="number"&&R.clearTimeout(n.m),n.m=null)}function gs(n){if(!gu(n.i)&&!n.m){n.m=!0;var e=n.Na;Kn||zc(),Qn||(Kn(),Qn=!0),so.add(e,n),n.C=0}}function gg(n,e){return _u(n.i)>=n.i.j-(n.m?1:0)?!1:n.m?(n.j=e.F.concat(n.j),!0):n.H==1||n.H==2||n.C>=(n.cb?0:n.eb)?!1:(n.m=Jn(ae(n.Na,n,e),Lu(n,n.C)),n.C++,!0)}y.Na=function(n){if(this.m)if(this.m=null,this.H==1){if(!n){this.W=Math.floor(1e5*Math.random()),n=this.W++;const s=new er(this,this.l,n);let i=this.s;if(this.U&&(i?(i=Lc(i),xc(i,this.U)):i=this.U),this.o!==null||this.O||(s.I=i,i=null),this.P)e:{for(var e=0,t=0;t<this.j.length;t++){t:{var r=this.j[t];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break t}r=void 0}if(r===void 0)break;if(e+=r,4096<e){e=t;break e}if(e===4096||t===this.j.length-1){e=t+1;break e}}e=1e3}else e=1e3;e=Du(this,s,e),t=et(this.I),j(t,"RID",n),j(t,"CVER",22),this.F&&j(t,"X-HTTP-Session-Id",this.F),ur(this,t),i&&(this.O?e="headers="+encodeURIComponent(String(Su(i)))+"&"+e:this.o&&yo(t,this.o,i)),go(this.i,s),this.bb&&j(t,"TYPE","init"),this.P?(j(t,"$req",e),j(t,"SID","null"),s.aa=!0,fo(s,t,null)):fo(s,t,e),this.H=2}}else this.H==3&&(n?ku(this,n):this.j.length==0||gu(this.i)||ku(this))};function ku(n,e){var t;e?t=e.m:t=n.W++;const r=et(n.I);j(r,"SID",n.K),j(r,"RID",t),j(r,"AID",n.V),ur(n,r),n.o&&n.s&&yo(r,n.o,n.s),t=new er(n,n.l,t,n.C+1),n.o===null&&(t.I=n.s),e&&(n.j=e.F.concat(n.j)),e=Du(n,t,1e3),t.setTimeout(Math.round(.5*n.xa)+Math.round(.5*n.xa*Math.random())),go(n.i,t),fo(t,r,e)}function ur(n,e){n.na&&Ki(n.na,function(t,r){j(e,r,t)}),n.h&&cu({},function(t,r){j(e,r,t)})}function Du(n,e,t){t=Math.min(n.j.length,t);var r=n.h?ae(n.h.Va,n.h,n):null;e:{var s=n.j;let i=-1;for(;;){const o=["count="+t];i==-1?0<t?(i=s[0].g,o.push("ofs="+i)):i=0:o.push("ofs="+i);let a=!0;for(let c=0;c<t;c++){let u=s[c].g;const l=s[c].map;if(u-=i,0>u)i=Math.max(0,s[c].g-100),a=!1;else try{ug(l,o,"req"+u+"_")}catch{r&&r(l)}}if(a){r=o.join("&");break e}}}return n=n.j.splice(0,t),e.F=n,r}function Nu(n){if(!n.g&&!n.u){n.ba=1;var e=n.Ma;Kn||zc(),Qn||(Kn(),Qn=!0),so.add(e,n),n.A=0}}function Eo(n){return n.g||n.u||3<=n.A?!1:(n.ba++,n.u=Jn(ae(n.Ma,n),Lu(n,n.A)),n.A++,!0)}y.Ma=function(){if(this.u=null,Ou(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var n=2*this.S;this.l.info("BP detection timer enabled: "+n),this.B=Jn(ae(this.jb,this),n)}},y.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,pe(10),ms(this),Ou(this))};function To(n){n.B!=null&&(R.clearTimeout(n.B),n.B=null)}function Ou(n){n.g=new er(n,n.l,"rpc",n.ba),n.o===null&&(n.g.I=n.s),n.g.O=0;var e=et(n.wa);j(e,"RID","rpc"),j(e,"SID",n.K),j(e,"AID",n.V),j(e,"CI",n.G?"0":"1"),!n.G&&n.qa&&j(e,"TO",n.qa),j(e,"TYPE","xmlhttp"),ur(n,e),n.o&&n.s&&yo(e,n.o,n.s),n.L&&n.g.setTimeout(n.L);var t=n.g;n=n.pa,t.L=1,t.A=ls(et(e)),t.u=null,t.S=!0,su(t,n)}y.ib=function(){this.v!=null&&(this.v=null,ms(this),Eo(this),pe(19))};function _s(n){n.v!=null&&(R.clearTimeout(n.v),n.v=null)}function Vu(n,e){var t=null;if(n.g==e){_s(n),To(n),n.g=null;var r=2}else if(mo(n.i,e))t=e.F,yu(n.i,e),r=1;else return;if(n.H!=0){if(e.i)if(r==1){t=e.u?e.u.length:0,e=Date.now()-e.G;var s=n.C;r=ss(),ee(r,new Jc(r,t)),gs(n)}else Nu(n);else if(s=e.s,s==3||s==0&&0<e.ca||!(r==1&&gg(n,e)||r==2&&Eo(n)))switch(t&&0<t.length&&(e=n.i,e.i=e.i.concat(t)),s){case 1:Mt(n,5);break;case 4:Mt(n,10);break;case 3:Mt(n,6);break;default:Mt(n,2)}}}function Lu(n,e){let t=n.ab+Math.floor(Math.random()*n.hb);return n.isActive()||(t*=2),t*e}function Mt(n,e){if(n.l.info("Error code "+e),e==2){var t=null;n.h&&(t=null);var r=ae(n.pb,n);t||(t=new Lt("//www.google.com/images/cleardot.gif"),R.location&&R.location.protocol=="http"||cs(t,"https"),ls(t)),lg(t.toString(),r)}else pe(2);n.H=0,n.h&&n.h.za(e),Mu(n),Cu(n)}y.pb=function(n){n?(this.l.info("Successfully pinged google.com"),pe(2)):(this.l.info("Failed to ping google.com"),pe(1))};function Mu(n){if(n.H=0,n.ma=[],n.h){const e=vu(n.i);(e.length!=0||n.j.length!=0)&&(kc(n.ma,e),kc(n.ma,n.j),n.i.i.length=0,Bi(n.j),n.j.length=0),n.h.ya()}}function xu(n,e,t){var r=t instanceof Lt?et(t):new Lt(t);if(r.g!="")e&&(r.g=e+"."+r.g),us(r,r.m);else{var s=R.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Lt(null);r&&cs(i,r),e&&(i.g=e),s&&us(i,s),t&&(i.l=t),r=i}return t=n.F,e=n.Da,t&&e&&j(r,t,e),j(r,"VER",n.ra),ur(n,r),r}function Uu(n,e,t){if(e&&!n.J)throw Error("Can't create secondary domain capable XhrIo object.");return e=n.Ha&&!n.va?new H(new ds({ob:t})):new H(n.va),e.Oa(n.J),e}y.isActive=function(){return!!this.h&&this.h.isActive(this)};function Fu(){}y=Fu.prototype,y.Ba=function(){},y.Aa=function(){},y.za=function(){},y.ya=function(){},y.isActive=function(){return!0},y.Va=function(){};function ys(){if(Zt&&!(10<=Number(Cm)))throw Error("Environmental error: no available transport.")}ys.prototype.g=function(n,e){return new we(n,e)};function we(n,e){J.call(this),this.g=new bu(e),this.l=n,this.h=e&&e.messageUrlParams||null,n=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(n?n["X-Client-Protocol"]="webchannel":n={"X-Client-Protocol":"webchannel"}),this.g.s=n,n=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(n?n["X-WebChannel-Content-Type"]=e.messageContentType:n={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.Ca&&(n?n["X-WebChannel-Client-Profile"]=e.Ca:n={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=n,(n=e&&e.cc)&&!Hn(n)&&(this.g.o=n),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Hn(e)&&(this.g.F=e,n=this.h,n!==null&&e in n&&(n=this.h,e in n&&delete n[e])),this.j=new nn(this)}X(we,J),we.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var n=this.g,e=this.l,t=this.h||void 0;pe(0),n.Y=e,n.na=t||{},n.G=n.aa,n.I=xu(n,null,n.Y),gs(n)},we.prototype.close=function(){vo(this.g)},we.prototype.u=function(n){var e=this.g;if(typeof n=="string"){var t={};t.__data__=n,n=t}else this.v&&(t={},t.__data__=ro(n),n=t);e.j.push(new ig(e.fb++,n)),e.H==3&&gs(e)},we.prototype.N=function(){this.g.h=null,delete this.j,vo(this.g),delete this.g,we.$.N.call(this)};function Bu(n){co.call(this),n.__headers__&&(this.headers=n.__headers__,this.statusCode=n.__status__,delete n.__headers__,delete n.__status__);var e=n.__sm__;if(e){e:{for(const t in e){n=t;break e}n=void 0}(this.i=n)&&(n=this.i,e=e!==null&&n in e?e[n]:void 0),this.data=e}else this.data=n}X(Bu,co);function ju(){uo.call(this),this.status=1}X(ju,uo);function nn(n){this.g=n}X(nn,Fu),nn.prototype.Ba=function(){ee(this.g,"a")},nn.prototype.Aa=function(n){ee(this.g,new Bu(n))},nn.prototype.za=function(n){ee(this.g,new ju)},nn.prototype.ya=function(){ee(this.g,"b")};function _g(){this.blockSize=-1}function Ne(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}X(Ne,_g),Ne.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function wo(n,e,t){t||(t=0);var r=Array(16);if(typeof e=="string")for(var s=0;16>s;++s)r[s]=e.charCodeAt(t++)|e.charCodeAt(t++)<<8|e.charCodeAt(t++)<<16|e.charCodeAt(t++)<<24;else for(s=0;16>s;++s)r[s]=e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24;e=n.g[0],t=n.g[1],s=n.g[2];var i=n.g[3],o=e+(i^t&(s^i))+r[0]+3614090360&4294967295;e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[1]+3905402710&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[2]+606105819&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[3]+3250441966&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[4]+4118548399&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[5]+1200080426&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[6]+2821735955&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[7]+4249261313&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[8]+1770035416&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[9]+2336552879&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[10]+4294925233&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[11]+2304563134&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(i^t&(s^i))+r[12]+1804603682&4294967295,e=t+(o<<7&4294967295|o>>>25),o=i+(s^e&(t^s))+r[13]+4254626195&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(t^i&(e^t))+r[14]+2792965006&4294967295,s=i+(o<<17&4294967295|o>>>15),o=t+(e^s&(i^e))+r[15]+1236535329&4294967295,t=s+(o<<22&4294967295|o>>>10),o=e+(s^i&(t^s))+r[1]+4129170786&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[6]+3225465664&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[11]+643717713&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[0]+3921069994&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[5]+3593408605&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[10]+38016083&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[15]+3634488961&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[4]+3889429448&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[9]+568446438&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[14]+3275163606&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[3]+4107603335&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[8]+1163531501&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(t^s))+r[13]+2850285829&4294967295,e=t+(o<<5&4294967295|o>>>27),o=i+(t^s&(e^t))+r[2]+4243563512&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^t&(i^e))+r[7]+1735328473&4294967295,s=i+(o<<14&4294967295|o>>>18),o=t+(i^e&(s^i))+r[12]+2368359562&4294967295,t=s+(o<<20&4294967295|o>>>12),o=e+(t^s^i)+r[5]+4294588738&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[8]+2272392833&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[11]+1839030562&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[14]+4259657740&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[1]+2763975236&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[4]+1272893353&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[7]+4139469664&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[10]+3200236656&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[13]+681279174&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[0]+3936430074&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[3]+3572445317&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[6]+76029189&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(t^s^i)+r[9]+3654602809&4294967295,e=t+(o<<4&4294967295|o>>>28),o=i+(e^t^s)+r[12]+3873151461&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^t)+r[15]+530742520&4294967295,s=i+(o<<16&4294967295|o>>>16),o=t+(s^i^e)+r[2]+3299628645&4294967295,t=s+(o<<23&4294967295|o>>>9),o=e+(s^(t|~i))+r[0]+4096336452&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[7]+1126891415&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[14]+2878612391&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[5]+4237533241&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[12]+1700485571&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[3]+2399980690&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[10]+4293915773&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[1]+2240044497&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[8]+1873313359&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[15]+4264355552&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[6]+2734768916&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[13]+1309151649&4294967295,t=s+(o<<21&4294967295|o>>>11),o=e+(s^(t|~i))+r[4]+4149444226&4294967295,e=t+(o<<6&4294967295|o>>>26),o=i+(t^(e|~s))+r[11]+3174756917&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~t))+r[2]+718787259&4294967295,s=i+(o<<15&4294967295|o>>>17),o=t+(i^(s|~e))+r[9]+3951481745&4294967295,n.g[0]=n.g[0]+e&4294967295,n.g[1]=n.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,n.g[2]=n.g[2]+s&4294967295,n.g[3]=n.g[3]+i&4294967295}Ne.prototype.j=function(n,e){e===void 0&&(e=n.length);for(var t=e-this.blockSize,r=this.m,s=this.h,i=0;i<e;){if(s==0)for(;i<=t;)wo(this,n,i),i+=this.blockSize;if(typeof n=="string"){for(;i<e;)if(r[s++]=n.charCodeAt(i++),s==this.blockSize){wo(this,r),s=0;break}}else for(;i<e;)if(r[s++]=n[i++],s==this.blockSize){wo(this,r),s=0;break}}this.h=s,this.i+=e},Ne.prototype.l=function(){var n=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);n[0]=128;for(var e=1;e<n.length-8;++e)n[e]=0;var t=8*this.i;for(e=n.length-8;e<n.length;++e)n[e]=t&255,t/=256;for(this.j(n),n=Array(16),e=t=0;4>e;++e)for(var r=0;32>r;r+=8)n[t++]=this.g[e]>>>r&255;return n};function U(n,e){this.h=e;for(var t=[],r=!0,s=n.length-1;0<=s;s--){var i=n[s]|0;r&&i==e||(t[s]=i,r=!1)}this.g=t}var yg={};function Io(n){return-128<=n&&128>n?Pm(n,function(e){return new U([e|0],0>e?-1:0)}):new U([n|0],0>n?-1:0)}function qe(n){if(isNaN(n)||!isFinite(n))return rn;if(0>n)return te(qe(-n));for(var e=[],t=1,r=0;n>=t;r++)e[r]=n/t|0,t*=Ao;return new U(e,0)}function qu(n,e){if(n.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(n.charAt(0)=="-")return te(qu(n.substring(1),e));if(0<=n.indexOf("-"))throw Error('number format error: interior "-" character');for(var t=qe(Math.pow(e,8)),r=rn,s=0;s<n.length;s+=8){var i=Math.min(8,n.length-s),o=parseInt(n.substring(s,s+i),e);8>i?(i=qe(Math.pow(e,i)),r=r.R(i).add(qe(o))):(r=r.R(t),r=r.add(qe(o)))}return r}var Ao=4294967296,rn=Io(0),Ro=Io(1),$u=Io(16777216);y=U.prototype,y.ea=function(){if(be(this))return-te(this).ea();for(var n=0,e=1,t=0;t<this.g.length;t++){var r=this.D(t);n+=(0<=r?r:Ao+r)*e,e*=Ao}return n},y.toString=function(n){if(n=n||10,2>n||36<n)throw Error("radix out of range: "+n);if(tt(this))return"0";if(be(this))return"-"+te(this).toString(n);for(var e=qe(Math.pow(n,6)),t=this,r="";;){var s=Ts(t,e).g;t=vs(t,s.R(e));var i=((0<t.g.length?t.g[0]:t.h)>>>0).toString(n);if(t=s,tt(t))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},y.D=function(n){return 0>n?0:n<this.g.length?this.g[n]:this.h};function tt(n){if(n.h!=0)return!1;for(var e=0;e<n.g.length;e++)if(n.g[e]!=0)return!1;return!0}function be(n){return n.h==-1}y.X=function(n){return n=vs(this,n),be(n)?-1:tt(n)?0:1};function te(n){for(var e=n.g.length,t=[],r=0;r<e;r++)t[r]=~n.g[r];return new U(t,~n.h).add(Ro)}y.abs=function(){return be(this)?te(this):this},y.add=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0,s=0;s<=e;s++){var i=r+(this.D(s)&65535)+(n.D(s)&65535),o=(i>>>16)+(this.D(s)>>>16)+(n.D(s)>>>16);r=o>>>16,i&=65535,o&=65535,t[s]=o<<16|i}return new U(t,t[t.length-1]&-2147483648?-1:0)};function vs(n,e){return n.add(te(e))}y.R=function(n){if(tt(this)||tt(n))return rn;if(be(this))return be(n)?te(this).R(te(n)):te(te(this).R(n));if(be(n))return te(this.R(te(n)));if(0>this.X($u)&&0>n.X($u))return qe(this.ea()*n.ea());for(var e=this.g.length+n.g.length,t=[],r=0;r<2*e;r++)t[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<n.g.length;s++){var i=this.D(r)>>>16,o=this.D(r)&65535,a=n.D(s)>>>16,c=n.D(s)&65535;t[2*r+2*s]+=o*c,Es(t,2*r+2*s),t[2*r+2*s+1]+=i*c,Es(t,2*r+2*s+1),t[2*r+2*s+1]+=o*a,Es(t,2*r+2*s+1),t[2*r+2*s+2]+=i*a,Es(t,2*r+2*s+2)}for(r=0;r<e;r++)t[r]=t[2*r+1]<<16|t[2*r];for(r=e;r<2*e;r++)t[r]=0;return new U(t,0)};function Es(n,e){for(;(n[e]&65535)!=n[e];)n[e+1]+=n[e]>>>16,n[e]&=65535,e++}function lr(n,e){this.g=n,this.h=e}function Ts(n,e){if(tt(e))throw Error("division by zero");if(tt(n))return new lr(rn,rn);if(be(n))return e=Ts(te(n),e),new lr(te(e.g),te(e.h));if(be(e))return e=Ts(n,te(e)),new lr(te(e.g),e.h);if(30<n.g.length){if(be(n)||be(e))throw Error("slowDivide_ only works with positive integers.");for(var t=Ro,r=e;0>=r.X(n);)t=zu(t),r=zu(r);var s=sn(t,1),i=sn(r,1);for(r=sn(r,2),t=sn(t,2);!tt(r);){var o=i.add(r);0>=o.X(n)&&(s=s.add(t),i=o),r=sn(r,1),t=sn(t,1)}return e=vs(n,s.R(e)),new lr(s,e)}for(s=rn;0<=n.X(e);){for(t=Math.max(1,Math.floor(n.ea()/e.ea())),r=Math.ceil(Math.log(t)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),i=qe(t),o=i.R(e);be(o)||0<o.X(n);)t-=r,i=qe(t),o=i.R(e);tt(i)&&(i=Ro),s=s.add(i),n=vs(n,o)}return new lr(s,n)}y.gb=function(n){return Ts(this,n).h},y.and=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)&n.D(r);return new U(t,this.h&n.h)},y.or=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)|n.D(r);return new U(t,this.h|n.h)},y.xor=function(n){for(var e=Math.max(this.g.length,n.g.length),t=[],r=0;r<e;r++)t[r]=this.D(r)^n.D(r);return new U(t,this.h^n.h)};function zu(n){for(var e=n.g.length+1,t=[],r=0;r<e;r++)t[r]=n.D(r)<<1|n.D(r-1)>>>31;return new U(t,n.h)}function sn(n,e){var t=e>>5;e%=32;for(var r=n.g.length-t,s=[],i=0;i<r;i++)s[i]=0<e?n.D(i+t)>>>e|n.D(i+t+1)<<32-e:n.D(i+t);return new U(s,n.h)}ys.prototype.createWebChannel=ys.prototype.g,we.prototype.send=we.prototype.u,we.prototype.open=we.prototype.m,we.prototype.close=we.prototype.close,is.NO_ERROR=0,is.TIMEOUT=8,is.HTTP_ERROR=6,Zc.COMPLETE="complete",tu.EventType=Zn,Zn.OPEN="a",Zn.CLOSE="b",Zn.ERROR="c",Zn.MESSAGE="d",J.prototype.listen=J.prototype.O,H.prototype.listenOnce=H.prototype.P,H.prototype.getLastError=H.prototype.Sa,H.prototype.getLastErrorCode=H.prototype.Ia,H.prototype.getStatus=H.prototype.da,H.prototype.getResponseJson=H.prototype.Wa,H.prototype.getResponseText=H.prototype.ja,H.prototype.send=H.prototype.ha,H.prototype.setWithCredentials=H.prototype.Oa,Ne.prototype.digest=Ne.prototype.l,Ne.prototype.reset=Ne.prototype.reset,Ne.prototype.update=Ne.prototype.j,U.prototype.add=U.prototype.add,U.prototype.multiply=U.prototype.R,U.prototype.modulo=U.prototype.gb,U.prototype.compare=U.prototype.X,U.prototype.toNumber=U.prototype.ea,U.prototype.toString=U.prototype.toString,U.prototype.getBits=U.prototype.D,U.fromNumber=qe,U.fromString=qu;var vg=function(){return new ys},Eg=function(){return ss()},Po=is,Tg=Zc,wg=Ot,Hu={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},ws=tu,Ig=H,Ag=Ne,on=U;const Wu="@firebase/firestore";/**
|
|
361
|
+
*/function Dm(n){bt(new ht("platform-logger",e=>new Hp(e),"PRIVATE")),bt(new ht("heartbeat",e=>new Sm(e),"PRIVATE")),qe(Hi,_c,n),qe(Hi,_c,"esm2017"),qe("fire-js","")}Dm("");var Rc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
362
|
+
Copyright The Closure Library Authors.
|
|
363
|
+
SPDX-License-Identifier: Apache-2.0
|
|
364
|
+
*/var St,bc;(function(){var n;/** @license
|
|
365
|
+
|
|
366
|
+
Copyright The Closure Library Authors.
|
|
367
|
+
SPDX-License-Identifier: Apache-2.0
|
|
368
|
+
*/function e(T,g){function _(){}_.prototype=g.prototype,T.D=g.prototype,T.prototype=new _,T.prototype.constructor=T,T.C=function(E,w,A){for(var y=Array(arguments.length-2),wt=2;wt<arguments.length;wt++)y[wt-2]=arguments[wt];return g.prototype[w].apply(E,y)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,t),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(T,g,_){_||(_=0);var E=Array(16);if(typeof g=="string")for(var w=0;16>w;++w)E[w]=g.charCodeAt(_++)|g.charCodeAt(_++)<<8|g.charCodeAt(_++)<<16|g.charCodeAt(_++)<<24;else for(w=0;16>w;++w)E[w]=g[_++]|g[_++]<<8|g[_++]<<16|g[_++]<<24;g=T.g[0],_=T.g[1],w=T.g[2];var A=T.g[3],y=g+(A^_&(w^A))+E[0]+3614090360&4294967295;g=_+(y<<7&4294967295|y>>>25),y=A+(w^g&(_^w))+E[1]+3905402710&4294967295,A=g+(y<<12&4294967295|y>>>20),y=w+(_^A&(g^_))+E[2]+606105819&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(g^w&(A^g))+E[3]+3250441966&4294967295,_=w+(y<<22&4294967295|y>>>10),y=g+(A^_&(w^A))+E[4]+4118548399&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(w^g&(_^w))+E[5]+1200080426&4294967295,A=g+(y<<12&4294967295|y>>>20),y=w+(_^A&(g^_))+E[6]+2821735955&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(g^w&(A^g))+E[7]+4249261313&4294967295,_=w+(y<<22&4294967295|y>>>10),y=g+(A^_&(w^A))+E[8]+1770035416&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(w^g&(_^w))+E[9]+2336552879&4294967295,A=g+(y<<12&4294967295|y>>>20),y=w+(_^A&(g^_))+E[10]+4294925233&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(g^w&(A^g))+E[11]+2304563134&4294967295,_=w+(y<<22&4294967295|y>>>10),y=g+(A^_&(w^A))+E[12]+1804603682&4294967295,g=_+(y<<7&4294967295|y>>>25),y=A+(w^g&(_^w))+E[13]+4254626195&4294967295,A=g+(y<<12&4294967295|y>>>20),y=w+(_^A&(g^_))+E[14]+2792965006&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(g^w&(A^g))+E[15]+1236535329&4294967295,_=w+(y<<22&4294967295|y>>>10),y=g+(w^A&(_^w))+E[1]+4129170786&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(g^_))+E[6]+3225465664&4294967295,A=g+(y<<9&4294967295|y>>>23),y=w+(g^_&(A^g))+E[11]+643717713&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(w^A))+E[0]+3921069994&4294967295,_=w+(y<<20&4294967295|y>>>12),y=g+(w^A&(_^w))+E[5]+3593408605&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(g^_))+E[10]+38016083&4294967295,A=g+(y<<9&4294967295|y>>>23),y=w+(g^_&(A^g))+E[15]+3634488961&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(w^A))+E[4]+3889429448&4294967295,_=w+(y<<20&4294967295|y>>>12),y=g+(w^A&(_^w))+E[9]+568446438&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(g^_))+E[14]+3275163606&4294967295,A=g+(y<<9&4294967295|y>>>23),y=w+(g^_&(A^g))+E[3]+4107603335&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(w^A))+E[8]+1163531501&4294967295,_=w+(y<<20&4294967295|y>>>12),y=g+(w^A&(_^w))+E[13]+2850285829&4294967295,g=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(g^_))+E[2]+4243563512&4294967295,A=g+(y<<9&4294967295|y>>>23),y=w+(g^_&(A^g))+E[7]+1735328473&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^g&(w^A))+E[12]+2368359562&4294967295,_=w+(y<<20&4294967295|y>>>12),y=g+(_^w^A)+E[5]+4294588738&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^w)+E[8]+2272392833&4294967295,A=g+(y<<11&4294967295|y>>>21),y=w+(A^g^_)+E[11]+1839030562&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^g)+E[14]+4259657740&4294967295,_=w+(y<<23&4294967295|y>>>9),y=g+(_^w^A)+E[1]+2763975236&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^w)+E[4]+1272893353&4294967295,A=g+(y<<11&4294967295|y>>>21),y=w+(A^g^_)+E[7]+4139469664&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^g)+E[10]+3200236656&4294967295,_=w+(y<<23&4294967295|y>>>9),y=g+(_^w^A)+E[13]+681279174&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^w)+E[0]+3936430074&4294967295,A=g+(y<<11&4294967295|y>>>21),y=w+(A^g^_)+E[3]+3572445317&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^g)+E[6]+76029189&4294967295,_=w+(y<<23&4294967295|y>>>9),y=g+(_^w^A)+E[9]+3654602809&4294967295,g=_+(y<<4&4294967295|y>>>28),y=A+(g^_^w)+E[12]+3873151461&4294967295,A=g+(y<<11&4294967295|y>>>21),y=w+(A^g^_)+E[15]+530742520&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^g)+E[2]+3299628645&4294967295,_=w+(y<<23&4294967295|y>>>9),y=g+(w^(_|~A))+E[0]+4096336452&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~w))+E[7]+1126891415&4294967295,A=g+(y<<10&4294967295|y>>>22),y=w+(g^(A|~_))+E[14]+2878612391&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~g))+E[5]+4237533241&4294967295,_=w+(y<<21&4294967295|y>>>11),y=g+(w^(_|~A))+E[12]+1700485571&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~w))+E[3]+2399980690&4294967295,A=g+(y<<10&4294967295|y>>>22),y=w+(g^(A|~_))+E[10]+4293915773&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~g))+E[1]+2240044497&4294967295,_=w+(y<<21&4294967295|y>>>11),y=g+(w^(_|~A))+E[8]+1873313359&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~w))+E[15]+4264355552&4294967295,A=g+(y<<10&4294967295|y>>>22),y=w+(g^(A|~_))+E[6]+2734768916&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~g))+E[13]+1309151649&4294967295,_=w+(y<<21&4294967295|y>>>11),y=g+(w^(_|~A))+E[4]+4149444226&4294967295,g=_+(y<<6&4294967295|y>>>26),y=A+(_^(g|~w))+E[11]+3174756917&4294967295,A=g+(y<<10&4294967295|y>>>22),y=w+(g^(A|~_))+E[2]+718787259&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~g))+E[9]+3951481745&4294967295,T.g[0]=T.g[0]+g&4294967295,T.g[1]=T.g[1]+(w+(y<<21&4294967295|y>>>11))&4294967295,T.g[2]=T.g[2]+w&4294967295,T.g[3]=T.g[3]+A&4294967295}r.prototype.u=function(T,g){g===void 0&&(g=T.length);for(var _=g-this.blockSize,E=this.B,w=this.h,A=0;A<g;){if(w==0)for(;A<=_;)s(this,T,A),A+=this.blockSize;if(typeof T=="string"){for(;A<g;)if(E[w++]=T.charCodeAt(A++),w==this.blockSize){s(this,E),w=0;break}}else for(;A<g;)if(E[w++]=T[A++],w==this.blockSize){s(this,E),w=0;break}}this.h=w,this.o+=g},r.prototype.v=function(){var T=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);T[0]=128;for(var g=1;g<T.length-8;++g)T[g]=0;var _=8*this.o;for(g=T.length-8;g<T.length;++g)T[g]=_&255,_/=256;for(this.u(T),T=Array(16),g=_=0;4>g;++g)for(var E=0;32>E;E+=8)T[_++]=this.g[g]>>>E&255;return T};function i(T,g){var _=c;return Object.prototype.hasOwnProperty.call(_,T)?_[T]:_[T]=g(T)}function a(T,g){this.h=g;for(var _=[],E=!0,w=T.length-1;0<=w;w--){var A=T[w]|0;E&&A==g||(_[w]=A,E=!1)}this.g=_}var c={};function l(T){return-128<=T&&128>T?i(T,function(g){return new a([g|0],0>g?-1:0)}):new a([T|0],0>T?-1:0)}function d(T){if(isNaN(T)||!isFinite(T))return m;if(0>T)return k(d(-T));for(var g=[],_=1,E=0;T>=_;E++)g[E]=T/_|0,_*=4294967296;return new a(g,0)}function f(T,g){if(T.length==0)throw Error("number format error: empty string");if(g=g||10,2>g||36<g)throw Error("radix out of range: "+g);if(T.charAt(0)=="-")return k(f(T.substring(1),g));if(0<=T.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=d(Math.pow(g,8)),E=m,w=0;w<T.length;w+=8){var A=Math.min(8,T.length-w),y=parseInt(T.substring(w,w+A),g);8>A?(A=d(Math.pow(g,A)),E=E.j(A).add(d(y))):(E=E.j(_),E=E.add(d(y)))}return E}var m=l(0),v=l(1),R=l(16777216);n=a.prototype,n.m=function(){if(N(this))return-k(this).m();for(var T=0,g=1,_=0;_<this.g.length;_++){var E=this.i(_);T+=(0<=E?E:4294967296+E)*g,g*=4294967296}return T},n.toString=function(T){if(T=T||10,2>T||36<T)throw Error("radix out of range: "+T);if(S(this))return"0";if(N(this))return"-"+k(this).toString(T);for(var g=d(Math.pow(T,6)),_=this,E="";;){var w=H(_,g).g;_=U(_,w.j(g));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(T);if(_=w,S(_))return A+E;for(;6>A.length;)A="0"+A;E=A+E}},n.i=function(T){return 0>T?0:T<this.g.length?this.g[T]:this.h};function S(T){if(T.h!=0)return!1;for(var g=0;g<T.g.length;g++)if(T.g[g]!=0)return!1;return!0}function N(T){return T.h==-1}n.l=function(T){return T=U(this,T),N(T)?-1:S(T)?0:1};function k(T){for(var g=T.g.length,_=[],E=0;E<g;E++)_[E]=~T.g[E];return new a(_,~T.h).add(v)}n.abs=function(){return N(this)?k(this):this},n.add=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],E=0,w=0;w<=g;w++){var A=E+(this.i(w)&65535)+(T.i(w)&65535),y=(A>>>16)+(this.i(w)>>>16)+(T.i(w)>>>16);E=y>>>16,A&=65535,y&=65535,_[w]=y<<16|A}return new a(_,_[_.length-1]&-2147483648?-1:0)};function U(T,g){return T.add(k(g))}n.j=function(T){if(S(this)||S(T))return m;if(N(this))return N(T)?k(this).j(k(T)):k(k(this).j(T));if(N(T))return k(this.j(k(T)));if(0>this.l(R)&&0>T.l(R))return d(this.m()*T.m());for(var g=this.g.length+T.g.length,_=[],E=0;E<2*g;E++)_[E]=0;for(E=0;E<this.g.length;E++)for(var w=0;w<T.g.length;w++){var A=this.i(E)>>>16,y=this.i(E)&65535,wt=T.i(w)>>>16,Vr=T.i(w)&65535;_[2*E+2*w]+=y*Vr,$(_,2*E+2*w),_[2*E+2*w+1]+=A*Vr,$(_,2*E+2*w+1),_[2*E+2*w+1]+=y*wt,$(_,2*E+2*w+1),_[2*E+2*w+2]+=A*wt,$(_,2*E+2*w+2)}for(E=0;E<g;E++)_[E]=_[2*E+1]<<16|_[2*E];for(E=g;E<2*g;E++)_[E]=0;return new a(_,0)};function $(T,g){for(;(T[g]&65535)!=T[g];)T[g+1]+=T[g]>>>16,T[g]&=65535,g++}function x(T,g){this.g=T,this.h=g}function H(T,g){if(S(g))throw Error("division by zero");if(S(T))return new x(m,m);if(N(T))return g=H(k(T),g),new x(k(g.g),k(g.h));if(N(g))return g=H(T,k(g)),new x(k(g.g),g.h);if(30<T.g.length){if(N(T)||N(g))throw Error("slowDivide_ only works with positive integers.");for(var _=v,E=g;0>=E.l(T);)_=he(_),E=he(E);var w=J(_,1),A=J(E,1);for(E=J(E,2),_=J(_,2);!S(E);){var y=A.add(E);0>=y.l(T)&&(w=w.add(_),A=y),E=J(E,1),_=J(_,1)}return g=U(T,w.j(g)),new x(w,g)}for(w=m;0<=T.l(g);){for(_=Math.max(1,Math.floor(T.m()/g.m())),E=Math.ceil(Math.log(_)/Math.LN2),E=48>=E?1:Math.pow(2,E-48),A=d(_),y=A.j(g);N(y)||0<y.l(T);)_-=E,A=d(_),y=A.j(g);S(A)&&(A=v),w=w.add(A),T=U(T,y)}return new x(w,T)}n.A=function(T){return H(this,T).h},n.and=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],E=0;E<g;E++)_[E]=this.i(E)&T.i(E);return new a(_,this.h&T.h)},n.or=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],E=0;E<g;E++)_[E]=this.i(E)|T.i(E);return new a(_,this.h|T.h)},n.xor=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],E=0;E<g;E++)_[E]=this.i(E)^T.i(E);return new a(_,this.h^T.h)};function he(T){for(var g=T.g.length+1,_=[],E=0;E<g;E++)_[E]=T.i(E)<<1|T.i(E-1)>>>31;return new a(_,T.h)}function J(T,g){var _=g>>5;g%=32;for(var E=T.g.length-_,w=[],A=0;A<E;A++)w[A]=0<g?T.i(A+_)>>>g|T.i(A+_+1)<<32-g:T.i(A+_);return new a(w,T.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,bc=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=f,St=a}).apply(typeof Rc<"u"?Rc:typeof self<"u"?self:typeof window<"u"?window:{});var ns=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
369
|
+
Copyright The Closure Library Authors.
|
|
370
|
+
SPDX-License-Identifier: Apache-2.0
|
|
371
|
+
*/var Pc,sr,Sc,rs,Ki,Cc,kc,Nc;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,u,h){return o==Array.prototype||o==Object.prototype||(o[u]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof ns=="object"&&ns];for(var u=0;u<o.length;++u){var h=o[u];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function s(o,u){if(u)e:{var h=r;o=o.split(".");for(var p=0;p<o.length-1;p++){var I=o[p];if(!(I in h))break e;h=h[I]}o=o[o.length-1],p=h[o],u=u(p),u!=p&&u!=null&&e(h,o,{configurable:!0,writable:!0,value:u})}}function i(o,u){o instanceof String&&(o+="");var h=0,p=!1,I={next:function(){if(!p&&h<o.length){var b=h++;return{value:u(b,o[b]),done:!1}}return p=!0,{done:!0,value:void 0}}};return I[Symbol.iterator]=function(){return I},I}s("Array.prototype.values",function(o){return o||function(){return i(this,function(u,h){return h})}});/** @license
|
|
372
|
+
|
|
373
|
+
Copyright The Closure Library Authors.
|
|
374
|
+
SPDX-License-Identifier: Apache-2.0
|
|
375
|
+
*/var a=a||{},c=this||self;function l(o){var u=typeof o;return u=u!="object"?u:o?Array.isArray(o)?"array":u:"null",u=="array"||u=="object"&&typeof o.length=="number"}function d(o){var u=typeof o;return u=="object"&&o!=null||u=="function"}function f(o,u,h){return o.call.apply(o.bind,arguments)}function m(o,u,h){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var I=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(I,p),o.apply(u,I)}}return function(){return o.apply(u,arguments)}}function v(o,u,h){return v=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:m,v.apply(null,arguments)}function R(o,u){var h=Array.prototype.slice.call(arguments,1);return function(){var p=h.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function S(o,u){function h(){}h.prototype=u.prototype,o.aa=u.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(p,I,b){for(var D=Array(arguments.length-2),Z=2;Z<arguments.length;Z++)D[Z-2]=arguments[Z];return u.prototype[I].apply(p,D)}}function N(o){const u=o.length;if(0<u){const h=Array(u);for(let p=0;p<u;p++)h[p]=o[p];return h}return[]}function k(o,u){for(let h=1;h<arguments.length;h++){const p=arguments[h];if(l(p)){const I=o.length||0,b=p.length||0;o.length=I+b;for(let D=0;D<b;D++)o[I+D]=p[D]}else o.push(p)}}class U{constructor(u,h){this.i=u,this.j=h,this.h=0,this.g=null}get(){let u;return 0<this.h?(this.h--,u=this.g,this.g=u.next,u.next=null):u=this.i(),u}}function $(o){return/^[\s\xa0]*$/.test(o)}function x(){var o=c.navigator;return o&&(o=o.userAgent)?o:""}function H(o){return H[" "](o),o}H[" "]=function(){};var he=x().indexOf("Gecko")!=-1&&!(x().toLowerCase().indexOf("webkit")!=-1&&x().indexOf("Edge")==-1)&&!(x().indexOf("Trident")!=-1||x().indexOf("MSIE")!=-1)&&x().indexOf("Edge")==-1;function J(o,u,h){for(const p in o)u.call(h,o[p],p,o)}function T(o,u){for(const h in o)u.call(void 0,o[h],h,o)}function g(o){const u={};for(const h in o)u[h]=o[h];return u}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function E(o,u){let h,p;for(let I=1;I<arguments.length;I++){p=arguments[I];for(h in p)o[h]=p[h];for(let b=0;b<_.length;b++)h=_[b],Object.prototype.hasOwnProperty.call(p,h)&&(o[h]=p[h])}}function w(o){var u=1;o=o.split(":");const h=[];for(;0<u&&o.length;)h.push(o.shift()),u--;return o.length&&h.push(o.join(":")),h}function A(o){c.setTimeout(()=>{throw o},0)}function y(){var o=La;let u=null;return o.g&&(u=o.g,o.g=o.g.next,o.g||(o.h=null),u.next=null),u}class wt{constructor(){this.h=this.g=null}add(u,h){const p=Vr.get();p.set(u,h),this.h?this.h.next=p:this.g=p,this.h=p}}var Vr=new U(()=>new bI,o=>o.reset());class bI{constructor(){this.next=this.g=this.h=null}set(u,h){this.h=u,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let Lr,Mr=!1,La=new wt,Zd=()=>{const o=c.Promise.resolve(void 0);Lr=()=>{o.then(PI)}};var PI=()=>{for(var o;o=y();){try{o.h.call(o.g)}catch(h){A(h)}var u=Vr;u.j(o),100>u.h&&(u.h++,o.next=u.g,u.g=o)}Mr=!1};function zt(){this.s=this.s,this.C=this.C}zt.prototype.s=!1,zt.prototype.ma=function(){this.s||(this.s=!0,this.N())},zt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function Re(o,u){this.type=o,this.g=this.target=u,this.defaultPrevented=!1}Re.prototype.h=function(){this.defaultPrevented=!0};var SI=function(){if(!c.addEventListener||!Object.defineProperty)return!1;var o=!1,u=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};c.addEventListener("test",h,u),c.removeEventListener("test",h,u)}catch{}return o}();function Ur(o,u){if(Re.call(this,o?o.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,o){var h=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=u,u=o.relatedTarget){if(he){e:{try{H(u.nodeName);var I=!0;break e}catch{}I=!1}I||(u=null)}}else h=="mouseover"?u=o.fromElement:h=="mouseout"&&(u=o.toElement);this.relatedTarget=u,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:CI[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&Ur.aa.h.call(this)}}S(Ur,Re);var CI={2:"touch",3:"pen",4:"mouse"};Ur.prototype.h=function(){Ur.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var gi="closure_listenable_"+(1e6*Math.random()|0),kI=0;function NI(o,u,h,p,I){this.listener=o,this.proxy=null,this.src=u,this.type=h,this.capture=!!p,this.ha=I,this.key=++kI,this.da=this.fa=!1}function _i(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function yi(o){this.src=o,this.g={},this.h=0}yi.prototype.add=function(o,u,h,p,I){var b=o.toString();o=this.g[b],o||(o=this.g[b]=[],this.h++);var D=Ua(o,u,p,I);return-1<D?(u=o[D],h||(u.fa=!1)):(u=new NI(u,this.src,b,!!p,I),u.fa=h,o.push(u)),u};function Ma(o,u){var h=u.type;if(h in o.g){var p=o.g[h],I=Array.prototype.indexOf.call(p,u,void 0),b;(b=0<=I)&&Array.prototype.splice.call(p,I,1),b&&(_i(u),o.g[h].length==0&&(delete o.g[h],o.h--))}}function Ua(o,u,h,p){for(var I=0;I<o.length;++I){var b=o[I];if(!b.da&&b.listener==u&&b.capture==!!h&&b.ha==p)return I}return-1}var xa="closure_lm_"+(1e6*Math.random()|0),Fa={};function ef(o,u,h,p,I){if(Array.isArray(u)){for(var b=0;b<u.length;b++)ef(o,u[b],h,p,I);return null}return h=rf(h),o&&o[gi]?o.K(u,h,d(p)?!!p.capture:!1,I):DI(o,u,h,!1,p,I)}function DI(o,u,h,p,I,b){if(!u)throw Error("Invalid event type");var D=d(I)?!!I.capture:!!I,Z=ja(o);if(Z||(o[xa]=Z=new yi(o)),h=Z.add(u,h,p,D,b),h.proxy)return h;if(p=OI(),h.proxy=p,p.src=o,p.listener=h,o.addEventListener)SI||(I=D),I===void 0&&(I=!1),o.addEventListener(u.toString(),p,I);else if(o.attachEvent)o.attachEvent(nf(u.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return h}function OI(){function o(h){return u.call(o.src,o.listener,h)}const u=VI;return o}function tf(o,u,h,p,I){if(Array.isArray(u))for(var b=0;b<u.length;b++)tf(o,u[b],h,p,I);else p=d(p)?!!p.capture:!!p,h=rf(h),o&&o[gi]?(o=o.i,u=String(u).toString(),u in o.g&&(b=o.g[u],h=Ua(b,h,p,I),-1<h&&(_i(b[h]),Array.prototype.splice.call(b,h,1),b.length==0&&(delete o.g[u],o.h--)))):o&&(o=ja(o))&&(u=o.g[u.toString()],o=-1,u&&(o=Ua(u,h,p,I)),(h=-1<o?u[o]:null)&&Ba(h))}function Ba(o){if(typeof o!="number"&&o&&!o.da){var u=o.src;if(u&&u[gi])Ma(u.i,o);else{var h=o.type,p=o.proxy;u.removeEventListener?u.removeEventListener(h,p,o.capture):u.detachEvent?u.detachEvent(nf(h),p):u.addListener&&u.removeListener&&u.removeListener(p),(h=ja(u))?(Ma(h,o),h.h==0&&(h.src=null,u[xa]=null)):_i(o)}}}function nf(o){return o in Fa?Fa[o]:Fa[o]="on"+o}function VI(o,u){if(o.da)o=!0;else{u=new Ur(u,this);var h=o.listener,p=o.ha||o.src;o.fa&&Ba(o),o=h.call(p,u)}return o}function ja(o){return o=o[xa],o instanceof yi?o:null}var qa="__closure_events_fn_"+(1e9*Math.random()>>>0);function rf(o){return typeof o=="function"?o:(o[qa]||(o[qa]=function(u){return o.handleEvent(u)}),o[qa])}function be(){zt.call(this),this.i=new yi(this),this.M=this,this.F=null}S(be,zt),be.prototype[gi]=!0,be.prototype.removeEventListener=function(o,u,h,p){tf(this,o,u,h,p)};function ke(o,u){var h,p=o.F;if(p)for(h=[];p;p=p.F)h.push(p);if(o=o.M,p=u.type||u,typeof u=="string")u=new Re(u,o);else if(u instanceof Re)u.target=u.target||o;else{var I=u;u=new Re(p,o),E(u,I)}if(I=!0,h)for(var b=h.length-1;0<=b;b--){var D=u.g=h[b];I=vi(D,p,!0,u)&&I}if(D=u.g=o,I=vi(D,p,!0,u)&&I,I=vi(D,p,!1,u)&&I,h)for(b=0;b<h.length;b++)D=u.g=h[b],I=vi(D,p,!1,u)&&I}be.prototype.N=function(){if(be.aa.N.call(this),this.i){var o=this.i,u;for(u in o.g){for(var h=o.g[u],p=0;p<h.length;p++)_i(h[p]);delete o.g[u],o.h--}}this.F=null},be.prototype.K=function(o,u,h,p){return this.i.add(String(o),u,!1,h,p)},be.prototype.L=function(o,u,h,p){return this.i.add(String(o),u,!0,h,p)};function vi(o,u,h,p){if(u=o.i.g[String(u)],!u)return!0;u=u.concat();for(var I=!0,b=0;b<u.length;++b){var D=u[b];if(D&&!D.da&&D.capture==h){var Z=D.listener,ve=D.ha||D.src;D.fa&&Ma(o.i,D),I=Z.call(ve,p)!==!1&&I}}return I&&!p.defaultPrevented}function sf(o,u,h){if(typeof o=="function")h&&(o=v(o,h));else if(o&&typeof o.handleEvent=="function")o=v(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(u)?-1:c.setTimeout(o,u||0)}function of(o){o.g=sf(()=>{o.g=null,o.i&&(o.i=!1,of(o))},o.l);const u=o.h;o.h=null,o.m.apply(null,u)}class LI extends zt{constructor(u,h){super(),this.m=u,this.l=h,this.h=null,this.i=!1,this.g=null}j(u){this.h=arguments,this.g?this.i=!0:of(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function xr(o){zt.call(this),this.h=o,this.g={}}S(xr,zt);var af=[];function cf(o){J(o.g,function(u,h){this.g.hasOwnProperty(h)&&Ba(u)},o),o.g={}}xr.prototype.N=function(){xr.aa.N.call(this),cf(this)},xr.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var $a=c.JSON.stringify,MI=c.JSON.parse,UI=class{stringify(o){return c.JSON.stringify(o,void 0)}parse(o){return c.JSON.parse(o,void 0)}};function Ha(){}Ha.prototype.h=null;function uf(o){return o.h||(o.h=o.i())}function lf(){}var Fr={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function za(){Re.call(this,"d")}S(za,Re);function Wa(){Re.call(this,"c")}S(Wa,Re);var hn={},hf=null;function Ei(){return hf=hf||new be}hn.La="serverreachability";function df(o){Re.call(this,hn.La,o)}S(df,Re);function Br(o){const u=Ei();ke(u,new df(u))}hn.STAT_EVENT="statevent";function ff(o,u){Re.call(this,hn.STAT_EVENT,o),this.stat=u}S(ff,Re);function Ne(o){const u=Ei();ke(u,new ff(u,o))}hn.Ma="timingevent";function pf(o,u){Re.call(this,hn.Ma,o),this.size=u}S(pf,Re);function jr(o,u){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){o()},u)}function qr(){this.g=!0}qr.prototype.xa=function(){this.g=!1};function xI(o,u,h,p,I,b){o.info(function(){if(o.g)if(b)for(var D="",Z=b.split("&"),ve=0;ve<Z.length;ve++){var Q=Z[ve].split("=");if(1<Q.length){var Pe=Q[0];Q=Q[1];var Se=Pe.split("_");D=2<=Se.length&&Se[1]=="type"?D+(Pe+"="+Q+"&"):D+(Pe+"=redacted&")}}else D=null;else D=b;return"XMLHTTP REQ ("+p+") [attempt "+I+"]: "+u+`
|
|
376
|
+
`+h+`
|
|
377
|
+
`+D})}function FI(o,u,h,p,I,b,D){o.info(function(){return"XMLHTTP RESP ("+p+") [ attempt "+I+"]: "+u+`
|
|
378
|
+
`+h+`
|
|
379
|
+
`+b+" "+D})}function Wn(o,u,h,p){o.info(function(){return"XMLHTTP TEXT ("+u+"): "+jI(o,h)+(p?" "+p:"")})}function BI(o,u){o.info(function(){return"TIMEOUT: "+u})}qr.prototype.info=function(){};function jI(o,u){if(!o.g)return u;if(!u)return null;try{var h=JSON.parse(u);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var p=h[o];if(!(2>p.length)){var I=p[1];if(Array.isArray(I)&&!(1>I.length)){var b=I[0];if(b!="noop"&&b!="stop"&&b!="close")for(var D=1;D<I.length;D++)I[D]=""}}}}return $a(h)}catch{return u}}var Ti={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},mf={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Ga;function wi(){}S(wi,Ha),wi.prototype.g=function(){return new XMLHttpRequest},wi.prototype.i=function(){return{}},Ga=new wi;function Wt(o,u,h,p){this.j=o,this.i=u,this.l=h,this.R=p||1,this.U=new xr(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new gf}function gf(){this.i=null,this.g="",this.h=!1}var _f={},Ka={};function Qa(o,u,h){o.L=1,o.v=bi(It(u)),o.m=h,o.P=!0,yf(o,null)}function yf(o,u){o.F=Date.now(),Ii(o),o.A=It(o.v);var h=o.A,p=o.R;Array.isArray(p)||(p=[String(p)]),Df(h.i,"t",p),o.C=0,h=o.j.J,o.h=new gf,o.g=Xf(o.j,h?u:null,!o.m),0<o.O&&(o.M=new LI(v(o.Y,o,o.g),o.O)),u=o.U,h=o.g,p=o.ca;var I="readystatechange";Array.isArray(I)||(I&&(af[0]=I.toString()),I=af);for(var b=0;b<I.length;b++){var D=ef(h,I[b],p||u.handleEvent,!1,u.h||u);if(!D)break;u.g[D.key]=D}u=o.H?g(o.H):{},o.m?(o.u||(o.u="POST"),u["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,u)):(o.u="GET",o.g.ea(o.A,o.u,null,u)),Br(),xI(o.i,o.u,o.A,o.l,o.R,o.m)}Wt.prototype.ca=function(o){o=o.target;const u=this.M;u&&At(o)==3?u.j():this.Y(o)},Wt.prototype.Y=function(o){try{if(o==this.g)e:{const Se=At(this.g);var u=this.g.Ba();const Qn=this.g.Z();if(!(3>Se)&&(Se!=3||this.g&&(this.h.h||this.g.oa()||Ff(this.g)))){this.J||Se!=4||u==7||(u==8||0>=Qn?Br(3):Br(2)),Xa(this);var h=this.g.Z();this.X=h;t:if(vf(this)){var p=Ff(this.g);o="";var I=p.length,b=At(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){dn(this),$r(this);var D="";break t}this.h.i=new c.TextDecoder}for(u=0;u<I;u++)this.h.h=!0,o+=this.h.i.decode(p[u],{stream:!(b&&u==I-1)});p.length=0,this.h.g+=o,this.C=0,D=this.h.g}else D=this.g.oa();if(this.o=h==200,FI(this.i,this.u,this.A,this.l,this.R,Se,h),this.o){if(this.T&&!this.K){t:{if(this.g){var Z,ve=this.g;if((Z=ve.g?ve.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!$(Z)){var Q=Z;break t}}Q=null}if(h=Q)Wn(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ya(this,h);else{this.o=!1,this.s=3,Ne(12),dn(this),$r(this);break e}}if(this.P){h=!0;let Je;for(;!this.J&&this.C<D.length;)if(Je=qI(this,D),Je==Ka){Se==4&&(this.s=4,Ne(14),h=!1),Wn(this.i,this.l,null,"[Incomplete Response]");break}else if(Je==_f){this.s=4,Ne(15),Wn(this.i,this.l,D,"[Invalid Chunk]"),h=!1;break}else Wn(this.i,this.l,Je,null),Ya(this,Je);if(vf(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Se!=4||D.length!=0||this.h.h||(this.s=1,Ne(16),h=!1),this.o=this.o&&h,!h)Wn(this.i,this.l,D,"[Invalid Chunked Response]"),dn(this),$r(this);else if(0<D.length&&!this.W){this.W=!0;var Pe=this.j;Pe.g==this&&Pe.ba&&!Pe.M&&(Pe.j.info("Great, no buffering proxy detected. Bytes received: "+D.length),rc(Pe),Pe.M=!0,Ne(11))}}else Wn(this.i,this.l,D,null),Ya(this,D);Se==4&&dn(this),this.o&&!this.J&&(Se==4?Wf(this.j,this):(this.o=!1,Ii(this)))}else iA(this.g),h==400&&0<D.indexOf("Unknown SID")?(this.s=3,Ne(12)):(this.s=0,Ne(13)),dn(this),$r(this)}}}catch{}finally{}};function vf(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function qI(o,u){var h=o.C,p=u.indexOf(`
|
|
380
|
+
`,h);return p==-1?Ka:(h=Number(u.substring(h,p)),isNaN(h)?_f:(p+=1,p+h>u.length?Ka:(u=u.slice(p,p+h),o.C=p+h,u)))}Wt.prototype.cancel=function(){this.J=!0,dn(this)};function Ii(o){o.S=Date.now()+o.I,Ef(o,o.I)}function Ef(o,u){if(o.B!=null)throw Error("WatchDog timer not null");o.B=jr(v(o.ba,o),u)}function Xa(o){o.B&&(c.clearTimeout(o.B),o.B=null)}Wt.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(BI(this.i,this.A),this.L!=2&&(Br(),Ne(17)),dn(this),this.s=2,$r(this)):Ef(this,this.S-o)};function $r(o){o.j.G==0||o.J||Wf(o.j,o)}function dn(o){Xa(o);var u=o.M;u&&typeof u.ma=="function"&&u.ma(),o.M=null,cf(o.U),o.g&&(u=o.g,o.g=null,u.abort(),u.ma())}function Ya(o,u){try{var h=o.j;if(h.G!=0&&(h.g==o||Ja(h.h,o))){if(!o.K&&Ja(h.h,o)&&h.G==3){try{var p=h.Da.g.parse(u)}catch{p=null}if(Array.isArray(p)&&p.length==3){var I=p;if(I[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)Di(h),ki(h);else break e;nc(h),Ne(18)}}else h.za=I[1],0<h.za-h.T&&37500>I[2]&&h.F&&h.v==0&&!h.C&&(h.C=jr(v(h.Za,h),6e3));if(1>=If(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else pn(h,11)}else if((o.K||h.g==o)&&Di(h),!$(u))for(I=h.Da.g.parse(u),u=0;u<I.length;u++){let Q=I[u];if(h.T=Q[0],Q=Q[1],h.G==2)if(Q[0]=="c"){h.K=Q[1],h.ia=Q[2];const Pe=Q[3];Pe!=null&&(h.la=Pe,h.j.info("VER="+h.la));const Se=Q[4];Se!=null&&(h.Aa=Se,h.j.info("SVER="+h.Aa));const Qn=Q[5];Qn!=null&&typeof Qn=="number"&&0<Qn&&(p=1.5*Qn,h.L=p,h.j.info("backChannelRequestTimeoutMs_="+p)),p=h;const Je=o.g;if(Je){const Vi=Je.g?Je.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Vi){var b=p.h;b.g||Vi.indexOf("spdy")==-1&&Vi.indexOf("quic")==-1&&Vi.indexOf("h2")==-1||(b.j=b.l,b.g=new Set,b.h&&(Za(b,b.h),b.h=null))}if(p.D){const sc=Je.g?Je.g.getResponseHeader("X-HTTP-Session-Id"):null;sc&&(p.ya=sc,ne(p.I,p.D,sc))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),p=h;var D=o;if(p.qa=Qf(p,p.J?p.ia:null,p.W),D.K){Af(p.h,D);var Z=D,ve=p.L;ve&&(Z.I=ve),Z.B&&(Xa(Z),Ii(Z)),p.g=D}else Hf(p);0<h.i.length&&Ni(h)}else Q[0]!="stop"&&Q[0]!="close"||pn(h,7);else h.G==3&&(Q[0]=="stop"||Q[0]=="close"?Q[0]=="stop"?pn(h,7):tc(h):Q[0]!="noop"&&h.l&&h.l.ta(Q),h.v=0)}}Br(4)}catch{}}var $I=class{constructor(o,u){this.g=o,this.map=u}};function Tf(o){this.l=o||10,c.PerformanceNavigationTiming?(o=c.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function wf(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function If(o){return o.h?1:o.g?o.g.size:0}function Ja(o,u){return o.h?o.h==u:o.g?o.g.has(u):!1}function Za(o,u){o.g?o.g.add(u):o.h=u}function Af(o,u){o.h&&o.h==u?o.h=null:o.g&&o.g.has(u)&&o.g.delete(u)}Tf.prototype.cancel=function(){if(this.i=Rf(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const o of this.g.values())o.cancel();this.g.clear()}};function Rf(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let u=o.i;for(const h of o.g.values())u=u.concat(h.D);return u}return N(o.i)}function HI(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map<"u"&&o instanceof Map||typeof Set<"u"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(l(o)){for(var u=[],h=o.length,p=0;p<h;p++)u.push(o[p]);return u}u=[],h=0;for(p in o)u[h++]=o[p];return u}function zI(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map<"u"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set<"u"&&o instanceof Set)){if(l(o)||typeof o=="string"){var u=[];o=o.length;for(var h=0;h<o;h++)u.push(h);return u}u=[],h=0;for(const p in o)u[h++]=p;return u}}}function bf(o,u){if(o.forEach&&typeof o.forEach=="function")o.forEach(u,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,u,void 0);else for(var h=zI(o),p=HI(o),I=p.length,b=0;b<I;b++)u.call(void 0,p[b],h&&h[b],o)}var Pf=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function WI(o,u){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var p=o[h].indexOf("="),I=null;if(0<=p){var b=o[h].substring(0,p);I=o[h].substring(p+1)}else b=o[h];u(b,I?decodeURIComponent(I.replace(/\+/g," ")):"")}}}function fn(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof fn){this.h=o.h,Ai(this,o.j),this.o=o.o,this.g=o.g,Ri(this,o.s),this.l=o.l;var u=o.i,h=new Wr;h.i=u.i,u.g&&(h.g=new Map(u.g),h.h=u.h),Sf(this,h),this.m=o.m}else o&&(u=String(o).match(Pf))?(this.h=!1,Ai(this,u[1]||"",!0),this.o=Hr(u[2]||""),this.g=Hr(u[3]||"",!0),Ri(this,u[4]),this.l=Hr(u[5]||"",!0),Sf(this,u[6]||"",!0),this.m=Hr(u[7]||"")):(this.h=!1,this.i=new Wr(null,this.h))}fn.prototype.toString=function(){var o=[],u=this.j;u&&o.push(zr(u,Cf,!0),":");var h=this.g;return(h||u=="file")&&(o.push("//"),(u=this.o)&&o.push(zr(u,Cf,!0),"@"),o.push(encodeURIComponent(String(h)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h=this.s,h!=null&&o.push(":",String(h))),(h=this.l)&&(this.g&&h.charAt(0)!="/"&&o.push("/"),o.push(zr(h,h.charAt(0)=="/"?QI:KI,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",zr(h,YI)),o.join("")};function It(o){return new fn(o)}function Ai(o,u,h){o.j=h?Hr(u,!0):u,o.j&&(o.j=o.j.replace(/:$/,""))}function Ri(o,u){if(u){if(u=Number(u),isNaN(u)||0>u)throw Error("Bad port number "+u);o.s=u}else o.s=null}function Sf(o,u,h){u instanceof Wr?(o.i=u,JI(o.i,o.h)):(h||(u=zr(u,XI)),o.i=new Wr(u,o.h))}function ne(o,u,h){o.i.set(u,h)}function bi(o){return ne(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Hr(o,u){return o?u?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function zr(o,u,h){return typeof o=="string"?(o=encodeURI(o).replace(u,GI),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function GI(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var Cf=/[#\/\?@]/g,KI=/[#\?:]/g,QI=/[#\?]/g,XI=/[#\?@]/g,YI=/#/g;function Wr(o,u){this.h=this.g=null,this.i=o||null,this.j=!!u}function Gt(o){o.g||(o.g=new Map,o.h=0,o.i&&WI(o.i,function(u,h){o.add(decodeURIComponent(u.replace(/\+/g," ")),h)}))}n=Wr.prototype,n.add=function(o,u){Gt(this),this.i=null,o=Gn(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(u),this.h+=1,this};function kf(o,u){Gt(o),u=Gn(o,u),o.g.has(u)&&(o.i=null,o.h-=o.g.get(u).length,o.g.delete(u))}function Nf(o,u){return Gt(o),u=Gn(o,u),o.g.has(u)}n.forEach=function(o,u){Gt(this),this.g.forEach(function(h,p){h.forEach(function(I){o.call(u,I,p,this)},this)},this)},n.na=function(){Gt(this);const o=Array.from(this.g.values()),u=Array.from(this.g.keys()),h=[];for(let p=0;p<u.length;p++){const I=o[p];for(let b=0;b<I.length;b++)h.push(u[p])}return h},n.V=function(o){Gt(this);let u=[];if(typeof o=="string")Nf(this,o)&&(u=u.concat(this.g.get(Gn(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)u=u.concat(o[h])}return u},n.set=function(o,u){return Gt(this),this.i=null,o=Gn(this,o),Nf(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[u]),this.h+=1,this},n.get=function(o,u){return o?(o=this.V(o),0<o.length?String(o[0]):u):u};function Df(o,u,h){kf(o,u),0<h.length&&(o.i=null,o.g.set(Gn(o,u),N(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],u=Array.from(this.g.keys());for(var h=0;h<u.length;h++){var p=u[h];const b=encodeURIComponent(String(p)),D=this.V(p);for(p=0;p<D.length;p++){var I=b;D[p]!==""&&(I+="="+encodeURIComponent(String(D[p]))),o.push(I)}}return this.i=o.join("&")};function Gn(o,u){return u=String(u),o.j&&(u=u.toLowerCase()),u}function JI(o,u){u&&!o.j&&(Gt(o),o.i=null,o.g.forEach(function(h,p){var I=p.toLowerCase();p!=I&&(kf(this,p),Df(this,I,h))},o)),o.j=u}function ZI(o,u){const h=new qr;if(c.Image){const p=new Image;p.onload=R(Kt,h,"TestLoadImage: loaded",!0,u,p),p.onerror=R(Kt,h,"TestLoadImage: error",!1,u,p),p.onabort=R(Kt,h,"TestLoadImage: abort",!1,u,p),p.ontimeout=R(Kt,h,"TestLoadImage: timeout",!1,u,p),c.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else u(!1)}function eA(o,u){const h=new qr,p=new AbortController,I=setTimeout(()=>{p.abort(),Kt(h,"TestPingServer: timeout",!1,u)},1e4);fetch(o,{signal:p.signal}).then(b=>{clearTimeout(I),b.ok?Kt(h,"TestPingServer: ok",!0,u):Kt(h,"TestPingServer: server error",!1,u)}).catch(()=>{clearTimeout(I),Kt(h,"TestPingServer: error",!1,u)})}function Kt(o,u,h,p,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),p(h)}catch{}}function tA(){this.g=new UI}function nA(o,u,h){const p=h||"";try{bf(o,function(I,b){let D=I;d(I)&&(D=$a(I)),u.push(p+b+"="+encodeURIComponent(D))})}catch(I){throw u.push(p+"type="+encodeURIComponent("_badmap")),I}}function Pi(o){this.l=o.Ub||null,this.j=o.eb||!1}S(Pi,Ha),Pi.prototype.g=function(){return new Si(this.l,this.j)},Pi.prototype.i=function(o){return function(){return o}}({});function Si(o,u){be.call(this),this.D=o,this.o=u,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}S(Si,be),n=Si.prototype,n.open=function(o,u){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=u,this.readyState=1,Kr(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const u={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(u.body=o),(this.D||c).fetch(new Request(this.A,u)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Gr(this)),this.readyState=0},n.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,Kr(this)),this.g&&(this.readyState=3,Kr(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in o){if(this.j=o.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Of(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function Of(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}n.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var u=o.value?o.value:new Uint8Array(0);(u=this.v.decode(u,{stream:!o.done}))&&(this.response=this.responseText+=u)}o.done?Gr(this):Kr(this),this.readyState==3&&Of(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,Gr(this))},n.Qa=function(o){this.g&&(this.response=o,Gr(this))},n.ga=function(){this.g&&Gr(this)};function Gr(o){o.readyState=4,o.l=null,o.j=null,o.v=null,Kr(o)}n.setRequestHeader=function(o,u){this.u.append(o,u)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],u=this.h.entries();for(var h=u.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=u.next();return o.join(`\r
|
|
381
|
+
`)};function Kr(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(Si.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function Vf(o){let u="";return J(o,function(h,p){u+=p,u+=":",u+=h,u+=`\r
|
|
382
|
+
`}),u}function ec(o,u,h){e:{for(p in h){var p=!1;break e}p=!0}p||(h=Vf(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):ne(o,u,h))}function ie(o){be.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}S(ie,be);var rA=/^https?$/i,sA=["POST","PUT"];n=ie.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,u,h,p){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);u=u?u.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Ga.g(),this.v=this.o?uf(this.o):uf(Ga),this.g.onreadystatechange=v(this.Ea,this);try{this.B=!0,this.g.open(u,String(o),!0),this.B=!1}catch(b){Lf(this,b);return}if(o=h||"",h=new Map(this.headers),p)if(Object.getPrototypeOf(p)===Object.prototype)for(var I in p)h.set(I,p[I]);else if(typeof p.keys=="function"&&typeof p.get=="function")for(const b of p.keys())h.set(b,p.get(b));else throw Error("Unknown input type for opt_headers: "+String(p));p=Array.from(h.keys()).find(b=>b.toLowerCase()=="content-type"),I=c.FormData&&o instanceof c.FormData,!(0<=Array.prototype.indexOf.call(sA,u,void 0))||p||I||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[b,D]of h)this.g.setRequestHeader(b,D);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{xf(this),this.u=!0,this.g.send(o),this.u=!1}catch(b){Lf(this,b)}};function Lf(o,u){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=u,o.m=5,Mf(o),Ci(o)}function Mf(o){o.A||(o.A=!0,ke(o,"complete"),ke(o,"error"))}n.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,ke(this,"complete"),ke(this,"abort"),Ci(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Ci(this,!0)),ie.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?Uf(this):this.bb())},n.bb=function(){Uf(this)};function Uf(o){if(o.h&&typeof a<"u"&&(!o.v[1]||At(o)!=4||o.Z()!=2)){if(o.u&&At(o)==4)sf(o.Ea,0,o);else if(ke(o,"readystatechange"),At(o)==4){o.h=!1;try{const D=o.Z();e:switch(D){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var u=!0;break e;default:u=!1}var h;if(!(h=u)){var p;if(p=D===0){var I=String(o.D).match(Pf)[1]||null;!I&&c.self&&c.self.location&&(I=c.self.location.protocol.slice(0,-1)),p=!rA.test(I?I.toLowerCase():"")}h=p}if(h)ke(o,"complete"),ke(o,"success");else{o.m=6;try{var b=2<At(o)?o.g.statusText:""}catch{b=""}o.l=b+" ["+o.Z()+"]",Mf(o)}}finally{Ci(o)}}}}function Ci(o,u){if(o.g){xf(o);const h=o.g,p=o.v[0]?()=>{}:null;o.g=null,o.v=null,u||ke(o,"ready");try{h.onreadystatechange=p}catch{}}}function xf(o){o.I&&(c.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function At(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<At(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(o){if(this.g){var u=this.g.responseText;return o&&u.indexOf(o)==0&&(u=u.substring(o.length)),MI(u)}};function Ff(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function iA(o){const u={};o=(o.g&&2<=At(o)&&o.g.getAllResponseHeaders()||"").split(`\r
|
|
383
|
+
`);for(let p=0;p<o.length;p++){if($(o[p]))continue;var h=w(o[p]);const I=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const b=u[I]||[];u[I]=b,b.push(h)}T(u,function(p){return p.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Qr(o,u,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||u}function Bf(o){this.Aa=0,this.i=[],this.j=new qr,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Qr("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Qr("baseRetryDelayMs",5e3,o),this.cb=Qr("retryDelaySeedMs",1e4,o),this.Wa=Qr("forwardChannelMaxRetries",2,o),this.wa=Qr("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new Tf(o&&o.concurrentRequestLimit),this.Da=new tA,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=Bf.prototype,n.la=8,n.G=1,n.connect=function(o,u,h,p){Ne(0),this.W=o,this.H=u||{},h&&p!==void 0&&(this.H.OSID=h,this.H.OAID=p),this.F=this.X,this.I=Qf(this,null,this.W),Ni(this)};function tc(o){if(jf(o),o.G==3){var u=o.U++,h=It(o.I);if(ne(h,"SID",o.K),ne(h,"RID",u),ne(h,"TYPE","terminate"),Xr(o,h),u=new Wt(o,o.j,u),u.L=2,u.v=bi(It(h)),h=!1,c.navigator&&c.navigator.sendBeacon)try{h=c.navigator.sendBeacon(u.v.toString(),"")}catch{}!h&&c.Image&&(new Image().src=u.v,h=!0),h||(u.g=Xf(u.j,null),u.g.ea(u.v)),u.F=Date.now(),Ii(u)}Kf(o)}function ki(o){o.g&&(rc(o),o.g.cancel(),o.g=null)}function jf(o){ki(o),o.u&&(c.clearTimeout(o.u),o.u=null),Di(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&c.clearTimeout(o.s),o.s=null)}function Ni(o){if(!wf(o.h)&&!o.s){o.s=!0;var u=o.Ga;Lr||Zd(),Mr||(Lr(),Mr=!0),La.add(u,o),o.B=0}}function oA(o,u){return If(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=u.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=jr(v(o.Ga,o,u),Gf(o,o.B)),o.B++,!0)}n.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;const I=new Wt(this,this.j,o);let b=this.o;if(this.S&&(b?(b=g(b),E(b,this.S)):b=this.S),this.m!==null||this.O||(I.H=b,b=null),this.P)e:{for(var u=0,h=0;h<this.i.length;h++){t:{var p=this.i[h];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(u+=p,4096<u){u=h;break e}if(u===4096||h===this.i.length-1){u=h+1;break e}}u=1e3}else u=1e3;u=$f(this,I,u),h=It(this.I),ne(h,"RID",o),ne(h,"CVER",22),this.D&&ne(h,"X-HTTP-Session-Id",this.D),Xr(this,h),b&&(this.O?u="headers="+encodeURIComponent(String(Vf(b)))+"&"+u:this.m&&ec(h,this.m,b)),Za(this.h,I),this.Ua&&ne(h,"TYPE","init"),this.P?(ne(h,"$req",u),ne(h,"SID","null"),I.T=!0,Qa(I,h,null)):Qa(I,h,u),this.G=2}}else this.G==3&&(o?qf(this,o):this.i.length==0||wf(this.h)||qf(this))};function qf(o,u){var h;u?h=u.l:h=o.U++;const p=It(o.I);ne(p,"SID",o.K),ne(p,"RID",h),ne(p,"AID",o.T),Xr(o,p),o.m&&o.o&&ec(p,o.m,o.o),h=new Wt(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),u&&(o.i=u.D.concat(o.i)),u=$f(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),Za(o.h,h),Qa(h,p,u)}function Xr(o,u){o.H&&J(o.H,function(h,p){ne(u,p,h)}),o.l&&bf({},function(h,p){ne(u,p,h)})}function $f(o,u,h){h=Math.min(o.i.length,h);var p=o.l?v(o.l.Na,o.l,o):null;e:{var I=o.i;let b=-1;for(;;){const D=["count="+h];b==-1?0<h?(b=I[0].g,D.push("ofs="+b)):b=0:D.push("ofs="+b);let Z=!0;for(let ve=0;ve<h;ve++){let Q=I[ve].g;const Pe=I[ve].map;if(Q-=b,0>Q)b=Math.max(0,I[ve].g-100),Z=!1;else try{nA(Pe,D,"req"+Q+"_")}catch{p&&p(Pe)}}if(Z){p=D.join("&");break e}}}return o=o.i.splice(0,h),u.D=o,p}function Hf(o){if(!o.g&&!o.u){o.Y=1;var u=o.Fa;Lr||Zd(),Mr||(Lr(),Mr=!0),La.add(u,o),o.v=0}}function nc(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=jr(v(o.Fa,o),Gf(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,zf(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=jr(v(this.ab,this),o)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Ne(10),ki(this),zf(this))};function rc(o){o.A!=null&&(c.clearTimeout(o.A),o.A=null)}function zf(o){o.g=new Wt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var u=It(o.qa);ne(u,"RID","rpc"),ne(u,"SID",o.K),ne(u,"AID",o.T),ne(u,"CI",o.F?"0":"1"),!o.F&&o.ja&&ne(u,"TO",o.ja),ne(u,"TYPE","xmlhttp"),Xr(o,u),o.m&&o.o&&ec(u,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=bi(It(u)),h.m=null,h.P=!0,yf(h,o)}n.Za=function(){this.C!=null&&(this.C=null,ki(this),nc(this),Ne(19))};function Di(o){o.C!=null&&(c.clearTimeout(o.C),o.C=null)}function Wf(o,u){var h=null;if(o.g==u){Di(o),rc(o),o.g=null;var p=2}else if(Ja(o.h,u))h=u.D,Af(o.h,u),p=1;else return;if(o.G!=0){if(u.o)if(p==1){h=u.m?u.m.length:0,u=Date.now()-u.F;var I=o.B;p=Ei(),ke(p,new pf(p,h)),Ni(o)}else Hf(o);else if(I=u.s,I==3||I==0&&0<u.X||!(p==1&&oA(o,u)||p==2&&nc(o)))switch(h&&0<h.length&&(u=o.h,u.i=u.i.concat(h)),I){case 1:pn(o,5);break;case 4:pn(o,10);break;case 3:pn(o,6);break;default:pn(o,2)}}}function Gf(o,u){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*u}function pn(o,u){if(o.j.info("Error code "+u),u==2){var h=v(o.fb,o),p=o.Xa;const I=!p;p=new fn(p||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||Ai(p,"https"),bi(p),I?ZI(p.toString(),h):eA(p.toString(),h)}else Ne(2);o.G=0,o.l&&o.l.sa(u),Kf(o),jf(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Ne(2)):(this.j.info("Failed to ping google.com"),Ne(1))};function Kf(o){if(o.G=0,o.ka=[],o.l){const u=Rf(o.h);(u.length!=0||o.i.length!=0)&&(k(o.ka,u),k(o.ka,o.i),o.h.i.length=0,N(o.i),o.i.length=0),o.l.ra()}}function Qf(o,u,h){var p=h instanceof fn?It(h):new fn(h);if(p.g!="")u&&(p.g=u+"."+p.g),Ri(p,p.s);else{var I=c.location;p=I.protocol,u=u?u+"."+I.hostname:I.hostname,I=+I.port;var b=new fn(null);p&&Ai(b,p),u&&(b.g=u),I&&Ri(b,I),h&&(b.l=h),p=b}return h=o.D,u=o.ya,h&&u&&ne(p,h,u),ne(p,"VER",o.la),Xr(o,p),p}function Xf(o,u,h){if(u&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return u=o.Ca&&!o.pa?new ie(new Pi({eb:h})):new ie(o.pa),u.Ha(o.J),u}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function Yf(){}n=Yf.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Oi(){}Oi.prototype.g=function(o,u){return new je(o,u)};function je(o,u){be.call(this),this.g=new Bf(u),this.l=o,this.h=u&&u.messageUrlParams||null,o=u&&u.messageHeaders||null,u&&u.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=u&&u.initMessageHeaders||null,u&&u.messageContentType&&(o?o["X-WebChannel-Content-Type"]=u.messageContentType:o={"X-WebChannel-Content-Type":u.messageContentType}),u&&u.va&&(o?o["X-WebChannel-Client-Profile"]=u.va:o={"X-WebChannel-Client-Profile":u.va}),this.g.S=o,(o=u&&u.Sb)&&!$(o)&&(this.g.m=o),this.v=u&&u.supportsCrossDomainXhr||!1,this.u=u&&u.sendRawJson||!1,(u=u&&u.httpSessionIdParam)&&!$(u)&&(this.g.D=u,o=this.h,o!==null&&u in o&&(o=this.h,u in o&&delete o[u])),this.j=new Kn(this)}S(je,be),je.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},je.prototype.close=function(){tc(this.g)},je.prototype.o=function(o){var u=this.g;if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=$a(o),o=h);u.i.push(new $I(u.Ya++,o)),u.G==3&&Ni(u)},je.prototype.N=function(){this.g.l=null,delete this.j,tc(this.g),delete this.g,je.aa.N.call(this)};function Jf(o){za.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var u=o.__sm__;if(u){e:{for(const h in u){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,u=u!==null&&o in u?u[o]:void 0),this.data=u}else this.data=o}S(Jf,za);function Zf(){Wa.call(this),this.status=1}S(Zf,Wa);function Kn(o){this.g=o}S(Kn,Yf),Kn.prototype.ua=function(){ke(this.g,"a")},Kn.prototype.ta=function(o){ke(this.g,new Jf(o))},Kn.prototype.sa=function(o){ke(this.g,new Zf)},Kn.prototype.ra=function(){ke(this.g,"b")},Oi.prototype.createWebChannel=Oi.prototype.g,je.prototype.send=je.prototype.o,je.prototype.open=je.prototype.m,je.prototype.close=je.prototype.close,Nc=function(){return new Oi},kc=function(){return Ei()},Cc=hn,Ki={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Ti.NO_ERROR=0,Ti.TIMEOUT=8,Ti.HTTP_ERROR=6,rs=Ti,mf.COMPLETE="complete",Sc=mf,lf.EventType=Fr,Fr.OPEN="a",Fr.CLOSE="b",Fr.ERROR="c",Fr.MESSAGE="d",be.prototype.listen=be.prototype.K,sr=lf,ie.prototype.listenOnce=ie.prototype.L,ie.prototype.getLastError=ie.prototype.Ka,ie.prototype.getLastErrorCode=ie.prototype.Ba,ie.prototype.getStatus=ie.prototype.Z,ie.prototype.getResponseJson=ie.prototype.Oa,ie.prototype.getResponseText=ie.prototype.oa,ie.prototype.send=ie.prototype.ea,ie.prototype.setWithCredentials=ie.prototype.Ha,Pc=ie}).apply(typeof ns<"u"?ns:typeof self<"u"?self:typeof window<"u"?window:{});const Dc="@firebase/firestore",Oc="4.7.8";/**
|
|
370
384
|
* @license
|
|
371
385
|
* Copyright 2017 Google LLC
|
|
372
386
|
*
|
|
@@ -381,7 +395,7 @@
|
|
|
381
395
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
396
|
* See the License for the specific language governing permissions and
|
|
383
397
|
* limitations under the License.
|
|
384
|
-
*/class
|
|
398
|
+
*/class we{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}we.UNAUTHENTICATED=new we(null),we.GOOGLE_CREDENTIALS=new we("google-credentials-uid"),we.FIRST_PARTY=new we("first-party-uid"),we.MOCK_USER=new we("mock-user");/**
|
|
385
399
|
* @license
|
|
386
400
|
* Copyright 2017 Google LLC
|
|
387
401
|
*
|
|
@@ -396,7 +410,7 @@
|
|
|
396
410
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
397
411
|
* See the License for the specific language governing permissions and
|
|
398
412
|
* limitations under the License.
|
|
399
|
-
*/let
|
|
413
|
+
*/let gn="11.3.1";/**
|
|
400
414
|
* @license
|
|
401
415
|
* Copyright 2017 Google LLC
|
|
402
416
|
*
|
|
@@ -411,7 +425,7 @@
|
|
|
411
425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
412
426
|
* See the License for the specific language governing permissions and
|
|
413
427
|
* limitations under the License.
|
|
414
|
-
*/const
|
|
428
|
+
*/const Yt=new Ui("@firebase/firestore");function _n(){return Yt.logLevel}function V(n,...e){if(Yt.logLevel<=z.DEBUG){const t=e.map(Qi);Yt.debug(`Firestore (${gn}): ${n}`,...t)}}function ft(n,...e){if(Yt.logLevel<=z.ERROR){const t=e.map(Qi);Yt.error(`Firestore (${gn}): ${n}`,...t)}}function yn(n,...e){if(Yt.logLevel<=z.WARN){const t=e.map(Qi);Yt.warn(`Firestore (${gn}): ${n}`,...t)}}function Qi(n){if(typeof n=="string")return n;try{/**
|
|
415
429
|
* @license
|
|
416
430
|
* Copyright 2020 Google LLC
|
|
417
431
|
*
|
|
@@ -441,7 +455,7 @@
|
|
|
441
455
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
442
456
|
* See the License for the specific language governing permissions and
|
|
443
457
|
* limitations under the License.
|
|
444
|
-
*/function
|
|
458
|
+
*/function F(n="Unexpected state"){const e=`FIRESTORE (${gn}) INTERNAL ASSERTION FAILED: `+n;throw ft(e),new Error(e)}function Y(n,e){n||F()}function B(n,e){return n}/**
|
|
445
459
|
* @license
|
|
446
460
|
* Copyright 2017 Google LLC
|
|
447
461
|
*
|
|
@@ -456,7 +470,7 @@
|
|
|
456
470
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
457
471
|
* See the License for the specific language governing permissions and
|
|
458
472
|
* limitations under the License.
|
|
459
|
-
*/const
|
|
473
|
+
*/const P={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class O extends ze{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
|
|
460
474
|
* @license
|
|
461
475
|
* Copyright 2017 Google LLC
|
|
462
476
|
*
|
|
@@ -471,7 +485,7 @@
|
|
|
471
485
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
472
486
|
* See the License for the specific language governing permissions and
|
|
473
487
|
* limitations under the License.
|
|
474
|
-
*/class
|
|
488
|
+
*/class Ze{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
|
|
475
489
|
* @license
|
|
476
490
|
* Copyright 2017 Google LLC
|
|
477
491
|
*
|
|
@@ -486,7 +500,7 @@
|
|
|
486
500
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
487
501
|
* See the License for the specific language governing permissions and
|
|
488
502
|
* limitations under the License.
|
|
489
|
-
*/class
|
|
503
|
+
*/class Vc{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Om{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(we.UNAUTHENTICATED))}shutdown(){}}class Vm{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Lm{constructor(e){this.t=e,this.currentUser=we.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Y(this.o===void 0);let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new Ze;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Ze,e.enqueueRetryable(()=>s(this.currentUser))};const a=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},c=l=>{V("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(l=>c(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(V("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Ze)}},0),a()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.i!==e?(V("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Y(typeof r.accessToken=="string"),new Vc(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Y(e===null||typeof e=="string"),new we(e)}}class Mm{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=we.FIRST_PARTY,this.T=new Map}I(){return this.P?this.P():null}get headers(){this.T.set("X-Goog-AuthUser",this.l);const e=this.I();return e&&this.T.set("Authorization",e),this.h&&this.T.set("X-Goog-Iam-Authorization-Token",this.h),this.T}}class Um{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new Mm(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(we.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Lc{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class xm{constructor(e,t){this.A=t,this.forceRefresh=!1,this.appCheck=null,this.R=null,this.V=null,Te(e)&&e.settings.appCheckToken&&(this.V=e.settings.appCheckToken)}start(e,t){Y(this.o===void 0);const r=i=>{i.error!=null&&V("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.R;return this.R=i.token,V("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{V("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.A.getImmediate({optional:!0});i?s(i):V("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.V)return Promise.resolve(new Lc(this.V));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(Y(typeof t.token=="string"),this.R=t.token,new Lc(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
|
|
490
504
|
* @license
|
|
491
505
|
* Copyright 2020 Google LLC
|
|
492
506
|
*
|
|
@@ -501,7 +515,7 @@
|
|
|
501
515
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
502
516
|
* See the License for the specific language governing permissions and
|
|
503
517
|
* limitations under the License.
|
|
504
|
-
*/function
|
|
518
|
+
*/function Fm(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<n;r++)t[r]=Math.floor(256*Math.random());return t}/**
|
|
505
519
|
* @license
|
|
506
520
|
* Copyright 2017 Google LLC
|
|
507
521
|
*
|
|
@@ -516,7 +530,7 @@
|
|
|
516
530
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
517
531
|
* See the License for the specific language governing permissions and
|
|
518
532
|
* limitations under the License.
|
|
519
|
-
*/class
|
|
533
|
+
*/class Mc{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=Fm(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%62))}return r}}function G(n,e){return n<e?-1:n>e?1:0}function vn(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
|
|
520
534
|
* @license
|
|
521
535
|
* Copyright 2017 Google LLC
|
|
522
536
|
*
|
|
@@ -531,7 +545,7 @@
|
|
|
531
545
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
532
546
|
* See the License for the specific language governing permissions and
|
|
533
547
|
* limitations under the License.
|
|
534
|
-
*/class
|
|
548
|
+
*/const Uc=-62135596800,xc=1e6;class ue{static now(){return ue.fromMillis(Date.now())}static fromDate(e){return ue.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*xc);return new ue(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<Uc)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/xc}_compareTo(e){return this.seconds===e.seconds?G(this.nanoseconds,e.nanoseconds):G(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds-Uc;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
|
|
535
549
|
* @license
|
|
536
550
|
* Copyright 2017 Google LLC
|
|
537
551
|
*
|
|
@@ -546,7 +560,7 @@
|
|
|
546
560
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
547
561
|
* See the License for the specific language governing permissions and
|
|
548
562
|
* limitations under the License.
|
|
549
|
-
*/class
|
|
563
|
+
*/class j{static fromTimestamp(e){return new j(e)}static min(){return new j(new ue(0,0))}static max(){return new j(new ue(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
|
|
550
564
|
* @license
|
|
551
565
|
* Copyright 2017 Google LLC
|
|
552
566
|
*
|
|
@@ -561,7 +575,7 @@
|
|
|
561
575
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
562
576
|
* See the License for the specific language governing permissions and
|
|
563
577
|
* limitations under the License.
|
|
564
|
-
*/class
|
|
578
|
+
*/const Fc="__name__";class et{constructor(e,t,r){t===void 0?t=0:t>e.length&&F(),r===void 0?r=e.length-t:r>e.length-t&&F(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return et.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof et?e.forEach(r=>{t.push(r)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let s=0;s<r;s++){const i=et.compareSegments(e.get(s),t.get(s));if(i!==0)return i}return Math.sign(e.length-t.length)}static compareSegments(e,t){const r=et.isNumericId(e),s=et.isNumericId(t);return r&&!s?-1:!r&&s?1:r&&s?et.extractNumericId(e).compare(et.extractNumericId(t)):e<t?-1:e>t?1:0}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return St.fromString(e.substring(4,e.length-2))}}class ee extends et{construct(e,t,r){return new ee(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new O(P.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new ee(t)}static emptyPath(){return new ee([])}}const Bm=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class me extends et{construct(e,t,r){return new me(e,t,r)}static isValidIdentifier(e){return Bm.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),me.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Fc}static keyField(){return new me([Fc])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];if(c==="\\"){if(s+1===e.length)throw new O(P.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new O(P.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new O(P.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new me(t)}static emptyPath(){return new me([])}}/**
|
|
565
579
|
* @license
|
|
566
580
|
* Copyright 2017 Google LLC
|
|
567
581
|
*
|
|
@@ -576,7 +590,22 @@
|
|
|
576
590
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
577
591
|
* See the License for the specific language governing permissions and
|
|
578
592
|
* limitations under the License.
|
|
579
|
-
*/class
|
|
593
|
+
*/class L{constructor(e){this.path=e}static fromPath(e){return new L(ee.fromString(e))}static fromName(e){return new L(ee.fromString(e).popFirst(5))}static empty(){return new L(ee.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&ee.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ee.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new L(new ee(e.slice()))}}/**
|
|
594
|
+
* @license
|
|
595
|
+
* Copyright 2021 Google LLC
|
|
596
|
+
*
|
|
597
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
598
|
+
* you may not use this file except in compliance with the License.
|
|
599
|
+
* You may obtain a copy of the License at
|
|
600
|
+
*
|
|
601
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
602
|
+
*
|
|
603
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
604
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
605
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
606
|
+
* See the License for the specific language governing permissions and
|
|
607
|
+
* limitations under the License.
|
|
608
|
+
*/const ir=-1;function jm(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=j.fromTimestamp(r===1e9?new ue(t+1,0):new ue(t,r));return new Ct(s,L.empty(),e)}function qm(n){return new Ct(n.readTime,n.key,ir)}class Ct{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Ct(j.min(),L.empty(),ir)}static max(){return new Ct(j.max(),L.empty(),ir)}}function $m(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=L.comparator(n.documentKey,e.documentKey),t!==0?t:G(n.largestBatchId,e.largestBatchId))}/**
|
|
580
609
|
* @license
|
|
581
610
|
* Copyright 2020 Google LLC
|
|
582
611
|
*
|
|
@@ -591,7 +620,7 @@
|
|
|
591
620
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
592
621
|
* See the License for the specific language governing permissions and
|
|
593
622
|
* limitations under the License.
|
|
594
|
-
*/const
|
|
623
|
+
*/const Hm="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class zm{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
|
|
595
624
|
* @license
|
|
596
625
|
* Copyright 2017 Google LLC
|
|
597
626
|
*
|
|
@@ -606,7 +635,7 @@
|
|
|
606
635
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
607
636
|
* See the License for the specific language governing permissions and
|
|
608
637
|
* limitations under the License.
|
|
609
|
-
*/async function
|
|
638
|
+
*/async function En(n){if(n.code!==P.FAILED_PRECONDITION||n.message!==Hm)throw n;V("LocalStore","Unexpectedly lost primary lease")}/**
|
|
610
639
|
* @license
|
|
611
640
|
* Copyright 2017 Google LLC
|
|
612
641
|
*
|
|
@@ -621,7 +650,22 @@
|
|
|
621
650
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
622
651
|
* See the License for the specific language governing permissions and
|
|
623
652
|
* limitations under the License.
|
|
624
|
-
*/class
|
|
653
|
+
*/class C{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)},t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&F(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new C((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(r,s)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof C?t:C.resolve(t)}catch(t){return C.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):C.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):C.reject(t)}static resolve(e){return new C((t,r)=>{t(e)})}static reject(e){return new C((t,r)=>{r(e)})}static waitFor(e){return new C((t,r)=>{let s=0,i=0,a=!1;e.forEach(c=>{++s,c.next(()=>{++i,a&&i===s&&t()},l=>r(l))}),a=!0,i===s&&t()})}static or(e){let t=C.resolve(!1);for(const r of e)t=t.next(s=>s?C.resolve(s):r());return t}static forEach(e,t){const r=[];return e.forEach((s,i)=>{r.push(t.call(this,s,i))}),this.waitFor(r)}static mapArray(e,t){return new C((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next(f=>{a[d]=f,++c,c===i&&r(a)},f=>s(f))}})}static doWhile(e,t){return new C((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function Wm(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Tn(n){return n.name==="IndexedDbTransactionError"}/**
|
|
654
|
+
* @license
|
|
655
|
+
* Copyright 2018 Google LLC
|
|
656
|
+
*
|
|
657
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
658
|
+
* you may not use this file except in compliance with the License.
|
|
659
|
+
* You may obtain a copy of the License at
|
|
660
|
+
*
|
|
661
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
662
|
+
*
|
|
663
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
664
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
665
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
666
|
+
* See the License for the specific language governing permissions and
|
|
667
|
+
* limitations under the License.
|
|
668
|
+
*/class ss{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.oe(r),this._e=r=>t.writeSequenceNumber(r))}oe(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this._e&&this._e(e),e}}ss.ae=-1;/**
|
|
625
669
|
* @license
|
|
626
670
|
* Copyright 2017 Google LLC
|
|
627
671
|
*
|
|
@@ -636,9 +680,9 @@
|
|
|
636
680
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
637
681
|
* See the License for the specific language governing permissions and
|
|
638
682
|
* limitations under the License.
|
|
639
|
-
*/
|
|
683
|
+
*/const Xi=-1;function is(n){return n==null}function os(n){return n===0&&1/n==-1/0}function Gm(n){return typeof n=="number"&&Number.isInteger(n)&&!os(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
|
|
640
684
|
* @license
|
|
641
|
-
* Copyright
|
|
685
|
+
* Copyright 2017 Google LLC
|
|
642
686
|
*
|
|
643
687
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
644
688
|
* you may not use this file except in compliance with the License.
|
|
@@ -651,7 +695,7 @@
|
|
|
651
695
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
652
696
|
* See the License for the specific language governing permissions and
|
|
653
697
|
* limitations under the License.
|
|
654
|
-
*/
|
|
698
|
+
*/const Bc="";function Km(n){let e="";for(let t=0;t<n.length;t++)e.length>0&&(e=jc(e)),e=Qm(n.get(t),e);return jc(e)}function Qm(n,e){let t=e;const r=n.length;for(let s=0;s<r;s++){const i=n.charAt(s);switch(i){case"\0":t+="";break;case Bc:t+="";break;default:t+=i}}return t}function jc(n){return n+Bc+""}/**
|
|
655
699
|
* @license
|
|
656
700
|
* Copyright 2017 Google LLC
|
|
657
701
|
*
|
|
@@ -666,7 +710,7 @@
|
|
|
666
710
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
667
711
|
* See the License for the specific language governing permissions and
|
|
668
712
|
* limitations under the License.
|
|
669
|
-
*/function
|
|
713
|
+
*/function qc(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function kt(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function Xm(n,e){const t=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.push(e(n[r],r,n));return t}function $c(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
|
|
670
714
|
* @license
|
|
671
715
|
* Copyright 2017 Google LLC
|
|
672
716
|
*
|
|
@@ -681,7 +725,7 @@
|
|
|
681
725
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
682
726
|
* See the License for the specific language governing permissions and
|
|
683
727
|
* limitations under the License.
|
|
684
|
-
*/class
|
|
728
|
+
*/class re{constructor(e,t){this.comparator=e,this.root=t||ge.EMPTY}insert(e,t){return new re(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ge.BLACK,null,null))}remove(e){return new re(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ge.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return t+r.left.size;s<0?r=r.left:(t+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){const e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new as(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new as(this.root,e,this.comparator,!1)}getReverseIterator(){return new as(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new as(this.root,e,this.comparator,!0)}}class as{constructor(e,t,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class ge{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??ge.RED,this.left=s??ge.EMPTY,this.right=i??ge.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new ge(e??this.key,t??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,r),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return ge.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let r,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return ge.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,ge.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,ge.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw F();const e=this.left.check();if(e!==this.right.check())throw F();return e+(this.isRed()?0:1)}}ge.EMPTY=null,ge.RED=!0,ge.BLACK=!1,ge.EMPTY=new class{constructor(){this.size=0}get key(){throw F()}get value(){throw F()}get color(){throw F()}get left(){throw F()}get right(){throw F()}copy(e,t,r,s,i){return this}insert(e,t,r){return new ge(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
|
|
685
729
|
* @license
|
|
686
730
|
* Copyright 2017 Google LLC
|
|
687
731
|
*
|
|
@@ -696,7 +740,7 @@
|
|
|
696
740
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
697
741
|
* See the License for the specific language governing permissions and
|
|
698
742
|
* limitations under the License.
|
|
699
|
-
*/class
|
|
743
|
+
*/class le{constructor(e){this.comparator=e,this.data=new re(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Hc(this.data.getIterator())}getIteratorFrom(e){return new Hc(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(r=>{t=t.add(r)}),t}isEqual(e){if(!(e instanceof le)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new le(this.comparator);return t.data=e,t}}class Hc{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
|
|
700
744
|
* @license
|
|
701
745
|
* Copyright 2020 Google LLC
|
|
702
746
|
*
|
|
@@ -711,7 +755,7 @@
|
|
|
711
755
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
712
756
|
* See the License for the specific language governing permissions and
|
|
713
757
|
* limitations under the License.
|
|
714
|
-
*/class
|
|
758
|
+
*/class Fe{constructor(e){this.fields=e,e.sort(me.comparator)}static empty(){return new Fe([])}unionWith(e){let t=new le(me.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Fe(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return vn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
|
|
715
759
|
* @license
|
|
716
760
|
* Copyright 2023 Google LLC
|
|
717
761
|
*
|
|
@@ -726,7 +770,7 @@
|
|
|
726
770
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
727
771
|
* See the License for the specific language governing permissions and
|
|
728
772
|
* limitations under the License.
|
|
729
|
-
*/class
|
|
773
|
+
*/class zc extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
|
|
730
774
|
* @license
|
|
731
775
|
* Copyright 2020 Google LLC
|
|
732
776
|
*
|
|
@@ -741,7 +785,7 @@
|
|
|
741
785
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
742
786
|
* See the License for the specific language governing permissions and
|
|
743
787
|
* limitations under the License.
|
|
744
|
-
*/class
|
|
788
|
+
*/class _e{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new zc("Invalid base64 string: "+i):i}}(e);return new _e(t)}static fromUint8Array(e){const t=function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i}(e);return new _e(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return G(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}_e.EMPTY_BYTE_STRING=new _e("");const Ym=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Nt(n){if(Y(!!n),typeof n=="string"){let e=0;const t=Ym.exec(n);if(Y(!!t),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:oe(n.seconds),nanos:oe(n.nanos)}}function oe(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Dt(n){return typeof n=="string"?_e.fromBase64String(n):_e.fromUint8Array(n)}/**
|
|
745
789
|
* @license
|
|
746
790
|
* Copyright 2020 Google LLC
|
|
747
791
|
*
|
|
@@ -756,7 +800,7 @@
|
|
|
756
800
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
757
801
|
* See the License for the specific language governing permissions and
|
|
758
802
|
* limitations under the License.
|
|
759
|
-
*/function
|
|
803
|
+
*/const Wc="server_timestamp",Gc="__type__",Kc="__previous_value__",Qc="__local_write_time__";function cs(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[Gc])===null||t===void 0?void 0:t.stringValue)===Wc}function us(n){const e=n.mapValue.fields[Kc];return cs(e)?us(e):e}function or(n){const e=Nt(n.mapValue.fields[Qc].timestampValue);return new ue(e.seconds,e.nanos)}/**
|
|
760
804
|
* @license
|
|
761
805
|
* Copyright 2017 Google LLC
|
|
762
806
|
*
|
|
@@ -771,7 +815,7 @@
|
|
|
771
815
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
772
816
|
* See the License for the specific language governing permissions and
|
|
773
817
|
* limitations under the License.
|
|
774
|
-
*/class
|
|
818
|
+
*/class Jm{constructor(e,t,r,s,i,a,c,l,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d}}const ls="(default)";class ar{constructor(e,t){this.projectId=e,this.database=t||ls}static empty(){return new ar("","")}get isDefaultDatabase(){return this.database===ls}isEqual(e){return e instanceof ar&&e.projectId===this.projectId&&e.database===this.database}}/**
|
|
775
819
|
* @license
|
|
776
820
|
* Copyright 2020 Google LLC
|
|
777
821
|
*
|
|
@@ -786,7 +830,7 @@
|
|
|
786
830
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
787
831
|
* See the License for the specific language governing permissions and
|
|
788
832
|
* limitations under the License.
|
|
789
|
-
*/const
|
|
833
|
+
*/const Xc="__type__",Zm="__max__",hs={mapValue:{}},Yc="__vector__",ds="value";function Ot(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?cs(n)?4:tg(n)?9007199254740991:eg(n)?10:11:F()}function tt(n,e){if(n===e)return!0;const t=Ot(n);if(t!==Ot(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return or(n).isEqual(or(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const a=Nt(s.timestampValue),c=Nt(i.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return Dt(s.bytesValue).isEqual(Dt(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return oe(s.geoPointValue.latitude)===oe(i.geoPointValue.latitude)&&oe(s.geoPointValue.longitude)===oe(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return oe(s.integerValue)===oe(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=oe(s.doubleValue),c=oe(i.doubleValue);return a===c?os(a)===os(c):isNaN(a)&&isNaN(c)}return!1}(n,e);case 9:return vn(n.arrayValue.values||[],e.arrayValue.values||[],tt);case 10:case 11:return function(s,i){const a=s.mapValue.fields||{},c=i.mapValue.fields||{};if(qc(a)!==qc(c))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(c[l]===void 0||!tt(a[l],c[l])))return!1;return!0}(n,e);default:return F()}}function cr(n,e){return(n.values||[]).find(t=>tt(t,e))!==void 0}function wn(n,e){if(n===e)return 0;const t=Ot(n),r=Ot(e);if(t!==r)return G(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return G(n.booleanValue,e.booleanValue);case 2:return function(i,a){const c=oe(i.integerValue||i.doubleValue),l=oe(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1}(n,e);case 3:return Jc(n.timestampValue,e.timestampValue);case 4:return Jc(or(n),or(e));case 5:return G(n.stringValue,e.stringValue);case 6:return function(i,a){const c=Dt(i),l=Dt(a);return c.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(i,a){const c=i.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const f=G(c[d],l[d]);if(f!==0)return f}return G(c.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,a){const c=G(oe(i.latitude),oe(a.latitude));return c!==0?c:G(oe(i.longitude),oe(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return Zc(n.arrayValue,e.arrayValue);case 10:return function(i,a){var c,l,d,f;const m=i.fields||{},v=a.fields||{},R=(c=m[ds])===null||c===void 0?void 0:c.arrayValue,S=(l=v[ds])===null||l===void 0?void 0:l.arrayValue,N=G(((d=R==null?void 0:R.values)===null||d===void 0?void 0:d.length)||0,((f=S==null?void 0:S.values)===null||f===void 0?void 0:f.length)||0);return N!==0?N:Zc(R,S)}(n.mapValue,e.mapValue);case 11:return function(i,a){if(i===hs.mapValue&&a===hs.mapValue)return 0;if(i===hs.mapValue)return 1;if(a===hs.mapValue)return-1;const c=i.fields||{},l=Object.keys(c),d=a.fields||{},f=Object.keys(d);l.sort(),f.sort();for(let m=0;m<l.length&&m<f.length;++m){const v=G(l[m],f[m]);if(v!==0)return v;const R=wn(c[l[m]],d[f[m]]);if(R!==0)return R}return G(l.length,f.length)}(n.mapValue,e.mapValue);default:throw F()}}function Jc(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return G(n,e);const t=Nt(n),r=Nt(e),s=G(t.seconds,r.seconds);return s!==0?s:G(t.nanos,r.nanos)}function Zc(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=wn(t[s],r[s]);if(i)return i}return G(t.length,r.length)}function In(n){return Yi(n)}function Yi(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const r=Nt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Dt(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return L.fromName(t).toString()}(n.referenceValue):"geoPointValue"in n?function(t){return`geo(${t.latitude},${t.longitude})`}(n.geoPointValue):"arrayValue"in n?function(t){let r="[",s=!0;for(const i of t.values||[])s?s=!1:r+=",",r+=Yi(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${Yi(t.fields[a])}`;return s+"}"}(n.mapValue):F()}function fs(n){switch(Ot(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=us(n);return e?16+fs(e):16;case 5:return 2*n.stringValue.length;case 6:return Dt(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((s,i)=>s+fs(i),0)}(n.arrayValue);case 10:case 11:return function(r){let s=0;return kt(r.fields,(i,a)=>{s+=i.length+fs(a)}),s}(n.mapValue);default:throw F()}}function ps(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function Ji(n){return!!n&&"integerValue"in n}function Zi(n){return!!n&&"arrayValue"in n}function eu(n){return!!n&&"nullValue"in n}function tu(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function ms(n){return!!n&&"mapValue"in n}function eg(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{})[Xc])===null||t===void 0?void 0:t.stringValue)===Yc}function ur(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){const e={mapValue:{fields:{}}};return kt(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=ur(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=ur(n.arrayValue.values[t]);return e}return Object.assign({},n)}function tg(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===Zm}/**
|
|
790
834
|
* @license
|
|
791
835
|
* Copyright 2017 Google LLC
|
|
792
836
|
*
|
|
@@ -801,7 +845,7 @@
|
|
|
801
845
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
802
846
|
* See the License for the specific language governing permissions and
|
|
803
847
|
* limitations under the License.
|
|
804
|
-
*/class
|
|
848
|
+
*/class De{constructor(e){this.value=e}static empty(){return new De({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!ms(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ur(t)}setAll(e){let t=me.emptyPath(),r={},s=[];e.forEach((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=c.popLast()}a?r[c.lastSegment()]=ur(a):s.push(c.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());ms(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return tt(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=t.mapValue.fields[e.get(r)];ms(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){kt(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new De(ur(this.value))}}function nu(n){const e=[];return kt(n.fields,(t,r)=>{const s=new me([t]);if(ms(r)){const i=nu(r.mapValue).fields;if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)}),new Fe(e)}/**
|
|
805
849
|
* @license
|
|
806
850
|
* Copyright 2017 Google LLC
|
|
807
851
|
*
|
|
@@ -816,7 +860,7 @@
|
|
|
816
860
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
817
861
|
* See the License for the specific language governing permissions and
|
|
818
862
|
* limitations under the License.
|
|
819
|
-
*/class
|
|
863
|
+
*/class Ie{constructor(e,t,r,s,i,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new Ie(e,0,j.min(),j.min(),j.min(),De.empty(),0)}static newFoundDocument(e,t,r,s){return new Ie(e,1,t,j.min(),r,s,0)}static newNoDocument(e,t){return new Ie(e,2,t,j.min(),j.min(),De.empty(),0)}static newUnknownDocument(e,t){return new Ie(e,3,t,j.min(),j.min(),De.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(j.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=De.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=De.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=j.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Ie&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Ie(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/**
|
|
820
864
|
* @license
|
|
821
865
|
* Copyright 2022 Google LLC
|
|
822
866
|
*
|
|
@@ -831,7 +875,7 @@
|
|
|
831
875
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
832
876
|
* See the License for the specific language governing permissions and
|
|
833
877
|
* limitations under the License.
|
|
834
|
-
*/class
|
|
878
|
+
*/class An{constructor(e,t){this.position=e,this.inclusive=t}}function ru(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],a=n.position[s];if(i.field.isKeyField()?r=L.comparator(L.fromName(a.referenceValue),t.key):r=wn(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function su(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!tt(n.position[t],e.position[t]))return!1;return!0}/**
|
|
835
879
|
* @license
|
|
836
880
|
* Copyright 2022 Google LLC
|
|
837
881
|
*
|
|
@@ -846,7 +890,7 @@
|
|
|
846
890
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
847
891
|
* See the License for the specific language governing permissions and
|
|
848
892
|
* limitations under the License.
|
|
849
|
-
*/class
|
|
893
|
+
*/class lr{constructor(e,t="asc"){this.field=e,this.dir=t}}function ng(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
|
|
850
894
|
* @license
|
|
851
895
|
* Copyright 2022 Google LLC
|
|
852
896
|
*
|
|
@@ -861,7 +905,7 @@
|
|
|
861
905
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
862
906
|
* See the License for the specific language governing permissions and
|
|
863
907
|
* limitations under the License.
|
|
864
|
-
*/class
|
|
908
|
+
*/class iu{}class ae extends iu{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new sg(e,t,r):t==="array-contains"?new ag(e,r):t==="in"?new cg(e,r):t==="not-in"?new ug(e,r):t==="array-contains-any"?new lg(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new ig(e,r):new og(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(wn(t,this.value)):t!==null&&Ot(this.value)===Ot(t)&&this.matchesComparison(wn(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return F()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class We extends iu{constructor(e,t){super(),this.filters=e,this.op=t,this.ce=null}static create(e,t){return new We(e,t)}matches(e){return ou(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ce!==null||(this.ce=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ce}getFilters(){return Object.assign([],this.filters)}}function ou(n){return n.op==="and"}function au(n){return rg(n)&&ou(n)}function rg(n){for(const e of n.filters)if(e instanceof We)return!1;return!0}function eo(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+In(n.value);if(au(n))return n.filters.map(e=>eo(e)).join(",");{const e=n.filters.map(t=>eo(t)).join(",");return`${n.op}(${e})`}}function cu(n,e){return n instanceof ae?function(r,s){return s instanceof ae&&r.op===s.op&&r.field.isEqual(s.field)&&tt(r.value,s.value)}(n,e):n instanceof We?function(r,s){return s instanceof We&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,a,c)=>i&&cu(a,s.filters[c]),!0):!1}(n,e):void F()}function uu(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${In(t.value)}`}(n):n instanceof We?function(t){return t.op.toString()+" {"+t.getFilters().map(uu).join(" ,")+"}"}(n):"Filter"}class sg extends ae{constructor(e,t,r){super(e,t,r),this.key=L.fromName(r.referenceValue)}matches(e){const t=L.comparator(e.key,this.key);return this.matchesComparison(t)}}class ig extends ae{constructor(e,t){super(e,"in",t),this.keys=lu("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class og extends ae{constructor(e,t){super(e,"not-in",t),this.keys=lu("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function lu(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>L.fromName(r.referenceValue))}class ag extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Zi(t)&&cr(t.arrayValue,this.value)}}class cg extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&cr(this.value.arrayValue,t)}}class ug extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(cr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!cr(this.value.arrayValue,t)}}class lg extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Zi(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>cr(this.value.arrayValue,r))}}/**
|
|
865
909
|
* @license
|
|
866
910
|
* Copyright 2019 Google LLC
|
|
867
911
|
*
|
|
@@ -876,7 +920,7 @@
|
|
|
876
920
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
877
921
|
* See the License for the specific language governing permissions and
|
|
878
922
|
* limitations under the License.
|
|
879
|
-
*/class
|
|
923
|
+
*/class hg{constructor(e,t=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.le=null}}function hu(n,e=null,t=[],r=[],s=null,i=null,a=null){return new hg(n,e,t,r,s,i,a)}function to(n){const e=B(n);if(e.le===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>eo(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),is(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>In(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>In(r)).join(",")),e.le=t}return e.le}function no(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!ng(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!cu(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!su(n.startAt,e.startAt)&&su(n.endAt,e.endAt)}function ro(n){return L.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
|
|
880
924
|
* @license
|
|
881
925
|
* Copyright 2017 Google LLC
|
|
882
926
|
*
|
|
@@ -891,7 +935,7 @@
|
|
|
891
935
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
892
936
|
* See the License for the specific language governing permissions and
|
|
893
937
|
* limitations under the License.
|
|
894
|
-
*/class
|
|
938
|
+
*/class Jt{constructor(e,t=null,r=[],s=[],i=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=l,this.he=null,this.Pe=null,this.Te=null,this.startAt,this.endAt}}function dg(n,e,t,r,s,i,a,c){return new Jt(n,e,t,r,s,i,a,c)}function gs(n){return new Jt(n)}function du(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function so(n){return n.collectionGroup!==null}function Rn(n){const e=B(n);if(e.he===null){e.he=[];const t=new Set;for(const i of e.explicitOrderBy)e.he.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new le(me.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(c=c.add(d.field))})}),c})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.he.push(new lr(i,r))}),t.has(me.keyField().canonicalString())||e.he.push(new lr(me.keyField(),r))}return e.he}function nt(n){const e=B(n);return e.Pe||(e.Pe=fu(e,Rn(n))),e.Pe}function fg(n){const e=B(n);return e.Te||(e.Te=fu(e,n.explicitOrderBy)),e.Te}function fu(n,e){if(n.limitType==="F")return hu(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new lr(s.field,i)});const t=n.endAt?new An(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new An(n.startAt.position,n.startAt.inclusive):null;return hu(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function io(n,e){const t=n.filters.concat([e]);return new Jt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function _s(n,e,t){return new Jt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function ys(n,e){return no(nt(n),nt(e))&&n.limitType===e.limitType}function pu(n){return`${to(nt(n))}|lt:${n.limitType}`}function bn(n){return`Query(target=${function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(s=>uu(s)).join(", ")}]`),is(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>In(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>In(s)).join(",")),`Target(${r})`}(nt(n))}; limitType=${n.limitType})`}function vs(n,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):L.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of Rn(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(n,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(n,e)&&function(r,s){return!(r.startAt&&!function(a,c,l){const d=ru(a,c,l);return a.inclusive?d<=0:d<0}(r.startAt,Rn(r),s)||r.endAt&&!function(a,c,l){const d=ru(a,c,l);return a.inclusive?d>=0:d>0}(r.endAt,Rn(r),s))}(n,e)}function pg(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function mu(n){return(e,t)=>{let r=!1;for(const s of Rn(n)){const i=mg(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function mg(n,e,t){const r=n.field.isKeyField()?L.comparator(e.key,t.key):function(i,a,c){const l=a.data.field(i),d=c.data.field(i);return l!==null&&d!==null?wn(l,d):F()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return F()}}/**
|
|
895
939
|
* @license
|
|
896
940
|
* Copyright 2017 Google LLC
|
|
897
941
|
*
|
|
@@ -906,7 +950,7 @@
|
|
|
906
950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
907
951
|
* See the License for the specific language governing permissions and
|
|
908
952
|
* limitations under the License.
|
|
909
|
-
*/class
|
|
953
|
+
*/class Zt{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[t]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){kt(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return $c(this.inner)}size(){return this.innerSize}}/**
|
|
910
954
|
* @license
|
|
911
955
|
* Copyright 2017 Google LLC
|
|
912
956
|
*
|
|
@@ -921,7 +965,7 @@
|
|
|
921
965
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
922
966
|
* See the License for the specific language governing permissions and
|
|
923
967
|
* limitations under the License.
|
|
924
|
-
*/const
|
|
968
|
+
*/const gg=new re(L.comparator);function pt(){return gg}const gu=new re(L.comparator);function hr(...n){let e=gu;for(const t of n)e=e.insert(t.key,t);return e}function _u(n){let e=gu;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function en(){return dr()}function yu(){return dr()}function dr(){return new Zt(n=>n.toString(),(n,e)=>n.isEqual(e))}const _g=new re(L.comparator),yg=new le(L.comparator);function W(...n){let e=yg;for(const t of n)e=e.add(t);return e}const vg=new le(G);function Eg(){return vg}/**
|
|
925
969
|
* @license
|
|
926
970
|
* Copyright 2020 Google LLC
|
|
927
971
|
*
|
|
@@ -936,7 +980,7 @@
|
|
|
936
980
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
937
981
|
* See the License for the specific language governing permissions and
|
|
938
982
|
* limitations under the License.
|
|
939
|
-
*/function
|
|
983
|
+
*/function oo(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:os(e)?"-0":e}}function vu(n){return{integerValue:""+n}}function Tg(n,e){return Gm(e)?vu(e):oo(n,e)}/**
|
|
940
984
|
* @license
|
|
941
985
|
* Copyright 2018 Google LLC
|
|
942
986
|
*
|
|
@@ -951,7 +995,7 @@
|
|
|
951
995
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
952
996
|
* See the License for the specific language governing permissions and
|
|
953
997
|
* limitations under the License.
|
|
954
|
-
*/class
|
|
998
|
+
*/class Es{constructor(){this._=void 0}}function wg(n,e,t){return n instanceof Ts?function(s,i){const a={fields:{[Gc]:{stringValue:Wc},[Qc]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&cs(i)&&(i=us(i)),i&&(a.fields[Kc]=i),{mapValue:a}}(t,e):n instanceof fr?Tu(n,e):n instanceof pr?wu(n,e):function(s,i){const a=Eu(s,i),c=Iu(a)+Iu(s.Ie);return Ji(a)&&Ji(s.Ie)?vu(c):oo(s.serializer,c)}(n,e)}function Ig(n,e,t){return n instanceof fr?Tu(n,e):n instanceof pr?wu(n,e):t}function Eu(n,e){return n instanceof ws?function(r){return Ji(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Ts extends Es{}class fr extends Es{constructor(e){super(),this.elements=e}}function Tu(n,e){const t=Au(e);for(const r of n.elements)t.some(s=>tt(s,r))||t.push(r);return{arrayValue:{values:t}}}class pr extends Es{constructor(e){super(),this.elements=e}}function wu(n,e){let t=Au(e);for(const r of n.elements)t=t.filter(s=>!tt(s,r));return{arrayValue:{values:t}}}class ws extends Es{constructor(e,t){super(),this.serializer=e,this.Ie=t}}function Iu(n){return oe(n.integerValue||n.doubleValue)}function Au(n){return Zi(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function Ag(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof fr&&s instanceof fr||r instanceof pr&&s instanceof pr?vn(r.elements,s.elements,tt):r instanceof ws&&s instanceof ws?tt(r.Ie,s.Ie):r instanceof Ts&&s instanceof Ts}(n.transform,e.transform)}class Rg{constructor(e,t){this.version=e,this.transformResults=t}}class $e{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new $e}static exists(e){return new $e(void 0,e)}static updateTime(e){return new $e(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Is(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class As{}function Ru(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Rs(n.key,$e.none()):new gr(n.key,n.data,$e.none());{const t=n.data,r=De.empty();let s=new le(me.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new Vt(n.key,r,new Fe(s.toArray()),$e.none())}}function bg(n,e,t){n instanceof gr?function(s,i,a){const c=s.value.clone(),l=Su(s.fieldTransforms,i,a.transformResults);c.setAll(l),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(n,e,t):n instanceof Vt?function(s,i,a){if(!Is(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=Su(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(Pu(s)),l.setAll(c),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function mr(n,e,t,r){return n instanceof gr?function(i,a,c,l){if(!Is(i.precondition,a))return c;const d=i.value.clone(),f=Cu(i.fieldTransforms,l,a);return d.setAll(f),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof Vt?function(i,a,c,l){if(!Is(i.precondition,a))return c;const d=Cu(i.fieldTransforms,l,a),f=a.data;return f.setAll(Pu(i)),f.setAll(d),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(m=>m.field))}(n,e,t,r):function(i,a,c){return Is(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c}(n,e,t)}function Pg(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=Eu(r.transform,s||null);i!=null&&(t===null&&(t=De.empty()),t.set(r.field,i))}return t||null}function bu(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&vn(r,s,(i,a)=>Ag(i,a))}(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class gr extends As{constructor(e,t,r,s=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class Vt extends As{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function Pu(n){const e=new Map;return n.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const r=n.data.field(t);e.set(t,r)}}),e}function Su(n,e,t){const r=new Map;Y(n.length===t.length);for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,Ig(a,c,t[s]))}return r}function Cu(n,e,t){const r=new Map;for(const s of n){const i=s.transform,a=t.data.field(s.field);r.set(s.field,wg(i,a,e))}return r}class Rs extends As{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Sg extends As{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
|
|
955
999
|
* @license
|
|
956
1000
|
* Copyright 2017 Google LLC
|
|
957
1001
|
*
|
|
@@ -966,7 +1010,7 @@
|
|
|
966
1010
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
967
1011
|
* See the License for the specific language governing permissions and
|
|
968
1012
|
* limitations under the License.
|
|
969
|
-
*/class
|
|
1013
|
+
*/class Cg{constructor(e,t,r,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&bg(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=mr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=mr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=yu();return this.mutations.forEach(s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=t.has(s.key)?null:c;const l=Ru(a,c);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(j.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),W())}isEqual(e){return this.batchId===e.batchId&&vn(this.mutations,e.mutations,(t,r)=>bu(t,r))&&vn(this.baseMutations,e.baseMutations,(t,r)=>bu(t,r))}}class ao{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){Y(e.mutations.length===r.length);let s=function(){return _g}();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new ao(e,t,r,s)}}/**
|
|
970
1014
|
* @license
|
|
971
1015
|
* Copyright 2022 Google LLC
|
|
972
1016
|
*
|
|
@@ -981,7 +1025,7 @@
|
|
|
981
1025
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
982
1026
|
* See the License for the specific language governing permissions and
|
|
983
1027
|
* limitations under the License.
|
|
984
|
-
*/class
|
|
1028
|
+
*/class kg{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
985
1029
|
largestBatchId: ${this.largestBatchId},
|
|
986
1030
|
mutation: ${this.mutation.toString()}
|
|
987
1031
|
}`}}/**
|
|
@@ -999,7 +1043,7 @@
|
|
|
999
1043
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1000
1044
|
* See the License for the specific language governing permissions and
|
|
1001
1045
|
* limitations under the License.
|
|
1002
|
-
*/class
|
|
1046
|
+
*/class Ng{constructor(e,t,r){this.alias=e,this.aggregateType=t,this.fieldPath=r}}/**
|
|
1003
1047
|
* @license
|
|
1004
1048
|
* Copyright 2017 Google LLC
|
|
1005
1049
|
*
|
|
@@ -1014,7 +1058,7 @@
|
|
|
1014
1058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1015
1059
|
* See the License for the specific language governing permissions and
|
|
1016
1060
|
* limitations under the License.
|
|
1017
|
-
*/class
|
|
1061
|
+
*/class Dg{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
|
|
1018
1062
|
* @license
|
|
1019
1063
|
* Copyright 2017 Google LLC
|
|
1020
1064
|
*
|
|
@@ -1029,7 +1073,7 @@
|
|
|
1029
1073
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1030
1074
|
* See the License for the specific language governing permissions and
|
|
1031
1075
|
* limitations under the License.
|
|
1032
|
-
*/var
|
|
1076
|
+
*/var ce,K;function Og(n){switch(n){case P.OK:return F();case P.CANCELLED:case P.UNKNOWN:case P.DEADLINE_EXCEEDED:case P.RESOURCE_EXHAUSTED:case P.INTERNAL:case P.UNAVAILABLE:case P.UNAUTHENTICATED:return!1;case P.INVALID_ARGUMENT:case P.NOT_FOUND:case P.ALREADY_EXISTS:case P.PERMISSION_DENIED:case P.FAILED_PRECONDITION:case P.ABORTED:case P.OUT_OF_RANGE:case P.UNIMPLEMENTED:case P.DATA_LOSS:return!0;default:return F()}}function ku(n){if(n===void 0)return ft("GRPC error has no .code"),P.UNKNOWN;switch(n){case ce.OK:return P.OK;case ce.CANCELLED:return P.CANCELLED;case ce.UNKNOWN:return P.UNKNOWN;case ce.DEADLINE_EXCEEDED:return P.DEADLINE_EXCEEDED;case ce.RESOURCE_EXHAUSTED:return P.RESOURCE_EXHAUSTED;case ce.INTERNAL:return P.INTERNAL;case ce.UNAVAILABLE:return P.UNAVAILABLE;case ce.UNAUTHENTICATED:return P.UNAUTHENTICATED;case ce.INVALID_ARGUMENT:return P.INVALID_ARGUMENT;case ce.NOT_FOUND:return P.NOT_FOUND;case ce.ALREADY_EXISTS:return P.ALREADY_EXISTS;case ce.PERMISSION_DENIED:return P.PERMISSION_DENIED;case ce.FAILED_PRECONDITION:return P.FAILED_PRECONDITION;case ce.ABORTED:return P.ABORTED;case ce.OUT_OF_RANGE:return P.OUT_OF_RANGE;case ce.UNIMPLEMENTED:return P.UNIMPLEMENTED;case ce.DATA_LOSS:return P.DATA_LOSS;default:return F()}}(K=ce||(ce={}))[K.OK=0]="OK",K[K.CANCELLED=1]="CANCELLED",K[K.UNKNOWN=2]="UNKNOWN",K[K.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",K[K.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",K[K.NOT_FOUND=5]="NOT_FOUND",K[K.ALREADY_EXISTS=6]="ALREADY_EXISTS",K[K.PERMISSION_DENIED=7]="PERMISSION_DENIED",K[K.UNAUTHENTICATED=16]="UNAUTHENTICATED",K[K.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",K[K.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",K[K.ABORTED=10]="ABORTED",K[K.OUT_OF_RANGE=11]="OUT_OF_RANGE",K[K.UNIMPLEMENTED=12]="UNIMPLEMENTED",K[K.INTERNAL=13]="INTERNAL",K[K.UNAVAILABLE=14]="UNAVAILABLE",K[K.DATA_LOSS=15]="DATA_LOSS";/**
|
|
1033
1077
|
* @license
|
|
1034
1078
|
* Copyright 2023 Google LLC
|
|
1035
1079
|
*
|
|
@@ -1044,7 +1088,7 @@
|
|
|
1044
1088
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1045
1089
|
* See the License for the specific language governing permissions and
|
|
1046
1090
|
* limitations under the License.
|
|
1047
|
-
*/function
|
|
1091
|
+
*/function Vg(){return new TextEncoder}/**
|
|
1048
1092
|
* @license
|
|
1049
1093
|
* Copyright 2022 Google LLC
|
|
1050
1094
|
*
|
|
@@ -1059,7 +1103,7 @@
|
|
|
1059
1103
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1060
1104
|
* See the License for the specific language governing permissions and
|
|
1061
1105
|
* limitations under the License.
|
|
1062
|
-
*/const
|
|
1106
|
+
*/const Lg=new St([4294967295,4294967295],0);function Nu(n){const e=Vg().encode(n),t=new bc;return t.update(e),new Uint8Array(t.digest())}function Du(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new St([t,r],0),new St([s,i],0)]}class co{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new _r(`Invalid padding: ${t}`);if(r<0)throw new _r(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new _r(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new _r(`Invalid padding when bitmap length is 0: ${t}`);this.Ee=8*e.length-t,this.de=St.fromNumber(this.Ee)}Ae(e,t,r){let s=e.add(t.multiply(St.fromNumber(r)));return s.compare(Lg)===1&&(s=new St([s.getBits(0),s.getBits(1)],0)),s.modulo(this.de).toNumber()}Re(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.Ee===0)return!1;const t=Nu(e),[r,s]=Du(t);for(let i=0;i<this.hashCount;i++){const a=this.Ae(r,s,i);if(!this.Re(a))return!1}return!0}static create(e,t,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new co(i,s,t);return r.forEach(c=>a.insert(c)),a}insert(e){if(this.Ee===0)return;const t=Nu(e),[r,s]=Du(t);for(let i=0;i<this.hashCount;i++){const a=this.Ae(r,s,i);this.Ve(a)}}Ve(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class _r extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
|
|
1063
1107
|
* @license
|
|
1064
1108
|
* Copyright 2017 Google LLC
|
|
1065
1109
|
*
|
|
@@ -1074,7 +1118,7 @@
|
|
|
1074
1118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1075
1119
|
* See the License for the specific language governing permissions and
|
|
1076
1120
|
* limitations under the License.
|
|
1077
|
-
*/class
|
|
1121
|
+
*/class bs{constructor(e,t,r,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const s=new Map;return s.set(e,yr.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new bs(j.min(),s,new re(G),pt(),W())}}class yr{constructor(e,t,r,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new yr(r,t,W(),W(),W())}}/**
|
|
1078
1122
|
* @license
|
|
1079
1123
|
* Copyright 2017 Google LLC
|
|
1080
1124
|
*
|
|
@@ -1089,7 +1133,7 @@
|
|
|
1089
1133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1090
1134
|
* See the License for the specific language governing permissions and
|
|
1091
1135
|
* limitations under the License.
|
|
1092
|
-
*/class Bs{constructor(e,t,r,s){this.Ve=e,this.removedTargetIds=t,this.key=r,this.me=s}}class Ll{constructor(e,t){this.targetId=e,this.fe=t}}class Ml{constructor(e,t,r=le.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class xl{constructor(){this.ge=0,this.pe=Fl(),this.ye=le.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=D(),t=D(),r=D();return this.pe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:A()}}),new br(this.ye,this.we,e,t,r)}Fe(){this.Se=!1,this.pe=Fl()}Me(e,t){this.Se=!0,this.pe=this.pe.insert(e,t)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1,F(this.ge>=0)}Le(){this.Se=!0,this.we=!0}}class A_{constructor(e){this.Be=e,this.ke=new Map,this.qe=nt(),this.Qe=Ul(),this.Ke=new $(M)}$e(e){for(const t of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(t,e.me):this.We(t,e.key,e.me);for(const t of e.removedTargetIds)this.We(t,e.key,e.me)}Ge(e){this.forEachTarget(e,t=>{const r=this.ze(t);switch(e.state){case 0:this.je(t)&&r.Ce(e.resumeToken);break;case 1:r.Ne(),r.be||r.Fe(),r.Ce(e.resumeToken);break;case 2:r.Ne(),r.be||this.removeTarget(t);break;case 3:this.je(t)&&(r.Le(),r.Ce(e.resumeToken));break;case 4:this.je(t)&&(this.He(t),r.Ce(e.resumeToken));break;default:A()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ke.forEach((r,s)=>{this.je(s)&&t(s)})}Je(e){const t=e.targetId,r=e.fe.count,s=this.Ye(t);if(s){const i=s.target;if(Uo(i))if(r===0){const o=new w(i.path);this.We(t,o,he.newNoDocument(o,S.min()))}else F(r===1);else{const o=this.Ze(t);if(o!==r){const a=this.Xe(e),c=a?this.et(a,e,o):1;if(c!==0){this.He(t);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(t,u)}}}}}Xe(e){const t=e.fe.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let o,a;try{o=jt(r).toUint8Array()}catch(c){if(c instanceof Zu)return cn("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new $o(o,s,i)}catch(c){return cn(c instanceof Sr?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.Te===0?null:a}et(e,t,r){return t.fe.count===r-this.rt(e,t.targetId)?0:2}rt(e,t){const r=this.Be.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const o=this.Be.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.We(t,i,null),s++)}),s}it(e){const t=new Map;this.ke.forEach((i,o)=>{const a=this.Ye(o);if(a){if(i.current&&Uo(a.target)){const c=new w(a.target.path);this.qe.get(c)!==null||this.st(o,c)||this.We(o,c,he.newNoDocument(c,e))}i.De&&(t.set(o,i.ve()),i.Fe())}});let r=D();this.Qe.forEach((i,o)=>{let a=!0;o.forEachWhile(c=>{const u=this.Ye(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(i))}),this.qe.forEach((i,o)=>o.setReadTime(e));const s=new Fs(e,t,this.Ke,this.qe,r);return this.qe=nt(),this.Qe=Ul(),this.Ke=new $(M),s}Ue(e,t){if(!this.je(e))return;const r=this.st(e,t.key)?2:0;this.ze(e).Me(t.key,r),this.qe=this.qe.insert(t.key,t),this.Qe=this.Qe.insert(t.key,this.ot(t.key).add(e))}We(e,t,r){if(!this.je(e))return;const s=this.ze(e);this.st(e,t)?s.Me(t,1):s.xe(t),this.Qe=this.Qe.insert(t,this.ot(t).delete(e)),r&&(this.qe=this.qe.insert(t,r))}removeTarget(e){this.ke.delete(e)}Ze(e){const t=this.ze(e).ve();return this.Be.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let t=this.ke.get(e);return t||(t=new xl,this.ke.set(e,t)),t}ot(e){let t=this.Qe.get(e);return t||(t=new se(M),this.Qe=this.Qe.insert(e,t)),t}je(e){const t=this.Ye(e)!==null;return t||v("WatchChangeAggregator","Detected inactive target",e),t}Ye(e){const t=this.ke.get(e);return t&&t.be?null:this.Be._t(e)}He(e){this.ke.set(e,new xl),this.Be.getRemoteKeysForTarget(e).forEach(t=>{this.We(e,t,null)})}st(e,t){return this.Be.getRemoteKeysForTarget(e).has(t)}}function Ul(){return new $(w.comparator)}function Fl(){return new $(w.comparator)}const R_={asc:"ASCENDING",desc:"DESCENDING"},P_={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},S_={and:"AND",or:"OR"};class b_{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function zo(n,e){return n.useProto3Json||Is(e)?e:{value:e}}function js(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Bl(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function C_(n,e){return js(n,e.toTimestamp())}function We(n){return F(!!n),S.fromTimestamp(function(t){const r=yt(t);return new Y(r.seconds,r.nanos)}(n))}function Ho(n,e){return Wo(n,e).canonicalString()}function Wo(n,e){const t=function(s){return new B(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function jl(n){const e=B.fromString(n);return F(Kl(e)),e}function Go(n,e){return Ho(n.databaseId,e.path)}function Ko(n,e){const t=jl(e);if(t.get(1)!==n.databaseId.projectId)throw new g(p.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new g(p.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new w($l(t))}function ql(n,e){return Ho(n.databaseId,e)}function k_(n){const e=jl(n);return e.length===4?B.emptyPath():$l(e)}function Qo(n){return new B(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function $l(n){return F(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function zl(n,e,t){return{name:Go(n,e),fields:t.value.mapValue.fields}}function D_(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:A()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,l){return u.useProto3Json?(F(l===void 0||typeof l=="string"),le.fromBase64String(l||"")):(F(l===void 0||l instanceof Buffer||l instanceof Uint8Array),le.fromUint8Array(l||new Uint8Array))}(n,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const l=u.code===void 0?p.UNKNOWN:Nl(u.code);return new g(l,u.message||"")}(o);t=new Ml(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Ko(n,r.document.name),i=We(r.document.updateTime),o=r.document.createTime?We(r.document.createTime):S.min(),a=new _e({mapValue:{fields:r.document.fields}}),c=he.newFoundDocument(s,i,o,a),u=r.targetIds||[],l=r.removedTargetIds||[];t=new Bs(u,l,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Ko(n,r.document),i=r.readTime?We(r.readTime):S.min(),o=he.newNoDocument(s,i),a=r.removedTargetIds||[];t=new Bs([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Ko(n,r.document),i=r.removedTargetIds||[];t=new Bs([],i,s,null)}else{if(!("filter"in e))return A();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new E_(s,i),a=r.targetId;t=new Ll(a,o)}}return t}function N_(n,e){let t;if(e instanceof Pr)t={update:zl(n,e.key,e.value)};else if(e instanceof Us)t={delete:Go(n,e.key)};else if(e instanceof vt)t={update:zl(n,e.key,e.data),updateMask:B_(e.fieldMask)};else{if(!(e instanceof g_))return A();t={verify:Go(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const a=o.transform;if(a instanceof Vs)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Ir)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Ar)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Ls)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw A()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:C_(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:A()}(n,e.precondition)),t}function O_(n,e){return n&&n.length>0?(F(e!==void 0),n.map(t=>function(s,i){let o=s.updateTime?We(s.updateTime):We(i);return o.isEqual(S.min())&&(o=We(i)),new f_(o,s.transformResults||[])}(t,e))):[]}function V_(n,e){return{documents:[ql(n,e.path)]}}function Hl(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=ql(n,s);const i=function(u){if(u.length!==0)return Gl(Ve.create(u,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(l=>function(d){return{field:Et(d.field),direction:x_(d.dir)}}(l))}(e.orderBy);o&&(t.structuredQuery.orderBy=o);const a=zo(n,e.limit);return a!==null&&(t.structuredQuery.limit=a),e.startAt&&(t.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ut:t,parent:s}}function L_(n){let e=k_(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){F(r===1);const l=t.from[0];l.allDescendants?s=l.collectionId:e=e.child(l.collectionId)}let i=[];t.where&&(i=function(h){const d=Wl(h);return d instanceof Ve&&cl(d)?d.getFilters():[d]}(t.where));let o=[];t.orderBy&&(o=function(h){return h.map(d=>function(E){return new Er(gn(E.field),function(_){switch(_){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(E.direction))}(d))}(t.orderBy));let a=null;t.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,Is(d)?null:d}(t.limit));let c=null;t.startAt&&(c=function(h){const d=!!h.before,f=h.values||[];return new dn(f,d)}(t.startAt));let u=null;return t.endAt&&(u=function(h){const d=!h.before,f=h.values||[];return new dn(f,d)}(t.endAt)),t_(e,s,o,i,a,"F",c,u)}function M_(n,e){const t=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return A()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Wl(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=gn(t.unaryFilter.field);return K.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=gn(t.unaryFilter.field);return K.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=gn(t.unaryFilter.field);return K.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=gn(t.unaryFilter.field);return K.create(o,"!=",{nullValue:"NULL_VALUE"});default:return A()}}(n):n.fieldFilter!==void 0?function(t){return K.create(gn(t.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return A()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return Ve.create(t.compositeFilter.filters.map(r=>Wl(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return A()}}(t.compositeFilter.op))}(n):A()}function x_(n){return R_[n]}function U_(n){return P_[n]}function F_(n){return S_[n]}function Et(n){return{fieldPath:n.canonicalString()}}function gn(n){return ne.fromServerFormat(n.fieldPath)}function Gl(n){return n instanceof K?function(t){if(t.op==="=="){if(nl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NAN"}};if(tl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(nl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NOT_NAN"}};if(tl(t.value))return{unaryFilter:{field:Et(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Et(t.field),op:U_(t.op),value:t.value}}}(n):n instanceof Ve?function(t){const r=t.getFilters().map(s=>Gl(s));return r.length===1?r[0]:{compositeFilter:{op:F_(t.op),filters:r}}}(n):A()}function B_(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Kl(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
|
|
1136
|
+
*/class Ps{constructor(e,t,r,s){this.me=e,this.removedTargetIds=t,this.key=r,this.fe=s}}class Ou{constructor(e,t){this.targetId=e,this.ge=t}}class Vu{constructor(e,t,r=_e.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class Lu{constructor(){this.pe=0,this.ye=Mu(),this.we=_e.EMPTY_BYTE_STRING,this.Se=!1,this.be=!0}get current(){return this.Se}get resumeToken(){return this.we}get De(){return this.pe!==0}get ve(){return this.be}Ce(e){e.approximateByteSize()>0&&(this.be=!0,this.we=e)}Fe(){let e=W(),t=W(),r=W();return this.ye.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:F()}}),new yr(this.we,this.Se,e,t,r)}Me(){this.be=!1,this.ye=Mu()}xe(e,t){this.be=!0,this.ye=this.ye.insert(e,t)}Oe(e){this.be=!0,this.ye=this.ye.remove(e)}Ne(){this.pe+=1}Be(){this.pe-=1,Y(this.pe>=0)}Le(){this.be=!0,this.Se=!0}}class Mg{constructor(e){this.ke=e,this.qe=new Map,this.Qe=pt(),this.$e=Ss(),this.Ke=Ss(),this.Ue=new re(G)}We(e){for(const t of e.me)e.fe&&e.fe.isFoundDocument()?this.Ge(t,e.fe):this.ze(t,e.key,e.fe);for(const t of e.removedTargetIds)this.ze(t,e.key,e.fe)}je(e){this.forEachTarget(e,t=>{const r=this.He(t);switch(e.state){case 0:this.Je(t)&&r.Ce(e.resumeToken);break;case 1:r.Be(),r.De||r.Me(),r.Ce(e.resumeToken);break;case 2:r.Be(),r.De||this.removeTarget(t);break;case 3:this.Je(t)&&(r.Le(),r.Ce(e.resumeToken));break;case 4:this.Je(t)&&(this.Ye(t),r.Ce(e.resumeToken));break;default:F()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.qe.forEach((r,s)=>{this.Je(s)&&t(s)})}Ze(e){const t=e.targetId,r=e.ge.count,s=this.Xe(t);if(s){const i=s.target;if(ro(i))if(r===0){const a=new L(i.path);this.ze(t,a,Ie.newNoDocument(a,j.min()))}else Y(r===1);else{const a=this.et(t);if(a!==r){const c=this.tt(e),l=c?this.nt(c,e,a):1;if(l!==0){this.Ye(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ue=this.Ue.insert(t,d)}}}}}tt(e){const t=e.ge.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,c;try{a=Dt(r).toUint8Array()}catch(l){if(l instanceof zc)return yn("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new co(a,s,i)}catch(l){return yn(l instanceof _r?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.Ee===0?null:c}nt(e,t,r){return t.ge.count===r-this.st(e,t.targetId)?0:2}st(e,t){const r=this.ke.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const a=this.ke.it(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.ze(t,i,null),s++)}),s}ot(e){const t=new Map;this.qe.forEach((i,a)=>{const c=this.Xe(a);if(c){if(i.current&&ro(c.target)){const l=new L(c.target.path);this._t(l).has(a)||this.ut(a,l)||this.ze(a,l,Ie.newNoDocument(l,e))}i.ve&&(t.set(a,i.Fe()),i.Me())}});let r=W();this.Ke.forEach((i,a)=>{let c=!0;a.forEachWhile(l=>{const d=this.Xe(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)}),c&&(r=r.add(i))}),this.Qe.forEach((i,a)=>a.setReadTime(e));const s=new bs(e,t,this.Ue,this.Qe,r);return this.Qe=pt(),this.$e=Ss(),this.Ke=Ss(),this.Ue=new re(G),s}Ge(e,t){if(!this.Je(e))return;const r=this.ut(e,t.key)?2:0;this.He(e).xe(t.key,r),this.Qe=this.Qe.insert(t.key,t),this.$e=this.$e.insert(t.key,this._t(t.key).add(e)),this.Ke=this.Ke.insert(t.key,this.ct(t.key).add(e))}ze(e,t,r){if(!this.Je(e))return;const s=this.He(e);this.ut(e,t)?s.xe(t,1):s.Oe(t),this.Ke=this.Ke.insert(t,this.ct(t).delete(e)),this.Ke=this.Ke.insert(t,this.ct(t).add(e)),r&&(this.Qe=this.Qe.insert(t,r))}removeTarget(e){this.qe.delete(e)}et(e){const t=this.He(e).Fe();return this.ke.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ne(e){this.He(e).Ne()}He(e){let t=this.qe.get(e);return t||(t=new Lu,this.qe.set(e,t)),t}ct(e){let t=this.Ke.get(e);return t||(t=new le(G),this.Ke=this.Ke.insert(e,t)),t}_t(e){let t=this.$e.get(e);return t||(t=new le(G),this.$e=this.$e.insert(e,t)),t}Je(e){const t=this.Xe(e)!==null;return t||V("WatchChangeAggregator","Detected inactive target",e),t}Xe(e){const t=this.qe.get(e);return t&&t.De?null:this.ke.lt(e)}Ye(e){this.qe.set(e,new Lu),this.ke.getRemoteKeysForTarget(e).forEach(t=>{this.ze(e,t,null)})}ut(e,t){return this.ke.getRemoteKeysForTarget(e).has(t)}}function Ss(){return new re(L.comparator)}function Mu(){return new re(L.comparator)}const Ug={asc:"ASCENDING",desc:"DESCENDING"},xg={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Fg={and:"AND",or:"OR"};class Bg{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function uo(n,e){return n.useProto3Json||is(e)?e:{value:e}}function Cs(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Uu(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function jg(n,e){return Cs(n,e.toTimestamp())}function rt(n){return Y(!!n),j.fromTimestamp(function(t){const r=Nt(t);return new ue(r.seconds,r.nanos)}(n))}function lo(n,e){return ho(n,e).canonicalString()}function ho(n,e){const t=function(s){return new ee(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function xu(n){const e=ee.fromString(n);return Y(zu(e)),e}function fo(n,e){return lo(n.databaseId,e.path)}function po(n,e){const t=xu(e);if(t.get(1)!==n.databaseId.projectId)throw new O(P.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new O(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new L(Bu(t))}function Fu(n,e){return lo(n.databaseId,e)}function qg(n){const e=xu(n);return e.length===4?ee.emptyPath():Bu(e)}function mo(n){return new ee(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Bu(n){return Y(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function ju(n,e,t){return{name:fo(n,e),fields:t.value.mapValue.fields}}function $g(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:F()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(d,f){return d.useProto3Json?(Y(f===void 0||typeof f=="string"),_e.fromBase64String(f||"")):(Y(f===void 0||f instanceof Buffer||f instanceof Uint8Array),_e.fromUint8Array(f||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&function(d){const f=d.code===void 0?P.UNKNOWN:ku(d.code);return new O(f,d.message||"")}(a);t=new Vu(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=po(n,r.document.name),i=rt(r.document.updateTime),a=r.document.createTime?rt(r.document.createTime):j.min(),c=new De({mapValue:{fields:r.document.fields}}),l=Ie.newFoundDocument(s,i,a,c),d=r.targetIds||[],f=r.removedTargetIds||[];t=new Ps(d,f,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=po(n,r.document),i=r.readTime?rt(r.readTime):j.min(),a=Ie.newNoDocument(s,i),c=r.removedTargetIds||[];t=new Ps([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=po(n,r.document),i=r.removedTargetIds||[];t=new Ps([],i,s,null)}else{if(!("filter"in e))return F();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new Dg(s,i),c=r.targetId;t=new Ou(c,a)}}return t}function Hg(n,e){let t;if(e instanceof gr)t={update:ju(n,e.key,e.value)};else if(e instanceof Rs)t={delete:fo(n,e.key)};else if(e instanceof Vt)t={update:ju(n,e.key,e.data),updateMask:Zg(e.fieldMask)};else{if(!(e instanceof Sg))return F();t={verify:fo(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,a){const c=a.transform;if(c instanceof Ts)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof fr)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof pr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof ws)return{fieldPath:a.field.canonicalString(),increment:c.Ie};throw F()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:jg(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:F()}(n,e.precondition)),t}function zg(n,e){return n&&n.length>0?(Y(e!==void 0),n.map(t=>function(s,i){let a=s.updateTime?rt(s.updateTime):rt(i);return a.isEqual(j.min())&&(a=rt(i)),new Rg(a,s.transformResults||[])}(t,e))):[]}function Wg(n,e){return{documents:[Fu(n,e.path)]}}function qu(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=Fu(n,s);const i=function(d){if(d.length!==0)return Hu(We.create(d,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const a=function(d){if(d.length!==0)return d.map(f=>function(v){return{field:Lt(v.field),direction:Xg(v.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=uo(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=function(d){return{before:d.inclusive,values:d.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(d){return{before:!d.inclusive,values:d.position}}(e.endAt)),{ht:t,parent:s}}function Gg(n,e,t,r){const{ht:s,parent:i}=qu(n,e),a={},c=[];let l=0;return t.forEach(d=>{const f="aggregate_"+l++;a[f]=d.alias,d.aggregateType==="count"?c.push({alias:f,count:{}}):d.aggregateType==="avg"?c.push({alias:f,avg:{field:Lt(d.fieldPath)}}):d.aggregateType==="sum"&&c.push({alias:f,sum:{field:Lt(d.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:c,structuredQuery:s.structuredQuery},parent:s.parent},Pt:a,parent:i}}function Kg(n){let e=qg(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){Y(r===1);const f=t.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];t.where&&(i=function(m){const v=$u(m);return v instanceof We&&au(v)?v.getFilters():[v]}(t.where));let a=[];t.orderBy&&(a=function(m){return m.map(v=>function(S){return new lr(Pn(S.field),function(k){switch(k){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(S.direction))}(v))}(t.orderBy));let c=null;t.limit&&(c=function(m){let v;return v=typeof m=="object"?m.value:m,is(v)?null:v}(t.limit));let l=null;t.startAt&&(l=function(m){const v=!!m.before,R=m.values||[];return new An(R,v)}(t.startAt));let d=null;return t.endAt&&(d=function(m){const v=!m.before,R=m.values||[];return new An(R,v)}(t.endAt)),dg(e,s,a,i,c,"F",l,d)}function Qg(n,e){const t=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return F()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function $u(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=Pn(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Pn(t.unaryFilter.field);return ae.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Pn(t.unaryFilter.field);return ae.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=Pn(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});default:return F()}}(n):n.fieldFilter!==void 0?function(t){return ae.create(Pn(t.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return F()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return We.create(t.compositeFilter.filters.map(r=>$u(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return F()}}(t.compositeFilter.op))}(n):F()}function Xg(n){return Ug[n]}function Yg(n){return xg[n]}function Jg(n){return Fg[n]}function Lt(n){return{fieldPath:n.canonicalString()}}function Pn(n){return me.fromServerFormat(n.fieldPath)}function Hu(n){return n instanceof ae?function(t){if(t.op==="=="){if(tu(t.value))return{unaryFilter:{field:Lt(t.field),op:"IS_NAN"}};if(eu(t.value))return{unaryFilter:{field:Lt(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(tu(t.value))return{unaryFilter:{field:Lt(t.field),op:"IS_NOT_NAN"}};if(eu(t.value))return{unaryFilter:{field:Lt(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Lt(t.field),op:Yg(t.op),value:t.value}}}(n):n instanceof We?function(t){const r=t.getFilters().map(s=>Hu(s));return r.length===1?r[0]:{compositeFilter:{op:Jg(t.op),filters:r}}}(n):F()}function Zg(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function zu(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
|
|
1093
1137
|
* @license
|
|
1094
1138
|
* Copyright 2017 Google LLC
|
|
1095
1139
|
*
|
|
@@ -1104,7 +1148,7 @@
|
|
|
1104
1148
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1105
1149
|
* See the License for the specific language governing permissions and
|
|
1106
1150
|
* limitations under the License.
|
|
1107
|
-
*/class
|
|
1151
|
+
*/class Mt{constructor(e,t,r,s,i=j.min(),a=j.min(),c=_e.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new Mt(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Mt(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Mt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Mt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
|
|
1108
1152
|
* @license
|
|
1109
1153
|
* Copyright 2017 Google LLC
|
|
1110
1154
|
*
|
|
@@ -1119,7 +1163,7 @@
|
|
|
1119
1163
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1120
1164
|
* See the License for the specific language governing permissions and
|
|
1121
1165
|
* limitations under the License.
|
|
1122
|
-
*/class
|
|
1166
|
+
*/class e_{constructor(e){this.Tt=e}}function t_(n){const e=Kg({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?_s(e,e.limit,"L"):e}/**
|
|
1123
1167
|
* @license
|
|
1124
1168
|
* Copyright 2019 Google LLC
|
|
1125
1169
|
*
|
|
@@ -1134,7 +1178,37 @@
|
|
|
1134
1178
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1135
1179
|
* See the License for the specific language governing permissions and
|
|
1136
1180
|
* limitations under the License.
|
|
1137
|
-
*/class
|
|
1181
|
+
*/class n_{constructor(){this.Tn=new r_}addToCollectionParentIndex(e,t){return this.Tn.add(t),C.resolve()}getCollectionParents(e,t){return C.resolve(this.Tn.getEntries(t))}addFieldIndex(e,t){return C.resolve()}deleteFieldIndex(e,t){return C.resolve()}deleteAllFieldIndexes(e){return C.resolve()}createTargetIndexes(e,t){return C.resolve()}getDocumentsMatchingTarget(e,t){return C.resolve(null)}getIndexType(e,t){return C.resolve(0)}getFieldIndexes(e,t){return C.resolve([])}getNextCollectionGroupToUpdate(e){return C.resolve(null)}getMinOffset(e,t){return C.resolve(Ct.min())}getMinOffsetFromCollectionGroup(e,t){return C.resolve(Ct.min())}updateCollectionGroup(e,t,r){return C.resolve()}updateIndexEntries(e,t){return C.resolve()}}class r_{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new le(ee.comparator),i=!s.has(r);return this.index[t]=s.add(r),i}has(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t];return s&&s.has(r)}getEntries(e){return(this.index[e]||new le(ee.comparator)).toArray()}}/**
|
|
1182
|
+
* @license
|
|
1183
|
+
* Copyright 2018 Google LLC
|
|
1184
|
+
*
|
|
1185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1186
|
+
* you may not use this file except in compliance with the License.
|
|
1187
|
+
* You may obtain a copy of the License at
|
|
1188
|
+
*
|
|
1189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1190
|
+
*
|
|
1191
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1194
|
+
* See the License for the specific language governing permissions and
|
|
1195
|
+
* limitations under the License.
|
|
1196
|
+
*/const Wu={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Gu=41943040;class Oe{static withCacheSize(e){return new Oe(e,Oe.DEFAULT_COLLECTION_PERCENTILE,Oe.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}/**
|
|
1197
|
+
* @license
|
|
1198
|
+
* Copyright 2017 Google LLC
|
|
1199
|
+
*
|
|
1200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1201
|
+
* you may not use this file except in compliance with the License.
|
|
1202
|
+
* You may obtain a copy of the License at
|
|
1203
|
+
*
|
|
1204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1205
|
+
*
|
|
1206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
|
+
* See the License for the specific language governing permissions and
|
|
1210
|
+
* limitations under the License.
|
|
1211
|
+
*/Oe.DEFAULT_COLLECTION_PERCENTILE=10,Oe.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Oe.DEFAULT=new Oe(Gu,Oe.DEFAULT_COLLECTION_PERCENTILE,Oe.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Oe.DISABLED=new Oe(-1,0,0);/**
|
|
1138
1212
|
* @license
|
|
1139
1213
|
* Copyright 2017 Google LLC
|
|
1140
1214
|
*
|
|
@@ -1149,7 +1223,27 @@
|
|
|
1149
1223
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1150
1224
|
* See the License for the specific language governing permissions and
|
|
1151
1225
|
* limitations under the License.
|
|
1152
|
-
*/class
|
|
1226
|
+
*/class Sn{constructor(e){this.$n=e}next(){return this.$n+=2,this.$n}static Kn(){return new Sn(0)}static Un(){return new Sn(-1)}}/**
|
|
1227
|
+
* @license
|
|
1228
|
+
* Copyright 2020 Google LLC
|
|
1229
|
+
*
|
|
1230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1231
|
+
* you may not use this file except in compliance with the License.
|
|
1232
|
+
* You may obtain a copy of the License at
|
|
1233
|
+
*
|
|
1234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1235
|
+
*
|
|
1236
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1239
|
+
* See the License for the specific language governing permissions and
|
|
1240
|
+
* limitations under the License.
|
|
1241
|
+
*/const Ku="LruGarbageCollector",s_=1048576;function Qu([n,e],[t,r]){const s=G(n,t);return s===0?G(e,r):s}class i_{constructor(e){this.Hn=e,this.buffer=new le(Qu),this.Jn=0}Yn(){return++this.Jn}Zn(e){const t=[e,this.Yn()];if(this.buffer.size<this.Hn)this.buffer=this.buffer.add(t);else{const r=this.buffer.last();Qu(t,r)<0&&(this.buffer=this.buffer.delete(r).add(t))}}get maxValue(){return this.buffer.last()[0]}}class o_{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Xn=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.er(6e4)}stop(){this.Xn&&(this.Xn.cancel(),this.Xn=null)}get started(){return this.Xn!==null}er(e){V(Ku,`Garbage collection scheduled in ${e}ms`),this.Xn=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Xn=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(t){Tn(t)?V(Ku,"Ignoring IndexedDB error during garbage collection: ",t):await En(t)}await this.er(3e5)})}}class a_{constructor(e,t){this.tr=e,this.params=t}calculateTargetCount(e,t){return this.tr.nr(e).next(r=>Math.floor(t/100*r))}nthSequenceNumber(e,t){if(t===0)return C.resolve(ss.ae);const r=new i_(t);return this.tr.forEachTarget(e,s=>r.Zn(s.sequenceNumber)).next(()=>this.tr.rr(e,s=>r.Zn(s))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.tr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.tr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(V("LruGarbageCollector","Garbage collection skipped; disabled"),C.resolve(Wu)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(V("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Wu):this.ir(e,t))}getCacheSize(e){return this.tr.getCacheSize(e)}ir(e,t){let r,s,i,a,c,l,d;const f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(m=>(m>this.params.maximumSequenceNumbersToCollect?(V("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${m}`),s=this.params.maximumSequenceNumbersToCollect):s=m,a=Date.now(),this.nthSequenceNumber(e,s))).next(m=>(r=m,c=Date.now(),this.removeTargets(e,r,t))).next(m=>(i=m,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(m=>(d=Date.now(),_n()<=z.DEBUG&&V("LruGarbageCollector",`LRU Garbage Collection
|
|
1242
|
+
Counted targets in ${a-f}ms
|
|
1243
|
+
Determined least recently used ${s} in `+(c-a)+`ms
|
|
1244
|
+
Removed ${i} targets in `+(l-c)+`ms
|
|
1245
|
+
Removed ${m} documents in `+(d-l)+`ms
|
|
1246
|
+
Total Duration: ${d-f}ms`),C.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:m})))}}function c_(n,e){return new a_(n,e)}/**
|
|
1153
1247
|
* @license
|
|
1154
1248
|
* Copyright 2017 Google LLC
|
|
1155
1249
|
*
|
|
@@ -1164,7 +1258,7 @@
|
|
|
1164
1258
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1165
1259
|
* See the License for the specific language governing permissions and
|
|
1166
1260
|
* limitations under the License.
|
|
1167
|
-
*/class
|
|
1261
|
+
*/class u_{constructor(){this.changes=new Zt(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Ie.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?C.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
|
|
1168
1262
|
* @license
|
|
1169
1263
|
* Copyright 2017 Google LLC
|
|
1170
1264
|
*
|
|
@@ -1194,7 +1288,7 @@
|
|
|
1194
1288
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1195
1289
|
* See the License for the specific language governing permissions and
|
|
1196
1290
|
* limitations under the License.
|
|
1197
|
-
*/class
|
|
1291
|
+
*/class l_{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
|
|
1198
1292
|
* @license
|
|
1199
1293
|
* Copyright 2017 Google LLC
|
|
1200
1294
|
*
|
|
@@ -1209,7 +1303,7 @@
|
|
|
1209
1303
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1210
1304
|
* See the License for the specific language governing permissions and
|
|
1211
1305
|
* limitations under the License.
|
|
1212
|
-
*/class
|
|
1306
|
+
*/class h_{constructor(e,t,r,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,t))).next(s=>(r!==null&&mr(r.mutation,s,Fe.empty(),ue.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,W()).next(()=>r))}getLocalViewOfDocuments(e,t,r=W()){const s=en();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let a=hr();return i.forEach((c,l)=>{a=a.insert(c,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=en();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,W()))}populateOverlays(e,t,r){const s=[];return r.forEach(i=>{t.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((a,c)=>{t.set(a,c)})})}computeViews(e,t,r,s){let i=pt();const a=dr(),c=function(){return dr()}();return t.forEach((l,d)=>{const f=r.get(d.key);s.has(d.key)&&(f===void 0||f.mutation instanceof Vt)?i=i.insert(d.key,d):f!==void 0?(a.set(d.key,f.mutation.getFieldMask()),mr(f.mutation,d,f.mutation.getFieldMask(),ue.now())):a.set(d.key,Fe.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((d,f)=>a.set(d,f)),t.forEach((d,f)=>{var m;return c.set(d,new l_(f,(m=a.get(d))!==null&&m!==void 0?m:null))}),c))}recalculateAndSaveOverlays(e,t){const r=dr();let s=new re((a,c)=>a-c),i=W();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const c of a)c.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let f=r.get(l)||Fe.empty();f=c.applyToLocalView(d,f),r.set(l,f);const m=(s.get(c.batchId)||W()).add(l);s=s.insert(c.batchId,m)})}).next(()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,f=l.value,m=yu();f.forEach(v=>{if(!i.has(v)){const R=Ru(t.get(v),r.get(v));R!==null&&m.set(v,R),i=i.add(v)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,m))}return C.waitFor(a)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return function(a){return L.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):so(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,s):this.getDocumentsMatchingCollectionQuery(e,t,r,s)}getNextDocuments(e,t,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,s).next(i=>{const a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):C.resolve(en());let c=ir,l=i;return a.next(d=>C.forEach(d,(f,m)=>(c<m.largestBatchId&&(c=m.largestBatchId),i.get(f)?C.resolve():this.remoteDocumentCache.getEntry(e,f).next(v=>{l=l.insert(f,v)}))).next(()=>this.populateOverlays(e,d,i)).next(()=>this.computeViews(e,l,d,W())).next(f=>({batchId:c,changes:_u(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new L(t)).next(r=>{let s=hr();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=hr();return this.indexManager.getCollectionParents(e,i).next(c=>C.forEach(c,l=>{const d=function(m,v){return new Jt(v,null,m.explicitOrderBy.slice(),m.filters.slice(),m.limit,m.limitType,m.startAt,m.endAt)}(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next(f=>{f.forEach((m,v)=>{a=a.insert(m,v)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(a=>{i.forEach((l,d)=>{const f=d.getKey();a.get(f)===null&&(a=a.insert(f,Ie.newInvalidDocument(f)))});let c=hr();return a.forEach((l,d)=>{const f=i.get(l);f!==void 0&&mr(f.mutation,d,Fe.empty(),ue.now()),vs(t,d)&&(c=c.insert(l,d))}),c})}}/**
|
|
1213
1307
|
* @license
|
|
1214
1308
|
* Copyright 2020 Google LLC
|
|
1215
1309
|
*
|
|
@@ -1224,7 +1318,7 @@
|
|
|
1224
1318
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1225
1319
|
* See the License for the specific language governing permissions and
|
|
1226
1320
|
* limitations under the License.
|
|
1227
|
-
*/class
|
|
1321
|
+
*/class d_{constructor(e){this.serializer=e,this.dr=new Map,this.Ar=new Map}getBundleMetadata(e,t){return C.resolve(this.dr.get(t))}saveBundleMetadata(e,t){return this.dr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:rt(s.createTime)}}(t)),C.resolve()}getNamedQuery(e,t){return C.resolve(this.Ar.get(t))}saveNamedQuery(e,t){return this.Ar.set(t.name,function(s){return{name:s.name,query:t_(s.bundledQuery),readTime:rt(s.readTime)}}(t)),C.resolve()}}/**
|
|
1228
1322
|
* @license
|
|
1229
1323
|
* Copyright 2022 Google LLC
|
|
1230
1324
|
*
|
|
@@ -1239,7 +1333,22 @@
|
|
|
1239
1333
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1240
1334
|
* See the License for the specific language governing permissions and
|
|
1241
1335
|
* limitations under the License.
|
|
1242
|
-
*/class
|
|
1336
|
+
*/class f_{constructor(){this.overlays=new re(L.comparator),this.Rr=new Map}getOverlay(e,t){return C.resolve(this.overlays.get(t))}getOverlays(e,t){const r=en();return C.forEach(t,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((s,i)=>{this.Et(e,t,i)}),C.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Rr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Rr.delete(r)),C.resolve()}getOverlaysForCollection(e,t,r){const s=en(),i=t.length+1,a=new L(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return C.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new re((d,f)=>d-f);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let f=i.get(d.largestBatchId);f===null&&(f=en(),i=i.insert(d.largestBatchId,f)),f.set(d.getKey(),d)}}const c=en(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,f)=>c.set(d,f)),!(c.size()>=s)););return C.resolve(c)}Et(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Rr.get(s.largestBatchId).delete(r.key);this.Rr.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new kg(t,r));let i=this.Rr.get(t);i===void 0&&(i=W(),this.Rr.set(t,i)),this.Rr.set(t,i.add(r.key))}}/**
|
|
1337
|
+
* @license
|
|
1338
|
+
* Copyright 2024 Google LLC
|
|
1339
|
+
*
|
|
1340
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1341
|
+
* you may not use this file except in compliance with the License.
|
|
1342
|
+
* You may obtain a copy of the License at
|
|
1343
|
+
*
|
|
1344
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1345
|
+
*
|
|
1346
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1347
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1348
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
|
+
* See the License for the specific language governing permissions and
|
|
1350
|
+
* limitations under the License.
|
|
1351
|
+
*/class p_{constructor(){this.sessionToken=_e.EMPTY_BYTE_STRING}getSessionToken(e){return C.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,C.resolve()}}/**
|
|
1243
1352
|
* @license
|
|
1244
1353
|
* Copyright 2017 Google LLC
|
|
1245
1354
|
*
|
|
@@ -1254,7 +1363,7 @@
|
|
|
1254
1363
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1255
1364
|
* See the License for the specific language governing permissions and
|
|
1256
1365
|
* limitations under the License.
|
|
1257
|
-
*/class
|
|
1366
|
+
*/class go{constructor(){this.Vr=new le(de.mr),this.gr=new le(de.pr)}isEmpty(){return this.Vr.isEmpty()}addReference(e,t){const r=new de(e,t);this.Vr=this.Vr.add(r),this.gr=this.gr.add(r)}yr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.wr(new de(e,t))}Sr(e,t){e.forEach(r=>this.removeReference(r,t))}br(e){const t=new L(new ee([])),r=new de(t,e),s=new de(t,e+1),i=[];return this.gr.forEachInRange([r,s],a=>{this.wr(a),i.push(a.key)}),i}Dr(){this.Vr.forEach(e=>this.wr(e))}wr(e){this.Vr=this.Vr.delete(e),this.gr=this.gr.delete(e)}vr(e){const t=new L(new ee([])),r=new de(t,e),s=new de(t,e+1);let i=W();return this.gr.forEachInRange([r,s],a=>{i=i.add(a.key)}),i}containsKey(e){const t=new de(e,0),r=this.Vr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class de{constructor(e,t){this.key=e,this.Cr=t}static mr(e,t){return L.comparator(e.key,t.key)||G(e.Cr,t.Cr)}static pr(e,t){return G(e.Cr,t.Cr)||L.comparator(e.key,t.key)}}/**
|
|
1258
1367
|
* @license
|
|
1259
1368
|
* Copyright 2017 Google LLC
|
|
1260
1369
|
*
|
|
@@ -1269,7 +1378,7 @@
|
|
|
1269
1378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1270
1379
|
* See the License for the specific language governing permissions and
|
|
1271
1380
|
* limitations under the License.
|
|
1272
|
-
*/class
|
|
1381
|
+
*/class m_{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Fr=1,this.Mr=new le(de.mr)}checkEmpty(e){return C.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.Fr;this.Fr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new Cg(i,t,r,s);this.mutationQueue.push(a);for(const c of s)this.Mr=this.Mr.add(new de(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return C.resolve(a)}lookupMutationBatch(e,t){return C.resolve(this.Or(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.Nr(r),i=s<0?0:s;return C.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return C.resolve(this.mutationQueue.length===0?Xi:this.Fr-1)}getAllMutationBatches(e){return C.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new de(t,0),s=new de(t,Number.POSITIVE_INFINITY),i=[];return this.Mr.forEachInRange([r,s],a=>{const c=this.Or(a.Cr);i.push(c)}),C.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new le(G);return t.forEach(s=>{const i=new de(s,0),a=new de(s,Number.POSITIVE_INFINITY);this.Mr.forEachInRange([i,a],c=>{r=r.add(c.Cr)})}),C.resolve(this.Br(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;L.isDocumentKey(i)||(i=i.child(""));const a=new de(new L(i),0);let c=new le(G);return this.Mr.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(l.Cr)),!0)},a),C.resolve(this.Br(c))}Br(e){const t=[];return e.forEach(r=>{const s=this.Or(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){Y(this.Lr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.Mr;return C.forEach(t.mutations,s=>{const i=new de(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Mr=r})}qn(e){}containsKey(e,t){const r=new de(t,0),s=this.Mr.firstAfterOrEqual(r);return C.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,C.resolve()}Lr(e,t){return this.Nr(e)}Nr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Or(e){const t=this.Nr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
|
|
1273
1382
|
* @license
|
|
1274
1383
|
* Copyright 2017 Google LLC
|
|
1275
1384
|
*
|
|
@@ -1284,7 +1393,7 @@
|
|
|
1284
1393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1285
1394
|
* See the License for the specific language governing permissions and
|
|
1286
1395
|
* limitations under the License.
|
|
1287
|
-
*/class
|
|
1396
|
+
*/class g_{constructor(e){this.kr=e,this.docs=function(){return new re(L.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,s=this.docs.get(r),i=s?s.size:0,a=this.kr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const r=this.docs.get(t);return C.resolve(r?r.document.mutableCopy():Ie.newInvalidDocument(t))}getEntries(e,t){let r=pt();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Ie.newInvalidDocument(s))}),C.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=pt();const a=t.path,c=new L(a.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(c);for(;l.hasNext();){const{key:d,value:{document:f}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||$m(qm(f),r)<=0||(s.has(f.key)||vs(t,f))&&(i=i.insert(f.key,f.mutableCopy()))}return C.resolve(i)}getAllFromCollectionGroup(e,t,r,s){F()}qr(e,t){return C.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new __(this)}getSize(e){return C.resolve(this.size)}}class __ extends u_{constructor(e){super(),this.Ir=e}applyChanges(e){const t=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.Ir.addEntry(e,s)):this.Ir.removeEntry(r)}),C.waitFor(t)}getFromCache(e,t){return this.Ir.getEntry(e,t)}getAllFromCache(e,t){return this.Ir.getEntries(e,t)}}/**
|
|
1288
1397
|
* @license
|
|
1289
1398
|
* Copyright 2017 Google LLC
|
|
1290
1399
|
*
|
|
@@ -1299,7 +1408,7 @@
|
|
|
1299
1408
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1300
1409
|
* See the License for the specific language governing permissions and
|
|
1301
1410
|
* limitations under the License.
|
|
1302
|
-
*/class
|
|
1411
|
+
*/class y_{constructor(e){this.persistence=e,this.Qr=new Zt(t=>to(t),no),this.lastRemoteSnapshotVersion=j.min(),this.highestTargetId=0,this.$r=0,this.Kr=new go,this.targetCount=0,this.Ur=Sn.Kn()}forEachTarget(e,t){return this.Qr.forEach((r,s)=>t(s)),C.resolve()}getLastRemoteSnapshotVersion(e){return C.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return C.resolve(this.$r)}allocateTargetId(e){return this.highestTargetId=this.Ur.next(),C.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.$r&&(this.$r=t),C.resolve()}zn(e){this.Qr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.Ur=new Sn(t),this.highestTargetId=t),e.sequenceNumber>this.$r&&(this.$r=e.sequenceNumber)}addTargetData(e,t){return this.zn(t),this.targetCount+=1,C.resolve()}updateTargetData(e,t){return this.zn(t),C.resolve()}removeTargetData(e,t){return this.Qr.delete(t.target),this.Kr.br(t.targetId),this.targetCount-=1,C.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.Qr.forEach((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.Qr.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)}),C.waitFor(i).next(()=>s)}getTargetCount(e){return C.resolve(this.targetCount)}getTargetData(e,t){const r=this.Qr.get(t)||null;return C.resolve(r)}addMatchingKeys(e,t,r){return this.Kr.yr(t,r),C.resolve()}removeMatchingKeys(e,t,r){this.Kr.Sr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),C.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Kr.br(t),C.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Kr.vr(t);return C.resolve(r)}containsKey(e,t){return C.resolve(this.Kr.containsKey(t))}}/**
|
|
1303
1412
|
* @license
|
|
1304
1413
|
* Copyright 2017 Google LLC
|
|
1305
1414
|
*
|
|
@@ -1314,7 +1423,7 @@
|
|
|
1314
1423
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1315
1424
|
* See the License for the specific language governing permissions and
|
|
1316
1425
|
* limitations under the License.
|
|
1317
|
-
*/class
|
|
1426
|
+
*/class Xu{constructor(e,t){this.Wr={},this.overlays={},this.Gr=new ss(0),this.zr=!1,this.zr=!0,this.jr=new p_,this.referenceDelegate=e(this),this.Hr=new y_(this),this.indexManager=new n_,this.remoteDocumentCache=function(s){return new g_(s)}(r=>this.referenceDelegate.Jr(r)),this.serializer=new e_(t),this.Yr=new d_(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.zr=!1,Promise.resolve()}get started(){return this.zr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new f_,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.Wr[e.toKey()];return r||(r=new m_(t,this.referenceDelegate),this.Wr[e.toKey()]=r),r}getGlobalsCache(){return this.jr}getTargetCache(){return this.Hr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Yr}runTransaction(e,t,r){V("MemoryPersistence","Starting transaction:",e);const s=new v_(this.Gr.next());return this.referenceDelegate.Zr(),r(s).next(i=>this.referenceDelegate.Xr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}ei(e,t){return C.or(Object.values(this.Wr).map(r=>()=>r.containsKey(e,t)))}}class v_ extends zm{constructor(e){super(),this.currentSequenceNumber=e}}class _o{constructor(e){this.persistence=e,this.ti=new go,this.ni=null}static ri(e){return new _o(e)}get ii(){if(this.ni)return this.ni;throw F()}addReference(e,t,r){return this.ti.addReference(r,t),this.ii.delete(r.toString()),C.resolve()}removeReference(e,t,r){return this.ti.removeReference(r,t),this.ii.add(r.toString()),C.resolve()}markPotentiallyOrphaned(e,t){return this.ii.add(t.toString()),C.resolve()}removeTarget(e,t){this.ti.br(t.targetId).forEach(s=>this.ii.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.ii.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}Zr(){this.ni=new Set}Xr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return C.forEach(this.ii,r=>{const s=L.fromPath(r);return this.si(e,s).next(i=>{i||t.removeEntry(s,j.min())})}).next(()=>(this.ni=null,t.apply(e)))}updateLimboDocument(e,t){return this.si(e,t).next(r=>{r?this.ii.delete(t.toString()):this.ii.add(t.toString())})}Jr(e){return 0}si(e,t){return C.or([()=>C.resolve(this.ti.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.ei(e,t)])}}class ks{constructor(e,t){this.persistence=e,this.oi=new Zt(r=>Km(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=c_(this,t)}static ri(e,t){return new ks(e,t)}Zr(){}Xr(e){return C.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}nr(e){const t=this.sr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>t.next(s=>r+s))}sr(e){let t=0;return this.rr(e,r=>{t++}).next(()=>t)}rr(e,t){return C.forEach(this.oi,(r,s)=>this.ar(e,r,s).next(i=>i?C.resolve():t(s)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.qr(e,a=>this.ar(e,a,t).next(c=>{c||(r++,i.removeEntry(a,j.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.oi.set(t,e.currentSequenceNumber),C.resolve()}removeTarget(e,t){const r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.oi.set(r,e.currentSequenceNumber),C.resolve()}removeReference(e,t,r){return this.oi.set(r,e.currentSequenceNumber),C.resolve()}updateLimboDocument(e,t){return this.oi.set(t,e.currentSequenceNumber),C.resolve()}Jr(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=fs(e.data.value)),t}ar(e,t,r){return C.or([()=>this.persistence.ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const s=this.oi.get(t);return C.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
|
|
1318
1427
|
* @license
|
|
1319
1428
|
* Copyright 2017 Google LLC
|
|
1320
1429
|
*
|
|
@@ -1329,7 +1438,7 @@
|
|
|
1329
1438
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1330
1439
|
* See the License for the specific language governing permissions and
|
|
1331
1440
|
* limitations under the License.
|
|
1332
|
-
*/class
|
|
1441
|
+
*/class yo{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.Hi=r,this.Ji=s}static Yi(e,t){let r=W(),s=W();for(const i of t.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new yo(e,t.fromCache,r,s)}}/**
|
|
1333
1442
|
* @license
|
|
1334
1443
|
* Copyright 2023 Google LLC
|
|
1335
1444
|
*
|
|
@@ -1344,7 +1453,7 @@
|
|
|
1344
1453
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1345
1454
|
* See the License for the specific language governing permissions and
|
|
1346
1455
|
* limitations under the License.
|
|
1347
|
-
*/class
|
|
1456
|
+
*/class E_{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
|
|
1348
1457
|
* @license
|
|
1349
1458
|
* Copyright 2019 Google LLC
|
|
1350
1459
|
*
|
|
@@ -1359,7 +1468,7 @@
|
|
|
1359
1468
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1360
1469
|
* See the License for the specific language governing permissions and
|
|
1361
1470
|
* limitations under the License.
|
|
1362
|
-
*/class
|
|
1471
|
+
*/class T_{constructor(){this.Zi=!1,this.Xi=!1,this.es=100,this.ts=function(){return mp()?8:Wm(Ee())>0?6:4}()}initialize(e,t){this.ns=e,this.indexManager=t,this.Zi=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.rs(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.ss(e,t,s,r).next(a=>{i.result=a})}).next(()=>{if(i.result)return;const a=new E_;return this._s(e,t,a).next(c=>{if(i.result=c,this.Xi)return this.us(e,t,a,c.size)})}).next(()=>i.result)}us(e,t,r,s){return r.documentReadCount<this.es?(_n()<=z.DEBUG&&V("QueryEngine","SDK will not create cache indexes for query:",bn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.es,"documents"),C.resolve()):(_n()<=z.DEBUG&&V("QueryEngine","Query:",bn(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.ts*s?(_n()<=z.DEBUG&&V("QueryEngine","The SDK decides to create cache indexes for query:",bn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,nt(t))):C.resolve())}rs(e,t){if(du(t))return C.resolve(null);let r=nt(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=_s(t,null,"F"),r=nt(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const a=W(...i);return this.ns.getDocuments(e,a).next(c=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.cs(t,c);return this.ls(t,d,a,l.readTime)?this.rs(e,_s(t,null,"F")):this.hs(e,d,t,l)}))})))}ss(e,t,r,s){return du(t)||s.isEqual(j.min())?C.resolve(null):this.ns.getDocuments(e,r).next(i=>{const a=this.cs(t,i);return this.ls(t,a,r,s)?C.resolve(null):(_n()<=z.DEBUG&&V("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),bn(t)),this.hs(e,a,t,jm(s,ir)).next(c=>c))})}cs(e,t){let r=new le(mu(e));return t.forEach((s,i)=>{vs(e,i)&&(r=r.add(i))}),r}ls(e,t,r,s){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}_s(e,t,r){return _n()<=z.DEBUG&&V("QueryEngine","Using full collection scan to execute query:",bn(t)),this.ns.getDocumentsMatchingQuery(e,t,Ct.min(),r)}hs(e,t,r,s){return this.ns.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}}/**
|
|
1363
1472
|
* @license
|
|
1364
1473
|
* Copyright 2020 Google LLC
|
|
1365
1474
|
*
|
|
@@ -1374,7 +1483,7 @@
|
|
|
1374
1483
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1375
1484
|
* See the License for the specific language governing permissions and
|
|
1376
1485
|
* limitations under the License.
|
|
1377
|
-
*/class
|
|
1486
|
+
*/const vo="LocalStore",w_=3e8;class I_{constructor(e,t,r,s){this.persistence=e,this.Ps=t,this.serializer=s,this.Ts=new re(G),this.Is=new Zt(i=>to(i),no),this.Es=new Map,this.ds=e.getRemoteDocumentCache(),this.Hr=e.getTargetCache(),this.Yr=e.getBundleCache(),this.As(r)}As(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new h_(this.ds,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ds.setIndexManager(this.indexManager),this.Ps.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Ts))}}function A_(n,e,t,r){return new I_(n,e,t,r)}async function Yu(n,e){const t=B(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.As(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const a=[],c=[];let l=W();for(const d of s){a.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}for(const d of i){c.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}return t.localDocuments.getDocuments(r,l).next(d=>({Rs:d,removedBatchIds:a,addedBatchIds:c}))})})}function R_(n,e){const t=B(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.ds.newChangeBuffer({trackRemovals:!0});return function(c,l,d,f){const m=d.batch,v=m.keys();let R=C.resolve();return v.forEach(S=>{R=R.next(()=>f.getEntry(l,S)).next(N=>{const k=d.docVersions.get(S);Y(k!==null),N.version.compareTo(k)<0&&(m.applyToRemoteDocument(N,d),N.isValidDocument()&&(N.setReadTime(d.commitVersion),f.addEntry(N)))})}),R.next(()=>c.mutationQueue.removeMutationBatch(l,m))}(t,r,e,i).next(()=>i.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(c){let l=W();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Ju(n){const e=B(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Hr.getLastRemoteSnapshotVersion(t))}function b_(n,e){const t=B(n),r=e.snapshotVersion;let s=t.Ts;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const a=t.ds.newChangeBuffer({trackRemovals:!0});s=t.Ts;const c=[];e.targetChanges.forEach((f,m)=>{const v=s.get(m);if(!v)return;c.push(t.Hr.removeMatchingKeys(i,f.removedDocuments,m).next(()=>t.Hr.addMatchingKeys(i,f.addedDocuments,m)));let R=v.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(m)!==null?R=R.withResumeToken(_e.EMPTY_BYTE_STRING,j.min()).withLastLimboFreeSnapshotVersion(j.min()):f.resumeToken.approximateByteSize()>0&&(R=R.withResumeToken(f.resumeToken,r)),s=s.insert(m,R),function(N,k,U){return N.resumeToken.approximateByteSize()===0||k.snapshotVersion.toMicroseconds()-N.snapshotVersion.toMicroseconds()>=w_?!0:U.addedDocuments.size+U.modifiedDocuments.size+U.removedDocuments.size>0}(v,R,f)&&c.push(t.Hr.updateTargetData(i,R))});let l=pt(),d=W();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(i,f))}),c.push(P_(i,a,e.documentUpdates).next(f=>{l=f.Vs,d=f.fs})),!r.isEqual(j.min())){const f=t.Hr.getLastRemoteSnapshotVersion(i).next(m=>t.Hr.setTargetsMetadata(i,i.currentSequenceNumber,r));c.push(f)}return C.waitFor(c).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,l,d)).next(()=>l)}).then(i=>(t.Ts=s,i))}function P_(n,e,t){let r=W(),s=W();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let a=pt();return t.forEach((c,l)=>{const d=i.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),l.isNoDocument()&&l.version.isEqual(j.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):V(vo,"Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)}),{Vs:a,fs:s}})}function S_(n,e){const t=B(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Xi),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function C_(n,e){const t=B(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Hr.getTargetData(r,e).next(i=>i?(s=i,C.resolve(s)):t.Hr.allocateTargetId(r).next(a=>(s=new Mt(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Hr.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.Ts.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.Ts=t.Ts.insert(r.targetId,r),t.Is.set(e,r.targetId)),r})}async function Eo(n,e,t){const r=B(n),s=r.Ts.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,a=>r.persistence.referenceDelegate.removeTarget(a,s))}catch(a){if(!Tn(a))throw a;V(vo,`Failed to update sequence numbers for target ${e}: ${a}`)}r.Ts=r.Ts.remove(e),r.Is.delete(s.target)}function Zu(n,e,t){const r=B(n);let s=j.min(),i=W();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,f){const m=B(l),v=m.Is.get(f);return v!==void 0?C.resolve(m.Ts.get(v)):m.Hr.getTargetData(d,f)}(r,a,nt(e)).next(c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.Hr.getMatchingKeysForTargetId(a,c.targetId).next(l=>{i=l})}).next(()=>r.Ps.getDocumentsMatchingQuery(a,e,t?s:j.min(),t?i:W())).next(c=>(k_(r,pg(e),c),{documents:c,gs:i})))}function k_(n,e,t){let r=n.Es.get(e)||j.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.Es.set(e,r)}class el{constructor(){this.activeTargetIds=Eg()}Ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}vs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}bs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class N_{constructor(){this.ho=new el,this.Po={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.ho.Ds(e),this.Po[e]||"not-current"}updateQueryState(e,t,r){this.Po[e]=t}removeLocalQueryTarget(e){this.ho.vs(e)}isLocalQueryTarget(e){return this.ho.activeTargetIds.has(e)}clearQueryState(e){delete this.Po[e]}getAllActiveQueryTargets(){return this.ho.activeTargetIds}isActiveQueryTarget(e){return this.ho.activeTargetIds.has(e)}start(){return this.ho=new el,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
|
|
1378
1487
|
* @license
|
|
1379
1488
|
* Copyright 2019 Google LLC
|
|
1380
1489
|
*
|
|
@@ -1389,7 +1498,7 @@
|
|
|
1389
1498
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1390
1499
|
* See the License for the specific language governing permissions and
|
|
1391
1500
|
* limitations under the License.
|
|
1392
|
-
*/class
|
|
1501
|
+
*/class D_{To(e){}shutdown(){}}/**
|
|
1393
1502
|
* @license
|
|
1394
1503
|
* Copyright 2019 Google LLC
|
|
1395
1504
|
*
|
|
@@ -1404,7 +1513,7 @@
|
|
|
1404
1513
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1405
1514
|
* See the License for the specific language governing permissions and
|
|
1406
1515
|
* limitations under the License.
|
|
1407
|
-
*/class
|
|
1516
|
+
*/const tl="ConnectivityMonitor";class nl{constructor(){this.Io=()=>this.Eo(),this.Ao=()=>this.Ro(),this.Vo=[],this.mo()}To(e){this.Vo.push(e)}shutdown(){window.removeEventListener("online",this.Io),window.removeEventListener("offline",this.Ao)}mo(){window.addEventListener("online",this.Io),window.addEventListener("offline",this.Ao)}Eo(){V(tl,"Network connectivity changed: AVAILABLE");for(const e of this.Vo)e(0)}Ro(){V(tl,"Network connectivity changed: UNAVAILABLE");for(const e of this.Vo)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
|
|
1408
1517
|
* @license
|
|
1409
1518
|
* Copyright 2023 Google LLC
|
|
1410
1519
|
*
|
|
@@ -1419,7 +1528,7 @@
|
|
|
1419
1528
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1420
1529
|
* See the License for the specific language governing permissions and
|
|
1421
1530
|
* limitations under the License.
|
|
1422
|
-
*/let
|
|
1531
|
+
*/let Ns=null;function To(){return Ns===null?Ns=function(){return 268435456+Math.round(2147483648*Math.random())}():Ns++,"0x"+Ns.toString(16)}/**
|
|
1423
1532
|
* @license
|
|
1424
1533
|
* Copyright 2020 Google LLC
|
|
1425
1534
|
*
|
|
@@ -1434,7 +1543,7 @@
|
|
|
1434
1543
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1435
1544
|
* See the License for the specific language governing permissions and
|
|
1436
1545
|
* limitations under the License.
|
|
1437
|
-
*/const
|
|
1546
|
+
*/const wo="RestConnection",O_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class V_{get fo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.po=t+"://"+e.host,this.yo=`projects/${r}/databases/${s}`,this.wo=this.databaseId.database===ls?`project_id=${r}`:`project_id=${r}&database_id=${s}`}So(e,t,r,s,i){const a=To(),c=this.bo(e,t.toUriEncodedString());V(wo,`Sending RPC '${e}' ${a}:`,c,r);const l={"google-cloud-resource-prefix":this.yo,"x-goog-request-params":this.wo};return this.Do(l,s,i),this.vo(e,c,l,r).then(d=>(V(wo,`Received RPC '${e}' ${a}: `,d),d),d=>{throw yn(wo,`RPC '${e}' ${a} failed with error: `,d,"url: ",c,"request:",r),d})}Co(e,t,r,s,i,a){return this.So(e,t,r,s,i)}Do(e,t,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+gn}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}bo(e,t){const r=O_[e];return`${this.po}/v1/${t}:${r}`}terminate(){}}/**
|
|
1438
1547
|
* @license
|
|
1439
1548
|
* Copyright 2017 Google LLC
|
|
1440
1549
|
*
|
|
@@ -1449,7 +1558,7 @@
|
|
|
1449
1558
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1450
1559
|
* See the License for the specific language governing permissions and
|
|
1451
1560
|
* limitations under the License.
|
|
1452
|
-
*/class
|
|
1561
|
+
*/class L_{constructor(e){this.Fo=e.Fo,this.Mo=e.Mo}xo(e){this.Oo=e}No(e){this.Bo=e}Lo(e){this.ko=e}onMessage(e){this.qo=e}close(){this.Mo()}send(e){this.Fo(e)}Qo(){this.Oo()}$o(){this.Bo()}Ko(e){this.ko(e)}Uo(e){this.qo(e)}}/**
|
|
1453
1562
|
* @license
|
|
1454
1563
|
* Copyright 2017 Google LLC
|
|
1455
1564
|
*
|
|
@@ -1464,7 +1573,7 @@
|
|
|
1464
1573
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1465
1574
|
* See the License for the specific language governing permissions and
|
|
1466
1575
|
* limitations under the License.
|
|
1467
|
-
*/const
|
|
1576
|
+
*/const Ae="WebChannelConnection";class M_ extends V_{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}vo(e,t,r,s){const i=To();return new Promise((a,c)=>{const l=new Pc;l.setWithCredentials(!0),l.listenOnce(Sc.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case rs.NO_ERROR:const f=l.getResponseJson();V(Ae,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(f)),a(f);break;case rs.TIMEOUT:V(Ae,`RPC '${e}' ${i} timed out`),c(new O(P.DEADLINE_EXCEEDED,"Request time out"));break;case rs.HTTP_ERROR:const m=l.getStatus();if(V(Ae,`RPC '${e}' ${i} failed with status:`,m,"response text:",l.getResponseText()),m>0){let v=l.getResponseJson();Array.isArray(v)&&(v=v[0]);const R=v==null?void 0:v.error;if(R&&R.status&&R.message){const S=function(k){const U=k.toLowerCase().replace(/_/g,"-");return Object.values(P).indexOf(U)>=0?U:P.UNKNOWN}(R.status);c(new O(S,R.message))}else c(new O(P.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new O(P.UNAVAILABLE,"Connection failed."));break;default:F()}}finally{V(Ae,`RPC '${e}' ${i} completed.`)}});const d=JSON.stringify(s);V(Ae,`RPC '${e}' ${i} sending request:`,s),l.send(t,"POST",d,r,15)})}Wo(e,t,r){const s=To(),i=[this.po,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=Nc(),c=kc(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(l.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Do(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const f=i.join("");V(Ae,`Creating RPC '${e}' stream ${s}: ${f}`,l);const m=a.createWebChannel(f,l);let v=!1,R=!1;const S=new L_({Fo:k=>{R?V(Ae,`Not sending because RPC '${e}' stream ${s} is closed:`,k):(v||(V(Ae,`Opening RPC '${e}' stream ${s} transport.`),m.open(),v=!0),V(Ae,`RPC '${e}' stream ${s} sending:`,k),m.send(k))},Mo:()=>m.close()}),N=(k,U,$)=>{k.listen(U,x=>{try{$(x)}catch(H){setTimeout(()=>{throw H},0)}})};return N(m,sr.EventType.OPEN,()=>{R||(V(Ae,`RPC '${e}' stream ${s} transport opened.`),S.Qo())}),N(m,sr.EventType.CLOSE,()=>{R||(R=!0,V(Ae,`RPC '${e}' stream ${s} transport closed`),S.Ko())}),N(m,sr.EventType.ERROR,k=>{R||(R=!0,yn(Ae,`RPC '${e}' stream ${s} transport errored:`,k),S.Ko(new O(P.UNAVAILABLE,"The operation could not be completed")))}),N(m,sr.EventType.MESSAGE,k=>{var U;if(!R){const $=k.data[0];Y(!!$);const x=$,H=(x==null?void 0:x.error)||((U=x[0])===null||U===void 0?void 0:U.error);if(H){V(Ae,`RPC '${e}' stream ${s} received error:`,H);const he=H.status;let J=function(_){const E=ce[_];if(E!==void 0)return ku(E)}(he),T=H.message;J===void 0&&(J=P.INTERNAL,T="Unknown error status: "+he+" with message "+H.message),R=!0,S.Ko(new O(J,T)),m.close()}else V(Ae,`RPC '${e}' stream ${s} received:`,$),S.Uo($)}}),N(c,Cc.STAT_EVENT,k=>{k.stat===Ki.PROXY?V(Ae,`RPC '${e}' stream ${s} detected buffering proxy`):k.stat===Ki.NOPROXY&&V(Ae,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{S.$o()},0),S}}function Io(){return typeof document<"u"?document:null}/**
|
|
1468
1577
|
* @license
|
|
1469
1578
|
* Copyright 2020 Google LLC
|
|
1470
1579
|
*
|
|
@@ -1479,7 +1588,7 @@
|
|
|
1479
1588
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1480
1589
|
* See the License for the specific language governing permissions and
|
|
1481
1590
|
* limitations under the License.
|
|
1482
|
-
*/function
|
|
1591
|
+
*/function Ds(n){return new Bg(n,!0)}/**
|
|
1483
1592
|
* @license
|
|
1484
1593
|
* Copyright 2017 Google LLC
|
|
1485
1594
|
*
|
|
@@ -1494,7 +1603,7 @@
|
|
|
1494
1603
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1495
1604
|
* See the License for the specific language governing permissions and
|
|
1496
1605
|
* limitations under the License.
|
|
1497
|
-
*/class
|
|
1606
|
+
*/class rl{constructor(e,t,r=1e3,s=1.5,i=6e4){this.Ti=e,this.timerId=t,this.Go=r,this.zo=s,this.jo=i,this.Ho=0,this.Jo=null,this.Yo=Date.now(),this.reset()}reset(){this.Ho=0}Zo(){this.Ho=this.jo}Xo(e){this.cancel();const t=Math.floor(this.Ho+this.e_()),r=Math.max(0,Date.now()-this.Yo),s=Math.max(0,t-r);s>0&&V("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Ho} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.Jo=this.Ti.enqueueAfterDelay(this.timerId,s,()=>(this.Yo=Date.now(),e())),this.Ho*=this.zo,this.Ho<this.Go&&(this.Ho=this.Go),this.Ho>this.jo&&(this.Ho=this.jo)}t_(){this.Jo!==null&&(this.Jo.skipDelay(),this.Jo=null)}cancel(){this.Jo!==null&&(this.Jo.cancel(),this.Jo=null)}e_(){return(Math.random()-.5)*this.Ho}}/**
|
|
1498
1607
|
* @license
|
|
1499
1608
|
* Copyright 2017 Google LLC
|
|
1500
1609
|
*
|
|
@@ -1509,7 +1618,7 @@
|
|
|
1509
1618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1510
1619
|
* See the License for the specific language governing permissions and
|
|
1511
1620
|
* limitations under the License.
|
|
1512
|
-
*/class
|
|
1621
|
+
*/const sl="PersistentStream";class il{constructor(e,t,r,s,i,a,c,l){this.Ti=e,this.n_=r,this.r_=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.i_=0,this.s_=null,this.o_=null,this.stream=null,this.__=0,this.a_=new rl(e,t)}u_(){return this.state===1||this.state===5||this.c_()}c_(){return this.state===2||this.state===3}start(){this.__=0,this.state!==4?this.auth():this.l_()}async stop(){this.u_()&&await this.close(0)}h_(){this.state=0,this.a_.reset()}P_(){this.c_()&&this.s_===null&&(this.s_=this.Ti.enqueueAfterDelay(this.n_,6e4,()=>this.T_()))}I_(e){this.E_(),this.stream.send(e)}async T_(){if(this.c_())return this.close(0)}E_(){this.s_&&(this.s_.cancel(),this.s_=null)}d_(){this.o_&&(this.o_.cancel(),this.o_=null)}async close(e,t){this.E_(),this.d_(),this.a_.cancel(),this.i_++,e!==4?this.a_.reset():t&&t.code===P.RESOURCE_EXHAUSTED?(ft(t.toString()),ft("Using maximum backoff delay to prevent overloading the backend."),this.a_.Zo()):t&&t.code===P.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.A_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Lo(t)}A_(){}auth(){this.state=1;const e=this.R_(this.i_),t=this.i_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.i_===t&&this.V_(r,s)},r=>{e(()=>{const s=new O(P.UNKNOWN,"Fetching auth token failed: "+r.message);return this.m_(s)})})}V_(e,t){const r=this.R_(this.i_);this.stream=this.f_(e,t),this.stream.xo(()=>{r(()=>this.listener.xo())}),this.stream.No(()=>{r(()=>(this.state=2,this.o_=this.Ti.enqueueAfterDelay(this.r_,1e4,()=>(this.c_()&&(this.state=3),Promise.resolve())),this.listener.No()))}),this.stream.Lo(s=>{r(()=>this.m_(s))}),this.stream.onMessage(s=>{r(()=>++this.__==1?this.g_(s):this.onNext(s))})}l_(){this.state=5,this.a_.Xo(async()=>{this.state=0,this.start()})}m_(e){return V(sl,`close with error: ${e}`),this.stream=null,this.close(4,e)}R_(e){return t=>{this.Ti.enqueueAndForget(()=>this.i_===e?t():(V(sl,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class U_ extends il{constructor(e,t,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}f_(e,t){return this.connection.Wo("Listen",e,t)}g_(e){return this.onNext(e)}onNext(e){this.a_.reset();const t=$g(this.serializer,e),r=function(i){if(!("targetChange"in i))return j.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?j.min():a.readTime?rt(a.readTime):j.min()}(e);return this.listener.p_(t,r)}y_(e){const t={};t.database=mo(this.serializer),t.addTarget=function(i,a){let c;const l=a.target;if(c=ro(l)?{documents:Wg(i,l)}:{query:qu(i,l).ht},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=Uu(i,a.resumeToken);const d=uo(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(j.min())>0){c.readTime=Cs(i,a.snapshotVersion.toTimestamp());const d=uo(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c}(this.serializer,e);const r=Qg(this.serializer,e);r&&(t.labels=r),this.I_(t)}w_(e){const t={};t.database=mo(this.serializer),t.removeTarget=e,this.I_(t)}}class x_ extends il{constructor(e,t,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}get S_(){return this.__>0}start(){this.lastStreamToken=void 0,super.start()}A_(){this.S_&&this.b_([])}f_(e,t){return this.connection.Wo("Write",e,t)}g_(e){return Y(!!e.streamToken),this.lastStreamToken=e.streamToken,Y(!e.writeResults||e.writeResults.length===0),this.listener.D_()}onNext(e){Y(!!e.streamToken),this.lastStreamToken=e.streamToken,this.a_.reset();const t=zg(e.writeResults,e.commitTime),r=rt(e.commitTime);return this.listener.v_(r,t)}C_(){const e={};e.database=mo(this.serializer),this.I_(e)}b_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>Hg(this.serializer,r))};this.I_(t)}}/**
|
|
1513
1622
|
* @license
|
|
1514
1623
|
* Copyright 2017 Google LLC
|
|
1515
1624
|
*
|
|
@@ -1524,8 +1633,8 @@
|
|
|
1524
1633
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1525
1634
|
* See the License for the specific language governing permissions and
|
|
1526
1635
|
* limitations under the License.
|
|
1527
|
-
*/class
|
|
1528
|
-
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.
|
|
1636
|
+
*/class F_{}class B_ extends F_{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.F_=!1}M_(){if(this.F_)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.")}So(e,t,r,s){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.So(e,ho(t,r),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new O(P.UNKNOWN,i.toString())})}Co(e,t,r,s,i){return this.M_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,c])=>this.connection.Co(e,ho(t,r),s,a,c,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new O(P.UNKNOWN,a.toString())})}terminate(){this.F_=!0,this.connection.terminate()}}class j_{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.x_=0,this.O_=null,this.N_=!0}B_(){this.x_===0&&(this.L_("Unknown"),this.O_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.O_=null,this.k_("Backend didn't respond within 10 seconds."),this.L_("Offline"),Promise.resolve())))}q_(e){this.state==="Online"?this.L_("Unknown"):(this.x_++,this.x_>=1&&(this.Q_(),this.k_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.L_("Offline")))}set(e){this.Q_(),this.x_=0,e==="Online"&&(this.N_=!1),this.L_(e)}L_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}k_(e){const t=`Could not reach Cloud Firestore backend. ${e}
|
|
1637
|
+
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.N_?(ft(t),this.N_=!1):V("OnlineStateTracker",t)}Q_(){this.O_!==null&&(this.O_.cancel(),this.O_=null)}}/**
|
|
1529
1638
|
* @license
|
|
1530
1639
|
* Copyright 2017 Google LLC
|
|
1531
1640
|
*
|
|
@@ -1540,7 +1649,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1540
1649
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1541
1650
|
* See the License for the specific language governing permissions and
|
|
1542
1651
|
* limitations under the License.
|
|
1543
|
-
*/class
|
|
1652
|
+
*/const tn="RemoteStore";class q_{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.K_=[],this.U_=new Map,this.W_=new Set,this.G_=[],this.z_=i,this.z_.To(a=>{r.enqueueAndForget(async()=>{nn(this)&&(V(tn,"Restarting streams for network reachability change."),await async function(l){const d=B(l);d.W_.add(4),await vr(d),d.j_.set("Unknown"),d.W_.delete(4),await Os(d)}(this))})}),this.j_=new j_(r,s)}}async function Os(n){if(nn(n))for(const e of n.G_)await e(!0)}async function vr(n){for(const e of n.G_)await e(!1)}function ol(n,e){const t=B(n);t.U_.has(e.targetId)||(t.U_.set(e.targetId,e),Po(t)?bo(t):Cn(t).c_()&&Ro(t,e))}function Ao(n,e){const t=B(n),r=Cn(t);t.U_.delete(e),r.c_()&&al(t,e),t.U_.size===0&&(r.c_()?r.P_():nn(t)&&t.j_.set("Unknown"))}function Ro(n,e){if(n.H_.Ne(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(j.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}Cn(n).y_(e)}function al(n,e){n.H_.Ne(e),Cn(n).w_(e)}function bo(n){n.H_=new Mg({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),lt:e=>n.U_.get(e)||null,it:()=>n.datastore.serializer.databaseId}),Cn(n).start(),n.j_.B_()}function Po(n){return nn(n)&&!Cn(n).u_()&&n.U_.size>0}function nn(n){return B(n).W_.size===0}function cl(n){n.H_=void 0}async function $_(n){n.j_.set("Online")}async function H_(n){n.U_.forEach((e,t)=>{Ro(n,e)})}async function z_(n,e){cl(n),Po(n)?(n.j_.q_(e),bo(n)):n.j_.set("Unknown")}async function W_(n,e,t){if(n.j_.set("Online"),e instanceof Vu&&e.state===2&&e.cause)try{await async function(s,i){const a=i.cause;for(const c of i.targetIds)s.U_.has(c)&&(await s.remoteSyncer.rejectListen(c,a),s.U_.delete(c),s.H_.removeTarget(c))}(n,e)}catch(r){V(tn,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Vs(n,r)}else if(e instanceof Ps?n.H_.We(e):e instanceof Ou?n.H_.Ze(e):n.H_.je(e),!t.isEqual(j.min()))try{const r=await Ju(n.localStore);t.compareTo(r)>=0&&await function(i,a){const c=i.H_.ot(a);return c.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const f=i.U_.get(d);f&&i.U_.set(d,f.withResumeToken(l.resumeToken,a))}}),c.targetMismatches.forEach((l,d)=>{const f=i.U_.get(l);if(!f)return;i.U_.set(l,f.withResumeToken(_e.EMPTY_BYTE_STRING,f.snapshotVersion)),al(i,l);const m=new Mt(f.target,l,d,f.sequenceNumber);Ro(i,m)}),i.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){V(tn,"Failed to raise snapshot:",r),await Vs(n,r)}}async function Vs(n,e,t){if(!Tn(e))throw e;n.W_.add(1),await vr(n),n.j_.set("Offline"),t||(t=()=>Ju(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{V(tn,"Retrying IndexedDB access"),await t(),n.W_.delete(1),await Os(n)})}function ul(n,e){return e().catch(t=>Vs(n,t,e))}async function Ls(n){const e=B(n),t=Ut(e);let r=e.K_.length>0?e.K_[e.K_.length-1].batchId:Xi;for(;G_(e);)try{const s=await S_(e.localStore,r);if(s===null){e.K_.length===0&&t.P_();break}r=s.batchId,K_(e,s)}catch(s){await Vs(e,s)}ll(e)&&hl(e)}function G_(n){return nn(n)&&n.K_.length<10}function K_(n,e){n.K_.push(e);const t=Ut(n);t.c_()&&t.S_&&t.b_(e.mutations)}function ll(n){return nn(n)&&!Ut(n).u_()&&n.K_.length>0}function hl(n){Ut(n).start()}async function Q_(n){Ut(n).C_()}async function X_(n){const e=Ut(n);for(const t of n.K_)e.b_(t.mutations)}async function Y_(n,e,t){const r=n.K_.shift(),s=ao.from(r,e,t);await ul(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await Ls(n)}async function J_(n,e){e&&Ut(n).S_&&await async function(r,s){if(function(a){return Og(a)&&a!==P.ABORTED}(s.code)){const i=r.K_.shift();Ut(r).h_(),await ul(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Ls(r)}}(n,e),ll(n)&&hl(n)}async function dl(n,e){const t=B(n);t.asyncQueue.verifyOperationInProgress(),V(tn,"RemoteStore received new credentials");const r=nn(t);t.W_.add(3),await vr(t),r&&t.j_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.W_.delete(3),await Os(t)}async function Z_(n,e){const t=B(n);e?(t.W_.delete(2),await Os(t)):e||(t.W_.add(2),await vr(t),t.j_.set("Unknown"))}function Cn(n){return n.J_||(n.J_=function(t,r,s){const i=B(t);return i.M_(),new U_(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{xo:$_.bind(null,n),No:H_.bind(null,n),Lo:z_.bind(null,n),p_:W_.bind(null,n)}),n.G_.push(async e=>{e?(n.J_.h_(),Po(n)?bo(n):n.j_.set("Unknown")):(await n.J_.stop(),cl(n))})),n.J_}function Ut(n){return n.Y_||(n.Y_=function(t,r,s){const i=B(t);return i.M_(),new x_(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{xo:()=>Promise.resolve(),No:Q_.bind(null,n),Lo:J_.bind(null,n),D_:X_.bind(null,n),v_:Y_.bind(null,n)}),n.G_.push(async e=>{e?(n.Y_.h_(),await Ls(n)):(await n.Y_.stop(),n.K_.length>0&&(V(tn,`Stopping write stream with ${n.K_.length} pending writes`),n.K_=[]))})),n.Y_}/**
|
|
1544
1653
|
* @license
|
|
1545
1654
|
* Copyright 2017 Google LLC
|
|
1546
1655
|
*
|
|
@@ -1555,7 +1664,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1555
1664
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1556
1665
|
* See the License for the specific language governing permissions and
|
|
1557
1666
|
* limitations under the License.
|
|
1558
|
-
*/class
|
|
1667
|
+
*/class So{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Ze,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(a=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const a=Date.now()+r,c=new So(e,t,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new O(P.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Co(n,e){if(ft("AsyncQueue",`${e}: ${n}`),Tn(n))return new O(P.UNAVAILABLE,`${e}: ${n}`);throw n}/**
|
|
1559
1668
|
* @license
|
|
1560
1669
|
* Copyright 2017 Google LLC
|
|
1561
1670
|
*
|
|
@@ -1570,10 +1679,10 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1570
1679
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1571
1680
|
* See the License for the specific language governing permissions and
|
|
1572
1681
|
* limitations under the License.
|
|
1573
|
-
*/class
|
|
1682
|
+
*/class kn{static emptySet(e){return new kn(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||L.comparator(t.key,r.key):(t,r)=>L.comparator(t.key,r.key),this.keyedMap=hr(),this.sortedSet=new re(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,r)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof kn)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
|
|
1574
1683
|
`+e.join(`
|
|
1575
1684
|
`)+`
|
|
1576
|
-
)`}copy(e,t){const r=new
|
|
1685
|
+
)`}copy(e,t){const r=new kn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
|
|
1577
1686
|
* @license
|
|
1578
1687
|
* Copyright 2017 Google LLC
|
|
1579
1688
|
*
|
|
@@ -1588,7 +1697,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1588
1697
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1589
1698
|
* See the License for the specific language governing permissions and
|
|
1590
1699
|
* limitations under the License.
|
|
1591
|
-
*/class
|
|
1700
|
+
*/class fl{constructor(){this.Z_=new re(L.comparator)}track(e){const t=e.doc.key,r=this.Z_.get(t);r?e.type!==0&&r.type===3?this.Z_=this.Z_.insert(t,e):e.type===3&&r.type!==1?this.Z_=this.Z_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.Z_=this.Z_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.Z_=this.Z_.remove(t):e.type===1&&r.type===2?this.Z_=this.Z_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.Z_=this.Z_.insert(t,{type:2,doc:e.doc}):F():this.Z_=this.Z_.insert(t,e)}X_(){const e=[];return this.Z_.inorderTraversal((t,r)=>{e.push(r)}),e}}class Nn{constructor(e,t,r,s,i,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach(c=>{a.push({type:0,doc:c})}),new Nn(e,t,kn.emptySet(t),a,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ys(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
|
|
1592
1701
|
* @license
|
|
1593
1702
|
* Copyright 2017 Google LLC
|
|
1594
1703
|
*
|
|
@@ -1603,7 +1712,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1603
1712
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1604
1713
|
* See the License for the specific language governing permissions and
|
|
1605
1714
|
* limitations under the License.
|
|
1606
|
-
*/class
|
|
1715
|
+
*/class ey{constructor(){this.ea=void 0,this.ta=[]}na(){return this.ta.some(e=>e.ra())}}class ty{constructor(){this.queries=pl(),this.onlineState="Unknown",this.ia=new Set}terminate(){(function(t,r){const s=B(t),i=s.queries;s.queries=pl(),i.forEach((a,c)=>{for(const l of c.ta)l.onError(r)})})(this,new O(P.ABORTED,"Firestore shutting down"))}}function pl(){return new Zt(n=>pu(n),ys)}async function ko(n,e){const t=B(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.na()&&e.ra()&&(r=2):(i=new ey,r=e.ra()?0:1);try{switch(r){case 0:i.ea=await t.onListen(s,!0);break;case 1:i.ea=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=Co(a,`Initialization of query '${bn(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.ta.push(e),e.sa(t.onlineState),i.ea&&e.oa(i.ea)&&Do(t)}async function No(n,e){const t=B(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.ta.indexOf(e);a>=0&&(i.ta.splice(a,1),i.ta.length===0?s=e.ra()?0:1:!i.na()&&e.ra()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function ny(n,e){const t=B(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.ta)c.oa(s)&&(r=!0);a.ea=s}}r&&Do(t)}function ry(n,e,t){const r=B(n),s=r.queries.get(e);if(s)for(const i of s.ta)i.onError(t);r.queries.delete(e)}function Do(n){n.ia.forEach(e=>{e.next()})}var Oo,ml;(ml=Oo||(Oo={}))._a="default",ml.Cache="cache";class Vo{constructor(e,t,r){this.query=e,this.aa=t,this.ua=!1,this.ca=null,this.onlineState="Unknown",this.options=r||{}}oa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Nn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.ua?this.la(e)&&(this.aa.next(e),t=!0):this.ha(e,this.onlineState)&&(this.Pa(e),t=!0),this.ca=e,t}onError(e){this.aa.error(e)}sa(e){this.onlineState=e;let t=!1;return this.ca&&!this.ua&&this.ha(this.ca,e)&&(this.Pa(this.ca),t=!0),t}ha(e,t){if(!e.fromCache||!this.ra())return!0;const r=t!=="Offline";return(!this.options.Ta||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}la(e){if(e.docChanges.length>0)return!0;const t=this.ca&&this.ca.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}Pa(e){e=Nn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.ua=!0,this.aa.next(e)}ra(){return this.options.source!==Oo.Cache}}/**
|
|
1607
1716
|
* @license
|
|
1608
1717
|
* Copyright 2017 Google LLC
|
|
1609
1718
|
*
|
|
@@ -1618,7 +1727,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1618
1727
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
1728
|
* See the License for the specific language governing permissions and
|
|
1620
1729
|
* limitations under the License.
|
|
1621
|
-
*/class ph{constructor(e){this.key=e}}class mh{constructor(e){this.key=e}}class xy{constructor(e,t){this.query=e,this.ua=t,this.ca=null,this.hasCachedResults=!1,this.current=!1,this.la=D(),this.mutatedKeys=D(),this.ha=gl(e),this.Pa=new vn(this.ha)}get Ia(){return this.ua}Ta(e,t){const r=t?t.Ea:new uh,s=t?t.Pa:this.Pa;let i=t?t.mutatedKeys:this.mutatedKeys,o=s,a=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((l,h)=>{const d=s.get(l),f=Ns(this.query,h)?h:null,E=!!d&&this.mutatedKeys.has(d.key),T=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let _=!1;d&&f?d.data.isEqual(f.data)?E!==T&&(r.track({type:3,doc:f}),_=!0):this.da(d,f)||(r.track({type:2,doc:f}),_=!0,(c&&this.ha(f,c)>0||u&&this.ha(f,u)<0)&&(a=!0)):!d&&f?(r.track({type:0,doc:f}),_=!0):d&&!f&&(r.track({type:1,doc:d}),_=!0,(c||u)&&(a=!0)),_&&(f?(o=o.add(f),i=T?i.add(l):i.delete(l)):(o=o.delete(l),i=i.delete(l)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const l=this.query.limitType==="F"?o.last():o.first();o=o.delete(l.key),i=i.delete(l.key),r.track({type:1,doc:l})}return{Pa:o,Ea:r,Xi:a,mutatedKeys:i}}da(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.Pa;this.Pa=e.Pa,this.mutatedKeys=e.mutatedKeys;const o=e.Ea.k_();o.sort((l,h)=>function(f,E){const T=_=>{switch(_){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return A()}};return T(f)-T(E)}(l.type,h.type)||this.ha(l.doc,h.doc)),this.Aa(r),s=s!=null&&s;const a=t&&!s?this.Ra():[],c=this.la.size===0&&this.current&&!s?1:0,u=c!==this.ca;return this.ca=c,o.length!==0||u?{snapshot:new En(this.query,e.Pa,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),Va:a}:{Va:a}}G_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Pa:this.Pa,Ea:new uh,mutatedKeys:this.mutatedKeys,Xi:!1},!1)):{Va:[]}}ma(e){return!this.ua.has(e)&&!!this.Pa.has(e)&&!this.Pa.get(e).hasLocalMutations}Aa(e){e&&(e.addedDocuments.forEach(t=>this.ua=this.ua.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.ua=this.ua.delete(t)),this.current=e.current)}Ra(){if(!this.current)return[];const e=this.la;this.la=D(),this.Pa.forEach(r=>{this.ma(r.key)&&(this.la=this.la.add(r.key))});const t=[];return e.forEach(r=>{this.la.has(r)||t.push(new mh(r))}),this.la.forEach(r=>{e.has(r)||t.push(new ph(r))}),t}fa(e){this.ua=e.hs,this.la=D();const t=this.Ta(e.documents);return this.applyChanges(t,!0)}ga(){return En.fromInitialDocuments(this.query,this.Pa,this.mutatedKeys,this.ca===0,this.hasCachedResults)}}class Uy{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class Fy{constructor(e){this.key=e,this.pa=!1}}class By{constructor(e,t,r,s,i,o){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.ya={},this.wa=new mn(a=>ml(a),Ds),this.Sa=new Map,this.ba=new Set,this.Da=new $(w.comparator),this.Ca=new Map,this.va=new Yo,this.Fa={},this.Ma=new Map,this.xa=_n.Ln(),this.onlineState="Unknown",this.Oa=void 0}get isPrimaryClient(){return this.Oa===!0}}async function jy(n,e,t=!0){const r=Ih(n);let s;const i=r.wa.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.ga()):s=await gh(r,e,t,!0),s}async function qy(n,e){const t=Ih(n);await gh(t,e,!0,!1)}async function gh(n,e,t,r){const s=await ly(n.localStore,He(e)),i=s.targetId,o=t?n.sharedClientState.addLocalQueryTarget(i):"not-current";let a;return r&&(a=await $y(n,e,i,o==="current",s.resumeToken)),n.isPrimaryClient&&t&&nh(n.remoteStore,s),a}async function $y(n,e,t,r,s){n.Na=(h,d,f)=>async function(T,_,C,L){let k=_.view.Ta(C);k.Xi&&(k=await Xl(T.localStore,_.query,!1).then(({documents:Fe})=>_.view.Ta(Fe,k)));const O=L&&L.targetChanges.get(_.targetId),ve=L&&L.targetMismatches.get(_.targetId)!=null,oe=_.view.applyChanges(k,T.isPrimaryClient,O,ve);return wh(T,_.targetId,oe.Va),oe.snapshot}(n,h,d,f);const i=await Xl(n.localStore,e,!0),o=new xy(e,i.hs),a=o.Ta(i.documents),c=br.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),u=o.applyChanges(a,n.isPrimaryClient,c);wh(n,t,u.Va);const l=new Uy(e,t,o);return n.wa.set(e,l),n.Sa.has(t)?n.Sa.get(t).push(e):n.Sa.set(t,[e]),u.snapshot}async function zy(n,e,t){const r=P(n),s=r.wa.get(e),i=r.Sa.get(s.targetId);if(i.length>1)return r.Sa.set(s.targetId,i.filter(o=>!Ds(o,e))),void r.wa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Zo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&na(r.remoteStore,s.targetId),la(r,s.targetId)}).catch(fr)):(la(r,s.targetId),await Zo(r.localStore,s.targetId,!0))}async function Hy(n,e){const t=P(n),r=t.wa.get(e),s=t.Sa.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),na(t.remoteStore,r.targetId))}async function Wy(n,e,t){const r=Zy(n);try{const s=await function(o,a){const c=P(o),u=Y.now(),l=a.reduce((f,E)=>f.add(E.key),D());let h,d;return c.persistence.runTransaction("Locally write mutations","readwrite",f=>{let E=nt(),T=D();return c.os.getEntries(f,l).next(_=>{E=_,E.forEach((C,L)=>{L.isValidDocument()||(T=T.add(C))})}).next(()=>c.localDocuments.getOverlayedDocuments(f,E)).next(_=>{h=_;const C=[];for(const L of a){const k=m_(L,h.get(L.key).overlayedDocument);k!=null&&C.push(new vt(L.key,k,rl(k.value.mapValue),Ce.exists(!0)))}return c.mutationQueue.addMutationBatch(f,u,C,a)}).next(_=>{d=_;const C=_.applyToLocalDocumentSet(h,T);return c.documentOverlayCache.saveOverlays(f,_.batchId,C)})}).then(()=>({batchId:d.batchId,changes:yl(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,a,c){let u=o.Fa[o.currentUser.toKey()];u||(u=new $(M)),u=u.insert(a,c),o.Fa[o.currentUser.toKey()]=u}(r,s.batchId,t),await kr(r,s.changes),await Ws(r.remoteStore)}catch(s){const i=aa(s,"Failed to persist write");t.reject(i)}}async function _h(n,e){const t=P(n);try{const r=await ay(t.localStore,e);e.targetChanges.forEach((s,i)=>{const o=t.Ca.get(i);o&&(F(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?o.pa=!0:s.modifiedDocuments.size>0?F(o.pa):s.removedDocuments.size>0&&(F(o.pa),o.pa=!1))}),await kr(t,r,e)}catch(r){await fr(r)}}function yh(n,e,t){const r=P(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.wa.forEach((i,o)=>{const a=o.view.G_(e);a.snapshot&&s.push(a.snapshot)}),function(o,a){const c=P(o);c.onlineState=a;let u=!1;c.queries.forEach((l,h)=>{for(const d of h.Q_)d.G_(a)&&(u=!0)}),u&&ca(c)}(r.eventManager,e),s.length&&r.ya.u_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function Gy(n,e,t){const r=P(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Ca.get(e),i=s&&s.key;if(i){let o=new $(w.comparator);o=o.insert(i,he.newNoDocument(i,S.min()));const a=D().add(i),c=new Fs(S.min(),new Map,new $(M),o,a);await _h(r,c),r.Da=r.Da.remove(i),r.Ca.delete(e),ha(r)}else await Zo(r.localStore,e,!1).then(()=>la(r,e,t)).catch(fr)}async function Ky(n,e){const t=P(n),r=e.batch.batchId;try{const s=await oy(t.localStore,e);Eh(t,r,null),vh(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await kr(t,s)}catch(s){await fr(s)}}async function Qy(n,e,t){const r=P(n);try{const s=await function(o,a){const c=P(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let l;return c.mutationQueue.lookupMutationBatch(u,a).next(h=>(F(h!==null),l=h.keys(),c.mutationQueue.removeMutationBatch(u,h))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,l,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,l)).next(()=>c.localDocuments.getDocuments(u,l))})}(r.localStore,e);Eh(r,e,t),vh(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await kr(r,s)}catch(s){await fr(s)}}function vh(n,e){(n.Ma.get(e)||[]).forEach(t=>{t.resolve()}),n.Ma.delete(e)}function Eh(n,e,t){const r=P(n);let s=r.Fa[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Fa[r.currentUser.toKey()]=s}}function la(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Sa.get(e))n.wa.delete(r),t&&n.ya.La(r,t);n.Sa.delete(e),n.isPrimaryClient&&n.va.Vr(e).forEach(r=>{n.va.containsKey(r)||Th(n,r)})}function Th(n,e){n.ba.delete(e.path.canonicalString());const t=n.Da.get(e);t!==null&&(na(n.remoteStore,t),n.Da=n.Da.remove(e),n.Ca.delete(t),ha(n))}function wh(n,e,t){for(const r of t)r instanceof ph?(n.va.addReference(r.key,e),Yy(n,r)):r instanceof mh?(v("SyncEngine","Document no longer in limbo: "+r.key),n.va.removeReference(r.key,e),n.va.containsKey(r.key)||Th(n,r.key)):A()}function Yy(n,e){const t=e.key,r=t.path.canonicalString();n.Da.get(t)||n.ba.has(r)||(v("SyncEngine","New document in limbo: "+t),n.ba.add(r),ha(n))}function ha(n){for(;n.ba.size>0&&n.Da.size<n.maxConcurrentLimboResolutions;){const e=n.ba.values().next().value;n.ba.delete(e);const t=new w(B.fromString(e)),r=n.xa.next();n.Ca.set(r,new Fy(t)),n.Da=n.Da.insert(t,r),nh(n.remoteStore,new Tt(He(Fo(t.path)),r,"TargetPurposeLimboResolution",ko._e))}}async function kr(n,e,t){const r=P(n),s=[],i=[],o=[];r.wa.isEmpty()||(r.wa.forEach((a,c)=>{o.push(r.Na(c,e,t).then(u=>{if((u||t)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(c.targetId,u!=null&&u.fromCache?"not-current":"current"),u){s.push(u);const l=Jo.Ki(c.targetId,u);i.push(l)}}))}),await Promise.all(o),r.ya.u_(s),await async function(c,u){const l=P(c);try{await l.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>m.forEach(u,d=>m.forEach(d.qi,f=>l.persistence.referenceDelegate.addReference(h,d.targetId,f)).next(()=>m.forEach(d.Qi,f=>l.persistence.referenceDelegate.removeReference(h,d.targetId,f)))))}catch(h){if(!mr(h))throw h;v("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const d=h.targetId;if(!h.fromCache){const f=l.ns.get(d),E=f.snapshotVersion,T=f.withLastLimboFreeSnapshotVersion(E);l.ns=l.ns.insert(d,T)}}}(r.localStore,i))}async function Xy(n,e){const t=P(n);if(!t.currentUser.isEqual(e)){v("SyncEngine","User change. New user:",e.toKey());const r=await Ql(t.localStore,e);t.currentUser=e,function(i,o){i.Ma.forEach(a=>{a.forEach(c=>{c.reject(new g(p.CANCELLED,o))})}),i.Ma.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await kr(t,r.us)}}function Jy(n,e){const t=P(n),r=t.Ca.get(e);if(r&&r.pa)return D().add(r.key);{let s=D();const i=t.Sa.get(e);if(!i)return s;for(const o of i){const a=t.wa.get(o);s=s.unionWith(a.view.Ia)}return s}}function Ih(n){const e=P(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=_h.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Jy.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Gy.bind(null,e),e.ya.u_=Ly.bind(null,e.eventManager),e.ya.La=My.bind(null,e.eventManager),e}function Zy(n){const e=P(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Ky.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Qy.bind(null,e),e}class Ah{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=$s(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return iy(this.persistence,new ry,e.initialUser,this.serializer)}createPersistence(e){return new ey(Xo.Hr,this.serializer)}createSharedClientState(e){return new dy}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class ev{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>yh(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=Xy.bind(null,this.syncEngine),await Ny(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new Vy}()}createDatastore(e){const t=$s(e.databaseInfo.databaseId),r=function(i){return new gy(i)}(e.databaseInfo);return function(i,o,a,c){return new vy(i,o,a,c)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,o,a){return new wy(r,s,i,o,a)}(this.localStore,this.datastore,e.asyncQueue,t=>yh(this.syncEngine,t,0),function(){return Zl.D()?new Zl:new fy}())}createSyncEngine(e,t){return function(s,i,o,a,c,u,l){const h=new By(s,i,o,a,c,u);return l&&(h.Oa=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e;await async function(r){const s=P(r);v("RemoteStore","RemoteStore shutting down."),s.v_.add(5),await Cr(s),s.M_.shutdown(),s.x_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate()}}/**
|
|
1730
|
+
*/class gl{constructor(e){this.key=e}}class _l{constructor(e){this.key=e}}class sy{constructor(e,t){this.query=e,this.fa=t,this.ga=null,this.hasCachedResults=!1,this.current=!1,this.pa=W(),this.mutatedKeys=W(),this.ya=mu(e),this.wa=new kn(this.ya)}get Sa(){return this.fa}ba(e,t){const r=t?t.Da:new fl,s=t?t.wa:this.wa;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const l=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,d=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,m)=>{const v=s.get(f),R=vs(this.query,m)?m:null,S=!!v&&this.mutatedKeys.has(v.key),N=!!R&&(R.hasLocalMutations||this.mutatedKeys.has(R.key)&&R.hasCommittedMutations);let k=!1;v&&R?v.data.isEqual(R.data)?S!==N&&(r.track({type:3,doc:R}),k=!0):this.va(v,R)||(r.track({type:2,doc:R}),k=!0,(l&&this.ya(R,l)>0||d&&this.ya(R,d)<0)&&(c=!0)):!v&&R?(r.track({type:0,doc:R}),k=!0):v&&!R&&(r.track({type:1,doc:v}),k=!0,(l||d)&&(c=!0)),k&&(R?(a=a.add(R),i=N?i.add(f):i.delete(f)):(a=a.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{wa:a,Da:r,ls:c,mutatedKeys:i}}va(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.wa;this.wa=e.wa,this.mutatedKeys=e.mutatedKeys;const a=e.Da.X_();a.sort((f,m)=>function(R,S){const N=k=>{switch(k){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return F()}};return N(R)-N(S)}(f.type,m.type)||this.ya(f.doc,m.doc)),this.Ca(r),s=s!=null&&s;const c=t&&!s?this.Fa():[],l=this.pa.size===0&&this.current&&!s?1:0,d=l!==this.ga;return this.ga=l,a.length!==0||d?{snapshot:new Nn(this.query,e.wa,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),Ma:c}:{Ma:c}}sa(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({wa:this.wa,Da:new fl,mutatedKeys:this.mutatedKeys,ls:!1},!1)):{Ma:[]}}xa(e){return!this.fa.has(e)&&!!this.wa.has(e)&&!this.wa.get(e).hasLocalMutations}Ca(e){e&&(e.addedDocuments.forEach(t=>this.fa=this.fa.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.fa=this.fa.delete(t)),this.current=e.current)}Fa(){if(!this.current)return[];const e=this.pa;this.pa=W(),this.wa.forEach(r=>{this.xa(r.key)&&(this.pa=this.pa.add(r.key))});const t=[];return e.forEach(r=>{this.pa.has(r)||t.push(new _l(r))}),this.pa.forEach(r=>{e.has(r)||t.push(new gl(r))}),t}Oa(e){this.fa=e.gs,this.pa=W();const t=this.ba(e.documents);return this.applyChanges(t,!0)}Na(){return Nn.fromInitialDocuments(this.query,this.wa,this.mutatedKeys,this.ga===0,this.hasCachedResults)}}const Lo="SyncEngine";class iy{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class oy{constructor(e){this.key=e,this.Ba=!1}}class ay{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.La={},this.ka=new Zt(c=>pu(c),ys),this.qa=new Map,this.Qa=new Set,this.$a=new re(L.comparator),this.Ka=new Map,this.Ua=new go,this.Wa={},this.Ga=new Map,this.za=Sn.Un(),this.onlineState="Unknown",this.ja=void 0}get isPrimaryClient(){return this.ja===!0}}async function cy(n,e,t=!0){const r=Rl(n);let s;const i=r.ka.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Na()):s=await yl(r,e,t,!0),s}async function uy(n,e){const t=Rl(n);await yl(t,e,!0,!1)}async function yl(n,e,t,r){const s=await C_(n.localStore,nt(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await ly(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&ol(n.remoteStore,s),c}async function ly(n,e,t,r,s){n.Ha=(m,v,R)=>async function(N,k,U,$){let x=k.view.ba(U);x.ls&&(x=await Zu(N.localStore,k.query,!1).then(({documents:T})=>k.view.ba(T,x)));const H=$&&$.targetChanges.get(k.targetId),he=$&&$.targetMismatches.get(k.targetId)!=null,J=k.view.applyChanges(x,N.isPrimaryClient,H,he);return Al(N,k.targetId,J.Ma),J.snapshot}(n,m,v,R);const i=await Zu(n.localStore,e,!0),a=new sy(e,i.gs),c=a.ba(i.documents),l=yr.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(c,n.isPrimaryClient,l);Al(n,t,d.Ma);const f=new iy(e,t,a);return n.ka.set(e,f),n.qa.has(t)?n.qa.get(t).push(e):n.qa.set(t,[e]),d.snapshot}async function hy(n,e,t){const r=B(n),s=r.ka.get(e),i=r.qa.get(s.targetId);if(i.length>1)return r.qa.set(s.targetId,i.filter(a=>!ys(a,e))),void r.ka.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Eo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&Ao(r.remoteStore,s.targetId),Mo(r,s.targetId)}).catch(En)):(Mo(r,s.targetId),await Eo(r.localStore,s.targetId,!0))}async function dy(n,e){const t=B(n),r=t.ka.get(e),s=t.qa.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),Ao(t.remoteStore,r.targetId))}async function fy(n,e,t){const r=Ey(n);try{const s=await function(a,c){const l=B(a),d=ue.now(),f=c.reduce((R,S)=>R.add(S.key),W());let m,v;return l.persistence.runTransaction("Locally write mutations","readwrite",R=>{let S=pt(),N=W();return l.ds.getEntries(R,f).next(k=>{S=k,S.forEach((U,$)=>{$.isValidDocument()||(N=N.add(U))})}).next(()=>l.localDocuments.getOverlayedDocuments(R,S)).next(k=>{m=k;const U=[];for(const $ of c){const x=Pg($,m.get($.key).overlayedDocument);x!=null&&U.push(new Vt($.key,x,nu(x.value.mapValue),$e.exists(!0)))}return l.mutationQueue.addMutationBatch(R,d,U,c)}).next(k=>{v=k;const U=k.applyToLocalDocumentSet(m,N);return l.documentOverlayCache.saveOverlays(R,k.batchId,U)})}).then(()=>({batchId:v.batchId,changes:_u(m)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(a,c,l){let d=a.Wa[a.currentUser.toKey()];d||(d=new re(G)),d=d.insert(c,l),a.Wa[a.currentUser.toKey()]=d}(r,s.batchId,t),await Er(r,s.changes),await Ls(r.remoteStore)}catch(s){const i=Co(s,"Failed to persist write");t.reject(i)}}async function vl(n,e){const t=B(n);try{const r=await b_(t.localStore,e);e.targetChanges.forEach((s,i)=>{const a=t.Ka.get(i);a&&(Y(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?a.Ba=!0:s.modifiedDocuments.size>0?Y(a.Ba):s.removedDocuments.size>0&&(Y(a.Ba),a.Ba=!1))}),await Er(t,r,e)}catch(r){await En(r)}}function El(n,e,t){const r=B(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.ka.forEach((i,a)=>{const c=a.view.sa(e);c.snapshot&&s.push(c.snapshot)}),function(a,c){const l=B(a);l.onlineState=c;let d=!1;l.queries.forEach((f,m)=>{for(const v of m.ta)v.sa(c)&&(d=!0)}),d&&Do(l)}(r.eventManager,e),s.length&&r.La.p_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function py(n,e,t){const r=B(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Ka.get(e),i=s&&s.key;if(i){let a=new re(L.comparator);a=a.insert(i,Ie.newNoDocument(i,j.min()));const c=W().add(i),l=new bs(j.min(),new Map,new re(G),a,c);await vl(r,l),r.$a=r.$a.remove(i),r.Ka.delete(e),Uo(r)}else await Eo(r.localStore,e,!1).then(()=>Mo(r,e,t)).catch(En)}async function my(n,e){const t=B(n),r=e.batch.batchId;try{const s=await R_(t.localStore,e);wl(t,r,null),Tl(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Er(t,s)}catch(s){await En(s)}}async function gy(n,e,t){const r=B(n);try{const s=await function(a,c){const l=B(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let f;return l.mutationQueue.lookupMutationBatch(d,c).next(m=>(Y(m!==null),f=m.keys(),l.mutationQueue.removeMutationBatch(d,m))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,f,c)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,f)).next(()=>l.localDocuments.getDocuments(d,f))})}(r.localStore,e);wl(r,e,t),Tl(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Er(r,s)}catch(s){await En(s)}}function Tl(n,e){(n.Ga.get(e)||[]).forEach(t=>{t.resolve()}),n.Ga.delete(e)}function wl(n,e,t){const r=B(n);let s=r.Wa[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Wa[r.currentUser.toKey()]=s}}function Mo(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.qa.get(e))n.ka.delete(r),t&&n.La.Ja(r,t);n.qa.delete(e),n.isPrimaryClient&&n.Ua.br(e).forEach(r=>{n.Ua.containsKey(r)||Il(n,r)})}function Il(n,e){n.Qa.delete(e.path.canonicalString());const t=n.$a.get(e);t!==null&&(Ao(n.remoteStore,t),n.$a=n.$a.remove(e),n.Ka.delete(t),Uo(n))}function Al(n,e,t){for(const r of t)r instanceof gl?(n.Ua.addReference(r.key,e),_y(n,r)):r instanceof _l?(V(Lo,"Document no longer in limbo: "+r.key),n.Ua.removeReference(r.key,e),n.Ua.containsKey(r.key)||Il(n,r.key)):F()}function _y(n,e){const t=e.key,r=t.path.canonicalString();n.$a.get(t)||n.Qa.has(r)||(V(Lo,"New document in limbo: "+t),n.Qa.add(r),Uo(n))}function Uo(n){for(;n.Qa.size>0&&n.$a.size<n.maxConcurrentLimboResolutions;){const e=n.Qa.values().next().value;n.Qa.delete(e);const t=new L(ee.fromString(e)),r=n.za.next();n.Ka.set(r,new oy(t)),n.$a=n.$a.insert(t,r),ol(n.remoteStore,new Mt(nt(gs(t.path)),r,"TargetPurposeLimboResolution",ss.ae))}}async function Er(n,e,t){const r=B(n),s=[],i=[],a=[];r.ka.isEmpty()||(r.ka.forEach((c,l)=>{a.push(r.Ha(l,e,t).then(d=>{var f;if((d||t)&&r.isPrimaryClient){const m=d?!d.fromCache:(f=t==null?void 0:t.targetChanges.get(l.targetId))===null||f===void 0?void 0:f.current;r.sharedClientState.updateQueryState(l.targetId,m?"current":"not-current")}if(d){s.push(d);const m=yo.Yi(l.targetId,d);i.push(m)}}))}),await Promise.all(a),r.La.p_(s),await async function(l,d){const f=B(l);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",m=>C.forEach(d,v=>C.forEach(v.Hi,R=>f.persistence.referenceDelegate.addReference(m,v.targetId,R)).next(()=>C.forEach(v.Ji,R=>f.persistence.referenceDelegate.removeReference(m,v.targetId,R)))))}catch(m){if(!Tn(m))throw m;V(vo,"Failed to update sequence numbers: "+m)}for(const m of d){const v=m.targetId;if(!m.fromCache){const R=f.Ts.get(v),S=R.snapshotVersion,N=R.withLastLimboFreeSnapshotVersion(S);f.Ts=f.Ts.insert(v,N)}}}(r.localStore,i))}async function yy(n,e){const t=B(n);if(!t.currentUser.isEqual(e)){V(Lo,"User change. New user:",e.toKey());const r=await Yu(t.localStore,e);t.currentUser=e,function(i,a){i.Ga.forEach(c=>{c.forEach(l=>{l.reject(new O(P.CANCELLED,a))})}),i.Ga.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Er(t,r.Rs)}}function vy(n,e){const t=B(n),r=t.Ka.get(e);if(r&&r.Ba)return W().add(r.key);{let s=W();const i=t.qa.get(e);if(!i)return s;for(const a of i){const c=t.ka.get(a);s=s.unionWith(c.view.Sa)}return s}}function Rl(n){const e=B(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=vl.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=vy.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=py.bind(null,e),e.La.p_=ny.bind(null,e.eventManager),e.La.Ja=ry.bind(null,e.eventManager),e}function Ey(n){const e=B(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=my.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=gy.bind(null,e),e}class Ms{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Ds(e.databaseInfo.databaseId),this.sharedClientState=this.Za(e),this.persistence=this.Xa(e),await this.persistence.start(),this.localStore=this.eu(e),this.gcScheduler=this.tu(e,this.localStore),this.indexBackfillerScheduler=this.nu(e,this.localStore)}tu(e,t){return null}nu(e,t){return null}eu(e){return A_(this.persistence,new T_,e.initialUser,this.serializer)}Xa(e){return new Xu(_o.ri,this.serializer)}Za(e){return new N_}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ms.provider={build:()=>new Ms};class Ty extends Ms{constructor(e){super(),this.cacheSizeBytes=e}tu(e,t){Y(this.persistence.referenceDelegate instanceof ks);const r=this.persistence.referenceDelegate.garbageCollector;return new o_(r,e.asyncQueue,t)}Xa(e){const t=this.cacheSizeBytes!==void 0?Oe.withCacheSize(this.cacheSizeBytes):Oe.DEFAULT;return new Xu(r=>ks.ri(r,t),this.serializer)}}class xo{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>El(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=yy.bind(null,this.syncEngine),await Z_(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new ty}()}createDatastore(e){const t=Ds(e.databaseInfo.databaseId),r=function(i){return new M_(i)}(e.databaseInfo);return function(i,a,c,l){return new B_(i,a,c,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,a,c){return new q_(r,s,i,a,c)}(this.localStore,this.datastore,e.asyncQueue,t=>El(this.syncEngine,t,0),function(){return nl.D()?new nl:new D_}())}createSyncEngine(e,t){return function(s,i,a,c,l,d,f){const m=new ay(s,i,a,c,l,d);return f&&(m.ja=!0),m}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=B(s);V(tn,"RemoteStore shutting down."),i.W_.add(5),await vr(i),i.z_.shutdown(),i.j_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}xo.provider={build:()=>new xo};/**
|
|
1622
1731
|
* @license
|
|
1623
1732
|
* Copyright 2020 Google LLC
|
|
1624
1733
|
*
|
|
@@ -1648,7 +1757,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1648
1757
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1649
1758
|
* See the License for the specific language governing permissions and
|
|
1650
1759
|
* limitations under the License.
|
|
1651
|
-
*/class
|
|
1760
|
+
*/class Fo{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.iu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.iu(this.observer.error,e):ft("Uncaught Error in snapshot listener:",e.toString()))}su(){this.muted=!0}iu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
|
|
1652
1761
|
* @license
|
|
1653
1762
|
* Copyright 2017 Google LLC
|
|
1654
1763
|
*
|
|
@@ -1663,7 +1772,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1663
1772
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1664
1773
|
* See the License for the specific language governing permissions and
|
|
1665
1774
|
* limitations under the License.
|
|
1666
|
-
*/class
|
|
1775
|
+
*/const xt="FirestoreClient";class wy{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=we.UNAUTHENTICATED,this.clientId=Mc.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async a=>{V(xt,"Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(r,a=>(V(xt,"Received new app check token=",a),this.appCheckCredentialListener(a,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Ze;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const r=Co(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Bo(n,e){n.asyncQueue.verifyOperationInProgress(),V(xt,"Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Yu(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function bl(n,e){n.asyncQueue.verifyOperationInProgress();const t=await Iy(n);V(xt,"Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>dl(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>dl(e.remoteStore,s)),n._onlineComponents=e}async function Iy(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){V(xt,"Using user provided OfflineComponentProvider");try{await Bo(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(s){return s.name==="FirebaseError"?s.code===P.FAILED_PRECONDITION||s.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;yn("Error using user provided cache. Falling back to memory cache: "+t),await Bo(n,new Ms)}}else V(xt,"Using default OfflineComponentProvider"),await Bo(n,new Ty(void 0));return n._offlineComponents}async function jo(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(V(xt,"Using user provided OnlineComponentProvider"),await bl(n,n._uninitializedComponentsProvider._online)):(V(xt,"Using default OnlineComponentProvider"),await bl(n,new xo))),n._onlineComponents}function Ay(n){return jo(n).then(e=>e.syncEngine)}function Ry(n){return jo(n).then(e=>e.datastore)}async function Us(n){const e=await jo(n),t=e.eventManager;return t.onListen=cy.bind(null,e.syncEngine),t.onUnlisten=hy.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=uy.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=dy.bind(null,e.syncEngine),t}function by(n,e,t={}){const r=new Ze;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new Fo({next:v=>{f.su(),a.enqueueAndForget(()=>No(i,m));const R=v.docs.has(c);!R&&v.fromCache?d.reject(new O(P.UNAVAILABLE,"Failed to get document because the client is offline.")):R&&v.fromCache&&l&&l.source==="server"?d.reject(new O(P.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):d.resolve(v)},error:v=>d.reject(v)}),m=new Vo(gs(c.path),f,{includeMetadataChanges:!0,Ta:!0});return ko(i,m)}(await Us(n),n.asyncQueue,e,t,r)),r.promise}function Py(n,e,t={}){const r=new Ze;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const f=new Fo({next:v=>{f.su(),a.enqueueAndForget(()=>No(i,m)),v.fromCache&&l.source==="server"?d.reject(new O(P.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):d.resolve(v)},error:v=>d.reject(v)}),m=new Vo(c,f,{includeMetadataChanges:!0,Ta:!0});return ko(i,m)}(await Us(n),n.asyncQueue,e,t,r)),r.promise}function Sy(n,e,t){const r=new Ze;return n.asyncQueue.enqueueAndForget(async()=>{try{const s=await Ry(n);r.resolve(async function(a,c,l){var d;const f=B(a),{request:m,Pt:v,parent:R}=Gg(f.serializer,fg(c),l);f.connection.fo||delete m.parent;const S=(await f.Co("RunAggregationQuery",f.serializer.databaseId,R,m,1)).filter(k=>!!k.result);Y(S.length===1);const N=(d=S[0].result)===null||d===void 0?void 0:d.aggregateFields;return Object.keys(N).reduce((k,U)=>(k[v[U]]=N[U],k),{})}(s,e,t))}catch(s){r.reject(s)}}),r.promise}/**
|
|
1667
1776
|
* @license
|
|
1668
1777
|
* Copyright 2023 Google LLC
|
|
1669
1778
|
*
|
|
@@ -1678,7 +1787,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1678
1787
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1679
1788
|
* See the License for the specific language governing permissions and
|
|
1680
1789
|
* limitations under the License.
|
|
1681
|
-
*/function
|
|
1790
|
+
*/function Pl(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
|
|
1682
1791
|
* @license
|
|
1683
1792
|
* Copyright 2020 Google LLC
|
|
1684
1793
|
*
|
|
@@ -1693,7 +1802,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1693
1802
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1694
1803
|
* See the License for the specific language governing permissions and
|
|
1695
1804
|
* limitations under the License.
|
|
1696
|
-
*/const
|
|
1805
|
+
*/const Sl=new Map;/**
|
|
1697
1806
|
* @license
|
|
1698
1807
|
* Copyright 2017 Google LLC
|
|
1699
1808
|
*
|
|
@@ -1708,7 +1817,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1708
1817
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1709
1818
|
* See the License for the specific language governing permissions and
|
|
1710
1819
|
* limitations under the License.
|
|
1711
|
-
*/function
|
|
1820
|
+
*/function Cl(n,e,t){if(!t)throw new O(P.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function Cy(n,e,t,r){if(e===!0&&r===!0)throw new O(P.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function kl(n){if(!L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Nl(n){if(L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function xs(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":F()}function Ge(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new O(P.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=xs(n);throw new O(P.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function ky(n,e){if(e<=0)throw new O(P.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
|
|
1712
1821
|
* @license
|
|
1713
1822
|
* Copyright 2020 Google LLC
|
|
1714
1823
|
*
|
|
@@ -1723,7 +1832,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1723
1832
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1724
1833
|
* See the License for the specific language governing permissions and
|
|
1725
1834
|
* limitations under the License.
|
|
1726
|
-
*/class
|
|
1835
|
+
*/const Dl="firestore.googleapis.com",Ol=!0;class Vl{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new O(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Dl,this.ssl=Ol}else this.host=e.host,this.ssl=(t=e.ssl)!==null&&t!==void 0?t:Ol;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=Gu;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<s_)throw new O(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}Cy("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Pl((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Fs{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Vl({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new O(P.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new O(P.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Vl(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new Om;switch(r.type){case"firstParty":return new Um(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new O(P.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=Sl.get(t);r&&(V("ComponentProvider","Removing Datastore"),Sl.delete(t),r.terminate())}(this),Promise.resolve()}}function Ll(n,e,t,r={}){var s;const i=(n=Ge(n,Fs))._getSettings(),a=`${e}:${t}`;if(i.host!==Dl&&i.host!==a&&yn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},i),{host:a,ssl:!1})),r.mockUserToken){let c,l;if(typeof r.mockUserToken=="string")c=r.mockUserToken,l=we.MOCK_USER;else{c=lc(r.mockUserToken,(s=n._app)===null||s===void 0?void 0:s.options.projectId);const d=r.mockUserToken.sub||r.mockUserToken.user_id;if(!d)throw new O(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new we(d)}n._authCredentials=new Vm(new Vc(c,l))}}/**
|
|
1727
1836
|
* @license
|
|
1728
1837
|
* Copyright 2020 Google LLC
|
|
1729
1838
|
*
|
|
@@ -1738,7 +1847,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1738
1847
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1739
1848
|
* See the License for the specific language governing permissions and
|
|
1740
1849
|
* limitations under the License.
|
|
1741
|
-
*/class
|
|
1850
|
+
*/class st{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new st(this.firestore,e,this._query)}}class Ve{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Ft(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ve(this.firestore,e,this._key)}}class Ft extends st{constructor(e,t,r){super(e,t,gs(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Ve(this.firestore,null,new L(e))}withConverter(e){return new Ft(this.firestore,e,this._path)}}function Ml(n,e,...t){if(n=X(n),Cl("collection","path",e),n instanceof Fs){const r=ee.fromString(e,...t);return Nl(r),new Ft(n,null,r)}{if(!(n instanceof Ve||n instanceof Ft))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return Nl(r),new Ft(n.firestore,null,r)}}function Bs(n,e,...t){if(n=X(n),arguments.length===1&&(e=Mc.newId()),Cl("doc","path",e),n instanceof Fs){const r=ee.fromString(e,...t);return kl(r),new Ve(n,null,new L(r))}{if(!(n instanceof Ve||n instanceof Ft))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return kl(r),new Ve(n.firestore,n instanceof Ft?n.converter:null,new L(r))}}/**
|
|
1742
1851
|
* @license
|
|
1743
1852
|
* Copyright 2020 Google LLC
|
|
1744
1853
|
*
|
|
@@ -1753,8 +1862,8 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1753
1862
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1754
1863
|
* See the License for the specific language governing permissions and
|
|
1755
1864
|
* limitations under the License.
|
|
1756
|
-
*/class
|
|
1757
|
-
`+
|
|
1865
|
+
*/const Ul="AsyncQueue";class xl{constructor(e=Promise.resolve()){this.Vu=[],this.mu=!1,this.fu=[],this.gu=null,this.pu=!1,this.yu=!1,this.wu=[],this.a_=new rl(this,"async_queue_retry"),this.Su=()=>{const r=Io();r&&V(Ul,"Visibility state changed to "+r.visibilityState),this.a_.t_()},this.bu=e;const t=Io();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Su)}get isShuttingDown(){return this.mu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Du(),this.vu(e)}enterRestrictedMode(e){if(!this.mu){this.mu=!0,this.yu=e||!1;const t=Io();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Su)}}enqueue(e){if(this.Du(),this.mu)return new Promise(()=>{});const t=new Ze;return this.vu(()=>this.mu&&this.yu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Vu.push(e),this.Cu()))}async Cu(){if(this.Vu.length!==0){try{await this.Vu[0](),this.Vu.shift(),this.a_.reset()}catch(e){if(!Tn(e))throw e;V(Ul,"Operation failed with retryable error: "+e)}this.Vu.length>0&&this.a_.Xo(()=>this.Cu())}}vu(e){const t=this.bu.then(()=>(this.pu=!0,e().catch(r=>{this.gu=r,this.pu=!1;const s=function(a){let c=a.message||"";return a.stack&&(c=a.stack.includes(a.message)?a.stack:a.message+`
|
|
1866
|
+
`+a.stack),c}(r);throw ft("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.pu=!1,r))));return this.bu=t,t}enqueueAfterDelay(e,t,r){this.Du(),this.wu.indexOf(e)>-1&&(t=0);const s=So.createAndSchedule(this,e,t,r,i=>this.Fu(i));return this.fu.push(s),s}Du(){this.gu&&F()}verifyOperationInProgress(){}async Mu(){let e;do e=this.bu,await e;while(e!==this.bu)}xu(e){for(const t of this.fu)if(t.timerId===e)return!0;return!1}Ou(e){return this.Mu().then(()=>{this.fu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.fu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.Mu()})}Nu(e){this.wu.push(e)}Fu(e){const t=this.fu.indexOf(e);this.fu.splice(t,1)}}function Fl(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(n,["next","error","complete"])}class Bt extends Fs{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new xl,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new xl(e),this._firestoreClient=void 0,await e}}}function Ny(n,e){const t=typeof n=="object"?n:ts(),r=typeof n=="string"?n:ls,s=nr(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=Li("firestore");i&&Ll(s,...i)}return s}function Dn(n){if(n._terminated)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Dy(n),n._firestoreClient}function Dy(n){var e,t,r;const s=n._freezeSettings(),i=function(c,l,d,f){return new Jm(c,l,d,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,Pl(f.experimentalLongPollingOptions),f.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,s);n._componentsProvider||!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),n._firestoreClient=new wy(n._authCredentials,n._appCheckCredentials,n._queue,i,n._componentsProvider&&function(c){const l=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(l),_online:l}}(n._componentsProvider))}/**
|
|
1758
1867
|
* @license
|
|
1759
1868
|
* Copyright 2020 Google LLC
|
|
1760
1869
|
*
|
|
@@ -1784,7 +1893,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1784
1893
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1785
1894
|
* See the License for the specific language governing permissions and
|
|
1786
1895
|
* limitations under the License.
|
|
1787
|
-
*/class
|
|
1896
|
+
*/class Oy{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class Vy{constructor(e,t,r){this._userDataWriter=t,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
|
|
1788
1897
|
* @license
|
|
1789
1898
|
* Copyright 2020 Google LLC
|
|
1790
1899
|
*
|
|
@@ -1799,7 +1908,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1799
1908
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1800
1909
|
* See the License for the specific language governing permissions and
|
|
1801
1910
|
* limitations under the License.
|
|
1802
|
-
*/class
|
|
1911
|
+
*/class On{constructor(e){this._byteString=e}static fromBase64String(e){try{return new On(_e.fromBase64String(e))}catch(t){throw new O(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new On(_e.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
|
|
1803
1912
|
* @license
|
|
1804
1913
|
* Copyright 2020 Google LLC
|
|
1805
1914
|
*
|
|
@@ -1814,7 +1923,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1814
1923
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1815
1924
|
* See the License for the specific language governing permissions and
|
|
1816
1925
|
* limitations under the License.
|
|
1817
|
-
*/class
|
|
1926
|
+
*/class js{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new O(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new me(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
|
|
1818
1927
|
* @license
|
|
1819
1928
|
* Copyright 2020 Google LLC
|
|
1820
1929
|
*
|
|
@@ -1829,7 +1938,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1829
1938
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1830
1939
|
* See the License for the specific language governing permissions and
|
|
1831
1940
|
* limitations under the License.
|
|
1832
|
-
*/class
|
|
1941
|
+
*/class qo{constructor(e){this._methodName=e}}/**
|
|
1833
1942
|
* @license
|
|
1834
1943
|
* Copyright 2017 Google LLC
|
|
1835
1944
|
*
|
|
@@ -1844,7 +1953,22 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1844
1953
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1845
1954
|
* See the License for the specific language governing permissions and
|
|
1846
1955
|
* limitations under the License.
|
|
1847
|
-
*/class
|
|
1956
|
+
*/class $o{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new O(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new O(P.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return G(this._lat,e._lat)||G(this._long,e._long)}}/**
|
|
1957
|
+
* @license
|
|
1958
|
+
* Copyright 2024 Google LLC
|
|
1959
|
+
*
|
|
1960
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1961
|
+
* you may not use this file except in compliance with the License.
|
|
1962
|
+
* You may obtain a copy of the License at
|
|
1963
|
+
*
|
|
1964
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1965
|
+
*
|
|
1966
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1967
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1968
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1969
|
+
* See the License for the specific language governing permissions and
|
|
1970
|
+
* limitations under the License.
|
|
1971
|
+
*/class Ho{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}}/**
|
|
1848
1972
|
* @license
|
|
1849
1973
|
* Copyright 2017 Google LLC
|
|
1850
1974
|
*
|
|
@@ -1859,7 +1983,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1859
1983
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1860
1984
|
* See the License for the specific language governing permissions and
|
|
1861
1985
|
* limitations under the License.
|
|
1862
|
-
*/const
|
|
1986
|
+
*/const Ly=/^__.*__$/;class My{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Vt(e,this.data,this.fieldMask,t,this.fieldTransforms):new gr(e,this.data,t,this.fieldTransforms)}}class Bl{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new Vt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function jl(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw F()}}class zo{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Bu(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Lu(){return this.settings.Lu}ku(e){return new zo(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}qu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:r,Qu:!1});return s.$u(e),s}Ku(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.ku({path:r,Qu:!1});return s.Bu(),s}Uu(e){return this.ku({path:void 0,Qu:!0})}Wu(e){return $s(e,this.settings.methodName,this.settings.Gu||!1,this.path,this.settings.zu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}Bu(){if(this.path)for(let e=0;e<this.path.length;e++)this.$u(this.path.get(e))}$u(e){if(e.length===0)throw this.Wu("Document fields must not be empty");if(jl(this.Lu)&&Ly.test(e))throw this.Wu('Document fields cannot begin and end with "__"')}}class Uy{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||Ds(e)}ju(e,t,r,s=!1){return new zo({Lu:e,methodName:t,zu:r,path:me.emptyPath(),Qu:!1,Gu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Wo(n){const e=n._freezeSettings(),t=Ds(n._databaseId);return new Uy(n._databaseId,!!e.ignoreUndefinedProperties,t)}function xy(n,e,t,r,s,i={}){const a=n.ju(i.merge||i.mergeFields?2:0,e,t,s);Go("Data must be an object, but it was:",a,r);const c=$l(r,a);let l,d;if(i.merge)l=new Fe(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const f=[];for(const m of i.mergeFields){const v=Ko(e,m,t);if(!a.contains(v))throw new O(P.INVALID_ARGUMENT,`Field '${v}' is specified in your field mask but missing from your input data.`);zl(f,v)||f.push(v)}l=new Fe(f),d=a.fieldTransforms.filter(m=>l.covers(m.field))}else l=null,d=a.fieldTransforms;return new My(new De(c),l,d)}class qs extends qo{_toFieldTransform(e){if(e.Lu!==2)throw e.Lu===1?e.Wu(`${this._methodName}() can only appear at the top level of your update data`):e.Wu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof qs}}function Fy(n,e,t,r){const s=n.ju(1,e,t);Go("Data must be an object, but it was:",s,r);const i=[],a=De.empty();kt(r,(l,d)=>{const f=Qo(e,l,t);d=X(d);const m=s.Ku(f);if(d instanceof qs)i.push(f);else{const v=Tr(d,m);v!=null&&(i.push(f),a.set(f,v))}});const c=new Fe(i);return new Bl(a,c,s.fieldTransforms)}function By(n,e,t,r,s,i){const a=n.ju(1,e,t),c=[Ko(e,r,t)],l=[s];if(i.length%2!=0)throw new O(P.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let v=0;v<i.length;v+=2)c.push(Ko(e,i[v])),l.push(i[v+1]);const d=[],f=De.empty();for(let v=c.length-1;v>=0;--v)if(!zl(d,c[v])){const R=c[v];let S=l[v];S=X(S);const N=a.Ku(R);if(S instanceof qs)d.push(R);else{const k=Tr(S,N);k!=null&&(d.push(R),f.set(R,k))}}const m=new Fe(d);return new Bl(f,m,a.fieldTransforms)}function ql(n,e,t,r=!1){return Tr(t,n.ju(r?4:3,e))}function Tr(n,e){if(Hl(n=X(n)))return Go("Unsupported field value:",e,n),$l(n,e);if(n instanceof qo)return function(r,s){if(!jl(s.Lu))throw s.Wu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Wu(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.Qu&&e.Lu!==4)throw e.Wu("Nested arrays are not supported");return function(r,s){const i=[];let a=0;for(const c of r){let l=Tr(c,s.Uu(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=X(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Tg(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=ue.fromDate(r);return{timestampValue:Cs(s.serializer,i)}}if(r instanceof ue){const i=new ue(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Cs(s.serializer,i)}}if(r instanceof $o)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof On)return{bytesValue:Uu(s.serializer,r._byteString)};if(r instanceof Ve){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.Wu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:lo(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Ho)return function(a,c){return{mapValue:{fields:{[Xc]:{stringValue:Yc},[ds]:{arrayValue:{values:a.toArray().map(d=>{if(typeof d!="number")throw c.Wu("VectorValues must only contain numeric values.");return oo(c.serializer,d)})}}}}}}(r,s);throw s.Wu(`Unsupported field value: ${xs(r)}`)}(n,e)}function $l(n,e){const t={};return $c(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):kt(n,(r,s)=>{const i=Tr(s,e.qu(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function Hl(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ue||n instanceof $o||n instanceof On||n instanceof Ve||n instanceof qo||n instanceof Ho)}function Go(n,e,t){if(!Hl(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=xs(t);throw r==="an object"?e.Wu(n+" a custom object"):e.Wu(n+" "+r)}}function Ko(n,e,t){if((e=X(e))instanceof js)return e._internalPath;if(typeof e=="string")return Qo(n,e);throw $s("Field path arguments must be of type string or ",n,!1,void 0,t)}const jy=new RegExp("[~\\*/\\[\\]]");function Qo(n,e,t){if(e.search(jy)>=0)throw $s(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new js(...e.split("."))._internalPath}catch{throw $s(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function $s(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new O(P.INVALID_ARGUMENT,c+n+l)}function zl(n,e){return n.some(t=>t.isEqual(e))}/**
|
|
1863
1987
|
* @license
|
|
1864
1988
|
* Copyright 2020 Google LLC
|
|
1865
1989
|
*
|
|
@@ -1874,7 +1998,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1874
1998
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1875
1999
|
* See the License for the specific language governing permissions and
|
|
1876
2000
|
* limitations under the License.
|
|
1877
|
-
*/class
|
|
2001
|
+
*/class Xo{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ve(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new qy(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(Hs("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class qy extends Xo{data(){return super.data()}}function Hs(n,e){return typeof e=="string"?Qo(n,e):e instanceof js?e._internalPath:e._delegate._internalPath}/**
|
|
1878
2002
|
* @license
|
|
1879
2003
|
* Copyright 2020 Google LLC
|
|
1880
2004
|
*
|
|
@@ -1889,7 +2013,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1889
2013
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1890
2014
|
* See the License for the specific language governing permissions and
|
|
1891
2015
|
* limitations under the License.
|
|
1892
|
-
*/function
|
|
2016
|
+
*/function Wl(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new O(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Yo{}class zs extends Yo{}function Gl(n,e,...t){let r=[];e instanceof Yo&&r.push(e),r=r.concat(t),function(i){const a=i.filter(l=>l instanceof Vn).length,c=i.filter(l=>l instanceof wr).length;if(a>1||a>0&&c>0)throw new O(P.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const s of r)n=s._apply(n);return n}class wr extends zs{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new wr(e,t,r)}_apply(e){const t=this._parse(e);return Jl(e._query,t),new st(e.firestore,e.converter,io(e._query,t))}_parse(e){const t=Wo(e.firestore);return function(i,a,c,l,d,f,m){let v;if(d.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new O(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){Yl(m,f);const S=[];for(const N of m)S.push(Xl(l,i,N));v={arrayValue:{values:S}}}else v=Xl(l,i,m)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||Yl(m,f),v=ql(c,a,m,f==="in"||f==="not-in");return ae.create(d,f,v)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function Kl(n,e,t){const r=e,s=Hs("where",n);return wr._create(s,r,t)}class Vn extends Yo{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Vn(e,t)}_parse(e){const t=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return t.length===1?t[0]:We.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let a=s;const c=i.getFlattenedFilters();for(const l of c)Jl(a,l),a=io(a,l)}(e._query,t),new st(e.firestore,e.converter,io(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function $y(...n){return n.forEach(e=>Zl("or",e)),Vn._create("or",n)}function Hy(...n){return n.forEach(e=>Zl("and",e)),Vn._create("and",n)}class Jo extends zs{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Jo(e,t)}_apply(e){const t=function(s,i,a){if(s.startAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new lr(i,a)}(e._query,this._field,this._direction);return new st(e.firestore,e.converter,function(s,i){const a=s.explicitOrderBy.concat([i]);return new Jt(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function zy(n,e="asc"){const t=e,r=Hs("orderBy",n);return Jo._create(r,t)}class Zo extends zs{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new Zo(e,t,r)}_apply(e){return new st(e.firestore,e.converter,_s(e._query,this._limit,this._limitType))}}function Ql(n){return ky("limit",n),Zo._create("limit",n,"F")}class ea extends zs{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new ea(e,t,r)}_apply(e){const t=Gy(e,this.type,this._docOrFields,this._inclusive);return new st(e.firestore,e.converter,function(s,i){return new Jt(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,t))}}function Wy(...n){return ea._create("startAfter",n,!1)}function Gy(n,e,t,r){if(t[0]=X(t[0]),t[0]instanceof Xo)return function(i,a,c,l,d){if(!l)throw new O(P.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${c}().`);const f=[];for(const m of Rn(i))if(m.field.isKeyField())f.push(ps(a,l.key));else{const v=l.data.field(m.field);if(cs(v))throw new O(P.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+m.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(v===null){const R=m.field.canonicalString();throw new O(P.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${R}' (used as the orderBy) does not exist.`)}f.push(v)}return new An(f,d)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=Wo(n.firestore);return function(a,c,l,d,f,m){const v=a.explicitOrderBy;if(f.length>v.length)throw new O(P.INVALID_ARGUMENT,`Too many arguments provided to ${d}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const R=[];for(let S=0;S<f.length;S++){const N=f[S];if(v[S].field.isKeyField()){if(typeof N!="string")throw new O(P.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${d}(), but got a ${typeof N}`);if(!so(a)&&N.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${d}() must be a plain document ID, but '${N}' contains a slash.`);const k=a.path.child(ee.fromString(N));if(!L.isDocumentKey(k))throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${d}() must result in a valid document path, but '${k}' is not because it contains an odd number of segments.`);const U=new L(k);R.push(ps(c,U))}else{const k=ql(l,d,N);R.push(k)}}return new An(R,m)}(n._query,n.firestore._databaseId,s,e,t,r)}}function Xl(n,e,t){if(typeof(t=X(t))=="string"){if(t==="")throw new O(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!so(e)&&t.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(ee.fromString(t));if(!L.isDocumentKey(r))throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return ps(n,new L(r))}if(t instanceof Ve)return ps(n,t._key);throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${xs(t)}.`)}function Yl(n,e){if(!Array.isArray(n)||n.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Jl(n,e){const t=function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.op;return null}(n.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function Zl(n,e){if(!(e instanceof wr||e instanceof Vn))throw new O(P.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class Ky{convertValue(e,t="none"){switch(Ot(e)){case 0:return null;case 1:return e.booleanValue;case 2:return oe(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Dt(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw F()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return kt(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertVectorValue(e){var t,r,s;const i=(s=(r=(t=e.fields)===null||t===void 0?void 0:t[ds].arrayValue)===null||r===void 0?void 0:r.values)===null||s===void 0?void 0:s.map(a=>oe(a.doubleValue));return new Ho(i)}convertGeoPoint(e){return new $o(oe(e.latitude),oe(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=us(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(or(e));default:return null}}convertTimestamp(e){const t=Nt(e);return new ue(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=ee.fromString(e);Y(zu(r));const s=new ar(r.get(1),r.get(3)),i=new L(r.popFirst(5));return s.isEqual(t)||ft(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}/**
|
|
1893
2017
|
* @license
|
|
1894
2018
|
* Copyright 2020 Google LLC
|
|
1895
2019
|
*
|
|
@@ -1904,7 +2028,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1904
2028
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1905
2029
|
* See the License for the specific language governing permissions and
|
|
1906
2030
|
* limitations under the License.
|
|
1907
|
-
*/function
|
|
2031
|
+
*/function Qy(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}function Xy(){return new Oy("count")}/**
|
|
1908
2032
|
* @license
|
|
1909
2033
|
* Copyright 2020 Google LLC
|
|
1910
2034
|
*
|
|
@@ -1919,7 +2043,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1919
2043
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1920
2044
|
* See the License for the specific language governing permissions and
|
|
1921
2045
|
* limitations under the License.
|
|
1922
|
-
*/class
|
|
2046
|
+
*/class Ir{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class eh extends Xo{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Ws(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const r=this._document.data.field(Hs("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class Ws extends eh{data(e={}){return super.data(e)}}class th{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new Ir(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new Ws(this._firestore,this._userDataWriter,r.key,r,new Ir(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new O(P.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let a=0;return s._snapshot.docChanges.map(c=>{const l=new Ws(s._firestore,s._userDataWriter,c.doc.key,c.doc,new Ir(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(c=>i||c.type!==3).map(c=>{const l=new Ws(s._firestore,s._userDataWriter,c.doc.key,c.doc,new Ir(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,f=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:Yy(c.type),doc:l,oldIndex:d,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function Yy(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return F()}}/**
|
|
1923
2047
|
* @license
|
|
1924
2048
|
* Copyright 2020 Google LLC
|
|
1925
2049
|
*
|
|
@@ -1934,7 +2058,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1934
2058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1935
2059
|
* See the License for the specific language governing permissions and
|
|
1936
2060
|
* limitations under the License.
|
|
1937
|
-
*/function
|
|
2061
|
+
*/function Jy(n){n=Ge(n,Ve);const e=Ge(n.firestore,Bt);return by(Dn(e),n._key).then(t=>sh(e,n,t))}class Gs extends Ky{constructor(e){super(),this.firestore=e}convertBytes(e){return new On(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ve(this.firestore,null,t)}}function Zy(n){n=Ge(n,st);const e=Ge(n.firestore,Bt),t=Dn(e),r=new Gs(e);return Wl(n._query),Py(t,n._query).then(s=>new th(e,r,n,s))}function ev(n){return rh(Ge(n.firestore,Bt),[new Rs(n._key,$e.none())])}function nh(n,...e){var t,r,s;n=X(n);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||Fl(e[a])||(i=e[a],a++);const c={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(Fl(e[a])){const m=e[a];e[a]=(t=m.next)===null||t===void 0?void 0:t.bind(m),e[a+1]=(r=m.error)===null||r===void 0?void 0:r.bind(m),e[a+2]=(s=m.complete)===null||s===void 0?void 0:s.bind(m)}let l,d,f;if(n instanceof Ve)d=Ge(n.firestore,Bt),f=gs(n._key.path),l={next:m=>{e[a]&&e[a](sh(d,n,m))},error:e[a+1],complete:e[a+2]};else{const m=Ge(n,st);d=Ge(m.firestore,Bt),f=m._query;const v=new Gs(d);l={next:R=>{e[a]&&e[a](new th(d,v,m,R))},error:e[a+1],complete:e[a+2]},Wl(n._query)}return function(v,R,S,N){const k=new Fo(N),U=new Vo(R,k,S);return v.asyncQueue.enqueueAndForget(async()=>ko(await Us(v),U)),()=>{k.su(),v.asyncQueue.enqueueAndForget(async()=>No(await Us(v),U))}}(Dn(d),f,c,l)}function rh(n,e){return function(r,s){const i=new Ze;return r.asyncQueue.enqueueAndForget(async()=>fy(await Ay(r),s,i)),i.promise}(Dn(n),e)}function sh(n,e,t){const r=t.docs.get(e._key),s=new Gs(n);return new eh(n,s,e._key,r,new Ir(t.hasPendingWrites,t.fromCache),e.converter)}/**
|
|
1938
2062
|
* @license
|
|
1939
2063
|
* Copyright 2022 Google LLC
|
|
1940
2064
|
*
|
|
@@ -1949,7 +2073,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1949
2073
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1950
2074
|
* See the License for the specific language governing permissions and
|
|
1951
2075
|
* limitations under the License.
|
|
1952
|
-
*/function
|
|
2076
|
+
*/function tv(n){return nv(n,{count:Xy()})}function nv(n,e){const t=Ge(n.firestore,Bt),r=Dn(t),s=Xm(e,(i,a)=>new Ng(a,i.aggregateType,i._internalFieldPath));return Sy(r,n._query,s).then(i=>function(c,l,d){const f=new Gs(c);return new Vy(l,f,d)}(t,n,i))}/**
|
|
1953
2077
|
* @license
|
|
1954
2078
|
* Copyright 2020 Google LLC
|
|
1955
2079
|
*
|
|
@@ -1964,7 +2088,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1964
2088
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1965
2089
|
* See the License for the specific language governing permissions and
|
|
1966
2090
|
* limitations under the License.
|
|
1967
|
-
*/class
|
|
2091
|
+
*/class rv{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Wo(e)}set(e,t,r){this._verifyNotCommitted();const s=ta(e,this._firestore),i=Qy(s.converter,t,r),a=xy(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(a.toMutation(s._key,$e.none())),this}update(e,t,r,...s){this._verifyNotCommitted();const i=ta(e,this._firestore);let a;return a=typeof(t=X(t))=="string"||t instanceof js?By(this._dataReader,"WriteBatch.update",i._key,t,r,s):Fy(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(a.toMutation(i._key,$e.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=ta(e,this._firestore);return this._mutations=this._mutations.concat(new Rs(t._key,$e.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new O(P.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function ta(n,e){if((n=X(n)).firestore!==e)throw new O(P.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
|
|
1968
2092
|
* @license
|
|
1969
2093
|
* Copyright 2020 Google LLC
|
|
1970
2094
|
*
|
|
@@ -1979,13 +2103,13 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1979
2103
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1980
2104
|
* See the License for the specific language governing permissions and
|
|
1981
2105
|
* limitations under the License.
|
|
1982
|
-
*/function
|
|
2106
|
+
*/function sv(n){return Dn(n=Ge(n,Bt)),new rv(n,e=>rh(n,e))}(function(e,t=!0){(function(s){gn=s})(Xt),bt(new ht("firestore",(r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new Bt(new Lm(r.getProvider("auth-internal")),new xm(a,r.getProvider("app-check-internal")),function(d,f){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new O(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ar(d.options.projectId,f)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),c._setSettings(i),c},"PUBLIC").setMultipleInstances(!0)),qe(Dc,Oc,e),qe(Dc,Oc,"esm2017")})();class ih{constructor(){this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}notify(e){this.subscribers.forEach(t=>t(e))}get subscribersCount(){return this.subscribers.size}}const ye=[];for(let n=0;n<256;++n)ye.push((n+256).toString(16).slice(1));function iv(n,e=0){return(ye[n[e+0]]+ye[n[e+1]]+ye[n[e+2]]+ye[n[e+3]]+"-"+ye[n[e+4]]+ye[n[e+5]]+"-"+ye[n[e+6]]+ye[n[e+7]]+"-"+ye[n[e+8]]+ye[n[e+9]]+"-"+ye[n[e+10]]+ye[n[e+11]]+ye[n[e+12]]+ye[n[e+13]]+ye[n[e+14]]+ye[n[e+15]]).toLowerCase()}let na;const ov=new Uint8Array(16);function av(){if(!na){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");na=crypto.getRandomValues.bind(crypto)}return na(ov)}const cv=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oh={randomUUID:cv};function uv(n,e,t){var r;if(oh.randomUUID&&!n)return oh.randomUUID();n=n||{};const s=n.random??((r=n.rng)==null?void 0:r.call(n))??av();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,iv(s)}var lv=Object.defineProperty,hv=(n,e,t,r)=>{for(var s=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=a(e,t,s)||s);return s&&lv(e,t,s),s},fe;const ah=(fe=class{static registerFactory(n,e,t){this._factoryMap[n]={factory:e,annotation:t}}static classFactory(n){if(!n)throw new Error("You should provide a class name.");if(!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].factory}static registeredClasses(){return Object.keys(this._factoryMap)}static classesExtending(n){return Object.entries(this._factoryMap).filter(([,e])=>new e.factory instanceof n).map(([e])=>e)}static annotations(n){if(n instanceof fe?n=n.className:typeof n=="string"||(n=new n().className),!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].annotation}constructor(n=uv()){this._id=n}get className(){return this.__className}setId(n){this._id=n}get id(){return this._id}afterDeserialize(){}beforeSerialize(){}getPersistentProperties(){return this._persistentProperties?this._persistentProperties.map(n=>({...n,name:n.name.slice(1)})):[]}getPropInfo(n){const e=this.getPersistentProperties().find(t=>t.name===n);if(!e)throw new Error(`Property "${n}" has not been registered.`);return e}isRequired(n){return this.getPropInfo(n).validator!=null}isPropValueValid(n){const e=this.getPropInfo(n);return e.validator?e.validator(this[e.name],e,this):!0}clone(n){const e=n.toObject();return delete e.id,this.fromObject(e)}fromObject(n){return this.fromObj(n),this.afterDeserialize(),this}fromObj(n){return this._persistentProperties?(this._persistentProperties.forEach(e=>{const t=this.removeUnderscore(e),r=n[t];r!=null&&(this[e.name]=this.fromDeepObject(r))}),this):this}toObject(){const n={},e=this.toObj(n);return this.pushDocument(n,this.className,e),{...e,__rootCollections:n}}toObj(n){if(!this._persistentProperties)return{};this.beforeSerialize();const e={};if(!this.className)throw new Error("You should register this class prior to streaming it.");return this._persistentProperties.forEach(t=>{const r=this[t.name],s=this.removeUnderscore(t);r!=null&&(t.isReference?e[s]=this.toReferenceObj(t,n):e[s]=this.toDeepObj(r,n),t.searchableArray&&(e[fe.searchableArrayNameFor(s)]=r.map(i=>i.id)))}),e.__className=this.className,e}static searchableArrayNameFor(n){return`__${n}_searchable`}fromDeepObject(n){if(n==null)return n;if(Array.isArray(n))return n.map(e=>this.fromDeepObject(e));if(n.__documentReference){const e=n,t=fe.createInstance(e);return t.__documentReference=n.__documentReference,t}if(n.__className)return fe.createInstance(n);if(typeof n=="object"){const e={};return Object.entries(n).forEach(([t,r])=>e[t]=this.fromDeepObject(r)),e}return n}toDeepObj(n,e){if(n!=null){if(Array.isArray(n))return n.map(t=>this.toDeepObj(t,e));if(n.__documentReference)return n;if(n instanceof fe)return n.toObj(e);if(typeof n=="object"){const t={};return Object.entries(n).forEach(([r,s])=>t[r]=this.toDeepObj(s,e)),t}return n}}static collectionPath(n,e){let t;return typeof e.storeInCollection=="function"?t=e.storeInCollection(n,e):t=e.storeInCollection??n.className,t}toReferenceObj(n,e){var t;const r=this[n.name];return Array.isArray(r)?r.map(s=>{var i;return n.isPureReference||this.pushDocument(e,fe.collectionPath(s,n),s),this.buildRefObject(s,fe.collectionPath(s,n),(i=n.cachedPropsConfig)==null?void 0:i.cachedProps)}):(n.isPureReference||this.pushDocument(e,fe.collectionPath(r,n),r),this.buildRefObject(r,fe.collectionPath(r,n),(t=n.cachedPropsConfig)==null?void 0:t.cachedProps))}buildRefObject(n,e,t){const r=t==null?void 0:t.reduce((s,i)=>(n[i]!==void 0&&(s[i]=n[i]),s),{});return{id:n.id,__className:n.className||n.__className,__documentReference:{storedInCollection:e},...r}}pushDocument(n,e,t){if("__documentReference"in t&&t.__documentReference)return;n[e]||(n[e]=[]);const r=this.toDeepObj(t,n);n[e].push(r)}removeUnderscore(n){return n.name.slice(1)}static createReference(n){const e=fe.createInstance(n);return e.__documentReference=n.__documentReference||{storedInCollection:e.className},e}static createInstance(n){if(typeof n=="string")return new(fe.classFactory(n));try{return new(fe.classFactory(n.__className))().fromObject(n)}catch(e){const t=Object.entries(n).filter(([r,s])=>s!=null&&typeof s!="function").map(([r,s])=>`${r}: ${s}`).join(`,
|
|
1983
2107
|
`);throw new Error(`${e}
|
|
1984
2108
|
-----> Class name not found in object:
|
|
1985
2109
|
{
|
|
1986
2110
|
${t}
|
|
1987
2111
|
}
|
|
1988
|
-
`)}}static propInfo(n,e){return fe.createInstance(n).getPropInfo(e)}},fe._factoryMap={},fe);Kv([An],ed.prototype,"_id",2);let me=ed;function An(n,e){return Qv()(n,e)}function Qv(n){return function(e,t){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===t);r?Object.assign(r,n):e._persistentProperties.push({name:t,...n})}}function Yv(n,e){return t=>{me.registerFactory(n,t,e),t.prototype.__className=n}}const td=class Hf{constructor(e,t,r){if(r){if(!(t instanceof me))throw new Error(Hf.error.persistentNeedForSubCollection);this.collectionName=`${t.className}/${t.id}/${r}`}else this.collectionName=t instanceof me?t.className:t;this._stream=e}findById(e,t){return new Promise((r,s)=>{this._stream.findById(e,this.collectionName).then(i=>{i?(t?t.fromObject(i):t=me.createInstance(i),r(t)):r(void 0)}).catch(i=>s(i))})}save(e){const t=e.toObject();return this.collectionName!==t.__className&&(t.__rootCollections[this.collectionName]=t.__rootCollections[t.__className],delete t.__rootCollections[t.__className]),new Promise((r,s)=>{this._stream.save(t.__rootCollections).then(()=>r()).catch(i=>s(i))})}delete(e){return new Promise((t,r)=>{this._stream.delete(e,this.collectionName).then(()=>t()).catch(s=>r(s))})}find(){return new Xv(this)}query(e={},t){if(t){const r=t instanceof me?t.className:t;e.operations||(e.operations=[]),e.operations.push({property:"__className",operator:"==",value:r})}return this.mapToInstance(()=>this._stream.find(this.preprocessQueryObject(e),this.collectionName))}count(e){return this._stream.count(e,this.collectionName)}next(e){return this.mapToInstance(()=>this._stream.next(e))}mapToInstance(e){return new Promise((t,r)=>{e().then(s=>t(s.map(i=>me.createInstance(i)))).catch(s=>r(s))})}preprocessQueryObject(e){var t;if(Object.values(e).length===0)return e;const r=((t=e.operations)==null?void 0:t.map(s=>{const i=s.value[0]??s.value;return Rn.isArrayOperator(s.operator)&&i instanceof me?{property:me.searchableArrayNameFor(s.property),operator:s.operator,value:Array.isArray(s.value)?s.value.map(o=>o.id):i.id,aggregate:s.aggregate}:{property:s.property,operator:s.operator,value:s.value instanceof me?{id:s.value.id}:s.value,aggregate:s.aggregate}}))??[];return{...e,operations:r}}};td.error={persistentNeedForSubCollection:"The document parameter for a sub-collection should be a Persistent instace",invalidQueryOrder:"Cannot add where calls after or calls"};let ni=td;class Xv{constructor(e){this.queryObject={operations:[]},this.model=e}where(e,t,r,s){var i,o,a;if((o=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&o.aggregate&&!s)throw new Error(ni.error.invalidQueryOrder);return(a=this.queryObject.operations)==null||a.push({property:e,operator:t,value:r,aggregate:s}),this}whereDeepProp(e,t,r,s){var i,o,a;if((o=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&o.aggregate&&!s)throw new Error(ni.error.invalidQueryOrder);const c=e.split(".");let u={},l=c.length>1?u:r;return c.slice(1).forEach((h,d)=>{u[h]=d<c.length-2?{}:r,u=u[h]}),(a=this.queryObject.operations)==null||a.push({property:c[0],operator:t,value:l,aggregate:s}),this}and(e,t,r){return this.where(e,t,r)}andDeepProp(e,t,r){return this.whereDeepProp(e,t,r)}or(e,t,r){return this.where(e,t,r,!0)}orDeepProp(e,t,r){return this.whereDeepProp(e,t,r,!0)}instanceOf(e){var t;const r=e instanceof me?e.className:e;return(t=this.queryObject.operations)==null||t.push({property:"__className",operator:"==",value:r}),this}get(e){return e&&(this.queryObject.limit=e),this.model.query(this.queryObject)}limit(e){return this.queryObject.limit=e,this}orderBy(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}orderByDeepProp(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}count(){return this.model.count(this.queryObject)}}const nd=class Mn{constructor(){}static useDataSource(e){this._dataSource=e}static get dataSource(){return Mn._dataSource}static getModel(e){if(!Mn._dataSource)throw new Error(this.error.shouldBeRegistered);return new ni(Mn._dataSource,e)}static getModelForSubCollection(e,t){if(!Mn._dataSource)throw new Error(this.error.shouldBeRegistered);return new ni(Mn._dataSource,e,t)}static async populate(e){if(!e)return;const t=async r=>{const s=r;if(!s.__documentReference)return r;const i=await this.getModel(s.__documentReference.storedInCollection).findById(s.id,r);return i&&(i.__documentReference=void 0),i};return Array.isArray(e)?(await Promise.all(e.map(r=>t(r)))).filter(r=>r):t(e)}static isPopulated(e){return Array.isArray(e)?e.reduce((t,r)=>t&&r.__documentReference===void 0,!0):e.__documentReference===void 0}};nd.error={shouldBeRegistered:"You should register a data source before using the data Store."};let Jv=nd;class Rn{installReferencePersistentPropsUpdaters(e,t=!0){this.onUpdate=e;const r=[],s=Rn.getSystemRegisteredReferencesWithStoredProps();return Object.entries(s).forEach(([i,o])=>{o.forEach(a=>{const c=this.documentChangeListerner(a,u=>this.onDocumentChange(u,a,i));if(c)r.push(c);else if(t)throw new Error("The method documentChangeListerner has not been implemented in the concrete data source")})}),r}documentChangeListerner(e,t){}static toPropertyPathOperations(e){return e?e.map(t=>{if(Rn.isArrayOperator(t.operator)&&t.value[0]instanceof me)return{property:me.searchableArrayNameFor(t.property),operator:t.operator,value:t.value.map(i=>i.id),aggregate:t.aggregate};const[r,s]=this.toPropertyPathValue(t.value);return{property:`${String(t.property)}${r?"."+r:""}`,operator:t.operator,value:s,aggregate:t.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const t=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[t]);return[`${t}${r?"."+r:""}`,s]}else return[void 0,e]}async onDocumentChange(e,t,r){if(!e.before||!t.forcedPersistentProps)return;const s=Jv.getModel(r);let i=s.find();t.forcedPersistentProps.forEach(a=>{const c=e.before[a],u=e.after[a];c!==u&&(i=i.orDeepProp(`${t.name}.${a}`,"==",c))});const o=await i.get();return Promise.all([o.map(async a=>{var c;(c=t.forcedPersistentProps)==null||c.forEach(async u=>{var l;const h=e.before[u],d=e.after[u];h!==d&&(a[`_${t.name}`][`_${u}`]=d,await s.save(a),(l=this.onUpdate)==null||l.call(this,a))})})])}static getSystemRegisteredReferencesWithStoredProps(){return me.registeredClasses().reduce((e,t)=>{const r=me.createInstance(t).getPersistentProperties().filter(s=>s.forcedPersistentProps);return r.length>0&&(e[t]=r),e},{})}}const rd=class xn{static registerCloudStorage(e,t){xn._cloudStorageFactoryMap[e]=t}static createInstance(e){const t=xn._cloudStorageFactoryMap[e];if(!t)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return t()}get className(){return this.__className}static useCloudStorage(e){xn._defaultCloudStorage=e}static get defaultCloudStorage(){if(!xn._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return xn._defaultCloudStorage}};rd._cloudStorageFactoryMap={};let Pn=rd;function sd(n,e){return Pn.registerCloudStorage(n,e),t=>{t.prototype.__className=n}}var Zv=Object.defineProperty,eE=Object.getOwnPropertyDescriptor,tE=(n,e,t,r)=>{for(var s=r>1?void 0:r?eE(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&Zv(e,t,s),s};let Ca=class extends Pn{constructor(n=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=n}simulateDelay(n){return this._simulateDelay=n,this}resolveWithDelay(n){if(this._simulateDelay<=0)return Promise.resolve(n);const e=new Promise(t=>{setTimeout(()=>t(n),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(t=>t===e)),e}save(n,e){const t=n;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[n]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:t;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:n=>this._onProgress=n}}getUrl(n){return Promise.resolve(this._pathToMockFiles+n)}delete(n){return delete this.mockFileSystem[n],this.resolveWithDelay()}};Ca=tE([sd("MockCloudStorage",()=>new Ca)],Ca);var nE=Object.defineProperty,rE=Object.getOwnPropertyDescriptor,Sn=(n,e,t,r)=>{for(var s=r>1?void 0:r?rE(e,t):e,i=n.length-1,o;i>=0;i--)(o=n[i])&&(s=(r?o(e,t,s):o(s))||s);return r&&s&&nE(e,t,s),s};let Wt=class extends me{constructor(){super(...arguments),this._onChange=new Jh}async save({data:n,fileName:e,progress:t,cloudStorageProvider:r}={}){const s=n||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||Pn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,t),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(n){this._provider=n,this._cloudStorageProviderName=n.className}get provider(){if(!this._provider)try{this._provider=Pn.createInstance(this._cloudStorageProviderName)}catch{this._provider=Pn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(n){return this._pendingData=n,this._originalFileName=n instanceof File?n.name:void 0,this._mimeType=n instanceof Blob?n.type:void 0,this._onChange.notify({event:1,pendingData:n,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(n){return this._onChange.subscribe(n)}};Sn([An],Wt.prototype,"_reference",2),Sn([An],Wt.prototype,"_url",2),Sn([An],Wt.prototype,"_cloudStorageProviderName",2),Sn([An],Wt.prototype,"_originalFileName",2),Sn([An],Wt.prototype,"_mimeType",2),Wt=Sn([Yv("StoredFile")],Wt);class id{}const od=class Ee extends id{constructor(){if(super(),this._onAuthStateChange=new Jh,!Ee._authService)throw new Error(Ee.error.shouldBeRegistered);Ee._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){Ee._authService!=e&&(Ee._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return Ee._authService.signUp(e)}login(e){return Ee._authService.login(e)}logout(){return Ee._authService.logout()}resetEmailPassword(e){return Ee._authService.resetEmailPassword(e)}resendVerificationEmail(e,t,r){return Ee._authService.resendVerificationEmail(e,t,r)}refreshToken(){return Ee._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return Ee._authService.linkAdditionalProvider(e)}unlinkProvider(e){return Ee._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};od.error={shouldBeRegistered:"You should register an auth service before using Auth."},od._instance=void 0;function ri(n){return n?n.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var sE="firebase",iE="10.11.0";/**
|
|
2112
|
+
`)}}static propInfo(n,e){return fe.createInstance(n).getPropInfo(e)}static getSystemRegisteredReferencesWithCachedProps(){return fe.registeredClasses().reduce((n,e)=>{const t=fe.createInstance(e).getPersistentProperties().filter(r=>{var s;return(s=r.cachedPropsConfig)==null?void 0:s.cachedProps});return t.length>0&&(n[e]=t),n},{})}},fe._factoryMap={},fe);hv([Ln],ah.prototype,"_id");let pe=ah;function Ln(n,e){return dv()(n,e)}function dv(n){return function(e,t){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===t);r?Object.assign(r,n):e._persistentProperties.push({name:t,...n})}}function fv(n,e){return t=>{pe.registerFactory(n,t,e),t.prototype.__className=n}}const ch=class ep{constructor(e,t,r){if(r){if(!(t instanceof pe))throw new Error(ep.error.persistentNeedForSubCollection);this.collectionName=`${t.className}/${t.id}/${r}`}else this.collectionName=t instanceof pe?t.className:t;this._stream=e}findById(e,t){return new Promise((r,s)=>{this._stream.findById(e,this.collectionName).then(i=>{i?(t?t.fromObject(i):t=pe.createInstance(i),r(t)):r(void 0)}).catch(i=>s(i))})}save(e){const t=e.toObject();return this.collectionName!==t.__className&&(t.__rootCollections[this.collectionName]=t.__rootCollections[t.__className],delete t.__rootCollections[t.__className]),new Promise((r,s)=>{this._stream.save(t.__rootCollections).then(()=>r()).catch(i=>s(i))})}delete(e){return new Promise((t,r)=>{this._stream.delete(e,this.collectionName).then(()=>t()).catch(s=>r(s))})}find(){return new pv(this)}query(e={},t){if(t){const r=t instanceof pe?t.className:t;e.operations||(e.operations=[]),e.operations.push({property:"__className",operator:"==",value:r})}return this.mapToInstance(()=>this._stream.find(this.preprocessQueryObject(e),this.collectionName))}count(e){return this._stream.count(e,this.collectionName)}next(e){return this.mapToInstance(()=>this._stream.next(e))}onDocumentChange(e,t){return this._stream.onDocumentChange(this.collectionName,e,r=>t(this.toPersistentChangeObject(r)))}onCollectionChange(e,t){return this._stream.onCollectionChange(e.getQueryObject(),this.collectionName,r=>t(this.toPersistentChangeObject(r)))}toPersistentChangeObject(e){return{...e,before:e.before&&pe.createInstance(e.before),after:e.after&&pe.createInstance(e.after)}}mapToInstance(e){return new Promise((t,r)=>{e().then(s=>t(s.map(i=>pe.createInstance(i)))).catch(s=>r(s))})}preprocessQueryObject(e){var t;if(Object.values(e).length===0)return e;const r=((t=e.operations)==null?void 0:t.map(s=>{const i=s.value[0]??s.value;return rn.isArrayOperator(s.operator)&&i instanceof pe?{property:pe.searchableArrayNameFor(s.property),operator:s.operator,value:Array.isArray(s.value)?s.value.map(a=>a.id):i.id,aggregate:s.aggregate}:{property:s.property,operator:s.operator,value:s.value instanceof pe?{id:s.value.id}:s.value,aggregate:s.aggregate}}))??[];return{...e,operations:r}}};ch.error={persistentNeedForSubCollection:"The document parameter for a sub-collection should be a Persistent instace",invalidQueryOrder:"Cannot add where calls after or calls"};let Ks=ch;class pv{constructor(e){this.queryObject={operations:[]},this.model=e}where(e,t,r,s){var i,a,c;if((a=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&a.aggregate&&!s)throw new Error(Ks.error.invalidQueryOrder);return(c=this.queryObject.operations)==null||c.push({property:e,operator:t,value:r,aggregate:s}),this}whereDeepProp(e,t,r,s){var i,a,c;if((a=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&a.aggregate&&!s)throw new Error(Ks.error.invalidQueryOrder);const l=e.split(".");let d={},f=l.length>1?d:r;return l.slice(1).forEach((m,v)=>{d[m]=v<l.length-2?{}:r,d=d[m]}),(c=this.queryObject.operations)==null||c.push({property:l[0],operator:t,value:f,aggregate:s}),this}and(e,t,r){return this.where(e,t,r)}andDeepProp(e,t,r){return this.whereDeepProp(e,t,r)}or(e,t,r){return this.where(e,t,r,!0)}orDeepProp(e,t,r){return this.whereDeepProp(e,t,r,!0)}instanceOf(e){var t;const r=e instanceof pe?e.className:e;return(t=this.queryObject.operations)==null||t.push({property:"__className",operator:"==",value:r}),this}get(e){return e&&(this.queryObject.limit=e),this.model.query(this.queryObject)}limit(e){return this.queryObject.limit=e,this}orderBy(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}orderByDeepProp(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}count(){return this.model.count(this.queryObject)}getQueryObject(){return this.queryObject}}const uh=class Xn{constructor(){}static useDataSource(e){this._dataSource=e}static get dataSource(){return Xn._dataSource}static getModel(e){if(!Xn._dataSource)throw new Error(this.error.shouldBeRegistered);return new Ks(Xn._dataSource,e)}static getModelForSubCollection(e,t){if(!Xn._dataSource)throw new Error(this.error.shouldBeRegistered);return new Ks(Xn._dataSource,e,t)}static async populate(e){if(!e)return;const t=async r=>{const s=r;if(!s.__documentReference)return r;const i=await this.getModel(s.__documentReference.storedInCollection).findById(s.id,r);return i&&(i.__documentReference=void 0),i};return Array.isArray(e)?(await Promise.all(e.map(r=>t(r)))).filter(r=>r):t(e)}static isPopulated(e){return Array.isArray(e)?e.reduce((t,r)=>t&&r.__documentReference===void 0,!0):e.__documentReference===void 0}};uh.error={shouldBeRegistered:"You should register a data source before using the data Store."};let mv=uh;class rn{installCachedPropsUpdaters(e={}){rn.onUpdate=e.onUpdate;const t=pe.getSystemRegisteredReferencesWithCachedProps(),r={};Object.entries(t).forEach(([i,a])=>{a.forEach(c=>{const l=pe.collectionPath(pe.createInstance(i),c);r[l]||(r[l]=[]),r[l].push({prop:c,collectionPropOwner:i})})});const s=[];return Object.entries(r).forEach(([i,a])=>{const c=this.subscribeToDocumentChangeListerner(i,l=>rn.onDocumentChange(l,a));if(c)s.push(c);else if(e.noThrowOnNonImplementedListener)throw new Error("The method documentChangeListerner has not been implemented in the concrete data source")}),s}subscribeToDocumentChangeListerner(e,t){}static toPropertyPathOperations(e){return e?e.map(t=>{if(rn.isArrayOperator(t.operator)&&t.value[0]instanceof pe)return{property:pe.searchableArrayNameFor(t.property),operator:t.operator,value:t.value.map(i=>i.id),aggregate:t.aggregate};const[r,s]=this.toPropertyPathValue(t.value);return{property:`${String(t.property)}${r?"."+r:""}`,operator:t.operator,value:s,aggregate:t.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const t=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[t]);return[`${t}${r?"."+r:""}`,s]}else return[void 0,e]}static async onDocumentChange(e,t){if(e.before)return t.map(async r=>{var s,i;const a=mv.getModel(r.collectionPropOwner);let c=a.find();(i=(s=r.prop.cachedPropsConfig)==null?void 0:s.cachedProps)==null||i.forEach(d=>{var f,m;const v=(f=e.before)==null?void 0:f[d],R=(m=e.after)==null?void 0:m[d];v!==R&&(c=c.orDeepProp(`${r.prop.name}.${d}`,"==",v))});const l=await c.get();return Promise.all([l.map(async d=>{var f,m;(m=(f=r.prop.cachedPropsConfig)==null?void 0:f.cachedProps)==null||m.forEach(async v=>{var R,S,N;const k=(R=e.before)==null?void 0:R[v],U=(S=e.after)==null?void 0:S[v];k!==U&&(d[`_${r.prop.name}`][`_${v}`]=U,await a.save(d),(N=this.onUpdate)==null||N.call(this,d,r.prop))})})])})}}const lh=class Yn{static registerCloudStorage(e,t){Yn._cloudStorageFactoryMap[e]=t}static createInstance(e){const t=Yn._cloudStorageFactoryMap[e];if(!t)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return t()}get className(){return this.__className}static useCloudStorage(e){Yn._defaultCloudStorage=e}static get defaultCloudStorage(){if(!Yn._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return Yn._defaultCloudStorage}};lh._cloudStorageFactoryMap={};let Mn=lh;function hh(n,e){return Mn.registerCloudStorage(n,e),t=>{t.prototype.__className=n}}var gv=(n,e,t,r)=>{for(var s=e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=a(s)||s);return s};let ra=class extends Mn{constructor(n=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=n}simulateDelay(n){return this._simulateDelay=n,this}resolveWithDelay(n){if(this._simulateDelay<=0)return Promise.resolve(n);const e=new Promise(t=>{setTimeout(()=>t(n),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(t=>t===e)),e}save(n,e){const t=n;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[n]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:t;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:n=>this._onProgress=n}}getUrl(n){return Promise.resolve(this._pathToMockFiles+n)}delete(n){return delete this.mockFileSystem[n],this.resolveWithDelay()}};ra=gv([hh("MockCloudStorage",()=>new ra)],ra);var _v=Object.defineProperty,yv=Object.getOwnPropertyDescriptor,Un=(n,e,t,r)=>{for(var s=r>1?void 0:r?yv(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=(r?a(e,t,s):a(s))||s);return r&&s&&_v(e,t,s),s};let sn=class extends pe{constructor(){super(...arguments),this._onChange=new ih}async save({data:n,fileName:e,progress:t,cloudStorageProvider:r}={}){const s=n||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||Mn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,t),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(n){this._provider=n,this._cloudStorageProviderName=n.className}get provider(){if(!this._provider)try{this._provider=Mn.createInstance(this._cloudStorageProviderName)}catch{this._provider=Mn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(n){return this._pendingData=n,this._originalFileName=n instanceof File?n.name:void 0,this._mimeType=n instanceof Blob?n.type:void 0,this._onChange.notify({event:1,pendingData:n,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(n){return this._onChange.subscribe(n)}};Un([Ln],sn.prototype,"_reference",2),Un([Ln],sn.prototype,"_url",2),Un([Ln],sn.prototype,"_cloudStorageProviderName",2),Un([Ln],sn.prototype,"_originalFileName",2),Un([Ln],sn.prototype,"_mimeType",2),sn=Un([fv("StoredFile")],sn);class dh{}const fh=class Ue extends dh{constructor(){if(super(),this._onAuthStateChange=new ih,!Ue._authService)throw new Error(Ue.error.shouldBeRegistered);Ue._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){Ue._authService!=e&&(Ue._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return Ue._authService.signUp(e)}login(e){return Ue._authService.login(e)}logout(){return Ue._authService.logout()}resetEmailPassword(e){return Ue._authService.resetEmailPassword(e)}resendVerificationEmail(e,t,r){return Ue._authService.resendVerificationEmail(e,t,r)}refreshToken(){return Ue._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return Ue._authService.linkAdditionalProvider(e)}unlinkProvider(e){return Ue._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};fh.error={shouldBeRegistered:"You should register an auth service before using Auth."},fh._instance=void 0;function Qs(n){return n?n.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var vv="firebase",Ev="11.3.1";/**
|
|
1989
2113
|
* @license
|
|
1990
2114
|
* Copyright 2020 Google LLC
|
|
1991
2115
|
*
|
|
@@ -2000,7 +2124,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2000
2124
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2001
2125
|
* See the License for the specific language governing permissions and
|
|
2002
2126
|
* limitations under the License.
|
|
2003
|
-
*/
|
|
2127
|
+
*/qe(vv,Ev,"app");function sa(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}typeof SuppressedError=="function"&&SuppressedError;function ph(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Tv=ph,mh=new Jn("auth","Firebase",ph());/**
|
|
2004
2128
|
* @license
|
|
2005
2129
|
* Copyright 2020 Google LLC
|
|
2006
2130
|
*
|
|
@@ -2015,7 +2139,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2015
2139
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2016
2140
|
* See the License for the specific language governing permissions and
|
|
2017
2141
|
* limitations under the License.
|
|
2018
|
-
*/const
|
|
2142
|
+
*/const Xs=new Ui("@firebase/auth");function wv(n,...e){Xs.logLevel<=z.WARN&&Xs.warn(`Auth (${Xt}): ${n}`,...e)}function Ys(n,...e){Xs.logLevel<=z.ERROR&&Xs.error(`Auth (${Xt}): ${n}`,...e)}/**
|
|
2019
2143
|
* @license
|
|
2020
2144
|
* Copyright 2020 Google LLC
|
|
2021
2145
|
*
|
|
@@ -2030,7 +2154,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2030
2154
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2031
2155
|
* See the License for the specific language governing permissions and
|
|
2032
2156
|
* limitations under the License.
|
|
2033
|
-
*/function
|
|
2157
|
+
*/function He(n,...e){throw oa(n,...e)}function Ke(n,...e){return oa(n,...e)}function ia(n,e,t){const r=Object.assign(Object.assign({},Tv()),{[e]:t});return new Jn("auth","Firebase",r).create(e,{appName:n.name})}function it(n){return ia(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function gh(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&He(n,"argument-error"),ia(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function oa(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return mh.create(n,...e)}function M(n,e,...t){if(!n)throw oa(e,...t)}function mt(n){const e="INTERNAL ASSERTION FAILED: "+n;throw Ys(e),new Error(e)}function gt(n,e){n||mt(e)}/**
|
|
2034
2158
|
* @license
|
|
2035
2159
|
* Copyright 2020 Google LLC
|
|
2036
2160
|
*
|
|
@@ -2045,7 +2169,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2045
2169
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2046
2170
|
* See the License for the specific language governing permissions and
|
|
2047
2171
|
* limitations under the License.
|
|
2048
|
-
*/function
|
|
2172
|
+
*/function aa(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Iv(){return _h()==="http:"||_h()==="https:"}function _h(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
|
|
2049
2173
|
* @license
|
|
2050
2174
|
* Copyright 2020 Google LLC
|
|
2051
2175
|
*
|
|
@@ -2060,7 +2184,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2060
2184
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2061
2185
|
* See the License for the specific language governing permissions and
|
|
2062
2186
|
* limitations under the License.
|
|
2063
|
-
*/function
|
|
2187
|
+
*/function Av(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Iv()||dp()||"connection"in navigator)?navigator.onLine:!0}function Rv(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
|
2064
2188
|
* @license
|
|
2065
2189
|
* Copyright 2020 Google LLC
|
|
2066
2190
|
*
|
|
@@ -2075,7 +2199,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2075
2199
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2076
2200
|
* See the License for the specific language governing permissions and
|
|
2077
2201
|
* limitations under the License.
|
|
2078
|
-
*/class
|
|
2202
|
+
*/class Ar{constructor(e,t){this.shortDelay=e,this.longDelay=t,gt(t>e,"Short delay should be less than long delay!"),this.isMobile=up()||fp()}get(){return Av()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
2079
2203
|
* @license
|
|
2080
2204
|
* Copyright 2020 Google LLC
|
|
2081
2205
|
*
|
|
@@ -2090,7 +2214,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2090
2214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2091
2215
|
* See the License for the specific language governing permissions and
|
|
2092
2216
|
* limitations under the License.
|
|
2093
|
-
*/function
|
|
2217
|
+
*/function ca(n,e){gt(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
|
2094
2218
|
* @license
|
|
2095
2219
|
* Copyright 2020 Google LLC
|
|
2096
2220
|
*
|
|
@@ -2105,7 +2229,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2105
2229
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2106
2230
|
* See the License for the specific language governing permissions and
|
|
2107
2231
|
* limitations under the License.
|
|
2108
|
-
*/class
|
|
2232
|
+
*/class yh{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;mt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;mt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;mt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
2109
2233
|
* @license
|
|
2110
2234
|
* Copyright 2020 Google LLC
|
|
2111
2235
|
*
|
|
@@ -2120,7 +2244,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2120
2244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2121
2245
|
* See the License for the specific language governing permissions and
|
|
2122
2246
|
* limitations under the License.
|
|
2123
|
-
*/const
|
|
2247
|
+
*/const bv={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
|
|
2124
2248
|
* @license
|
|
2125
2249
|
* Copyright 2020 Google LLC
|
|
2126
2250
|
*
|
|
@@ -2135,7 +2259,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2135
2259
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2136
2260
|
* See the License for the specific language governing permissions and
|
|
2137
2261
|
* limitations under the License.
|
|
2138
|
-
*/const
|
|
2262
|
+
*/const Pv=new Ar(3e4,6e4);function _t(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Qe(n,e,t,r,s={}){return vh(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=Zn(Object.assign({key:n.config.apiKey},a)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const d=Object.assign({method:e,headers:l},i);return hp()||(d.referrerPolicy="no-referrer"),yh.fetch()(Eh(n,n.config.apiHost,t,c),d)})}async function vh(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},bv),e);try{const s=new Cv(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw Js(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Js(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw Js(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw Js(n,"user-disabled",a);const f=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw ia(n,f,d);He(n,f)}}catch(s){if(s instanceof ze)throw s;He(n,"network-request-failed",{message:String(s)})}}async function Rr(n,e,t,r,s={}){const i=await Qe(n,e,t,r,s);return"mfaPendingCredential"in i&&He(n,"multi-factor-auth-required",{_serverResponse:i}),i}function Eh(n,e,t,r){const s=`${e}${t}?${r}`;return n.config.emulator?ca(n.config,s):`${n.config.apiScheme}://${s}`}function Sv(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Cv{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Ke(this.auth,"network-request-failed")),Pv.get())})}}function Js(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=Ke(n,e,r);return s.customData._tokenResponse=t,s}function Th(n){return n!==void 0&&n.enterprise!==void 0}class kv{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Sv(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Nv(n,e){return Qe(n,"GET","/v2/recaptchaConfig",_t(n,e))}/**
|
|
2139
2263
|
* @license
|
|
2140
2264
|
* Copyright 2020 Google LLC
|
|
2141
2265
|
*
|
|
@@ -2150,7 +2274,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2150
2274
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2151
2275
|
* See the License for the specific language governing permissions and
|
|
2152
2276
|
* limitations under the License.
|
|
2153
|
-
*/async function
|
|
2277
|
+
*/async function Dv(n,e){return Qe(n,"POST","/v1/accounts:delete",e)}async function Ov(n,e){return Qe(n,"POST","/v1/accounts:update",e)}async function wh(n,e){return Qe(n,"POST","/v1/accounts:lookup",e)}/**
|
|
2154
2278
|
* @license
|
|
2155
2279
|
* Copyright 2020 Google LLC
|
|
2156
2280
|
*
|
|
@@ -2165,7 +2289,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2165
2289
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2166
2290
|
* See the License for the specific language governing permissions and
|
|
2167
2291
|
* limitations under the License.
|
|
2168
|
-
*/function
|
|
2292
|
+
*/function br(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Vv(n,e=!1){const t=X(n),r=await t.getIdToken(e),s=la(r);M(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:br(ua(s.auth_time)),issuedAtTime:br(ua(s.iat)),expirationTime:br(ua(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function ua(n){return Number(n)*1e3}function la(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return Ys("JWT malformed, contained fewer than 3 sections"),null;try{const s=oc(t);return s?JSON.parse(s):(Ys("Failed to decode base64 JWT payload"),null)}catch(s){return Ys("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Ih(n){const e=la(n);return M(e,"internal-error"),M(typeof e.exp<"u","internal-error"),M(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
|
2169
2293
|
* @license
|
|
2170
2294
|
* Copyright 2020 Google LLC
|
|
2171
2295
|
*
|
|
@@ -2180,7 +2304,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2180
2304
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2181
2305
|
* See the License for the specific language governing permissions and
|
|
2182
2306
|
* limitations under the License.
|
|
2183
|
-
*/async function
|
|
2307
|
+
*/async function xn(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof ze&&Lv(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Lv({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
|
2184
2308
|
* @license
|
|
2185
2309
|
* Copyright 2020 Google LLC
|
|
2186
2310
|
*
|
|
@@ -2195,7 +2319,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2195
2319
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2196
2320
|
* See the License for the specific language governing permissions and
|
|
2197
2321
|
* limitations under the License.
|
|
2198
|
-
*/class
|
|
2322
|
+
*/class Mv{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const s=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,s)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
2199
2323
|
* @license
|
|
2200
2324
|
* Copyright 2020 Google LLC
|
|
2201
2325
|
*
|
|
@@ -2210,7 +2334,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2210
2334
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2211
2335
|
* See the License for the specific language governing permissions and
|
|
2212
2336
|
* limitations under the License.
|
|
2213
|
-
*/class
|
|
2337
|
+
*/class ha{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=br(this.lastLoginAt),this.creationTime=br(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
2214
2338
|
* @license
|
|
2215
2339
|
* Copyright 2019 Google LLC
|
|
2216
2340
|
*
|
|
@@ -2225,7 +2349,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2225
2349
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2226
2350
|
* See the License for the specific language governing permissions and
|
|
2227
2351
|
* limitations under the License.
|
|
2228
|
-
*/async function
|
|
2352
|
+
*/async function Pr(n){var e;const t=n.auth,r=await n.getIdToken(),s=await xn(n,wh(t,{idToken:r}));M(s==null?void 0:s.users.length,t,"internal-error");const i=s.users[0];n._notifyReloadListener(i);const a=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?Ah(i.providerUserInfo):[],c=xv(n.providerData,a),l=n.isAnonymous,d=!(n.email&&i.passwordHash)&&!(c!=null&&c.length),f=l?d:!1,m={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:c,metadata:new ha(i.createdAt,i.lastLoginAt),isAnonymous:f};Object.assign(n,m)}async function Uv(n){const e=X(n);await Pr(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function xv(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function Ah(n){return n.map(e=>{var{providerId:t}=e,r=sa(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
|
|
2229
2353
|
* @license
|
|
2230
2354
|
* Copyright 2020 Google LLC
|
|
2231
2355
|
*
|
|
@@ -2240,7 +2364,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2240
2364
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2241
2365
|
* See the License for the specific language governing permissions and
|
|
2242
2366
|
* limitations under the License.
|
|
2243
|
-
*/async function
|
|
2367
|
+
*/async function Fv(n,e){const t=await vh(n,{},async()=>{const r=Zn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=Eh(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",yh.fetch()(a,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Bv(n,e){return Qe(n,"POST","/v2/accounts:revokeToken",_t(n,e))}/**
|
|
2244
2368
|
* @license
|
|
2245
2369
|
* Copyright 2020 Google LLC
|
|
2246
2370
|
*
|
|
@@ -2255,7 +2379,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2255
2379
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2256
2380
|
* See the License for the specific language governing permissions and
|
|
2257
2381
|
* limitations under the License.
|
|
2258
|
-
*/class
|
|
2382
|
+
*/class Fn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){M(e.idToken,"internal-error"),M(typeof e.idToken<"u","internal-error"),M(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Ih(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){M(e.length!==0,"internal-error");const t=Ih(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(M(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await Fv(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,a=new Fn;return r&&(M(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(M(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(M(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Fn,this.toJSON())}_performRefresh(){return mt("not implemented")}}/**
|
|
2259
2383
|
* @license
|
|
2260
2384
|
* Copyright 2020 Google LLC
|
|
2261
2385
|
*
|
|
@@ -2270,7 +2394,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2270
2394
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2271
2395
|
* See the License for the specific language governing permissions and
|
|
2272
2396
|
* limitations under the License.
|
|
2273
|
-
*/function
|
|
2397
|
+
*/function jt(n,e){M(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class yt{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=sa(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Mv(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new ha(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await xn(this,this.stsTokenManager.getToken(this.auth,e));return M(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Vv(this,e)}reload(){return Uv(this)}_assign(e){this!==e&&(M(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new yt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){M(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Pr(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Te(this.auth.app))return Promise.reject(it(this.auth));const e=await this.getIdToken();return await xn(this,Dv(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,s,i,a,c,l,d,f;const m=(r=t.displayName)!==null&&r!==void 0?r:void 0,v=(s=t.email)!==null&&s!==void 0?s:void 0,R=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,S=(a=t.photoURL)!==null&&a!==void 0?a:void 0,N=(c=t.tenantId)!==null&&c!==void 0?c:void 0,k=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,U=(d=t.createdAt)!==null&&d!==void 0?d:void 0,$=(f=t.lastLoginAt)!==null&&f!==void 0?f:void 0,{uid:x,emailVerified:H,isAnonymous:he,providerData:J,stsTokenManager:T}=t;M(x&&T,e,"internal-error");const g=Fn.fromJSON(this.name,T);M(typeof x=="string",e,"internal-error"),jt(m,e.name),jt(v,e.name),M(typeof H=="boolean",e,"internal-error"),M(typeof he=="boolean",e,"internal-error"),jt(R,e.name),jt(S,e.name),jt(N,e.name),jt(k,e.name),jt(U,e.name),jt($,e.name);const _=new yt({uid:x,auth:e,email:v,emailVerified:H,displayName:m,isAnonymous:he,photoURL:S,phoneNumber:R,tenantId:N,stsTokenManager:g,createdAt:U,lastLoginAt:$});return J&&Array.isArray(J)&&(_.providerData=J.map(E=>Object.assign({},E))),k&&(_._redirectEventId=k),_}static async _fromIdTokenResponse(e,t,r=!1){const s=new Fn;s.updateFromServerResponse(t);const i=new yt({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Pr(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];M(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?Ah(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),c=new Fn;c.updateFromIdToken(r);const l=new yt({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new ha(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
|
|
2274
2398
|
* @license
|
|
2275
2399
|
* Copyright 2020 Google LLC
|
|
2276
2400
|
*
|
|
@@ -2285,7 +2409,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2285
2409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2286
2410
|
* See the License for the specific language governing permissions and
|
|
2287
2411
|
* limitations under the License.
|
|
2288
|
-
*/const
|
|
2412
|
+
*/const Rh=new Map;function vt(n){gt(n instanceof Function,"Expected a class definition");let e=Rh.get(n);return e?(gt(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Rh.set(n,e),e)}/**
|
|
2289
2413
|
* @license
|
|
2290
2414
|
* Copyright 2019 Google LLC
|
|
2291
2415
|
*
|
|
@@ -2300,7 +2424,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2300
2424
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2301
2425
|
* See the License for the specific language governing permissions and
|
|
2302
2426
|
* limitations under the License.
|
|
2303
|
-
*/class
|
|
2427
|
+
*/class bh{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}bh.type="NONE";const Ph=bh;/**
|
|
2304
2428
|
* @license
|
|
2305
2429
|
* Copyright 2019 Google LLC
|
|
2306
2430
|
*
|
|
@@ -2315,7 +2439,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2315
2439
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2316
2440
|
* See the License for the specific language governing permissions and
|
|
2317
2441
|
* limitations under the License.
|
|
2318
|
-
*/function
|
|
2442
|
+
*/function Zs(n,e,t){return`firebase:${n}:${e}:${t}`}class Bn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Zs(this.userKey,s.apiKey,i),this.fullPersistenceKey=Zs("persistence",s.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?yt._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new Bn(vt(Ph),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||vt(Ph);const a=Zs(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const f=await d._get(a);if(f){const m=yt._fromJSON(e,f);d!==i&&(c=m),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new Bn(i,e,r):(i=l[0],c&&await i._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new Bn(i,e,r))}}/**
|
|
2319
2443
|
* @license
|
|
2320
2444
|
* Copyright 2020 Google LLC
|
|
2321
2445
|
*
|
|
@@ -2330,7 +2454,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2330
2454
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2331
2455
|
* See the License for the specific language governing permissions and
|
|
2332
2456
|
* limitations under the License.
|
|
2333
|
-
*/function
|
|
2457
|
+
*/function Sh(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Dh(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ch(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Vh(e))return"Blackberry";if(Lh(e))return"Webos";if(kh(e))return"Safari";if((e.includes("chrome/")||Nh(e))&&!e.includes("edge/"))return"Chrome";if(Oh(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Ch(n=Ee()){return/firefox\//i.test(n)}function kh(n=Ee()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Nh(n=Ee()){return/crios\//i.test(n)}function Dh(n=Ee()){return/iemobile/i.test(n)}function Oh(n=Ee()){return/android/i.test(n)}function Vh(n=Ee()){return/blackberry/i.test(n)}function Lh(n=Ee()){return/webos/i.test(n)}function da(n=Ee()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function jv(n=Ee()){var e;return da(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function qv(){return pp()&&document.documentMode===10}function Mh(n=Ee()){return da(n)||Oh(n)||Lh(n)||Vh(n)||/windows phone/i.test(n)||Dh(n)}/**
|
|
2334
2458
|
* @license
|
|
2335
2459
|
* Copyright 2020 Google LLC
|
|
2336
2460
|
*
|
|
@@ -2345,7 +2469,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2345
2469
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2346
2470
|
* See the License for the specific language governing permissions and
|
|
2347
2471
|
* limitations under the License.
|
|
2348
|
-
*/function
|
|
2472
|
+
*/function Uh(n,e=[]){let t;switch(n){case"Browser":t=Sh(Ee());break;case"Worker":t=`${Sh(Ee())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Xt}/${r}`}/**
|
|
2349
2473
|
* @license
|
|
2350
2474
|
* Copyright 2022 Google LLC
|
|
2351
2475
|
*
|
|
@@ -2360,7 +2484,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2360
2484
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2361
2485
|
* See the License for the specific language governing permissions and
|
|
2362
2486
|
* limitations under the License.
|
|
2363
|
-
*/class
|
|
2487
|
+
*/class $v{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,c)=>{try{const l=e(i);a(l)}catch(l){c(l)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
|
|
2364
2488
|
* @license
|
|
2365
2489
|
* Copyright 2023 Google LLC
|
|
2366
2490
|
*
|
|
@@ -2375,7 +2499,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2375
2499
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2376
2500
|
* See the License for the specific language governing permissions and
|
|
2377
2501
|
* limitations under the License.
|
|
2378
|
-
*/async function
|
|
2502
|
+
*/async function Hv(n,e={}){return Qe(n,"GET","/v2/passwordPolicy",_t(n,e))}/**
|
|
2379
2503
|
* @license
|
|
2380
2504
|
* Copyright 2023 Google LLC
|
|
2381
2505
|
*
|
|
@@ -2390,7 +2514,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2390
2514
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2391
2515
|
* See the License for the specific language governing permissions and
|
|
2392
2516
|
* limitations under the License.
|
|
2393
|
-
*/const
|
|
2517
|
+
*/const zv=6;class Wv{constructor(e){var t,r,s,i;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:zv,a.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=a.maxPasswordLength),a.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=a.containsLowercaseCharacter),a.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=a.containsUppercaseCharacter),a.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=a.containsNumericCharacter),a.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=a.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(i=e.forceUpgradeOnSignin)!==null&&i!==void 0?i:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,s,i,a,c;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(i=l.containsUppercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(a=l.containsNumericCharacter)!==null&&a!==void 0?a:!0),l.isValid&&(l.isValid=(c=l.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),l}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
|
|
2394
2518
|
* @license
|
|
2395
2519
|
* Copyright 2020 Google LLC
|
|
2396
2520
|
*
|
|
@@ -2405,7 +2529,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2405
2529
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2406
2530
|
* See the License for the specific language governing permissions and
|
|
2407
2531
|
* limitations under the License.
|
|
2408
|
-
*/class
|
|
2532
|
+
*/class Gv{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new xh(this),this.idTokenSubscription=new xh(this),this.beforeStateQueue=new $v(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=mh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=vt(t)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await Bn.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await wh(this,{idToken:e}),r=await yt._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Te(this.app)){const a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(s=l.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(a){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return M(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Pr(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Rv()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Te(this.app))return Promise.reject(it(this));const t=e?X(e):null;return t&&M(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&M(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Te(this.app)?Promise.reject(it(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Te(this.app)?Promise.reject(it(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(vt(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Hv(this),t=new Wv(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Jn("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await Bv(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&vt(e)||this._popupRedirectResolver;M(t,this,"argument-error"),this.redirectPersistenceManager=await Bn.create(this,[vt(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(M(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,s);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return M(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Uh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const s=await this._getAppCheckToken();return s&&(t["X-Firebase-AppCheck"]=s),t}async _getAppCheckToken(){var e;if(Te(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&wv(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function ot(n){return X(n)}class xh{constructor(e){this.auth=e,this.observer=null,this.addObserver=wp(t=>this.observer=t)}get next(){return M(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
2409
2533
|
* @license
|
|
2410
2534
|
* Copyright 2020 Google LLC
|
|
2411
2535
|
*
|
|
@@ -2420,7 +2544,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2420
2544
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2421
2545
|
* See the License for the specific language governing permissions and
|
|
2422
2546
|
* limitations under the License.
|
|
2423
|
-
*/let
|
|
2547
|
+
*/let ei={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Kv(n){ei=n}function Fh(n){return ei.loadJS(n)}function Qv(){return ei.recaptchaEnterpriseScript}function Xv(){return ei.gapiScript}function Yv(n){return`__${n}${Math.floor(Math.random()*1e6)}`}class Jv{constructor(){this.enterprise=new Zv}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class Zv{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const eE="recaptcha-enterprise",Bh="NO_RECAPTCHA";class tE{constructor(e){this.type=eE,this.auth=ot(e)}async verify(e="verify",t=!1){async function r(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(a,c)=>{Nv(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const d=new kv(l);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(l=>{c(l)})})}function s(i,a,c){const l=window.grecaptcha;Th(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(Bh)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Jv().execute("siteKey",{action:"verify"}):new Promise((i,a)=>{r(this.auth).then(c=>{if(!t&&Th(window.grecaptcha))s(c,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=Qv();l.length!==0&&(l+=c),Fh(l).then(()=>{s(c,i,a)}).catch(d=>{a(d)})}}).catch(c=>{a(c)})})}}async function jh(n,e,t,r=!1,s=!1){const i=new tE(n);let a;if(s)a=Bh;else try{a=await i.verify(t)}catch{a=await i.verify(t,!0)}const c=Object.assign({},e);if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){const l=c.phoneEnrollmentInfo.phoneNumber,d=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:d,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){const l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ti(n,e,t,r,s){var i;if(!((i=n._getRecaptchaConfig())===null||i===void 0)&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const a=await jh(n,e,t,t==="getOobCode");return r(n,a)}else return r(n,e).catch(async a=>{if(a.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const c=await jh(n,e,t,t==="getOobCode");return r(n,c)}else return Promise.reject(a)})}/**
|
|
2424
2548
|
* @license
|
|
2425
2549
|
* Copyright 2020 Google LLC
|
|
2426
2550
|
*
|
|
@@ -2435,7 +2559,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2435
2559
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2436
2560
|
* See the License for the specific language governing permissions and
|
|
2437
2561
|
* limitations under the License.
|
|
2438
|
-
*/function
|
|
2562
|
+
*/function nE(n,e){const t=nr(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Zr(i,e??{}))return s;He(s,"already-initialized")}return t.initialize({options:e})}function rE(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(vt);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function qh(n,e,t){const r=ot(n);M(r._canInitEmulator,r,"emulator-config-failed"),M(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=$h(e),{host:a,port:c}=sE(e),l=c===null?"":`:${c}`;r.config.emulator={url:`${i}//${a}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),iE()}function $h(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function sE(n){const e=$h(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:Hh(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:Hh(a)}}}function Hh(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function iE(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
|
|
2439
2563
|
* @license
|
|
2440
2564
|
* Copyright 2020 Google LLC
|
|
2441
2565
|
*
|
|
@@ -2450,7 +2574,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2450
2574
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2451
2575
|
* See the License for the specific language governing permissions and
|
|
2452
2576
|
* limitations under the License.
|
|
2453
|
-
*/class
|
|
2577
|
+
*/class fa{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return mt("not implemented")}_getIdTokenResponse(e){return mt("not implemented")}_linkToIdToken(e,t){return mt("not implemented")}_getReauthenticationResolver(e){return mt("not implemented")}}async function oE(n,e){return Qe(n,"POST","/v1/accounts:signUp",e)}/**
|
|
2454
2578
|
* @license
|
|
2455
2579
|
* Copyright 2020 Google LLC
|
|
2456
2580
|
*
|
|
@@ -2465,7 +2589,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2465
2589
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2466
2590
|
* See the License for the specific language governing permissions and
|
|
2467
2591
|
* limitations under the License.
|
|
2468
|
-
*/async function
|
|
2592
|
+
*/async function aE(n,e){return Rr(n,"POST","/v1/accounts:signInWithPassword",_t(n,e))}async function zh(n,e){return Qe(n,"POST","/v1/accounts:sendOobCode",_t(n,e))}async function cE(n,e){return zh(n,e)}async function uE(n,e){return zh(n,e)}/**
|
|
2469
2593
|
* @license
|
|
2470
2594
|
* Copyright 2020 Google LLC
|
|
2471
2595
|
*
|
|
@@ -2480,7 +2604,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2480
2604
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2481
2605
|
* See the License for the specific language governing permissions and
|
|
2482
2606
|
* limitations under the License.
|
|
2483
|
-
*/async function
|
|
2607
|
+
*/async function lE(n,e){return Rr(n,"POST","/v1/accounts:signInWithEmailLink",_t(n,e))}async function hE(n,e){return Rr(n,"POST","/v1/accounts:signInWithEmailLink",_t(n,e))}/**
|
|
2484
2608
|
* @license
|
|
2485
2609
|
* Copyright 2020 Google LLC
|
|
2486
2610
|
*
|
|
@@ -2495,7 +2619,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2495
2619
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2496
2620
|
* See the License for the specific language governing permissions and
|
|
2497
2621
|
* limitations under the License.
|
|
2498
|
-
*/class
|
|
2622
|
+
*/class Sr extends fa{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new Sr(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Sr(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ti(e,t,"signInWithPassword",aE);case"emailLink":return lE(e,{email:this._email,oobCode:this._password});default:He(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ti(e,r,"signUpPassword",oE);case"emailLink":return hE(e,{idToken:t,email:this._email,oobCode:this._password});default:He(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
|
2499
2623
|
* @license
|
|
2500
2624
|
* Copyright 2020 Google LLC
|
|
2501
2625
|
*
|
|
@@ -2510,7 +2634,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2510
2634
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2511
2635
|
* See the License for the specific language governing permissions and
|
|
2512
2636
|
* limitations under the License.
|
|
2513
|
-
*/async function
|
|
2637
|
+
*/async function jn(n,e){return Rr(n,"POST","/v1/accounts:signInWithIdp",_t(n,e))}/**
|
|
2514
2638
|
* @license
|
|
2515
2639
|
* Copyright 2020 Google LLC
|
|
2516
2640
|
*
|
|
@@ -2525,7 +2649,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2525
2649
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2526
2650
|
* See the License for the specific language governing permissions and
|
|
2527
2651
|
* limitations under the License.
|
|
2528
|
-
*/const
|
|
2652
|
+
*/const dE="http://localhost";class on extends fa{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new on(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):He("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=t,i=sa(t,["providerId","signInMethod"]);if(!r||!s)return null;const a=new on(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return jn(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,jn(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,jn(e,t)}buildRequest(){const e={requestUri:dE,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Zn(t)}return e}}/**
|
|
2529
2653
|
* @license
|
|
2530
2654
|
* Copyright 2020 Google LLC
|
|
2531
2655
|
*
|
|
@@ -2540,7 +2664,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2540
2664
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2541
2665
|
* See the License for the specific language governing permissions and
|
|
2542
2666
|
* limitations under the License.
|
|
2543
|
-
*/function
|
|
2667
|
+
*/function fE(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function pE(n){const e=er(tr(n)).link,t=e?er(tr(e)).deep_link_id:null,r=er(tr(n)).deep_link_id;return(r?er(tr(r)).link:null)||r||t||e||n}class pa{constructor(e){var t,r,s,i,a,c;const l=er(tr(e)),d=(t=l.apiKey)!==null&&t!==void 0?t:null,f=(r=l.oobCode)!==null&&r!==void 0?r:null,m=fE((s=l.mode)!==null&&s!==void 0?s:null);M(d&&f&&m,"argument-error"),this.apiKey=d,this.operation=m,this.code=f,this.continueUrl=(i=l.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(a=l.languageCode)!==null&&a!==void 0?a:null,this.tenantId=(c=l.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=pE(e);try{return new pa(t)}catch{return null}}}/**
|
|
2544
2668
|
* @license
|
|
2545
2669
|
* Copyright 2020 Google LLC
|
|
2546
2670
|
*
|
|
@@ -2555,7 +2679,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2555
2679
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2556
2680
|
* See the License for the specific language governing permissions and
|
|
2557
2681
|
* limitations under the License.
|
|
2558
|
-
*/class
|
|
2682
|
+
*/class qn{constructor(){this.providerId=qn.PROVIDER_ID}static credential(e,t){return Sr._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=pa.parseLink(t);return M(r,"argument-error"),Sr._fromEmailAndCode(e,r.code,r.tenantId)}}qn.PROVIDER_ID="password",qn.EMAIL_PASSWORD_SIGN_IN_METHOD="password",qn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
|
2559
2683
|
* @license
|
|
2560
2684
|
* Copyright 2020 Google LLC
|
|
2561
2685
|
*
|
|
@@ -2570,7 +2694,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2570
2694
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2571
2695
|
* See the License for the specific language governing permissions and
|
|
2572
2696
|
* limitations under the License.
|
|
2573
|
-
*/class
|
|
2697
|
+
*/class ni{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
|
|
2574
2698
|
* @license
|
|
2575
2699
|
* Copyright 2019 Google LLC
|
|
2576
2700
|
*
|
|
@@ -2585,7 +2709,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2585
2709
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2586
2710
|
* See the License for the specific language governing permissions and
|
|
2587
2711
|
* limitations under the License.
|
|
2588
|
-
*/class
|
|
2712
|
+
*/class Cr extends ni{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
|
|
2589
2713
|
* @license
|
|
2590
2714
|
* Copyright 2020 Google LLC
|
|
2591
2715
|
*
|
|
@@ -2600,7 +2724,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2600
2724
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2601
2725
|
* See the License for the specific language governing permissions and
|
|
2602
2726
|
* limitations under the License.
|
|
2603
|
-
*/class
|
|
2727
|
+
*/class at extends Cr{constructor(){super("facebook.com")}static credential(e){return on._fromParams({providerId:at.PROVIDER_ID,signInMethod:at.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return at.credentialFromTaggedObject(e)}static credentialFromError(e){return at.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return at.credential(e.oauthAccessToken)}catch{return null}}}at.FACEBOOK_SIGN_IN_METHOD="facebook.com",at.PROVIDER_ID="facebook.com";/**
|
|
2604
2728
|
* @license
|
|
2605
2729
|
* Copyright 2020 Google LLC
|
|
2606
2730
|
*
|
|
@@ -2615,7 +2739,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2615
2739
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2616
2740
|
* See the License for the specific language governing permissions and
|
|
2617
2741
|
* limitations under the License.
|
|
2618
|
-
*/class
|
|
2742
|
+
*/class ct extends Cr{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return on._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return ct.credential(t,r)}catch{return null}}}ct.GOOGLE_SIGN_IN_METHOD="google.com",ct.PROVIDER_ID="google.com";/**
|
|
2619
2743
|
* @license
|
|
2620
2744
|
* Copyright 2020 Google LLC
|
|
2621
2745
|
*
|
|
@@ -2630,7 +2754,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2630
2754
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2631
2755
|
* See the License for the specific language governing permissions and
|
|
2632
2756
|
* limitations under the License.
|
|
2633
|
-
*/class
|
|
2757
|
+
*/class qt extends Cr{constructor(){super("github.com")}static credential(e){return on._fromParams({providerId:qt.PROVIDER_ID,signInMethod:qt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return qt.credentialFromTaggedObject(e)}static credentialFromError(e){return qt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return qt.credential(e.oauthAccessToken)}catch{return null}}}qt.GITHUB_SIGN_IN_METHOD="github.com",qt.PROVIDER_ID="github.com";/**
|
|
2634
2758
|
* @license
|
|
2635
2759
|
* Copyright 2020 Google LLC
|
|
2636
2760
|
*
|
|
@@ -2645,7 +2769,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2645
2769
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2646
2770
|
* See the License for the specific language governing permissions and
|
|
2647
2771
|
* limitations under the License.
|
|
2648
|
-
*/class
|
|
2772
|
+
*/class Xe extends Cr{constructor(){super("twitter.com")}static credential(e,t){return on._fromParams({providerId:Xe.PROVIDER_ID,signInMethod:Xe.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Xe.credentialFromTaggedObject(e)}static credentialFromError(e){return Xe.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Xe.credential(t,r)}catch{return null}}}Xe.TWITTER_SIGN_IN_METHOD="twitter.com",Xe.PROVIDER_ID="twitter.com";/**
|
|
2649
2773
|
* @license
|
|
2650
2774
|
* Copyright 2020 Google LLC
|
|
2651
2775
|
*
|
|
@@ -2660,7 +2784,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2660
2784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2661
2785
|
* See the License for the specific language governing permissions and
|
|
2662
2786
|
* limitations under the License.
|
|
2663
|
-
*/async function
|
|
2787
|
+
*/async function Wh(n,e){return Rr(n,"POST","/v1/accounts:signUp",_t(n,e))}/**
|
|
2664
2788
|
* @license
|
|
2665
2789
|
* Copyright 2020 Google LLC
|
|
2666
2790
|
*
|
|
@@ -2675,7 +2799,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2675
2799
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2676
2800
|
* See the License for the specific language governing permissions and
|
|
2677
2801
|
* limitations under the License.
|
|
2678
|
-
*/class
|
|
2802
|
+
*/class Et{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await yt._fromIdTokenResponse(e,r,s),a=Gh(r);return new Et({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=Gh(r);return new Et({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function Gh(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
|
2679
2803
|
* @license
|
|
2680
2804
|
* Copyright 2020 Google LLC
|
|
2681
2805
|
*
|
|
@@ -2690,7 +2814,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2690
2814
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2691
2815
|
* See the License for the specific language governing permissions and
|
|
2692
2816
|
* limitations under the License.
|
|
2693
|
-
*/async function
|
|
2817
|
+
*/async function mE(n){var e;if(Te(n.app))return Promise.reject(it(n));const t=ot(n);if(await t._initializationPromise,!((e=t.currentUser)===null||e===void 0)&&e.isAnonymous)return new Et({user:t.currentUser,providerId:null,operationType:"signIn"});const r=await Wh(t,{returnSecureToken:!0}),s=await Et._fromIdTokenResponse(t,"signIn",r,!0);return await t._updateCurrentUser(s.user),s}/**
|
|
2694
2818
|
* @license
|
|
2695
2819
|
* Copyright 2020 Google LLC
|
|
2696
2820
|
*
|
|
@@ -2705,7 +2829,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2705
2829
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2706
2830
|
* See the License for the specific language governing permissions and
|
|
2707
2831
|
* limitations under the License.
|
|
2708
|
-
*/class
|
|
2832
|
+
*/class ri extends ze{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ri.prototype),this.customData={appName:e.name,tenantId:(i=e.tenantId)!==null&&i!==void 0?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new ri(e,t,r,s)}}function Kh(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?ri._fromErrorAndOperation(n,i,e,r):i})}/**
|
|
2709
2833
|
* @license
|
|
2710
2834
|
* Copyright 2020 Google LLC
|
|
2711
2835
|
*
|
|
@@ -2720,7 +2844,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2720
2844
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2721
2845
|
* See the License for the specific language governing permissions and
|
|
2722
2846
|
* limitations under the License.
|
|
2723
|
-
*/function
|
|
2847
|
+
*/function Qh(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}/**
|
|
2724
2848
|
* @license
|
|
2725
2849
|
* Copyright 2019 Google LLC
|
|
2726
2850
|
*
|
|
@@ -2735,7 +2859,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2735
2859
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2736
2860
|
* See the License for the specific language governing permissions and
|
|
2737
2861
|
* limitations under the License.
|
|
2738
|
-
*/async function
|
|
2862
|
+
*/async function gE(n,e){const t=X(n);await yE(!0,t,e);const{providerUserInfo:r}=await Ov(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),s=Qh(r||[]);return t.providerData=t.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function _E(n,e,t=!1){const r=await xn(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return Et._forOperation(n,"link",r)}async function yE(n,e,t){await Pr(e);const r=Qh(e.providerData);M(r.has(t)===n,e.auth,"no-such-provider")}/**
|
|
2739
2863
|
* @license
|
|
2740
2864
|
* Copyright 2019 Google LLC
|
|
2741
2865
|
*
|
|
@@ -2750,7 +2874,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2750
2874
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2751
2875
|
* See the License for the specific language governing permissions and
|
|
2752
2876
|
* limitations under the License.
|
|
2753
|
-
*/async function
|
|
2877
|
+
*/async function vE(n,e,t=!1){const{auth:r}=n;if(Te(r.app))return Promise.reject(it(r));const s="reauthenticate";try{const i=await xn(n,Kh(r,s,e,n),t);M(i.idToken,r,"internal-error");const a=la(i.idToken);M(a,r,"internal-error");const{sub:c}=a;return M(n.uid===c,r,"user-mismatch"),Et._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&He(r,"user-mismatch"),i}}/**
|
|
2754
2878
|
* @license
|
|
2755
2879
|
* Copyright 2020 Google LLC
|
|
2756
2880
|
*
|
|
@@ -2765,7 +2889,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2765
2889
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2766
2890
|
* See the License for the specific language governing permissions and
|
|
2767
2891
|
* limitations under the License.
|
|
2768
|
-
*/async function
|
|
2892
|
+
*/async function Xh(n,e,t=!1){if(Te(n.app))return Promise.reject(it(n));const r="signIn",s=await Kh(n,r,e),i=await Et._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function EE(n,e){return Xh(ot(n),e)}/**
|
|
2769
2893
|
* @license
|
|
2770
2894
|
* Copyright 2020 Google LLC
|
|
2771
2895
|
*
|
|
@@ -2780,7 +2904,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2780
2904
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2781
2905
|
* See the License for the specific language governing permissions and
|
|
2782
2906
|
* limitations under the License.
|
|
2783
|
-
*/function
|
|
2907
|
+
*/function TE(n,e,t){var r;M(((r=t.url)===null||r===void 0?void 0:r.length)>0,n,"invalid-continue-uri"),M(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),M(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(M(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(M(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
|
|
2784
2908
|
* @license
|
|
2785
2909
|
* Copyright 2020 Google LLC
|
|
2786
2910
|
*
|
|
@@ -2795,7 +2919,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2795
2919
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2796
2920
|
* See the License for the specific language governing permissions and
|
|
2797
2921
|
* limitations under the License.
|
|
2798
|
-
*/async function
|
|
2922
|
+
*/async function Yh(n){const e=ot(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function wE(n,e,t){const r=ot(n);await ti(r,{requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"},"getOobCode",uE)}async function IE(n,e,t){if(Te(n.app))return Promise.reject(it(n));const r=ot(n),a=await ti(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Wh).catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&Yh(n),l}),c=await Et._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function Jh(n,e,t){return Te(n.app)?Promise.reject(it(n)):EE(X(n),qn.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Yh(n),r})}async function Zh(n,e){const t=X(n),s={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&TE(t.auth,s,e);const{email:i}=await cE(t.auth,s);i!==n.email&&await n.reload()}/**
|
|
2799
2923
|
* @license
|
|
2800
2924
|
* Copyright 2020 Google LLC
|
|
2801
2925
|
*
|
|
@@ -2810,7 +2934,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2810
2934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2811
2935
|
* See the License for the specific language governing permissions and
|
|
2812
2936
|
* limitations under the License.
|
|
2813
|
-
*/async function
|
|
2937
|
+
*/async function AE(n,e){return Qe(n,"POST","/v1/accounts:update",e)}/**
|
|
2814
2938
|
* @license
|
|
2815
2939
|
* Copyright 2020 Google LLC
|
|
2816
2940
|
*
|
|
@@ -2825,7 +2949,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2825
2949
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2826
2950
|
* See the License for the specific language governing permissions and
|
|
2827
2951
|
* limitations under the License.
|
|
2828
|
-
*/async function
|
|
2952
|
+
*/async function RE(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;const r=X(n),i={idToken:await r.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},a=await xn(r,AE(r.auth,i));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;const c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function bE(n,e,t,r){return X(n).onIdTokenChanged(e,t,r)}function PE(n,e,t){return X(n).beforeAuthStateChanged(e,t)}const si="__sak";/**
|
|
2829
2953
|
* @license
|
|
2830
2954
|
* Copyright 2019 Google LLC
|
|
2831
2955
|
*
|
|
@@ -2840,7 +2964,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2840
2964
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2841
2965
|
* See the License for the specific language governing permissions and
|
|
2842
2966
|
* limitations under the License.
|
|
2843
|
-
*/class
|
|
2967
|
+
*/class ed{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(si,"1"),this.storage.removeItem(si),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
2844
2968
|
* @license
|
|
2845
2969
|
* Copyright 2020 Google LLC
|
|
2846
2970
|
*
|
|
@@ -2855,7 +2979,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2855
2979
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2856
2980
|
* See the License for the specific language governing permissions and
|
|
2857
2981
|
* limitations under the License.
|
|
2858
|
-
*/
|
|
2982
|
+
*/const SE=1e3,CE=10;class td extends ed{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Mh(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);qv()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,CE):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},SE)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}td.type="LOCAL";const kE=td;/**
|
|
2859
2983
|
* @license
|
|
2860
2984
|
* Copyright 2020 Google LLC
|
|
2861
2985
|
*
|
|
@@ -2870,7 +2994,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2870
2994
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2871
2995
|
* See the License for the specific language governing permissions and
|
|
2872
2996
|
* limitations under the License.
|
|
2873
|
-
*/class
|
|
2997
|
+
*/class nd extends ed{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}nd.type="SESSION";const rd=nd;/**
|
|
2874
2998
|
* @license
|
|
2875
2999
|
* Copyright 2019 Google LLC
|
|
2876
3000
|
*
|
|
@@ -2885,7 +3009,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2885
3009
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2886
3010
|
* See the License for the specific language governing permissions and
|
|
2887
3011
|
* limitations under the License.
|
|
2888
|
-
*/function
|
|
3012
|
+
*/function NE(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
|
2889
3013
|
* @license
|
|
2890
3014
|
* Copyright 2019 Google LLC
|
|
2891
3015
|
*
|
|
@@ -2900,7 +3024,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2900
3024
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2901
3025
|
* See the License for the specific language governing permissions and
|
|
2902
3026
|
* limitations under the License.
|
|
2903
|
-
*/class
|
|
3027
|
+
*/class ii{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new ii(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,a=this.handlersMap[s];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(t.origin,i)),l=await NE(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}ii.receivers=[];/**
|
|
2904
3028
|
* @license
|
|
2905
3029
|
* Copyright 2020 Google LLC
|
|
2906
3030
|
*
|
|
@@ -2915,7 +3039,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2915
3039
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2916
3040
|
* See the License for the specific language governing permissions and
|
|
2917
3041
|
* limitations under the License.
|
|
2918
|
-
*/function
|
|
3042
|
+
*/function ma(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
|
|
2919
3043
|
* @license
|
|
2920
3044
|
* Copyright 2019 Google LLC
|
|
2921
3045
|
*
|
|
@@ -2930,7 +3054,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2930
3054
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2931
3055
|
* See the License for the specific language governing permissions and
|
|
2932
3056
|
* limitations under the License.
|
|
2933
|
-
*/class
|
|
3057
|
+
*/class DE{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,a;return new Promise((c,l)=>{const d=ma("",20);s.port1.start();const f=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(m){const v=m;if(v.data.eventId===d)switch(v.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(v.data.response);break;default:clearTimeout(f),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
|
|
2934
3058
|
* @license
|
|
2935
3059
|
* Copyright 2020 Google LLC
|
|
2936
3060
|
*
|
|
@@ -2945,7 +3069,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2945
3069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2946
3070
|
* See the License for the specific language governing permissions and
|
|
2947
3071
|
* limitations under the License.
|
|
2948
|
-
*/function
|
|
3072
|
+
*/function ut(){return window}function OE(n){ut().location.href=n}/**
|
|
2949
3073
|
* @license
|
|
2950
3074
|
* Copyright 2020 Google LLC.
|
|
2951
3075
|
*
|
|
@@ -2960,7 +3084,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2960
3084
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2961
3085
|
* See the License for the specific language governing permissions and
|
|
2962
3086
|
* limitations under the License.
|
|
2963
|
-
*/function
|
|
3087
|
+
*/function sd(){return typeof ut().WorkerGlobalScope<"u"&&typeof ut().importScripts=="function"}async function VE(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function LE(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function ME(){return sd()?self:null}/**
|
|
2964
3088
|
* @license
|
|
2965
3089
|
* Copyright 2019 Google LLC
|
|
2966
3090
|
*
|
|
@@ -2975,7 +3099,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2975
3099
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2976
3100
|
* See the License for the specific language governing permissions and
|
|
2977
3101
|
* limitations under the License.
|
|
2978
|
-
*/const
|
|
3102
|
+
*/const id="firebaseLocalStorageDb",UE=1,oi="firebaseLocalStorage",od="fbase_key";class kr{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function ai(n,e){return n.transaction([oi],e?"readwrite":"readonly").objectStore(oi)}function xE(){const n=indexedDB.deleteDatabase(id);return new kr(n).toPromise()}function ga(){const n=indexedDB.open(id,UE);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(oi,{keyPath:od})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(oi)?e(r):(r.close(),await xE(),e(await ga()))})})}async function ad(n,e,t){const r=ai(n,!0).put({[od]:e,value:t});return new kr(r).toPromise()}async function FE(n,e){const t=ai(n,!1).get(e),r=await new kr(t).toPromise();return r===void 0?null:r.value}function cd(n,e){const t=ai(n,!0).delete(e);return new kr(t).toPromise()}const BE=800,jE=3;class ud{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await ga(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>jE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return sd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ii._getInstance(ME()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await VE(),!this.activeServiceWorker)return;this.sender=new DE(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((t=r[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||LE()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await ga();return await ad(e,si,"1"),await cd(e,si),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>ad(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>FE(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>cd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=ai(s,!1).getAll();return new kr(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),BE)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}ud.type="LOCAL";const qE=ud;new Ar(3e4,6e4);/**
|
|
2979
3103
|
* @license
|
|
2980
3104
|
* Copyright 2021 Google LLC
|
|
2981
3105
|
*
|
|
@@ -2990,7 +3114,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
2990
3114
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2991
3115
|
* See the License for the specific language governing permissions and
|
|
2992
3116
|
* limitations under the License.
|
|
2993
|
-
*/function
|
|
3117
|
+
*/function _a(n,e){return e?vt(e):(M(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
|
2994
3118
|
* @license
|
|
2995
3119
|
* Copyright 2019 Google LLC
|
|
2996
3120
|
*
|
|
@@ -3005,7 +3129,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3005
3129
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3006
3130
|
* See the License for the specific language governing permissions and
|
|
3007
3131
|
* limitations under the License.
|
|
3008
|
-
*/class
|
|
3132
|
+
*/class ya extends fa{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return jn(e,this._buildIdpRequest())}_linkToIdToken(e,t){return jn(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return jn(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function $E(n){return Xh(n.auth,new ya(n),n.bypassAuthState)}function HE(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),vE(t,new ya(n),n.bypassAuthState)}async function zE(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),_E(t,new ya(n),n.bypassAuthState)}/**
|
|
3009
3133
|
* @license
|
|
3010
3134
|
* Copyright 2020 Google LLC
|
|
3011
3135
|
*
|
|
@@ -3020,7 +3144,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3020
3144
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3021
3145
|
* See the License for the specific language governing permissions and
|
|
3022
3146
|
* limitations under the License.
|
|
3023
|
-
*/class
|
|
3147
|
+
*/class ld{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:a,type:c}=e;if(a){this.reject(a);return}const l={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return $E;case"linkViaPopup":case"linkViaRedirect":return zE;case"reauthViaPopup":case"reauthViaRedirect":return HE;default:He(this.auth,"internal-error")}}resolve(e){gt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){gt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
|
3024
3148
|
* @license
|
|
3025
3149
|
* Copyright 2020 Google LLC
|
|
3026
3150
|
*
|
|
@@ -3035,7 +3159,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3035
3159
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3036
3160
|
* See the License for the specific language governing permissions and
|
|
3037
3161
|
* limitations under the License.
|
|
3038
|
-
*/const
|
|
3162
|
+
*/const WE=new Ar(2e3,1e4);async function va(n,e,t){if(Te(n.app))return Promise.reject(Ke(n,"operation-not-supported-in-this-environment"));const r=ot(n);gh(n,e,ni);const s=_a(r,t);return new $t(r,"signInViaPopup",e,s).executeNotNull()}async function hd(n,e,t){const r=X(n);gh(r.auth,e,ni);const s=_a(r.auth,t);return new $t(r.auth,"linkViaPopup",e,s,r).executeNotNull()}class $t extends ld{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,$t.currentPopupAction&&$t.currentPopupAction.cancel(),$t.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return M(e,this.auth,"internal-error"),e}async onExecution(){gt(this.filter.length===1,"Popup operations only handle one event");const e=ma();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(Ke(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(Ke(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,$t.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Ke(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,WE.get())};e()}}$t.currentPopupAction=null;/**
|
|
3039
3163
|
* @license
|
|
3040
3164
|
* Copyright 2020 Google LLC
|
|
3041
3165
|
*
|
|
@@ -3050,7 +3174,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3050
3174
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3051
3175
|
* See the License for the specific language governing permissions and
|
|
3052
3176
|
* limitations under the License.
|
|
3053
|
-
*/const
|
|
3177
|
+
*/const GE="pendingRedirect",ci=new Map;class KE extends ld{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=ci.get(this.auth._key());if(!e){try{const r=await QE(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}ci.set(this.auth._key(),e)}return this.bypassAuthState||ci.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function QE(n,e){const t=JE(e),r=YE(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function XE(n,e){ci.set(n._key(),e)}function YE(n){return vt(n._redirectPersistence)}function JE(n){return Zs(GE,n.config.apiKey,n.name)}async function ZE(n,e,t=!1){if(Te(n.app))return Promise.reject(it(n));const r=ot(n),s=_a(r,e),a=await new KE(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
|
|
3054
3178
|
* @license
|
|
3055
3179
|
* Copyright 2020 Google LLC
|
|
3056
3180
|
*
|
|
@@ -3065,7 +3189,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3065
3189
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3066
3190
|
* See the License for the specific language governing permissions and
|
|
3067
3191
|
* limitations under the License.
|
|
3068
|
-
*/const
|
|
3192
|
+
*/const eT=10*60*1e3;class tT{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!nT(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!fd(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(Ke(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=eT&&this.cachedEventUids.clear(),this.cachedEventUids.has(dd(e))}saveEventToCache(e){this.cachedEventUids.add(dd(e)),this.lastProcessedEventTime=Date.now()}}function dd(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function fd({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function nT(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return fd(n);default:return!1}}/**
|
|
3069
3193
|
* @license
|
|
3070
3194
|
* Copyright 2020 Google LLC
|
|
3071
3195
|
*
|
|
@@ -3080,7 +3204,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3080
3204
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3081
3205
|
* See the License for the specific language governing permissions and
|
|
3082
3206
|
* limitations under the License.
|
|
3083
|
-
*/async function
|
|
3207
|
+
*/async function rT(n,e={}){return Qe(n,"GET","/v1/projects",e)}/**
|
|
3084
3208
|
* @license
|
|
3085
3209
|
* Copyright 2020 Google LLC
|
|
3086
3210
|
*
|
|
@@ -3095,7 +3219,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3095
3219
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3096
3220
|
* See the License for the specific language governing permissions and
|
|
3097
3221
|
* limitations under the License.
|
|
3098
|
-
*/const
|
|
3222
|
+
*/const sT=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,iT=/^https?/;async function oT(n){if(n.config.emulator)return;const{authorizedDomains:e}=await rT(n);for(const t of e)try{if(aT(t))return}catch{}He(n,"unauthorized-domain")}function aT(n){const e=aa(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!iT.test(t))return!1;if(sT.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
3099
3223
|
* @license
|
|
3100
3224
|
* Copyright 2020 Google LLC.
|
|
3101
3225
|
*
|
|
@@ -3110,7 +3234,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3110
3234
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3111
3235
|
* See the License for the specific language governing permissions and
|
|
3112
3236
|
* limitations under the License.
|
|
3113
|
-
*/const
|
|
3237
|
+
*/const cT=new Ar(3e4,6e4);function pd(){const n=ut().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function uT(n){return new Promise((e,t)=>{var r,s,i;function a(){pd(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{pd(),t(Ke(n,"network-request-failed"))},timeout:cT.get()})}if(!((s=(r=ut().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=ut().gapi)===null||i===void 0)&&i.load)a();else{const c=Yv("iframefcb");return ut()[c]=()=>{gapi.load?a():t(Ke(n,"network-request-failed"))},Fh(`${Xv()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw ui=null,e})}let ui=null;function lT(n){return ui=ui||uT(n),ui}/**
|
|
3114
3238
|
* @license
|
|
3115
3239
|
* Copyright 2020 Google LLC.
|
|
3116
3240
|
*
|
|
@@ -3125,7 +3249,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3125
3249
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3126
3250
|
* See the License for the specific language governing permissions and
|
|
3127
3251
|
* limitations under the License.
|
|
3128
|
-
*/const
|
|
3252
|
+
*/const hT=new Ar(5e3,15e3),dT="__/auth/iframe",fT="emulator/auth/iframe",pT={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},mT=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gT(n){const e=n.config;M(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?ca(e,fT):`https://${n.config.authDomain}/${dT}`,r={apiKey:e.apiKey,appName:n.name,v:Xt},s=mT.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${Zn(r).slice(1)}`}async function _T(n){const e=await lT(n),t=ut().gapi;return M(t,n,"internal-error"),e.open({where:document.body,url:gT(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pT,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=Ke(n,"network-request-failed"),c=ut().setTimeout(()=>{i(a)},hT.get());function l(){ut().clearTimeout(c),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
|
|
3129
3253
|
* @license
|
|
3130
3254
|
* Copyright 2020 Google LLC.
|
|
3131
3255
|
*
|
|
@@ -3140,7 +3264,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3140
3264
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3141
3265
|
* See the License for the specific language governing permissions and
|
|
3142
3266
|
* limitations under the License.
|
|
3143
|
-
*/const
|
|
3267
|
+
*/const yT={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},vT=500,ET=600,TT="_blank",wT="http://localhost";class md{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function IT(n,e,t,r=vT,s=ET){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l=Object.assign(Object.assign({},yT),{width:r.toString(),height:s.toString(),top:i,left:a}),d=Ee().toLowerCase();t&&(c=Nh(d)?TT:t),Ch(d)&&(e=e||wT,l.scrollbars="yes");const f=Object.entries(l).reduce((v,[R,S])=>`${v}${R}=${S},`,"");if(jv(d)&&c!=="_self")return AT(e||"",c),new md(null);const m=window.open(e||"",c,f);M(m,n,"popup-blocked");try{m.focus()}catch{}return new md(m)}function AT(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
|
|
3144
3268
|
* @license
|
|
3145
3269
|
* Copyright 2021 Google LLC
|
|
3146
3270
|
*
|
|
@@ -3155,7 +3279,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3155
3279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3156
3280
|
* See the License for the specific language governing permissions and
|
|
3157
3281
|
* limitations under the License.
|
|
3158
|
-
*/const
|
|
3282
|
+
*/const RT="__/auth/handler",bT="emulator/auth/handler",PT=encodeURIComponent("fac");async function gd(n,e,t,r,s,i){M(n.config.authDomain,n,"auth-domain-config-required"),M(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:Xt,eventId:s};if(e instanceof ni){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",Tp(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,m]of Object.entries({}))a[f]=m}if(e instanceof Cr){const f=e.getScopes().filter(m=>m!=="");f.length>0&&(a.scopes=f.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const l=await n._getAppCheckToken(),d=l?`#${PT}=${encodeURIComponent(l)}`:"";return`${ST(n)}?${Zn(c).slice(1)}${d}`}function ST({config:n}){return n.emulator?ca(n,bT):`https://${n.authDomain}/${RT}`}/**
|
|
3159
3283
|
* @license
|
|
3160
3284
|
* Copyright 2020 Google LLC
|
|
3161
3285
|
*
|
|
@@ -3170,7 +3294,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3170
3294
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3171
3295
|
* See the License for the specific language governing permissions and
|
|
3172
3296
|
* limitations under the License.
|
|
3173
|
-
*/const
|
|
3297
|
+
*/const Ea="webStorageSupport";class CT{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=rd,this._completeRedirectFn=ZE,this._overrideRedirectResult=XE}async _openPopup(e,t,r,s){var i;gt((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const a=await gd(e,t,r,aa(),s);return IT(e,a,ma())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await gd(e,t,r,aa(),s);return OE(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(gt(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await _T(e),r=new tT(e);return t.register("authEvent",s=>(M(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Ea,{type:Ea},s=>{var i;const a=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Ea];a!==void 0&&t(!!a),He(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=oT(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Mh()||kh()||da()}}const kT=CT;var _d="@firebase/auth",yd="1.9.0";/**
|
|
3174
3298
|
* @license
|
|
3175
3299
|
* Copyright 2020 Google LLC
|
|
3176
3300
|
*
|
|
@@ -3185,7 +3309,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3185
3309
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3186
3310
|
* See the License for the specific language governing permissions and
|
|
3187
3311
|
* limitations under the License.
|
|
3188
|
-
*/class
|
|
3312
|
+
*/class NT{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){M(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
3189
3313
|
* @license
|
|
3190
3314
|
* Copyright 2020 Google LLC
|
|
3191
3315
|
*
|
|
@@ -3200,7 +3324,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3200
3324
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3201
3325
|
* See the License for the specific language governing permissions and
|
|
3202
3326
|
* limitations under the License.
|
|
3203
|
-
*/function
|
|
3327
|
+
*/function DT(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function OT(n){bt(new ht("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;M(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Uh(n)},d=new Gv(r,s,i,l);return rE(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),bt(new ht("auth-internal",e=>{const t=ot(e.getProvider("auth").getImmediate());return(r=>new NT(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),qe(_d,yd,DT(n)),qe(_d,yd,"esm2017")}/**
|
|
3204
3328
|
* @license
|
|
3205
3329
|
* Copyright 2021 Google LLC
|
|
3206
3330
|
*
|
|
@@ -3215,22 +3339,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3215
3339
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3216
3340
|
* See the License for the specific language governing permissions and
|
|
3217
3341
|
* limitations under the License.
|
|
3218
|
-
*/const
|
|
3219
|
-
* @license
|
|
3220
|
-
* Copyright 2017 Google LLC
|
|
3221
|
-
*
|
|
3222
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3223
|
-
* you may not use this file except in compliance with the License.
|
|
3224
|
-
* You may obtain a copy of the License at
|
|
3225
|
-
*
|
|
3226
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3227
|
-
*
|
|
3228
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3229
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3230
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3231
|
-
* See the License for the specific language governing permissions and
|
|
3232
|
-
* limitations under the License.
|
|
3233
|
-
*/const ff="firebasestorage.googleapis.com",pf="storageBucket",Aw=2*60*1e3,Rw=10*60*1e3,Pw=1e3;/**
|
|
3342
|
+
*/const VT=5*60,LT=uc("authIdTokenMaxAge")||VT;let vd=null;const MT=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>LT)return;const s=t==null?void 0:t.token;vd!==s&&(vd=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function UT(n=ts()){const e=nr(n,"auth");if(e.isInitialized())return e.getImmediate();const t=nE(n,{popupRedirectResolver:kT,persistence:[qE,kE,rd]}),r=uc("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=MT(i.toString());PE(t,a,()=>a(t.currentUser)),bE(t,c=>a(c))}}const s=ac("auth");return s&&qh(t,`http://${s}`),t}function xT(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}Kv({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=Ke("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",xT().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),OT("Browser");/**
|
|
3234
3343
|
* @license
|
|
3235
3344
|
* Copyright 2017 Google LLC
|
|
3236
3345
|
*
|
|
@@ -3245,8 +3354,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
3245
3354
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3246
3355
|
* See the License for the specific language governing permissions and
|
|
3247
3356
|
* limitations under the License.
|
|
3248
|
-
*/
|
|
3249
|
-
${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(q||(q={}));function Ga(n){return"storage/"+n}function Ka(){const n="An unknown error occurred, please check the error payload for server response.";return new z(q.UNKNOWN,n)}function Sw(n){return new z(q.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function bw(n){return new z(q.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function Cw(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new z(q.UNAUTHENTICATED,n)}function kw(){return new z(q.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function Dw(n){return new z(q.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function mf(){return new z(q.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function gf(){return new z(q.CANCELED,"User canceled the upload/download.")}function Nw(n){return new z(q.INVALID_URL,"Invalid URL '"+n+"'.")}function Ow(n){return new z(q.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function Vw(){return new z(q.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+pf+"' property when initializing the app?")}function _f(){return new z(q.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Lw(){return new z(q.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function Mw(){return new z(q.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function xw(n){return new z(q.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function Qa(n){return new z(q.INVALID_ARGUMENT,n)}function yf(){return new z(q.APP_DELETED,"The Firebase app was deleted.")}function Uw(n){return new z(q.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function qr(n,e){return new z(q.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function $r(n){throw new z(q.INTERNAL_ERROR,"Internal error: "+n)}/**
|
|
3357
|
+
*/const Ed="firebasestorage.googleapis.com",Td="storageBucket",FT=2*60*1e3,BT=10*60*1e3,jT=1e3;/**
|
|
3250
3358
|
* @license
|
|
3251
3359
|
* Copyright 2017 Google LLC
|
|
3252
3360
|
*
|
|
@@ -3261,7 +3369,8 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3261
3369
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3262
3370
|
* See the License for the specific language governing permissions and
|
|
3263
3371
|
* limitations under the License.
|
|
3264
|
-
*/class
|
|
3372
|
+
*/class se extends ze{constructor(e,t,r=0){super(Ta(e),`Firebase Storage: ${t} (${Ta(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,se.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Ta(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
|
|
3373
|
+
${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(te||(te={}));function Ta(n){return"storage/"+n}function wa(){const n="An unknown error occurred, please check the error payload for server response.";return new se(te.UNKNOWN,n)}function qT(n){return new se(te.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function $T(n){return new se(te.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function HT(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new se(te.UNAUTHENTICATED,n)}function zT(){return new se(te.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function WT(n){return new se(te.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function wd(){return new se(te.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Id(){return new se(te.CANCELED,"User canceled the upload/download.")}function GT(n){return new se(te.INVALID_URL,"Invalid URL '"+n+"'.")}function KT(n){return new se(te.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function QT(){return new se(te.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Td+"' property when initializing the app?")}function Ad(){return new se(te.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function XT(){return new se(te.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function YT(){return new se(te.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function JT(n){return new se(te.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function Ia(n){return new se(te.INVALID_ARGUMENT,n)}function Rd(){return new se(te.APP_DELETED,"The Firebase app was deleted.")}function ZT(n){return new se(te.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function Nr(n,e){return new se(te.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function Dr(n){throw new se(te.INTERNAL_ERROR,"Internal error: "+n)}/**
|
|
3265
3374
|
* @license
|
|
3266
3375
|
* Copyright 2017 Google LLC
|
|
3267
3376
|
*
|
|
@@ -3276,7 +3385,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3276
3385
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3277
3386
|
* See the License for the specific language governing permissions and
|
|
3278
3387
|
* limitations under the License.
|
|
3279
|
-
*/
|
|
3388
|
+
*/class Be{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=Be.makeFromUrl(e,t)}catch{return new Be(e,"")}if(r.path==="")return r;throw KT(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(H){H.path.charAt(H.path.length-1)==="/"&&(H.path_=H.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),l={bucket:1,path:3};function d(H){H.path_=decodeURIComponent(H.path)}const f="v[A-Za-z0-9_]+",m=t.replace(/[.]/g,"\\."),v="(/([^?#]*).*)?$",R=new RegExp(`^https?://${m}/${f}/b/${s}/o${v}`,"i"),S={bucket:1,path:3},N=t===Ed?"(?:storage.googleapis.com|storage.cloud.google.com)":t,k="([^?#]*)",U=new RegExp(`^https?://${N}/${s}/${k}`,"i"),x=[{regex:c,indices:l,postModify:i},{regex:R,indices:S,postModify:d},{regex:U,indices:{bucket:1,path:2},postModify:d}];for(let H=0;H<x.length;H++){const he=x[H],J=he.regex.exec(e);if(J){const T=J[he.indices.bucket];let g=J[he.indices.path];g||(g=""),r=new Be(T,g),he.postModify(r);break}}if(r==null)throw GT(e);return r}}class ew{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
|
|
3280
3389
|
* @license
|
|
3281
3390
|
* Copyright 2017 Google LLC
|
|
3282
3391
|
*
|
|
@@ -3291,7 +3400,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3291
3400
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3292
3401
|
* See the License for the specific language governing permissions and
|
|
3293
3402
|
* limitations under the License.
|
|
3294
|
-
*/function
|
|
3403
|
+
*/function tw(n,e,t){let r=1,s=null,i=null,a=!1,c=0;function l(){return c===2}let d=!1;function f(...k){d||(d=!0,e.apply(null,k))}function m(k){s=setTimeout(()=>{s=null,n(R,l())},k)}function v(){i&&clearTimeout(i)}function R(k,...U){if(d){v();return}if(k){v(),f.call(null,k,...U);return}if(l()||a){v(),f.call(null,k,...U);return}r<64&&(r*=2);let x;c===1?(c=2,x=0):x=(r+Math.random())*1e3,m(x)}let S=!1;function N(k){S||(S=!0,v(),!d&&(s!==null?(k||(c=2),clearTimeout(s),m(0)):k||(c=1)))}return m(0),i=setTimeout(()=>{a=!0,N(!0)},t),N}function nw(n){n(!1)}/**
|
|
3295
3404
|
* @license
|
|
3296
3405
|
* Copyright 2017 Google LLC
|
|
3297
3406
|
*
|
|
@@ -3306,7 +3415,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3306
3415
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3307
3416
|
* See the License for the specific language governing permissions and
|
|
3308
3417
|
* limitations under the License.
|
|
3309
|
-
*/function
|
|
3418
|
+
*/function rw(n){return n!==void 0}function sw(n){return typeof n=="function"}function iw(n){return typeof n=="object"&&!Array.isArray(n)}function li(n){return typeof n=="string"||n instanceof String}function bd(n){return Aa()&&n instanceof Blob}function Aa(){return typeof Blob<"u"}function Pd(n,e,t,r){if(r<e)throw Ia(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw Ia(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
|
|
3310
3419
|
* @license
|
|
3311
3420
|
* Copyright 2017 Google LLC
|
|
3312
3421
|
*
|
|
@@ -3321,7 +3430,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3321
3430
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3322
3431
|
* See the License for the specific language governing permissions and
|
|
3323
3432
|
* limitations under the License.
|
|
3324
|
-
*/var
|
|
3433
|
+
*/function $n(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function Sd(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const s=e(r)+"="+e(n[r]);t=t+s+"&"}return t=t.slice(0,-1),t}var an;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(an||(an={}));/**
|
|
3325
3434
|
* @license
|
|
3326
3435
|
* Copyright 2022 Google LLC
|
|
3327
3436
|
*
|
|
@@ -3336,7 +3445,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3336
3445
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3337
3446
|
* See the License for the specific language governing permissions and
|
|
3338
3447
|
* limitations under the License.
|
|
3339
|
-
*/function
|
|
3448
|
+
*/function Cd(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
|
|
3340
3449
|
* @license
|
|
3341
3450
|
* Copyright 2017 Google LLC
|
|
3342
3451
|
*
|
|
@@ -3351,7 +3460,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3351
3460
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3352
3461
|
* See the License for the specific language governing permissions and
|
|
3353
3462
|
* limitations under the License.
|
|
3354
|
-
*/class
|
|
3463
|
+
*/class ow{constructor(e,t,r,s,i,a,c,l,d,f,m,v=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=f,this.connectionFactory_=m,this.retry=v,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((R,S)=>{this.resolve_=R,this.reject_=S,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new hi(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const l=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,d)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===an.NO_ERROR,l=i.getStatus();if(!c||Cd(l,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===an.ABORT;r(!1,new hi(!1,null,f));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new hi(d,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(c,c.getResponse());rw(l)?i(l):i()}catch(l){a(l)}else if(c!==null){const l=wa();l.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,l)):a(l)}else if(s.canceled){const l=this.appDelete_?Rd():Id();a(l)}else{const l=wd();a(l)}};this.canceled_?t(!1,new hi(!1,null,!0)):this.backoffId_=tw(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&nw(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class hi{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function aw(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function cw(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function uw(n,e){e&&(n["X-Firebase-GMPID"]=e)}function lw(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function hw(n,e,t,r,s,i,a=!0){const c=Sd(n.urlParams),l=n.url+c,d=Object.assign({},n.headers);return uw(d,e),aw(d,t),cw(d,i),lw(d,r),new ow(l,n.method,d,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a)}/**
|
|
3355
3464
|
* @license
|
|
3356
3465
|
* Copyright 2017 Google LLC
|
|
3357
3466
|
*
|
|
@@ -3366,7 +3475,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3366
3475
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3367
3476
|
* See the License for the specific language governing permissions and
|
|
3368
3477
|
* limitations under the License.
|
|
3369
|
-
*/function
|
|
3478
|
+
*/function dw(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function fw(...n){const e=dw();if(e!==void 0){const t=new e;for(let r=0;r<n.length;r++)t.append(n[r]);return t.getBlob()}else{if(Aa())return new Blob(n);throw new se(te.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function pw(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
|
|
3370
3479
|
* @license
|
|
3371
3480
|
* Copyright 2021 Google LLC
|
|
3372
3481
|
*
|
|
@@ -3381,7 +3490,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3381
3490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3382
3491
|
* See the License for the specific language governing permissions and
|
|
3383
3492
|
* limitations under the License.
|
|
3384
|
-
*/function
|
|
3493
|
+
*/function mw(n){if(typeof atob>"u")throw JT("base-64");return atob(n)}/**
|
|
3385
3494
|
* @license
|
|
3386
3495
|
* Copyright 2017 Google LLC
|
|
3387
3496
|
*
|
|
@@ -3396,7 +3505,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3396
3505
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3397
3506
|
* See the License for the specific language governing permissions and
|
|
3398
3507
|
* limitations under the License.
|
|
3399
|
-
*/const
|
|
3508
|
+
*/const lt={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Ra{constructor(e,t){this.data=e,this.contentType=t||null}}function gw(n,e){switch(n){case lt.RAW:return new Ra(kd(e));case lt.BASE64:case lt.BASE64URL:return new Ra(Nd(n,e));case lt.DATA_URL:return new Ra(yw(e),vw(e))}throw wa()}function kd(n){const e=[];for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<n.length-1&&(n.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const i=r,a=n.charCodeAt(++t);r=65536|(i&1023)<<10|a&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function _w(n){let e;try{e=decodeURIComponent(n)}catch{throw Nr(lt.DATA_URL,"Malformed data URL.")}return kd(e)}function Nd(n,e){switch(n){case lt.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw Nr(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case lt.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw Nr(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=mw(e)}catch(s){throw s.message.includes("polyfill")?s:Nr(n,"Invalid character found")}const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}class Dd{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw Nr(lt.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=Ew(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function yw(n){const e=new Dd(n);return e.base64?Nd(lt.BASE64,e.rest):_w(e.rest)}function vw(n){return new Dd(n).contentType}function Ew(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
|
|
3400
3509
|
* @license
|
|
3401
3510
|
* Copyright 2017 Google LLC
|
|
3402
3511
|
*
|
|
@@ -3411,7 +3520,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3411
3520
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3412
3521
|
* See the License for the specific language governing permissions and
|
|
3413
3522
|
* limitations under the License.
|
|
3414
|
-
*/class
|
|
3523
|
+
*/class Ht{constructor(e,t){let r=0,s="";bd(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(bd(this.data_)){const r=this.data_,s=pw(r,e,t);return s===null?null:new Ht(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new Ht(r,!0)}}static getBlob(...e){if(Aa()){const t=e.map(r=>r instanceof Ht?r.data_:r);return new Ht(fw.apply(null,t))}else{const t=e.map(a=>li(a)?gw(lt.RAW,a).data:a.data_);let r=0;t.forEach(a=>{r+=a.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(a=>{for(let c=0;c<a.length;c++)s[i++]=a[c]}),new Ht(s,!0)}}uploadData(){return this.data_}}/**
|
|
3415
3524
|
* @license
|
|
3416
3525
|
* Copyright 2017 Google LLC
|
|
3417
3526
|
*
|
|
@@ -3426,7 +3535,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3426
3535
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3427
3536
|
* See the License for the specific language governing permissions and
|
|
3428
3537
|
* limitations under the License.
|
|
3429
|
-
*/function
|
|
3538
|
+
*/function Od(n){let e;try{e=JSON.parse(n)}catch{return null}return iw(e)?e:null}/**
|
|
3430
3539
|
* @license
|
|
3431
3540
|
* Copyright 2017 Google LLC
|
|
3432
3541
|
*
|
|
@@ -3441,7 +3550,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3441
3550
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3442
3551
|
* See the License for the specific language governing permissions and
|
|
3443
3552
|
* limitations under the License.
|
|
3444
|
-
*/function
|
|
3553
|
+
*/function Tw(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function ww(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function Vd(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
|
|
3445
3554
|
* @license
|
|
3446
3555
|
* Copyright 2017 Google LLC
|
|
3447
3556
|
*
|
|
@@ -3456,7 +3565,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3456
3565
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3457
3566
|
* See the License for the specific language governing permissions and
|
|
3458
3567
|
* limitations under the License.
|
|
3459
|
-
*/function
|
|
3568
|
+
*/function Iw(n,e){return e}class Ce{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||Iw}}let di=null;function Aw(n){return!li(n)||n.length<2?n:Vd(n)}function Ld(){if(di)return di;const n=[];n.push(new Ce("bucket")),n.push(new Ce("generation")),n.push(new Ce("metageneration")),n.push(new Ce("name","fullPath",!0));function e(i,a){return Aw(a)}const t=new Ce("name");t.xform=e,n.push(t);function r(i,a){return a!==void 0?Number(a):a}const s=new Ce("size");return s.xform=r,n.push(s),n.push(new Ce("timeCreated")),n.push(new Ce("updated")),n.push(new Ce("md5Hash",null,!0)),n.push(new Ce("cacheControl",null,!0)),n.push(new Ce("contentDisposition",null,!0)),n.push(new Ce("contentEncoding",null,!0)),n.push(new Ce("contentLanguage",null,!0)),n.push(new Ce("contentType",null,!0)),n.push(new Ce("metadata","customMetadata",!0)),di=n,di}function Rw(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Be(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function bw(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const a=t[i];r[a.local]=a.xform(r,e[a.server])}return Rw(r,n),r}function Md(n,e,t){const r=Od(e);return r===null?null:bw(n,r,t)}function Pw(n,e,t,r){const s=Od(e);if(s===null||!li(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>{const f=n.bucket,m=n.fullPath,v="/b/"+a(f)+"/o/"+a(m),R=$n(v,t,r),S=Sd({alt:"media",token:d});return R+S})[0]}function Ud(n,e){const t={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(t[i.server]=n[i.local])}return JSON.stringify(t)}class cn{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
|
|
3460
3569
|
* @license
|
|
3461
3570
|
* Copyright 2017 Google LLC
|
|
3462
3571
|
*
|
|
@@ -3471,15 +3580,15 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var q;(functi
|
|
|
3471
3580
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3472
3581
|
* See the License for the specific language governing permissions and
|
|
3473
3582
|
* limitations under the License.
|
|
3474
|
-
*/function
|
|
3583
|
+
*/function Tt(n){if(!n)throw wa()}function ba(n,e){function t(r,s){const i=Md(n,s,e);return Tt(i!==null),i}return t}function Sw(n,e){function t(r,s){const i=Md(n,s,e);return Tt(i!==null),Pw(i,s,n.host,n._protocol)}return t}function Or(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=zT():s=HT():t.getStatus()===402?s=$T(n.bucket):t.getStatus()===403?s=WT(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Pa(n){const e=Or(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=qT(n.path)),i.serverResponse=s.serverResponse,i}return t}function Cw(n,e,t){const r=e.fullServerUrl(),s=$n(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new cn(s,i,ba(n,t),a);return c.errorHandler=Pa(e),c}function kw(n,e,t){const r=e.fullServerUrl(),s=$n(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new cn(s,i,Sw(n,t),a);return c.errorHandler=Pa(e),c}function Nw(n,e){const t=e.fullServerUrl(),r=$n(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function a(l,d){}const c=new cn(r,s,a,i);return c.successCodes=[200,204],c.errorHandler=Pa(e),c}function Dw(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function xd(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=Dw(null,e)),r}function Ow(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let x="";for(let H=0;H<2;H++)x=x+Math.random().toString().slice(2);return x}const l=c();a["Content-Type"]="multipart/related; boundary="+l;const d=xd(e,r,s),f=Ud(d,t),m="--"+l+`\r
|
|
3475
3584
|
Content-Type: application/json; charset=utf-8\r
|
|
3476
3585
|
\r
|
|
3477
|
-
`+
|
|
3478
|
-
--`+
|
|
3479
|
-
Content-Type: `+
|
|
3586
|
+
`+f+`\r
|
|
3587
|
+
--`+l+`\r
|
|
3588
|
+
Content-Type: `+d.contentType+`\r
|
|
3480
3589
|
\r
|
|
3481
|
-
`,
|
|
3482
|
-
--`+
|
|
3590
|
+
`,v=`\r
|
|
3591
|
+
--`+l+"--",R=Ht.getBlob(m,r,v);if(R===null)throw Ad();const S={name:d.fullPath},N=$n(i,n.host,n._protocol),k="POST",U=n.maxUploadRetryTime,$=new cn(N,k,ba(n,t),U);return $.urlParams=S,$.headers=a,$.body=R.uploadData(),$.errorHandler=Or(e),$}class fi{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function Sa(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{Tt(!1)}return Tt(!!t&&(e||["active"]).indexOf(t)!==-1),t}function Vw(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a=xd(e,r,s),c={name:a.fullPath},l=$n(i,n.host,n._protocol),d="POST",f={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},m=Ud(a,t),v=n.maxUploadRetryTime;function R(N){Sa(N);let k;try{k=N.getResponseHeader("X-Goog-Upload-URL")}catch{Tt(!1)}return Tt(li(k)),k}const S=new cn(l,d,R,v);return S.urlParams=c,S.headers=f,S.body=m,S.errorHandler=Or(e),S}function Lw(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(d){const f=Sa(d,["active","final"]);let m=null;try{m=d.getResponseHeader("X-Goog-Upload-Size-Received")}catch{Tt(!1)}m||Tt(!1);const v=Number(m);return Tt(!isNaN(v)),new fi(v,r.size(),f==="final")}const a="POST",c=n.maxUploadRetryTime,l=new cn(t,a,i,c);return l.headers=s,l.errorHandler=Or(e),l}const Fd=256*1024;function Mw(n,e,t,r,s,i,a,c){const l=new fi(0,0);if(a?(l.current=a.current,l.total=a.total):(l.current=0,l.total=r.size()),r.size()!==l.total)throw XT();const d=l.total-l.current;let f=d;s>0&&(f=Math.min(f,s));const m=l.current,v=m+f;let R="";f===0?R="finalize":d===f?R="upload, finalize":R="upload";const S={"X-Goog-Upload-Command":R,"X-Goog-Upload-Offset":`${l.current}`},N=r.slice(m,v);if(N===null)throw Ad();function k(H,he){const J=Sa(H,["active","final"]),T=l.current+f,g=r.size();let _;return J==="final"?_=ba(e,i)(H,he):_=null,new fi(T,g,J==="final",_)}const U="POST",$=e.maxUploadRetryTime,x=new cn(t,U,k,$);return x.headers=S,x.body=N.uploadData(),x.progressCallback=c||null,x.errorHandler=Or(n),x}const Le={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function Ca(n){switch(n){case"running":case"pausing":case"canceling":return Le.RUNNING;case"paused":return Le.PAUSED;case"success":return Le.SUCCESS;case"canceled":return Le.CANCELED;case"error":return Le.ERROR;default:return Le.ERROR}}/**
|
|
3483
3592
|
* @license
|
|
3484
3593
|
* Copyright 2017 Google LLC
|
|
3485
3594
|
*
|
|
@@ -3494,7 +3603,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3494
3603
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3495
3604
|
* See the License for the specific language governing permissions and
|
|
3496
3605
|
* limitations under the License.
|
|
3497
|
-
*/class
|
|
3606
|
+
*/class Uw{constructor(e,t,r){if(sw(e)||t!=null||r!=null)this.next=e,this.error=t??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
|
|
3498
3607
|
* @license
|
|
3499
3608
|
* Copyright 2017 Google LLC
|
|
3500
3609
|
*
|
|
@@ -3509,7 +3618,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3509
3618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3510
3619
|
* See the License for the specific language governing permissions and
|
|
3511
3620
|
* limitations under the License.
|
|
3512
|
-
*/function
|
|
3621
|
+
*/function Hn(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}class xw{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=an.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=an.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=an.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw Dr("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),s!==void 0)for(const i in s)s.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,s[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Dr("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Dr("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Dr("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Dr("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class Fw extends xw{initXhr(){this.xhr_.responseType="text"}}function un(){return new Fw}/**
|
|
3513
3622
|
* @license
|
|
3514
3623
|
* Copyright 2017 Google LLC
|
|
3515
3624
|
*
|
|
@@ -3524,7 +3633,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3524
3633
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3525
3634
|
* See the License for the specific language governing permissions and
|
|
3526
3635
|
* limitations under the License.
|
|
3527
|
-
*/class
|
|
3636
|
+
*/class Bw{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=Ld(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(te.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(Cd(s.status,[]))if(i)s=wd();else{this.sleepTime=Math.max(this.sleepTime*2,jT),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(te.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,r])=>{switch(this._state){case"running":e(t,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,t)=>{const r=Vw(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,un,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,r)=>{const s=Lw(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,un,t,r);this._request=i,i.getPromise().then(a=>{a=a,this._request=void 0,this._updateProgress(a.current),this._needToFetchStatus=!1,a.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=Fd*this._chunkMultiplier,t=new fi(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let a;try{a=Mw(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(l){this._error=l,this._transition("error");return}const c=this._ref.storage._makeRequest(a,un,s,i,!1);this._request=c,c.getPromise().then(l=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(l.current),l.finalized?(this._metadata=l.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){Fd*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=Cw(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,un,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const r=Ow(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,un,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t=this._state==="paused";this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=Id(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=Ca(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const i=new Uw(t||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);t!==-1&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(Ca(this._state)){case Le.SUCCESS:Hn(this._resolve.bind(null,this.snapshot))();break;case Le.CANCELED:case Le.ERROR:const t=this._reject;Hn(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Ca(this._state)){case Le.RUNNING:case Le.PAUSED:e.next&&Hn(e.next.bind(e,this.snapshot))();break;case Le.SUCCESS:e.complete&&Hn(e.complete.bind(e))();break;case Le.CANCELED:case Le.ERROR:e.error&&Hn(e.error.bind(e,this._error))();break;default:e.error&&Hn(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
|
|
3528
3637
|
* @license
|
|
3529
3638
|
* Copyright 2019 Google LLC
|
|
3530
3639
|
*
|
|
@@ -3539,7 +3648,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3539
3648
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3540
3649
|
* See the License for the specific language governing permissions and
|
|
3541
3650
|
* limitations under the License.
|
|
3542
|
-
*/class
|
|
3651
|
+
*/class ln{constructor(e,t){this._service=e,t instanceof Be?this._location=t:this._location=Be.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new ln(e,t)}get root(){const e=new Be(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Vd(this._location.path)}get storage(){return this._service}get parent(){const e=Tw(this._location.path);if(e===null)return null;const t=new Be(this._location.bucket,e);return new ln(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw ZT(e)}}function jw(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new Bw(n,new Ht(e),t)}function qw(n){n._throwIfRoot("getDownloadURL");const e=kw(n.storage,n._location,Ld());return n.storage.makeRequestWithTokens(e,un).then(t=>{if(t===null)throw YT();return t})}function $w(n){n._throwIfRoot("deleteObject");const e=Nw(n.storage,n._location);return n.storage.makeRequestWithTokens(e,un)}function Hw(n,e){const t=ww(n._location.path,e),r=new Be(n._location.bucket,t);return new ln(n.storage,r)}/**
|
|
3543
3652
|
* @license
|
|
3544
3653
|
* Copyright 2017 Google LLC
|
|
3545
3654
|
*
|
|
@@ -3554,7 +3663,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3554
3663
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3555
3664
|
* See the License for the specific language governing permissions and
|
|
3556
3665
|
* limitations under the License.
|
|
3557
|
-
*/function
|
|
3666
|
+
*/function zw(n){return/^[A-Za-z]+:\/\//.test(n)}function Ww(n,e){return new ln(n,e)}function Bd(n,e){if(n instanceof ka){const t=n;if(t._bucket==null)throw QT();const r=new ln(t,t._bucket);return e!=null?Bd(r,e):r}else return e!==void 0?Hw(n,e):n}function Gw(n,e){if(e&&zw(e)){if(n instanceof ka)return Ww(n,e);throw Ia("To use ref(service, url), the first argument must be a Storage instance.")}else return Bd(n,e)}function jd(n,e){const t=e==null?void 0:e[Td];return t==null?null:Be.makeFromBucketSpec(t,n)}function Kw(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:s}=r;s&&(n._overrideAuthToken=typeof s=="string"?s:lc(s,n.app.options.projectId))}class ka{constructor(e,t,r,s,i){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._bucket=null,this._host=Ed,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=FT,this._maxUploadRetryTime=BT,this._requests=new Set,s!=null?this._bucket=Be.makeFromBucketSpec(s,this._host):this._bucket=jd(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Be.makeFromBucketSpec(this._url,e):this._bucket=jd(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Pd("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Pd("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){if(Te(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new ln(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new ew(Rd());{const a=hw(e,this._appId,r,s,t,this._firebaseVersion,i);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const qd="@firebase/storage",$d="0.13.6";/**
|
|
3558
3667
|
* @license
|
|
3559
3668
|
* Copyright 2020 Google LLC
|
|
3560
3669
|
*
|
|
@@ -3569,7 +3678,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3569
3678
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3570
3679
|
* See the License for the specific language governing permissions and
|
|
3571
3680
|
* limitations under the License.
|
|
3572
|
-
*/const
|
|
3681
|
+
*/const Hd="storage";function Qw(n,e,t){return n=X(n),jw(n,e,t)}function Xw(n){return n=X(n),qw(n)}function Yw(n){return n=X(n),$w(n)}function Na(n,e){return n=X(n),Gw(n,e)}function Jw(n=ts(),e){n=X(n);const r=nr(n,Hd).getImmediate({identifier:e}),s=Li("storage");return s&&zd(r,...s),r}function zd(n,e,t,r={}){Kw(n,e,t,r)}function Zw(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new ka(t,r,s,e,Xt)}function eI(){bt(new ht(Hd,Zw,"PUBLIC").setMultipleInstances(!0)),qe(qd,$d,""),qe(qd,$d,"esm2017")}eI();/**
|
|
3573
3682
|
* @license
|
|
3574
3683
|
* Copyright 2017 Google LLC
|
|
3575
3684
|
*
|
|
@@ -3584,7 +3693,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3584
3693
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3585
3694
|
* See the License for the specific language governing permissions and
|
|
3586
3695
|
* limitations under the License.
|
|
3587
|
-
*/const
|
|
3696
|
+
*/const tI="type.googleapis.com/google.protobuf.Int64Value",nI="type.googleapis.com/google.protobuf.UInt64Value";function Wd(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function pi(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>pi(e));if(typeof n=="function"||typeof n=="object")return Wd(n,e=>pi(e));throw new Error("Data cannot be encoded in JSON: "+n)}function zn(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case tI:case nI:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>zn(e)):typeof n=="function"||typeof n=="object"?Wd(n,e=>zn(e)):n}/**
|
|
3588
3697
|
* @license
|
|
3589
3698
|
* Copyright 2020 Google LLC
|
|
3590
3699
|
*
|
|
@@ -3599,7 +3708,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3599
3708
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3600
3709
|
* See the License for the specific language governing permissions and
|
|
3601
3710
|
* limitations under the License.
|
|
3602
|
-
*/const
|
|
3711
|
+
*/const Da="functions";/**
|
|
3603
3712
|
* @license
|
|
3604
3713
|
* Copyright 2017 Google LLC
|
|
3605
3714
|
*
|
|
@@ -3614,7 +3723,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3614
3723
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3615
3724
|
* See the License for the specific language governing permissions and
|
|
3616
3725
|
* limitations under the License.
|
|
3617
|
-
*/const
|
|
3726
|
+
*/const Gd={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Me extends ze{constructor(e,t,r){super(`${Da}/${e}`,t||""),this.details=r,Object.setPrototypeOf(this,Me.prototype)}}function rI(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function mi(n,e){let t=rI(n),r=t,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!Gd[a])return new Me("internal","internal");t=Gd[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=zn(s))}}catch{}return t==="ok"?null:new Me(t,r,s)}/**
|
|
3618
3727
|
* @license
|
|
3619
3728
|
* Copyright 2017 Google LLC
|
|
3620
3729
|
*
|
|
@@ -3629,7 +3738,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3629
3738
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3630
3739
|
* See the License for the specific language governing permissions and
|
|
3631
3740
|
* limitations under the License.
|
|
3632
|
-
*/class
|
|
3741
|
+
*/class sI{constructor(e,t,r,s){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,Te(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=t.getImmediate({optional:!0}),this.messaging=r.getImmediate({optional:!0}),this.auth||t.get().then(i=>this.auth=i,()=>{}),this.messaging||r.get().then(i=>this.messaging=i,()=>{}),this.appCheck||s==null||s.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:s}}}/**
|
|
3633
3742
|
* @license
|
|
3634
3743
|
* Copyright 2017 Google LLC
|
|
3635
3744
|
*
|
|
@@ -3644,7 +3753,8 @@ Content-Type: `+u.contentType+`\r
|
|
|
3644
3753
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3645
3754
|
* See the License for the specific language governing permissions and
|
|
3646
3755
|
* limitations under the License.
|
|
3647
|
-
*/const
|
|
3756
|
+
*/const Oa="us-central1",iI=/^data: (.*?)(?:\n|$)/;function oI(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Me("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class aI{constructor(e,t,r,s,i=Oa,a=(...c)=>fetch(...c)){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new sI(e,t,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=Oa}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function cI(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function uI(n,e,t){const r=s=>hI(n,e,s,{});return r.stream=(s,i)=>fI(n,e,s,i),r}async function lI(n,e,t,r){t["Content-Type"]="application/json";let s;try{s=await r(n,{method:"POST",body:JSON.stringify(e),headers:t})}catch{return{status:0,json:null}}let i=null;try{i=await s.json()}catch{}return{status:s.status,json:i}}async function Kd(n,e){const t={},r=await n.contextProvider.getContext(e.limitedUseAppCheckTokens);return r.authToken&&(t.Authorization="Bearer "+r.authToken),r.messagingToken&&(t["Firebase-Instance-ID-Token"]=r.messagingToken),r.appCheckToken!==null&&(t["X-Firebase-AppCheck"]=r.appCheckToken),t}function hI(n,e,t,r){const s=n._url(e);return dI(n,s,t,r)}async function dI(n,e,t,r){t=pi(t);const s={data:t},i=await Kd(n,r),a=r.timeout||7e4,c=oI(a),l=await Promise.race([lI(e,s,i,n.fetchImpl),c.promise,n.cancelAllRequests]);if(c.cancel(),!l)throw new Me("cancelled","Firebase Functions instance was deleted.");const d=mi(l.status,l.json);if(d)throw d;if(!l.json)throw new Me("internal","Response is not valid JSON object.");let f=l.json.data;if(typeof f>"u"&&(f=l.json.result),typeof f>"u")throw new Me("internal","Response is missing data field.");return{data:zn(f)}}function fI(n,e,t,r){const s=n._url(e);return pI(n,s,t,r||{})}async function pI(n,e,t,r){var s;t=pi(t);const i={data:t},a=await Kd(n,r);a["Content-Type"]="application/json",a.Accept="text/event-stream";let c;try{c=await n.fetchImpl(e,{method:"POST",body:JSON.stringify(i),headers:a,signal:r==null?void 0:r.signal})}catch(R){if(R instanceof Error&&R.name==="AbortError"){const N=new Me("cancelled","Request was cancelled.");return{data:Promise.reject(N),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(N)}}}}}}const S=mi(0,null);return{data:Promise.reject(S),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(S)}}}}}}let l,d;const f=new Promise((R,S)=>{l=R,d=S});(s=r==null?void 0:r.signal)===null||s===void 0||s.addEventListener("abort",()=>{const R=new Me("cancelled","Request was cancelled.");d(R)});const m=c.body.getReader(),v=mI(m,l,d,r==null?void 0:r.signal);return{stream:{[Symbol.asyncIterator](){const R=v.getReader();return{async next(){const{value:S,done:N}=await R.read();return{value:S,done:N}},async return(){return await R.cancel(),{done:!0,value:void 0}}}}},data:f}}function mI(n,e,t,r){const s=(a,c)=>{const l=a.match(iI);if(!l)return;const d=l[1];try{const f=JSON.parse(d);if("result"in f){e(zn(f.result));return}if("message"in f){c.enqueue(zn(f.message));return}if("error"in f){const m=mi(0,f);c.error(m),t(m);return}}catch(f){if(f instanceof Me){c.error(f),t(f);return}}},i=new TextDecoder;return new ReadableStream({start(a){let c="";return l();async function l(){if(r!=null&&r.aborted){const d=new Me("cancelled","Request was cancelled");return a.error(d),t(d),Promise.resolve()}try{const{value:d,done:f}=await n.read();if(f){c.trim()&&s(c.trim(),a),a.close();return}if(r!=null&&r.aborted){const v=new Me("cancelled","Request was cancelled");a.error(v),t(v),await n.cancel();return}c+=i.decode(d,{stream:!0});const m=c.split(`
|
|
3757
|
+
`);c=m.pop()||"";for(const v of m)v.trim()&&s(v.trim(),a);return l()}catch(d){const f=d instanceof Me?d:mi(0,null);a.error(f),t(f)}}},cancel(){return n.cancel()}})}const Qd="@firebase/functions",Xd="0.12.2";/**
|
|
3648
3758
|
* @license
|
|
3649
3759
|
* Copyright 2019 Google LLC
|
|
3650
3760
|
*
|
|
@@ -3659,7 +3769,7 @@ Content-Type: `+u.contentType+`\r
|
|
|
3659
3769
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3660
3770
|
* See the License for the specific language governing permissions and
|
|
3661
3771
|
* limitations under the License.
|
|
3662
|
-
*/const
|
|
3772
|
+
*/const gI="auth-internal",_I="app-check-internal",yI="messaging-internal";function vI(n){const e=(t,{instanceIdentifier:r})=>{const s=t.getProvider("app").getImmediate(),i=t.getProvider(gI),a=t.getProvider(yI),c=t.getProvider(_I);return new aI(s,i,a,c,r)};bt(new ht(Da,e,"PUBLIC").setMultipleInstances(!0)),qe(Qd,Xd,n),qe(Qd,Xd,"esm2017")}/**
|
|
3663
3773
|
* @license
|
|
3664
3774
|
* Copyright 2020 Google LLC
|
|
3665
3775
|
*
|
|
@@ -3674,5 +3784,5 @@ Content-Type: `+u.contentType+`\r
|
|
|
3674
3784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3675
3785
|
* See the License for the specific language governing permissions and
|
|
3676
3786
|
* limitations under the License.
|
|
3677
|
-
*/function
|
|
3787
|
+
*/function EI(n=ts(),e=Oa){const r=nr(X(n),Da).getImmediate({identifier:e}),s=Li("functions");return s&&Yd(r,...s),r}function Yd(n,e,t){cI(X(n),e,t)}function TI(n,e,t){return uI(X(n),e)}vI();const Ye=class Ye{static setFirebaseConfig(e){Ye._firebaseConfig=e}static useEmulator(e){this._emulatorConfig={...Ye.defaultEmulatorConfig,emulate:!0,...e}}static get emulator(){return this._emulatorConfig}constructor(){if(!Ye._firebaseConfig)throw new Error("You should set a firebase config object before using Firebase");this._firebaseApp=vc(Ye._firebaseConfig)}static get instance(){return this._instance||(this._instance=new Ye)}firestore(){return Ny(this._firebaseApp)}storage(){return Jw(this._firebaseApp)}auth(){return UT(this._firebaseApp)}functions(){return EI(this._firebaseApp,Ye._region)}static setRegion(e){this._region=e}};Ye.defaultEmulatorConfig={host:"localhost",firestorePort:8080,storagePort:9199,authPort:9099,functionsPort:5001,emulate:!1},Ye._emulatorConfig=Ye.defaultEmulatorConfig;let q=Ye;class wI extends rn{constructor(e){var t;if(super(),this._lastLimit=0,e&&q.useEmulator(e),(t=q.emulator)!=null&&t.emulate){const{host:r,firestorePort:s}=q.emulator;Ll(q.instance.firestore(),r,s)}}findById(e,t){const r=q.instance.firestore();return new Promise(async s=>{try{const i=await Jy(Bs(r,t,e));s(i.data())}catch(i){return console.log(i),null}})}save(e){const t=q.instance.firestore(),r=sv(t);return Object.entries(e).forEach(([s,i])=>{i==null||i.forEach(a=>{const c=Bs(t,s,a.id);r.set(c,a)})}),r.commit()}find(e,t){const r=this.queryObjectToQueryConstraints(e,t);return this.getFromQuery(r)}async count(e,t){const r=this.queryObjectToQueryConstraints(e,t);return(await tv(r)).data().count}delete(e,t){const r=q.instance.firestore();return ev(Bs(r,t,e))}next(e){if(!this._lastConstraints||!this._lastCollectionName)throw new Error("You should perform a query prior to using method next");const t=q.instance.firestore();this._lastLimit=e||this._lastLimit;const r=this._lastConstraints.nonFilterConstraints.concat(Ql(this._lastLimit),Wy(this._lastDocRetrieved));return this.getFromQuery(Gl(Ml(t,this._lastCollectionName),...r))}onCollectionChange(e,t,r){const s=this.queryObjectToQueryConstraints(e,t);return nh(s,i=>{i.docChanges().forEach(a=>{r({type:a.type==="added"?"create":a.type==="modified"?"update":"delete",after:a.doc.data(),before:void 0,params:{}})})})}onDocumentChange(e,t,r){const s=q.instance.firestore();return nh(Bs(s,e,t),i=>{r({type:"update",before:void 0,after:i.data(),params:{}})})}queryObjectToQueryConstraints(e,t){var c;const r=q.instance.firestore(),s=[],i=[],a=[];return rn.toPropertyPathOperations(e.operations).forEach(l=>{const d=this.toFirebaseOperator(l.operator);l.aggregate?i.push(Kl(l.property,d,l.value)):s.push(Kl(l.property,d,l.value))}),(c=e.sort)!=null&&c.propertyName&&a.push(zy(e.sort.propertyName,e.sort.order)),this._lastConstraints={orConstraints:i,andConstraints:s,nonFilterConstraints:a},this._lastCollectionName=t,e.limit&&(this._lastLimit=e.limit,a.push(Ql(e.limit))),Gl(Ml(r,t),$y(...i,Hy(...s)),...a)}toFirebaseOperator(e){switch(e){case"==":case"!=":case"<":case"<=":case">":case">=":return e;case"contains":return"array-contains";case"containsAny":return"array-contains-any";default:return e}}getFromQuery(e){return new Promise(async t=>{const r=await Zy(e);this._lastDocRetrieved=r.docs[r.docs.length-1],t(r.docs.map(s=>s.data()))})}}var II=Object.getOwnPropertyDescriptor,AI=(n,e,t,r)=>{for(var s=r>1?void 0:r?II(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=a(s)||s);return s};xe.FirebaseCloudStorage=class extends Mn{constructor(e){var t;if(super(),e&&q.useEmulator(e),(t=q.emulator)!=null&&t.emulate){const{host:r,storagePort:s}=q.emulator;zd(q.instance.storage(),r,s)}}save(e,t,r){const s=q.instance.storage();return new Promise((i,a)=>{if(this._uploadTask=Qw(Na(s,e),t),r)var c=this._uploadTask.on("state_changed",l=>{r(l.bytesTransferred,l.totalBytes)},null,()=>c());this._uploadTask.then(()=>i(e)).catch(l=>a(l))})}getUrl(e){if(!e)return Promise.reject("needs a reference");const t=q.instance.storage();return Xw(Na(t,e))}uploadControl(){if(!this._uploadTask)throw new Error("You should call save() before uploadControl()");return{cancel:()=>{var e;return(e=this._uploadTask)==null?void 0:e.cancel()},pause:()=>{var e;return(e=this._uploadTask)==null?void 0:e.pause()},resume:()=>{var e;return(e=this._uploadTask)==null?void 0:e.resume()},onProgress:e=>{var t;return(t=this._uploadTask)==null?void 0:t.on("state_changed",r=>{e&&e(r.bytesTransferred,r.totalBytes)})}}}delete(e){const t=q.instance.storage();return Yw(Na(t,e))}},xe.FirebaseCloudStorage=AI([hh("FirebaseCloudStorage",()=>new xe.FirebaseCloudStorage)],xe.FirebaseCloudStorage);const Jd={twitter:()=>new Xe,facebook:()=>new at,google:()=>new ct};class Va extends dh{constructor(e){var t;if(super(),this.credentialProviders={},e&&q.useEmulator(e),(t=q.emulator)!=null&&t.emulate){const{host:r,authPort:s}=q.emulator;if(!r||!s)throw new Error("You should define a host and an auth emulator port to use the emulator");qh(q.instance.auth(),`http://${r}:${s}`)}this.registerCredentialProviders()}signUp(e){const{authProvider:t,verificationLink:r}=e;return t.slice(0,5)==="email"?new Promise(async(s,i)=>{try{const a=this.credentialProviders["email-sign-up"];if(!a)throw new Error(`The provider ${t} is not registered`);const c=await a(e);e.name&&await RE(c.user,{displayName:e.name}),r&&await Zh(c.user,{url:r}),s(await this.toUserCredentials(c.user))}catch(a){i({code:Qs(a.code.slice(5)),message:a.message})}}):this.login(e)}login(e){const{authProvider:t}=e;return new Promise(async(r,s)=>{try{const i=this.credentialProviders[t];if(!i)throw new Error(`The provider ${t} is not registered`);const a=await i(e);r(await this.toUserCredentials(a.user))}catch(i){s({code:i.code===400?"missingPassword":Qs(i.code.slice(5)),message:i.message})}})}logout(){return q.instance.auth().signOut()}resetEmailPassword(e){return new Promise(async(t,r)=>{try{await wE(q.instance.auth(),e),t()}catch(s){r({code:Qs(s.code.slice(5)),message:s.message})}})}resendVerificationEmail(e,t,r){return new Promise(async(s,i)=>{try{await Jh(q.instance.auth(),e,t);const a=q.instance.auth().currentUser;if(!a){i({code:"userNotFound",message:"There is no logged in user"});return}await Zh(a,{url:r}),s()}catch(a){i({code:Qs(a.code.slice(5)),message:r})}})}refreshToken(){var e;return(e=q.instance.auth().currentUser)==null?void 0:e.getIdToken(!0)}onAuthStateChange(e){q.instance.auth().onAuthStateChanged(async t=>{e(t?await this.toUserCredentials(t):void 0)})}linkAdditionalProvider(e){const t=Jd[e](),r=q.instance.auth().currentUser;if(!r)throw new Error("There is no logged in user");return hd(r,t)}unlinkProvider(e){const{currentUser:t}=q.instance.auth();if(!t)throw new Error("There is no logged in user");return t.providerData,gE(t,Jd[e]().providerId)}async toUserCredentials(e){if(!e)throw new Error("The user in user credentials is not defined");const t=(await e.getIdTokenResult()).claims;return Va.convertCredentials(e,t)}static convertCredentials(e,t){return{id:e.uid,email:e.email??"",name:e.displayName??void 0,pictureUrl:e.photoURL??void 0,phoneNumber:e.phoneNumber??void 0,emailVerified:e.emailVerified,customData:{...t},lastLogin:Date.now(),creationDate:e.metadata.creationTime?new Date(e.metadata.creationTime).getTime():void 0}}registerCredentialProvider(e,t){this.credentialProviders[e]=t}registerCredentialProviders(){this.registerCredentialProvider("email-sign-up",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return IE(q.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("email",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return Jh(q.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("google",()=>va(q.instance.auth(),new ct)),this.registerCredentialProvider("facebook",()=>va(q.instance.auth(),new at)),this.registerCredentialProvider("twitter",()=>va(q.instance.auth(),new Xe)),this.registerCredentialProvider("link-twitter",()=>{const e=q.instance.auth().currentUser;if(!e)throw new Error("There is no logged in user");return hd(e,new Xe)}),this.registerCredentialProvider("anonymous",()=>mE(q.instance.auth()))}}class RI{constructor(e,t){var r;if(e&&q.setRegion(e),t&&q.useEmulator(t),(r=q.emulator)!=null&&r.emulate){const{host:s,functionsPort:i}=q.emulator;Yd(q.instance.functions(),s,i)}}retrieveFunction(e){return TI(q.instance.functions(),e)}async callFunction(e,t){return(await e(t)).data}}xe.FirebaseAuth=Va,xe.FirebaseCloudFunctions=RI,xe.FirebaseDatasource=wI,xe.FirebaseHelper=q,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|
|
3678
3788
|
//# sourceMappingURL=entropic-bond-firebase.umd.cjs.map
|