PageSourceSearch

https://seodoon-church-admin.web.app/assets/vendor-firebase-Da9KY1q_.js

js seodoon-church-admin.web.app collected 2026-10-03 12:35:23 UTC 510,336 bytes, 3,670 lines download raw bytes

vendor: 4,632 bytes, lines 1-35
1var wc={};/**
2 * @license
3 * Copyright 2017 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *   http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */const Gu=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},yf=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++],u=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|u&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("")},Qu={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,u=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,p=i>>2,y=(i&3)<<4|u>>4;let I=(u&15)<<2|d>>6,P=d&63;l||(P=64,a||(I=64)),r.push(t[p],t[y],t[I],t[P])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Gu(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):yf(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++)],u=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const y=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||u==null||d==null||y==null)throw new vf;const I=i<<2|u>>4;if(r.push(I),d!==64){const P=u<<4&240|d>>2;if(r.push(P),y!==64){const k=d<<6&192|y;r.push(k)}}}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 vf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Ef=function(n){const e=Gu(n);return Qu.encodeByteArray(e,!0)},fs=function(n){return Ef(n).replace(/\./g,"")},Yu=function(n){try{return Qu.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
17 * @license
18 * Copyright 2022 Google LLC
19 *
20 * Licensed under the Apache License, Version 2.0 (the "License");
21 * you may not use this file except in compliance with the License.
22 * You may obtain a copy of the License at
23 *
24 *   http://www.apache.org/licenses/LICENSE-2.0
25 *
26 * Unless required by applicable law or agreed to in writing, software
27 * distributed under the License is distributed on an "AS IS" BASIS,
28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 * See the License for the specific language governing permissions and
30 * limitations under the License.
31 */function Tf(){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.")}/**
32 * @license
33 * Copyright 2022 Google LLC
34 *
35 * Licensed under the Apache License, Version 2.0 (the "License");
36 * you may not use this file except in compliance with the License.
37 * You may obtain a copy of the License at
38 *
39 *   http://www.apache.org/licenses/LICENSE-2.0
40 *
41 * Unless required by applicable law or agreed to in writing, software
42 * distributed under the License is distributed on an "AS IS" BASIS,
43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44 * See the License for the specific language governing permissions and
45 * limitations under the License.
46 */const If=()=>Tf().__FIREBASE_DEFAULTS__,wf=()=>{if(typeof process>"u"||typeof wc>"u")return;const n=wc.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Af=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Yu(n[1]);return e&&JSON.parse(e)},Cs=()=>{try{return If()||wf()||Af()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Xu=n=>{var e,t;return(t=(e=Cs())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Rf=n=>{const e=Xu(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]},Ju=()=>{var n;return(n=Cs())===null||n===void 0?void 0:n.config},Zu=n=>{var e;return(e=Cs())===null||e===void 0?void 0:e[`_${n}`]};/**
47 * @license
48 * Copyright 2017 Google LLC
49 *
50 * Licensed under the Apache License, Version 2.0 (the "License");
51 * you may not use this file except in compliance with the License.
52 * You may obtain a copy of the License at
53 *
54 *   http://www.apache.org/licenses/LICENSE-2.0
55 *
56 * Unless required by applicable law or agreed to in writing, software
57 * distributed under the License is distributed on an "AS IS" BASIS,
58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59 * See the License for the specific language governing permissions and
60 * limitations under the License.
61 */class Pf{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))}}}/**
62 * @license
63 * Copyright 2021 Google LLC
64 *
65 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
67 * You may obtain a copy of the License at
68 *
69 *   http://www.apache.org/licenses/LICENSE-2.0
70 *
71 * Unless required by applicable law or agreed to in writing, software
72 * distributed under the License is distributed on an "AS IS" BASIS,
73 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74 * See the License for the specific language governing permissions and
75 * limitations under the License.
76 */function bf(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[fs(JSON.stringify(t)),fs(JSON.stringify(a)),""].join(".")}/**
77 * @license
78 * Copyright 2017 Google LLC
79 *
80 * Licensed under the Apache License, Version 2.0 (the "License");
81 * you may not use this file except in compliance with the License.
82 * You may obtain a copy of the License at
83 *
84 *   http://www.apache.org/licenses/LICENSE-2.0
85 *
86 * Unless required by applicable law or agreed to in writing, software
87 * distributed under the License is distributed on an "AS IS" BASIS,
88 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89 * See the License for the specific language governing permissions and
90 * limitations under the License.
91 */function we(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Sf(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(we())}function Cf(){var n;const e=(n=Cs())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;
91if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function kf(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Nf(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Df(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Vf(){const n=we();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Of(){return!Cf()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Lf(){try{return typeof indexedDB=="object"}catch{return!1}}function Mf(){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)}})}function iI(){return!(typeof navigator>"u"||!navigator.cookieEnabled)}/**
92 * @license
93 * Copyright 2017 Google LLC
94 *
95 * Licensed under the Apache License, Version 2.0 (the "License");
96 * you may not use this file except in compliance with the License.
97 * You may obtain a copy of the License at
98 *
99 *   http://www.apache.org/licenses/LICENSE-2.0
100 *
101 * Unless required by applicable law or agreed to in writing, software
102 * distributed under the License is distributed on an "AS IS" BASIS,
103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104 * See the License for the specific language governing permissions and
105 * limitations under the License.
106 */const xf="FirebaseError";class Ue extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=xf,Object.setPrototypeOf(this,Ue.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,mn.prototype.create)}}class mn{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?Uf(i,r):"Error",u=`${this.serviceName}: ${a} (${s}).`;return new Ue(s,u,r)}}function Uf(n,e){return n.replace(Ff,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Ff=/\{\$([^}]+)}/g;function Bf(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function on(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(Ac(i)&&Ac(a)){if(!on(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function Ac(n){return n!==null&&typeof n=="object"}/**
107 * @license
108 * Copyright 2017 Google LLC
109 *
110 * Licensed under the Apache License, Version 2.0 (the "License");
111 * you may not use this file except in compliance with the License.
112 * You may obtain a copy of the License at
113 *
114 *   http://www.apache.org/licenses/LICENSE-2.0
115 *
116 * Unless required by applicable law or agreed to in writing, software
117 * distributed under the License is distributed on an "AS IS" BASIS,
118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119 * See the License for the specific language governing permissions and
120 * limitations under the License.
121 */function mr(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 Hn(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Wn(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function qf(n,e){const t=new jf(n,e);return t.subscribe.bind(t)}class jf{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.");$f(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Ti),s.error===void 0&&(s.error=Ti),s.complete===void 0&&(s.complete=Ti);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(()=>
121{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 $f(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 Ti(){}/**
122 * @license
123 * Copyright 2021 Google LLC
124 *
125 * Licensed under the Apache License, Version 2.0 (the "License");
126 * you may not use this file except in compliance with the License.
127 * You may obtain a copy of the License at
128 *
129 *   http://www.apache.org/licenses/LICENSE-2.0
130 *
131 * Unless required by applicable law or agreed to in writing, software
132 * distributed under the License is distributed on an "AS IS" BASIS,
133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134 * See the License for the specific language governing permissions and
135 * limitations under the License.
136 */function Y(n){return n&&n._delegate?n._delegate:n}class ze{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}}/**
137 * @license
138 * Copyright 2019 Google LLC
139 *
140 * Licensed under the Apache License, Version 2.0 (the "License");
141 * you may not use this file except in compliance with the License.
142 * You may obtain a copy of the License at
143 *
144 *   http://www.apache.org/licenses/LICENSE-2.0
145 *
146 * Unless required by applicable law or agreed to in writing, software
147 * distributed under the License is distributed on an "AS IS" BASIS,
148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149 * See the License for the specific language governing permissions and
150 * limitations under the License.
151 */const Nt="[DEFAULT]";/**
152 * @license
153 * Copyright 2019 Google LLC
154 *
155 * Licensed under the Apache License, Version 2.0 (the "License");
156 * you may not use this file except in compliance with the License.
157 * You may obtain a copy of the License at
158 *
159 *   http://www.apache.org/licenses/LICENSE-2.0
160 *
161 * Unless required by applicable law or agreed to in writing, software
162 * distributed under the License is distributed on an "AS IS" BASIS,
163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164 * See the License for the specific language governing permissions and
165 * limitations under the License.
166 */class zf{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 Pf;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(Wf(e))try{this.getOrInitializeService({instanceIdentifier:Nt})}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=Nt){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=Nt){return this.instances.has(e)}getOptions(e=Nt){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 u=this.normalizeInstanceIdentifier(i);r===u&&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:Hf(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=Nt){return this.component?this.component.multipleInstances?e:Nt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Hf(n){return n===Nt?void 0:n}function Wf(n){return n.instantiationMode==="EAGER"}/**
167 * @license
168 * Copyright 2019 Google LLC
169 *
170 * Licensed under the Apache License, Version 2.0 (the "License");
171 * you may not use this file except in compliance with the License.
172 * You may obtain a copy of the License at
173 *
174 *   http://www.apache.org/licenses/LICENSE-2.0
175 *
176 * Unless required by applicable law or agreed to in writing, software
177 * distributed under the License is distributed on an "AS IS" BASIS,
178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 * See the License for the specific language governing permissions and
180 * limitations under the License.
181 */class Kf{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 zf(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
182 * @license
183 * Copyright 2017 Google LLC
184 *
185 * Licensed under the Apache License, Version 2.0 (the "License");
186 * you may not use this file except in compliance with the License.
187 * You may obtain a copy of the License at
188 *
189 *   http://www.apache.org/licenses/LICENSE-2.0
190 *
191 * Unless required by applicable law or agreed to in writing, software
192 * distributed under the License is distributed on an "AS IS" BASIS,
193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194 * See the License for the specific language governing permissions and
195 * limitations under the License.
196 */var H;(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"})(H||(H={}));const Gf={debug:H.DEBUG,verbose:H.VERBOSE,info:H.INFO,warn:H.WARN,error:H.ERROR,silent:H.SILENT},Qf=H.INFO,Yf={[H.DEBUG]:"log",[H.VERBOSE]:"log",[H.INFO]:"info",[H.WARN]:"warn",[H.ERROR]:"error"},Xf=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Yf[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 uo{constructor(e){this.name=e,this._logLevel=Qf,this._logHandler=Xf,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in H))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Gf[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,H.DEBUG,...e),this._logHandler(this,H.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,H.VERBOSE,...e),this._logHandler(this,H.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,H.INFO,...e),this._logHandler(this,H.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,H.WARN,...e),this._logHandler(this,H.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,H.ERROR,...e),this._logHandler(this,H.ERROR,...e)}}const Jf=(n,e)=>e.some(t=>n instanceof t);let Rc,Pc;function Zf(){return Rc||(Rc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ep(){return Pc||(Pc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const el=new WeakMap,xi=new WeakMap,tl=new WeakMap,Ii=new WeakMap,lo=new WeakMap;function tp(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",a)},i=()=>{t(et(n.result)),s()},a=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&el.set(t,n)}).catch(()=>{}),lo.set(e,n),e}function np(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 Ui={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return xi.get(n);if(e==="objectStoreNames")return n.objectStoreNames||tl.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return et(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 rp(n){Ui=n(Ui)}
196function sp(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(wi(this),e,...t);return tl.set(r,e.sort?e.sort():[e]),et(r)}:ep().includes(n)?function(...e){return n.apply(wi(this),e),et(el.get(this))}:function(...e){return et(n.apply(wi(this),e))}}function ip(n){return typeof n=="function"?sp(n):(n instanceof IDBTransaction&&np(n),Jf(n,Zf())?new Proxy(n,Ui):n)}function et(n){if(n instanceof IDBRequest)return tp(n);if(Ii.has(n))return Ii.get(n);const e=ip(n);return e!==n&&(Ii.set(n,e),lo.set(e,n)),e}const wi=n=>lo.get(n);function nl(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(n,e),u=et(a);return r&&a.addEventListener("upgradeneeded",l=>{r(et(a.result),l.oldVersion,l.newVersion,et(a.transaction),l)}),t&&a.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),u.then(l=>{i&&l.addEventListener("close",()=>i()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),u}function oI(n,{blocked:e}={}){const t=indexedDB.deleteDatabase(n);return e&&t.addEventListener("blocked",r=>e(r.oldVersion,r)),et(t).then(()=>{})}const op=["get","getKey","getAll","getAllKeys","count"],ap=["put","add","delete","clear"],Ai=new Map;function bc(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Ai.get(e))return Ai.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=ap.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||op.includes(t)))return;const i=async function(a,...u){const l=this.transaction(a,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(u.shift())),(await Promise.all([d[t](...u),s&&l.done]))[0]};return Ai.set(e,i),i}rp(n=>({...n,get:(e,t,r)=>bc(e,t)||n.get(e,t,r),has:(e,t)=>!!bc(e,t)||n.has(e,t)}));/**
197 * @license
198 * Copyright 2019 Google LLC
199 *
200 * Licensed under the Apache License, Version 2.0 (the "License");
201 * you may not use this file except in compliance with the License.
202 * You may obtain a copy of the License at
203 *
204 *   http://www.apache.org/licenses/LICENSE-2.0
205 *
206 * Unless required by applicable law or agreed to in writing, software
207 * distributed under the License is distributed on an "AS IS" BASIS,
208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209 * See the License for the specific language governing permissions and
210 * limitations under the License.
211 */class cp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(up(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function up(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Fi="@firebase/app",Sc="0.10.13";/**
212 * @license
213 * Copyright 2019 Google LLC
214 *
215 * Licensed under the Apache License, Version 2.0 (the "License");
216 * you may not use this file except in compliance with the License.
217 * You may obtain a copy of the License at
218 *
219 *   http://www.apache.org/licenses/LICENSE-2.0
220 *
221 * Unless required by applicable law or agreed to in writing, software
222 * distributed under the License is distributed on an "AS IS" BASIS,
223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224 * See the License for the specific language governing permissions and
225 * limitations under the License.
226 */const nt=new uo("@firebase/app"),lp="@firebase/app-compat",hp="@firebase/analytics-compat",dp="@firebase/analytics",fp="@firebase/app-check-compat",pp="@firebase/app-check",mp="@firebase/auth",gp="@firebase/auth-compat",_p="@firebase/database",yp="@firebase/data-connect",vp="@firebase/database-compat",Ep="@firebase/functions",Tp="@firebase/functions-compat",Ip="@firebase/installations",wp="@firebase/installations-compat",Ap="@firebase/messaging",Rp="@firebase/messaging-compat",Pp="@firebase/performance",bp="@firebase/performance-compat",Sp="@firebase/remote-config",Cp="@firebase/remote-config-compat",kp="@firebase/storage",Np="@f
226irebase/storage-compat",Dp="@firebase/firestore",Vp="@firebase/vertexai-preview",Op="@firebase/firestore-compat",Lp="firebase",Mp="10.14.1";/**
227 * @license
228 * Copyright 2019 Google LLC
229 *
230 * Licensed under the Apache License, Version 2.0 (the "License");
231 * you may not use this file except in compliance with the License.
232 * You may obtain a copy of the License at
233 *
234 *   http://www.apache.org/licenses/LICENSE-2.0
235 *
236 * Unless required by applicable law or agreed to in writing, software
237 * distributed under the License is distributed on an "AS IS" BASIS,
238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239 * See the License for the specific language governing permissions and
240 * limitations under the License.
241 */const Bi="[DEFAULT]",xp={[Fi]:"fire-core",[lp]:"fire-core-compat",[dp]:"fire-analytics",[hp]:"fire-analytics-compat",[pp]:"fire-app-check",[fp]:"fire-app-check-compat",[mp]:"fire-auth",[gp]:"fire-auth-compat",[_p]:"fire-rtdb",[yp]:"fire-data-connect",[vp]:"fire-rtdb-compat",[Ep]:"fire-fn",[Tp]:"fire-fn-compat",[Ip]:"fire-iid",[wp]:"fire-iid-compat",[Ap]:"fire-fcm",[Rp]:"fire-fcm-compat",[Pp]:"fire-perf",[bp]:"fire-perf-compat",[Sp]:"fire-rc",[Cp]:"fire-rc-compat",[kp]:"fire-gcs",[Np]:"fire-gcs-compat",[Dp]:"fire-fst",[Op]:"fire-fst-compat",[Vp]:"fire-vertex","fire-js":"fire-js",[Lp]:"fire-js-all"};/**
242 * @license
243 * Copyright 2019 Google LLC
244 *
245 * Licensed under the Apache License, Version 2.0 (the "License");
246 * you may not use this file except in compliance with the License.
247 * You may obtain a copy of the License at
248 *
249 *   http://www.apache.org/licenses/LICENSE-2.0
250 *
251 * Unless required by applicable law or agreed to in writing, software
252 * distributed under the License is distributed on an "AS IS" BASIS,
253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254 * See the License for the specific language governing permissions and
255 * limitations under the License.
256 */const ps=new Map,Up=new Map,qi=new Map;function Cc(n,e){try{n.container.addComponent(e)}catch(t){nt.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function rt(n){const e=n.name;if(qi.has(e))return nt.debug(`There were multiple attempts to register component ${e}.`),!1;qi.set(e,n);for(const t of ps.values())Cc(t,n);for(const t of Up.values())Cc(t,n);return!0}function gn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Ye(n){return n.settings!==void 0}/**
257 * @license
258 * Copyright 2019 Google LLC
259 *
260 * Licensed under the Apache License, Version 2.0 (the "License");
261 * you may not use this file except in compliance with the License.
262 * You may obtain a copy of the License at
263 *
264 *   http://www.apache.org/licenses/LICENSE-2.0
265 *
266 * Unless required by applicable law or agreed to in writing, software
267 * distributed under the License is distributed on an "AS IS" BASIS,
268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269 * See the License for the specific language governing permissions and
270 * limitations under the License.
271 */const Fp={"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.","invali
271d-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."},vt=new mn("app","Firebase",Fp);/**
272 * @license
273 * Copyright 2019 Google LLC
274 *
275 * Licensed under the Apache License, Version 2.0 (the "License");
276 * you may not use this file except in compliance with the License.
277 * You may obtain a copy of the License at
278 *
279 *   http://www.apache.org/licenses/LICENSE-2.0
280 *
281 * Unless required by applicable law or agreed to in writing, software
282 * distributed under the License is distributed on an "AS IS" BASIS,
283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284 * See the License for the specific language governing permissions and
285 * limitations under the License.
286 */class Bp{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 ze("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 vt.create("app-deleted",{appName:this._name})}}/**
287 * @license
288 * Copyright 2019 Google LLC
289 *
290 * Licensed under the Apache License, Version 2.0 (the "License");
291 * you may not use this file except in compliance with the License.
292 * You may obtain a copy of the License at
293 *
294 *   http://www.apache.org/licenses/LICENSE-2.0
295 *
296 * Unless required by applicable law or agreed to in writing, software
297 * distributed under the License is distributed on an "AS IS" BASIS,
298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299 * See the License for the specific language governing permissions and
300 * limitations under the License.
301 */const $t=Mp;function qp(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Bi,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw vt.create("bad-app-name",{appName:String(s)});if(t||(t=Ju()),!t)throw vt.create("no-options");const i=ps.get(s);if(i){if(on(t,i.options)&&on(r,i.config))return i;throw vt.create("duplicate-app",{appName:s})}const a=new Kf(s);for(const l of qi.values())a.addComponent(l);const u=new Bp(t,r,a);return ps.set(s,u),u}function rl(n=Bi){const e=ps.get(n);if(!e&&n===Bi&&Ju())return qp();if(!e)throw vt.create("no-app",{appName:n});return e}function Oe(n,e,t){var r;let s=(r=xp[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){const u=[`Unable to register library "${s}" with version "${e}":`];i&&u.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&u.push("and"),a&&u.push(`version name "${e}" contains illegal characters (whitespace or "/")`),nt.warn(u.join(" "));return}rt(new ze(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
302 * @license
303 * Copyright 2021 Google LLC
304 *
305 * Licensed under the Apache License, Version 2.0 (the "License");
306 * you may not use this file except in compliance with the License.
307 * You may obtain a copy of the License at
308 *
309 *   http://www.apache.org/licenses/LICENSE-2.0
310 *
311 * Unless required by applicable law or agreed to in writing, softw
311are
312 * distributed under the License is distributed on an "AS IS" BASIS,
313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314 * See the License for the specific language governing permissions and
315 * limitations under the License.
316 */const jp="firebase-heartbeat-database",$p=1,rr="firebase-heartbeat-store";let Ri=null;function sl(){return Ri||(Ri=nl(jp,$p,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(rr)}catch(t){console.warn(t)}}}}).catch(n=>{throw vt.create("idb-open",{originalErrorMessage:n.message})})),Ri}async function zp(n){try{const t=(await sl()).transaction(rr),r=await t.objectStore(rr).get(il(n));return await t.done,r}catch(e){if(e instanceof Ue)nt.warn(e.message);else{const t=vt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});nt.warn(t.message)}}}async function kc(n,e){try{const r=(await sl()).transaction(rr,"readwrite");await r.objectStore(rr).put(e,il(n)),await r.done}catch(t){if(t instanceof Ue)nt.warn(t.message);else{const r=vt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});nt.warn(r.message)}}}function il(n){return`${n.name}!${n.options.appId}`}/**
317 * @license
318 * Copyright 2021 Google LLC
319 *
320 * Licensed under the Apache License, Version 2.0 (the "License");
321 * you may not use this file except in compliance with the License.
322 * You may obtain a copy of the License at
323 *
324 *   http://www.apache.org/licenses/LICENSE-2.0
325 *
326 * Unless required by applicable law or agreed to in writing, software
327 * distributed under the License is distributed on an "AS IS" BASIS,
328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329 * See the License for the specific language governing permissions and
330 * limitations under the License.
331 */const Hp=1024,Wp=30*24*60*60*1e3;class Kp{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Qp(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=Nc();return((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)?void 0:(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const u=new Date(a.date).valueOf();return Date.now()-u<=Wp}),this._storage.overwrite(this._heartbeatsCache))}catch(r){nt.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=Nc(),{heartbeatsToSend:r,unsentEntries:s}=Gp(this._heartbeatsCache.heartbeats),i=fs(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 nt.warn(t),""}}}function Nc(){return new Date().toISOString().substring(0,10)}function Gp(n,e=Hp){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),Dc(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),Dc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Qp{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Lf()?Mf().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await zp(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 kc(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 kc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function Dc(n){return fs(JSON.stringify({version:2,heartbeats:n})).length}/**
332 * @license
333 * Copyright 2019 Google LLC
334 *
335 * Licensed under the Apache License, Version 2.0 (the "License");
336 * you may not use this file except in compliance with the License.
337 * You may obtain a copy of the License at
338 *
339 *   http://www.apache.org/licenses/LICENSE-2.0
340 *
341 * Unless required by applicable law or agreed to in writing, software
342 * distributed under the License is distributed on an "AS IS" BASIS,
343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344 * See the License for the specific language governing permissions and
345 * limitations under the License.
346 */function Yp(n){rt(new ze("platform-logger",e=>new cp(e),"PRIVATE")),rt(new ze("heartbeat",e=>new Kp(e),"PRIVATE")),Oe(Fi,Sc,n),Oe(Fi,Sc,"esm2017"),Oe("fire-js","")}Yp("");function ho(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}function aI(n,e,t,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,r);else for(var u=n.length-1;u>=0;u--)(a=n[u])&&(i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i);return s>3&&i&&Object.defineProperty(e,t,i),i}function ol(){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 Xp=ol,al=new mn("auth","Firebase",ol());/**
347 * @license
348 * Copyright 2020 Google LLC
349 *
350 * Licensed under the Apache License, Version 2.0 (the "License");
351 * you may not use this file except in compliance with the License.
352 * You may obtain a copy of the License at
353 *
354 *   http://www.apache.org/licenses/LICENSE-2.0
355 *
356 * Unless required by applicable law or agreed to in writing, software
357 * distributed under the License is distributed on an "AS IS" BASIS,
358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359 * See the License for the specific language governing permissions and
360 * limitations under the License.
361 */const ms=new uo("@firebase/auth");function Jp(n,...e){ms.logLevel<=H.WARN&&ms.warn(`Auth (${$t}): ${n}`,...e)}function ss(n,...e){ms.logLevel<=H.ERROR&&ms.error(`Auth (${$t}): ${n}`,...e)}/**
362 * @license
363 * Copyright 2020 Google LLC
364 *
365 * Licensed under the Apache License, Version 2.0 (the "License");
366 * you may not use this file except in compliance with the License.
367 * You may obtain a copy of the License at
368 *
369 *   http://www.apache.org/licenses/LICENSE-2.0
370 *
371 * Unless required by applicable law or agreed to in writing, software
372 * distributed under the License is distributed on an "AS IS" BASIS,
373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
374 * See the License for the specific language governing permissions and
375 * limitations under the License.
376 */function Me(n,...e){throw fo(n,...e)}function Be(n,...e){return fo(n,...e)}function cl(n,e,t){const r=Object.assign(Object.assign({},Xp()),{[e]:t});return new mn("auth","Firebase",r).create(e,{appName:n.name})}function Et(n){return cl(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function fo(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 al.create(n,...e)}function M(n,e,...t){if(!n)throw fo(e,...t)}function Xe(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ss(e),new Error(e)}function st(n,e){n||Xe(e)}/**
377 * @license
378 * Copyright 2020 Google LLC
379 *
380 * Licensed under the Apache License, Version 2.0 (the "License");
381 * you may not use this file except in compliance with the License.
382 * You may obtain a copy of the License at
383 *
384 *   http://www.apache.org/licenses/LICENSE-2.0
385 *
386 * Unless required by applicable law or agreed to in writing, software
387 * distributed under the License is distributed on an "AS IS" BASIS,
388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
389 * See the License for the specific language governing permissions and
390 * limitations under the License.
391 */function ji(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function Zp(){return Vc()==="http:"||Vc()==="https:"}function Vc(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
392 * @license
393 * Copyright 2020 Google LLC
394 *
395 * Licensed under the Apache License, Version 2.0 (the "License");
396 * you may not use this file except in compliance with the License.
397 * You may obtain a copy of the License at
398 *
399 *   http://www.apache.org/licenses/LICENSE-2.0
400 *
401 * Unless required by applicable law or agreed to in writing, software
402 * distributed under the License is distributed on an "AS IS" BASIS,
403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
404 * See the License for the specific language governing permissions and
405 * limitations under the License.
406 */function em(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Zp()||Nf()||"connection"in navigator)?navigator.onLine:!0}function tm(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
407 * @license
408 * Copyright 2020 Google LLC
409 *
410 * Licensed under the Apache License, Version 2.0 (the "License");
411 * you may not use this file except in compliance with the License.
412 * You may obtain a copy of the License at
413 *
414 *   http://www.apache.org/licenses/LICENSE-2.0
415 *
416 * Unless required by applicable law or agreed to in writing, software
417 * distributed under the License is distributed on an "AS IS" BASIS,
418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
419 * See the License for the specific language governing permissions and
420 * limitations under the License.
421 */class gr{constructor(e,t){this.shortDelay=e,this.longDelay=t,st(t>e,"Short delay should be less than long delay!"),this.isMobile=Sf()||Df()}get(){return em()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
422 * @license
423 * Copyright 2020 Google LLC
424 *
425 * Licensed under the Apache License, Version 2.0 (the "License");
426 * you may not use this file except in compliance with the License.
427 * You may obtain a copy of the License at
428 *
429 *   http://www.apache.org/licenses/LICENSE-2.0
430 *
431 * Unless required by applicable law or agreed to in writing, software
432 * distributed under the License is distributed on an "AS IS" BASIS,
433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
434 * See the License for the specific language governing permissions and
435 * limitations under the License.
436 */function po(n,e){st(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
437 * @license
438 * Copyright 2020 Google LLC
439 *
440 * Licensed under the Apache License, Version 2.0 (the "License");
441 * you may not use this file except in compliance with the License.
442 * You may obtain a copy of the License at
443 *
444 *   http://www.apache.org/licenses/LICENSE-2.0
445 *
446 * Unless required by applicable law or agreed to in writing, software
447 * distributed under the License is distributed on an "AS IS" BASIS,
448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
449 * See the License for the specific language governing permissions and
450 * limitations under the License.
451 */class ul{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;Xe("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;Xe("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;Xe("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
452 * @license
453 * Copyright 2020 Google LLC
454 *
455 * Licensed under the Apache License, Version 2.0 (the "License");
456 * you may not use this file except in compliance with the License.
457 * You may obtain a copy of the License at
458 *
459 *   http://www.apache.org/licenses/LICENSE-2.0
460 *
461 * Unless required by applicable law or agreed to in writing, software
462 * distributed under the License is distributed on an "AS IS" BASIS,
463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
464 * See the License for the specific language governing permissions and
465 * limitations under the License.
466 */const nm={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"};/**
467 * @license
468 * Copyright 2020 Google LLC
469 *
470 * Licensed under the Apache License, Version 2.0 (the "License");
471 * you may not use this file except in compliance with the License.
472 * You may obtain a copy of the License at
473 *
474 *   http://www.apache.org/licenses/LICENSE-2.0
475 *
476 * Unless required by applicable law or agreed to in writing, software
477 * distributed under the License is distributed on an "AS IS" BASIS,
478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
479 * See the License for the specific language governing permissions and
480 * limitations under the License.
481 */const rm=new gr(3e4,6e4);function zt(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Rt(n,e,t,r,s={}){return ll(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const u=mr(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 kf()||(d.referrerPolicy="no-referrer"),ul.fetch()(hl(n,n.config.apiHost,t,u),d)})}async function ll(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},nm),e);try{const s=new im(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw Xr(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const u=i.ok?a.errorMessage:a.error.message,[l,d]=u.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Xr(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw Xr(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw Xr(n,"user-disabled",a);const p=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw cl(n,p,d);Me(n,p)}}catch(s){if(s instanceof Ue)throw s;Me(n,"network-request-failed",{message:String(s)})}}async function ks(n,e,t,r,s={}){const i=await Rt(n,e,t,r,s);return"mfaPendingCredential"in i&&Me(n,"multi-factor-auth-required",{_serverResponse:i}),i}function hl(n,e,t,r){const s=`${e}${t}?${r}`;return n.config.emulator?po(n.config,s):`${n.config.apiScheme}://${s}`}function sm(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class im{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Be(this.auth,"network-request-failed")),rm.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function Xr(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=Be(n,e,r);return s.customData._tokenResponse=t,s}function Oc(n){return n!==void 0&&n.enterprise!==void 0}class om{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 sm(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function am(n,e){return Rt(n,"GET","/v2/recaptchaConfig",zt(n,e))}/**
482 * @license
483 * Copyright 2020 Google LLC
484 *
485 * Licensed under the Apache License, Version 2.0 (the "License");
486 * you may not use this file except in compliance with the License.
487 * You may obtain a copy of the License at
488 *
489 *   http://www.apache.org/licenses/LICENSE-2.0
490 *
491 * Unless required by applicable law or agreed to in writing, software
492 * distributed under the License is distributed on an "AS IS" BASIS,
493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
494 * See the License for the specific language governing permissions and
495 * limitations under the License.
496 */async function cm(n,e){return Rt(n,"POST","/v1/accounts:delete",e)}async function dl(n,e){return Rt(n,"POST","/v1/accounts:lookup",e)}/**
497 * @license
498 * Copyright 2020 Google LLC
499 *
500 * Licensed under the Apache License, Version 2.0 (the "License");
501 * you may not use this file except in compliance with the License.
502 * You may obtain a copy of the License at
503 *
504 *   http://www.apache.org/licenses/LICENSE-2.0
505 *
506 * Unless required by applicable law or agreed to in writing, software
507 * distributed under the License is distributed on an "AS IS" BASIS,
508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
509 * See the License for the specific language governing permissions and
510 * limitations under the License.
511 */function Xn(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function um(n,e=!1){const t=Y(n),r=await t.getIdToken(e),s=mo(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:Xn(Pi(s.auth_time)),issuedAtTime:Xn(Pi(s.iat)),expirationTime:Xn(Pi(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function Pi(n){return Number(n)*1e3}function mo(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ss("JWT malformed, contained fewer than 3 sections"),null;try{const s=Yu(t);return s?JSON.parse(s):(ss("Failed to decode base64 JWT payload"),null)}catch(s){return ss("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Lc(n){const e=mo(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)}/**
512 * @license
513 * Copyright 2020 Google LLC
514 *
515 * Licensed under the Apache License, Version 2.0 (the "License");
516 * you may not use this file except in compliance with the License.
517 * You may obtain a copy of the License at
518 *
519 *   http://www.apache.org/licenses/LICENSE-2.0
520 *
521 * Unless required by applicable law or agreed to in writing, software
522 * distributed under the License is distributed on an "AS IS" BASIS,
523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524 * See the License for the specific language governing permissions and
525 * limitations under the License.
526 */async function sr(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof Ue&&lm(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function lm({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
527 * @license
528 * Copyright 2020 Google LLC
529 *
530 * Licensed under the Apache License, Version 2.0 (the "License");
531 * you may not use this file except in compliance with the License.
532 * You may obtain a copy of the License at
533 *
534 *   http://www.apache.org/licenses/LICENSE-2.0
535 *
536 * Unless required by applicable law or agreed to in writing, software
537 * distributed under the License is distributed on an "AS IS" BASIS,
538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
539 * See the License for the specific language governing permissions and
540 * limitations under the License.
541 */class hm{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()}}/**
542 * @license
543 * Copyright 2020 Google LLC
544 *
545 * Licensed under the Apache License, Version 2.0 (the "License");
546 * you may not use this file except in compliance with the License.
547 * You may obtain a copy of the License at
548 *
549 *   http://www.apache.org/licenses/LICENSE-2.0
550 *
551 * Unless required by applicable law or agreed to in writing, software
552 * distributed under the License is distributed on an "AS IS" BASIS,
553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554 * See the License for the specific language governing permissions and
555 * limitations under the License.
556 */class $i{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Xn(this.lastLoginAt),this.creationTime=Xn(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
557 * @license
558 * Copyright 2019 Google LLC
559 *
560 * Licensed under the Apache License, Version 2.0 (the "License");
561 * you may not use this file except in compliance with the License.
562 * You may obtain a copy of the License at
563 *
564 *   http://www.apache.org/licenses/LICENSE-2.0
565 *
566 * Unless required by applicable law or agreed to in writing, software
567 * distributed under the License is distributed on an "AS IS" BASIS,
568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569 * See the License for the specific language governing permissions and
570 * limitations under the License.
571 */async function gs(n){var e;const t=n.auth,r=await n.getIdToken(),s=await sr(n,dl(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?fl(i.providerUserInfo):[],u=fm(n.providerData,a),l=n.isAnonymous,d=!(n.email&&i.passwordHash)&&!(u!=null&&u.length),p=l?d:!1,y={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:u,metadata:new $i(i.createdAt,i.lastLoginAt),isAnonymous:p};Object.assign(n,y)}async function dm(n){const e=Y(n);await gs(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function fm(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function fl(n){return n.map(e=>{var{providerId:t}=e,r=ho(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
572 * @license
573 * Copyright 2020 Google LLC
574 *
575 * Licensed under the Apache License, Version 2.0 (the "License");
576 * you may not use this file except in compliance with the License.
577 * You may obtain a copy of the License at
578 *
579 *   http://www.apache.org/licenses/LICENSE-2.0
580 *
581 * Unless required by applicable law or agreed to in writing, software
582 * distributed under the License is distributed on an "AS IS" BASIS,
583 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
584 * See the License for the specific language governing permissions and
585 * limitations under the License.
586 */async function pm(n,e){const t=await ll(n,{},async()=>{const r=mr({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=hl(n,s,"/v1/token",`key=${i}`),u=await n._getAdditionalHeaders();return u["Content-Type"]="application/x-www-form-urlencoded",ul.fetch()(a,{method:"POST",headers:u,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function mm(n,e){return Rt(n,"POST","/v2/accounts:revokeToken",zt(n,e))}/**
587 * @license
588 * Copyright 2020 Google LLC
589 *
590 * Licensed under the Apache License, Version 2.0 (the "License");
591 * you may not use this file except in compliance with the License.
592 * You may obtain a copy of the License at
593 *
594 *   http://www.apache.org/licenses/LICENSE-2.0
595 *
596 * Unless required by applicable law or agreed to in writing, software
597 * distributed under the License is distributed on an "AS IS" BASIS,
598 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
599 * See the License for the specific language governing permissions and
600 * limitations under the License.
601 */class tn{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");
601const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Lc(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){M(e.length!==0,"internal-error");const t=Lc(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 pm(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 tn;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 tn,this.toJSON())}_performRefresh(){return Xe("not implemented")}}/**
602 * @license
603 * Copyright 2020 Google LLC
604 *
605 * Licensed under the Apache License, Version 2.0 (the "License");
606 * you may not use this file except in compliance with the License.
607 * You may obtain a copy of the License at
608 *
609 *   http://www.apache.org/licenses/LICENSE-2.0
610 *
611 * Unless required by applicable law or agreed to in writing, software
612 * distributed under the License is distributed on an "AS IS" BASIS,
613 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
614 * See the License for the specific language governing permissions and
615 * limitations under the License.
616 */function dt(n,e){M(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class Je{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=ho(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new hm(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 $i(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await sr(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 um(this,e)}reload(){return dm(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 Je(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 gs(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ye(this.auth.app))return Promise.reject(Et(this.auth));const e=await this.getIdToken();return await sr(this,cm(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,isA
616nonymous: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,u,l,d,p;const y=(r=t.displayName)!==null&&r!==void 0?r:void 0,I=(s=t.email)!==null&&s!==void 0?s:void 0,P=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,k=(a=t.photoURL)!==null&&a!==void 0?a:void 0,V=(u=t.tenantId)!==null&&u!==void 0?u:void 0,C=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,B=(d=t.createdAt)!==null&&d!==void 0?d:void 0,j=(p=t.lastLoginAt)!==null&&p!==void 0?p:void 0,{uid:q,emailVerified:$,isAnonymous:le,providerData:J,stsTokenManager:E}=t;M(q&&E,e,"internal-error");const m=tn.fromJSON(this.name,E);M(typeof q=="string",e,"internal-error"),dt(y,e.name),dt(I,e.name),M(typeof $=="boolean",e,"internal-error"),M(typeof le=="boolean",e,"internal-error"),dt(P,e.name),dt(k,e.name),dt(V,e.name),dt(C,e.name),dt(B,e.name),dt(j,e.name);const _=new Je({uid:q,auth:e,email:I,emailVerified:$,displayName:y,isAnonymous:le,photoURL:k,phoneNumber:P,tenantId:V,stsTokenManager:m,createdAt:B,lastLoginAt:j});return J&&Array.isArray(J)&&(_.providerData=J.map(v=>Object.assign({},v))),C&&(_._redirectEventId=C),_}static async _fromIdTokenResponse(e,t,r=!1){const s=new tn;s.updateFromServerResponse(t);const i=new Je({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await gs(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?fl(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),u=new tn;u.updateFromIdToken(r);const l=new Je({uid:s.localId,auth:e,stsTokenManager:u,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 $i(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
617 * @license
618 * Copyright 2020 Google LLC
619 *
620 * Licensed under the Apache License, Version 2.0 (the "License");
621 * you may not use this file except in compliance with the License.
622 * You may obtain a copy of the License at
623 *
624 *   http://www.apache.org/licenses/LICENSE-2.0
625 *
626 * Unless required by applicable law or agreed to in writing, software
627 * distributed under the License is distributed on an "AS IS" BASIS,
628 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
629 * See the License for the specific language governing permissions and
630 * limitations under the License.
631 */const Mc=new Map;function Ze(n){st(n instanceof Function,"Expected a class definition");let e=Mc.get(n);return e?(st(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Mc.set(n,e),e)}/**
632 * @license
633 * Copyright 2019 Google LLC
634 *
635 * Licensed under the Apache License, Version 2.0 (the "License");
636 * you may not use this file except in compliance with the License.
637 * You may obtain a copy of the License at
638 *
639 *   http://www.apache.org/licenses/LICENSE-2.0
640 *
641 * Unless required by applicable law or agreed to in writing, software
642 * distributed under the License is distributed on an "AS IS" BASIS,
643 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
644 * See the License for the specific language governing permissions and
645 * limitations under the License.
646 */class pl{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){}}pl.type="NONE";const xc=pl;/**
647 * @license
648 * Copyright 2019 Google LLC
649 *
650 * Licensed under the Apache License, Version 2.0 (the "License");
651 * you may not use this file except in compliance with the License.
652 * You may obtain a copy of the License at
653 *
654 *   http://www.apache.org/licenses/LICENSE-2.0
655 *
656 * Unless required by applicable law or agreed to in writing, software
657 * distributed under the License is distributed on an "AS IS" BASIS,
658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
659 * See the License for the specific language governing permissions and
660 * limitations under the License.
661 */function is(n,e,t){return`firebase:${n}:${e}:${t}`}class nn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=is(this.userKey,s.apiKey,i),this.fullPersistenceKey=is("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?Je._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 nn(Ze(xc),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||Ze(xc);const a=is(r,e.config.apiKey,e.name);let u=null;for(const d of t)try{const p=await d._get(a);if(p){const y=Je._fromJSON(e,p);d!==i&&(u=y),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new nn(i,e,r):(i=l[0],u&&await i._set(a,u.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new nn(i,e,r))}}/**
662 * @license
663 * Copyright 2020 Google LLC
664 *
665 * Licensed under the Apache License, Version 2.0 (the "License");
666 * you may not use this file except in compliance with the License.
667 * You may obtain a copy of the License at
668 *
669 *   http://www.apache.org/licenses/LICENSE-2.0
670 *
671 * Unless required by applicable law or agreed to in writing, software
672 * distributed under the License is distributed on an "AS IS" BASIS,
673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674 * See the License for the specific language governing permissions and
675 * limitations under the License.
676 */function Uc(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(yl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(ml(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(El(e))return"Blackberry";if(Tl(e))return"Webos";if(gl(e))return"Safari";if((e.includes("chrome/")||_l(e))&&!e.includes("edge/"))return"Chrome";if(vl(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 ml(n=we()){return/firefox\//i.test(n)}function gl(n=we()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function _l(n=we()){return/crios\//i.test(n)}function yl(n=we()){return/iemobile/i.test(n)}function vl(n=we()){return/android/i.test(n)}function El(n=we()){return/blackberry/i.test(n)}function Tl(n=we()){return/webos/i.test(n)}function go(n=we()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function gm(n=we()){var e;return go(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function _m(){return Vf()&&document.documentMode===10}function Il(n=we()){return go(n)||vl(n)||Tl(n)||El(n)||/windows phone/i.test(n)||yl(n)}/**
677 * @license
678 * Copyright 2020 Google LLC
679 *
680 * Licensed under the Apache License, Version 2.0 (the "License");
681 * you may not use this file except in compliance with the License.
682 * You may obtain a copy of the License at
683 *
684 *   http://www.apache.org/licenses/LICENSE-2.0
685 *
686 * Unless required by applicable law or agreed to in writing, software
687 * distributed under the License is distributed on an "AS IS" BASIS,
688 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
689 * See the License for the specific language governing permissions and
690 * limitations under the License.
691 */function wl(n,e=[]){let t;switch(n){case"Browser":t=Uc(we());break;case"Worker":t=`${Uc(we())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${$t}/${r}`}/**
692 * @license
693 * Copyright 2022 Google LLC
694 *
695 * Licensed under the Apache License, Version 2.0 (the "License");
696 * you may not use this file except in compliance with the License.
697 * You may obtain a copy of the License at
698 *
699 *   http://www.apache.org/licenses/LICENSE-2.0
700 *
701 * Unless required by applicable law or agreed to in writing, software
702 * distributed under the License is distributed on an "AS IS" BASIS,
703 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
704 * See the License for the specific language governing permissions and
705 * limitations under the License.
706 */class ym{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,u)=>{try{const l=e(i);a(l)}catch(l){u(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})}}}/**
707 * @license
708 * Copyright 2023 Google LLC
709 *
710 * Licensed under the Apache License, Version 2.0 (the "License");
711 * you may not use this file except in compliance with the License.
712 * You may obtain a copy of the License at
713 *
714 *   http://www.apache.org/licenses/LICENSE-2.0
715 *
716 * Unless required by applicable law or agreed to in writing, software
717 * distributed under the License is distributed on an "AS IS" BASIS,
718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
719 * See the License for the specific language governing permissions and
720 * limitations under the License.
721 */async function vm(n,e={}){return Rt(n,"GET","/v2/passwordPolicy",zt(n,e))}/**
722 * @license
723 * Copyright 2023 Google LLC
724 *
725 * Licensed under the Apache License, Version 2.0 (the "License");
726 * you may not use this file except in compliance with the License.
727 * You may obtain a copy of the License at
728 *
729 *   http://www.apache.org/licenses/LICENSE-2.0
730 *
731 * Unless required by applicable law or agreed to in writing, software
732 * distributed under the License is distributed on an "AS IS" BASIS,
733 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
734 * See the License for the specific language governing permissions and
735 * limitations under the License.
736 */const Em=6;class Tm{constructor(e){var t,r,s,i;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:Em,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,u;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&
736(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=(u=l.containsNonAlphanumericCharacter)!==null&&u!==void 0?u:!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))}}/**
737 * @license
738 * Copyright 2020 Google LLC
739 *
740 * Licensed under the Apache License, Version 2.0 (the "License");
741 * you may not use this file except in compliance with the License.
742 * You may obtain a copy of the License at
743 *
744 *   http://www.apache.org/licenses/LICENSE-2.0
745 *
746 * Unless required by applicable law or agreed to in writing, software
747 * distributed under the License is distributed on an "AS IS" BASIS,
748 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
749 * See the License for the specific language governing permissions and
750 * limitations under the License.
751 */class Im{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 Fc(this),this.idTokenSubscription=new Fc(this),this.beforeStateQueue=new ym(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=al,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=Ze(t)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await nn.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 dl(this,{idToken:e}),r=await Je._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(Ye(this.app)){const a=this.app.settings.authIdToken;return a?new Promise(u=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(u,u))}):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,u=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===u)&&(l!=null&&l.user)&&(s=l.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);
751if(!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 gs(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=tm()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Ye(this.app))return Promise.reject(Et(this));const t=e?Y(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 Ye(this.app)?Promise.reject(Et(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Ye(this.app)?Promise.reject(Et(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ze(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 vm(this),t=new Tm(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new mn("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 mm(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&&Ze(e)||this._popupRedirectResolver;M(t,this,"argument-error"),this.redirectPersistenceManager=await nn.create(this,[Ze(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 u=this._isInitialized?Promise.resolve():this._initializationPromise;if(M(u,this,"internal-error"),u.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=wl(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;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&Jp(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function _n(n){return Y(n)}class Fc{constructor(e){this.auth=e,this.observer=null,this.addObserver=qf(t=>this.observer=t)}get next(){return M(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
752 * @license
753 * Copyright 2020 Google LLC
754 *
755 * Licensed under the Apache License, Version 2.0 (the "License");
756 * you may not use this file except in compliance with the License.
757 * You may obtain a copy of the License at
758 *
759 *   http://www.apache.org/licenses/LICENSE-2.0
760 *
761 * Unless required by applicable law or agreed to in writing, software
762 * distributed under the License is distributed on an "AS IS" BASIS,
763 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
764 * See the License for the specific language governing permissions and
765 * limitations under the License.
766 */let Ns={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function wm(n){Ns=n}function Al(n){return Ns.loadJS(n)}function Am(){return Ns.recaptchaEnterpriseScript}function Rm(){return Ns.gapiScript}function Pm(n){return`__${n}${Math.floor(Math.random()*1e6)}`}const bm="recaptcha-enterprise",Sm="NO_RECAPTCHA";class Cm{constructor(e){this.type=bm,this.auth=_n(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,u)=>{am(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)u(new Error("recaptcha Enterprise site key undefined"));else{const d=new om(l);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(l=>{u(l)})})}function s(i,a,u){const l=window.grecaptcha;Oc(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(Sm)})}):u(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((i,a)=>{r(this.auth).then(u=>{if(!t&&Oc(window.grecaptcha))s(u,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=Am();l.length!==0&&(l+=u),Al(l).then(()=>{s(u,i,a)}).catch(d=>{a(d)})}}).catch(u=>{a(u)})})}}async function Bc(n,e,t,r=!1){const s=new Cm(n);let i;try{i=await s.verify(t)}catch{i=await s.verify(t,!0)}const a=Object.assign({},e);return r?Object.assign(a,{captchaResp:i}):Object.assign(a,{captchaResponse:i}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function qc(n,e,t,r){var s;if(!((s=n._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await Bc(n,e,t,t==="getOobCode");return r(n,i)}else return r(n,e).catch(async i=>{if(i.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 a=await Bc(n,e,t,t==="getOobCode");return r(n,a)}else return Promise.reject(i)})}/**
767 * @license
768 * Copyright 2020 Google LLC
769 *
770 * Licensed under the Apache License, Version 2.0 (the "License");
771 * you may not use this file except in compliance with the License.
772 * You may obtain a copy of the License at
773 *
774 *   http://www.apache.org/licenses/LICENSE-2.0
775 *
776 * Unless required by applicable law or agreed to in writing, software
777 * distributed under the License is distributed on an "AS IS" BASIS,
778 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
779 * See the License for the specific language governing permissions and
780 * limitations under the License.
781 */function km(n,e){const t=gn(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(on(i,e??{}))return s;Me(s,"already-initialized")}return t.initialize({options:e})}function Nm(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(Ze);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function Dm(n,e,t){const r=_n(n);M(r._canInitEmulator,r,"emulator-config-failed"),M(/^https?:\/\//.test(e),r,"invali
781d-emulator-scheme");const s=!1,i=Rl(e),{host:a,port:u}=Vm(e),l=u===null?"":`:${u}`;r.config.emulator={url:`${i}//${a}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:u,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),Om()}function Rl(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Vm(n){const e=Rl(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:jc(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:jc(a)}}}function jc(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Om(){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())}/**
782 * @license
783 * Copyright 2020 Google LLC
784 *
785 * Licensed under the Apache License, Version 2.0 (the "License");
786 * you may not use this file except in compliance with the License.
787 * You may obtain a copy of the License at
788 *
789 *   http://www.apache.org/licenses/LICENSE-2.0
790 *
791 * Unless required by applicable law or agreed to in writing, software
792 * distributed under the License is distributed on an "AS IS" BASIS,
793 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
794 * See the License for the specific language governing permissions and
795 * limitations under the License.
796 */class _o{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Xe("not implemented")}_getIdTokenResponse(e){return Xe("not implemented")}_linkToIdToken(e,t){return Xe("not implemented")}_getReauthenticationResolver(e){return Xe("not implemented")}}async function Lm(n,e){return Rt(n,"POST","/v1/accounts:signUp",e)}/**
797 * @license
798 * Copyright 2020 Google LLC
799 *
800 * Licensed under the Apache License, Version 2.0 (the "License");
801 * you may not use this file except in compliance with the License.
802 * You may obtain a copy of the License at
803 *
804 *   http://www.apache.org/licenses/LICENSE-2.0
805 *
806 * Unless required by applicable law or agreed to in writing, software
807 * distributed under the License is distributed on an "AS IS" BASIS,
808 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
809 * See the License for the specific language governing permissions and
810 * limitations under the License.
811 */async function Mm(n,e){return ks(n,"POST","/v1/accounts:signInWithPassword",zt(n,e))}/**
812 * @license
813 * Copyright 2020 Google LLC
814 *
815 * Licensed under the Apache License, Version 2.0 (the "License");
816 * you may not use this file except in compliance with the License.
817 * You may obtain a copy of the License at
818 *
819 *   http://www.apache.org/licenses/LICENSE-2.0
820 *
821 * Unless required by applicable law or agreed to in writing, software
822 * distributed under the License is distributed on an "AS IS" BASIS,
823 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
824 * See the License for the specific language governing permissions and
825 * limitations under the License.
826 */async function xm(n,e){return ks(n,"POST","/v1/accounts:signInWithEmailLink",zt(n,e))}async function Um(n,e){return ks(n,"POST","/v1/accounts:signInWithEmailLink",zt(n,e))}/**
827 * @license
828 * Copyright 2020 Google LLC
829 *
830 * Licensed under the Apache License, Version 2.0 (the "License");
831 * you may not use this file except in compliance with the License.
832 * You may obtain a copy of the License at
833 *
834 *   http://www.apache.org/licenses/LICENSE-2.0
835 *
836 * Unless required by applicable law or agreed to in writing, softw
836are
837 * distributed under the License is distributed on an "AS IS" BASIS,
838 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
839 * See the License for the specific language governing permissions and
840 * limitations under the License.
841 */class ir extends _o{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new ir(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new ir(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 qc(e,t,"signInWithPassword",Mm);case"emailLink":return xm(e,{email:this._email,oobCode:this._password});default:Me(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 qc(e,r,"signUpPassword",Lm);case"emailLink":return Um(e,{idToken:t,email:this._email,oobCode:this._password});default:Me(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
842 * @license
843 * Copyright 2020 Google LLC
844 *
845 * Licensed under the Apache License, Version 2.0 (the "License");
846 * you may not use this file except in compliance with the License.
847 * You may obtain a copy of the License at
848 *
849 *   http://www.apache.org/licenses/LICENSE-2.0
850 *
851 * Unless required by applicable law or agreed to in writing, software
852 * distributed under the License is distributed on an "AS IS" BASIS,
853 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854 * See the License for the specific language governing permissions and
855 * limitations under the License.
856 */async function rn(n,e){return ks(n,"POST","/v1/accounts:signInWithIdp",zt(n,e))}/**
857 * @license
858 * Copyright 2020 Google LLC
859 *
860 * Licensed under the Apache License, Version 2.0 (the "License");
861 * you may not use this file except in compliance with the License.
862 * You may obtain a copy of the License at
863 *
864 *   http://www.apache.org/licenses/LICENSE-2.0
865 *
866 * Unless required by applicable law or agreed to in writing, software
867 * distributed under the License is distributed on an "AS IS" BASIS,
868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
869 * See the License for the specific language governing permissions and
870 * limitations under the License.
871 */const Fm="http://localhost";class Mt extends _o{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Mt(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):Me("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
871once: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=ho(t,["providerId","signInMethod"]);if(!r||!s)return null;const a=new Mt(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 rn(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,rn(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,rn(e,t)}buildRequest(){const e={requestUri:Fm,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=mr(t)}return e}}/**
872 * @license
873 * Copyright 2020 Google LLC
874 *
875 * Licensed under the Apache License, Version 2.0 (the "License");
876 * you may not use this file except in compliance with the License.
877 * You may obtain a copy of the License at
878 *
879 *   http://www.apache.org/licenses/LICENSE-2.0
880 *
881 * Unless required by applicable law or agreed to in writing, software
882 * distributed under the License is distributed on an "AS IS" BASIS,
883 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
884 * See the License for the specific language governing permissions and
885 * limitations under the License.
886 */function Bm(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 qm(n){const e=Hn(Wn(n)).link,t=e?Hn(Wn(e)).deep_link_id:null,r=Hn(Wn(n)).deep_link_id;return(r?Hn(Wn(r)).link:null)||r||t||e||n}class yo{constructor(e){var t,r,s,i,a,u;const l=Hn(Wn(e)),d=(t=l.apiKey)!==null&&t!==void 0?t:null,p=(r=l.oobCode)!==null&&r!==void 0?r:null,y=Bm((s=l.mode)!==null&&s!==void 0?s:null);M(d&&p&&y,"argument-error"),this.apiKey=d,this.operation=y,this.code=p,this.continueUrl=(i=l.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(a=l.languageCode)!==null&&a!==void 0?a:null,this.tenantId=(u=l.tenantId)!==null&&u!==void 0?u:null}static parseLink(e){const t=qm(e);try{return new yo(t)}catch{return null}}}/**
887 * @license
888 * Copyright 2020 Google LLC
889 *
890 * Licensed under the Apache License, Version 2.0 (the "License");
891 * you may not use this file except in compliance with the License.
892 * You may obtain a copy of the License at
893 *
894 *   http://www.apache.org/licenses/LICENSE-2.0
895 *
896 * Unless required by applicable law or agreed to in writing, software
897 * distributed under the License is distributed on an "AS IS" BASIS,
898 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
899 * See the License for the specific language governing permissions and
900 * limitations under the License.
901 */class yn{constructor(){this.providerId=yn.PROVIDER_ID}static credential(e,t){return ir._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=yo.parseLink(t);return M(r,"argument-error"),ir._fromEmailAndCode(e,r.code,r.tenantId)}}yn.PROVIDER_ID="password";yn.EMAIL_PASSWORD_SIGN_IN_METHOD="password";yn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
902 * @license
903 * Copyright 2020 Google LLC
904 *
905 * Licensed under the Apache License, Version 2.0 (the "License");
906 * you may not use this file except in compliance with the License.
907 * You may obtain a copy of the License at
908 *
909 *   http://www.apache.org/licenses/LICENSE-2.0
910 *
911 * Unless required by applicable law or agreed to in writing, software
912 * distributed under the License is distributed on an "AS IS" BASIS,
913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
914 * See the License for the specific language governing permissions and
915 * limitations under the License.
916 */class Pl{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}}/**
917 * @license
918 * Copyright 2019 Google LLC
919 *
920 * Licensed under the Apache License, Version 2.0 (the "License");
921 * you may not use this file except in compliance with the License.
922 * You may obtain a copy of the License at
923 *
924 *   http://www.apache.org/licenses/LICENSE-2.0
925 *
926 * Unless required by applicable law or agreed to in writing, software
927 * distributed under the License is distributed on an "AS IS" BASIS,
928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
929 * See the License for the specific language governing permissions and
930 * limitations under the License.
931 */class _r extends Pl{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
932 * @license
933 * Copyright 2020 Google LLC
934 *
935 * Licensed under the Apache License, Version 2.0 (the "License");
936 * you may not use this file except in compliance with the License.
937 * You may obtain a copy of the License at
938 *
939 *   http://www.apache.org/licenses/LICENSE-2.0
940 *
941 * Unless required by applicable law or agreed to in writing, software
942 * distributed under the License is distributed on an "AS IS" BASIS,
943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
944 * See the License for the specific language governing permissions and
945 * limitations under the License.
946 */class ft extends _r{constructor(){super("facebook.com")}static credential(e){return Mt._fromParams({providerId:ft.PROVIDER_ID,signInMethod:ft.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ft.credentialFromTaggedObject(e)}static credentialFromError(e){return ft.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ft.credential(e.oauthAccessToken)}catch{return null}}}ft.FACEBOOK_SIGN_IN_METHOD="facebook.com";ft.PROVIDER_ID="facebook.com";/**
947 * @license
948 * Copyright 2020 Google LLC
949 *
950 * Licensed under the Apache License, Version 2.0 (the "License");
951 * you may not use this file except in compliance with the License.
952 * You may obtain a copy of the License at
953 *
954 *   http://www.apache.org/licenses/LICENSE-2.0
955 *
956 * Unless required by applicable law or agreed to in writing, software
957 * distributed under the License is distributed on an "AS IS" BASIS,
958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
959 * See the License for the specific language governing permissions and
960 * limitations under the License.
961 */class pt extends _r{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Mt._fromParams({providerId:pt.PROVIDER_ID,signInMethod:pt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return pt.credentialFromTaggedObject(e)}static credentialFromError(e){return pt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return pt.credential(t,r)}catch{return null}}}pt.GOOGLE_SIGN_IN_METHOD="google.com";pt.PROVIDER_ID="google.com";/**
962 * @license
963 * Copyright 2020 Google LLC
964 *
965 * Licensed under the Apache License, Version 2.0 (the "License");
966 * you may not use this file except in compliance with the License.
967 * You may obtain a copy of the License at
968 *
969 *   http://www.apache.org/licenses/LICENSE-2.0
970 *
971 * Unless required by applicable law or agreed to in writing, software
972 * distributed under the License is distributed on an "AS IS" BASIS,
973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
974 * See the License for the specific language governing permissions and
975 * limitations under the License.
976 */class mt extends _r{constructor(){super("github.com")}static credential(e){return Mt._fromParams({providerId:mt.PROVIDER_ID,signInMethod:mt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return mt.credentialFromTaggedObject(e)}static credentialFromError(e){return mt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return mt.credential(e.oauthAccessToken)}catch{return null}}}mt.GITHUB_SIGN_IN_METHOD="github.com";mt.PROVIDER_ID="github.com";/**
977 * @license
978 * Copyright 2020 Google LLC
979 *
980 * Licensed under the Apache License, Version 2.0 (the "License");
981 * you may not use this file except in compliance with the License.
982 * You may obtain a copy of the License at
983 *
984 *   http://www.apache.org/licenses/LICENSE-2.0
985 *
986 * Unless required by applicable law or agreed to in writing, software
987 * distributed under the License is distributed on an "AS IS" BASIS,
988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
989 * See the License for the specific language governing permissions and
990 * limitations under the License.
991 */class gt extends _r{constructor(){super("twitter.com")}static credential(e,t){return Mt._fromParams({providerId:gt.PROVIDER_ID,signInMethod:gt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return gt.credentialFromTaggedObject(e)}static credentialFromError(e){return gt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return gt.credential(t,r)}catch{return null}}}gt.TWITTER_SIGN_IN_METHOD="twitter.com";gt.PROVIDER_ID="twitter.com";/**
992 * @license
993 * Copyright 2020 Google LLC
994 *
995 * Licensed under the Apache License, Version 2.0 (the "License");
996 * you may not use this file except in compliance with the License.
997 * You may obtain a copy of the License at
998 *
999 *   http://www.apache.org/licenses/LICENSE-2.0
1000 *
1001 * Unless required by applicable law or agreed to in writing, software
1002 * distributed under the License is distributed on an "AS IS" BASIS,
1003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1004 * See the License for the specific language governing permissions and
1005 * limitations under the License.
1006 */class an{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 Je._fromIdTokenResponse(e,r,s),a=$c(r);return new an({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=$c(r);return new an({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function $c(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1007 * @license
1008 * Copyright 2020 Google LLC
1009 *
1010 * Licensed under the Apache License, Version 2.0 (the "License");
1011 * you may not use this file except in compliance with the License.
1012 * You may obtain a copy of the License at
1013 *
1014 *   http://www.apache.org/licenses/LICENSE-2.0
1015 *
1016 * Unless required by applicable law or agreed to in writing, software
1017 * distributed under the License is distributed on an "AS IS" BASIS,
1018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1019 * See the License for the specific language governing permissions and
1020 * limitations under the License.
1021 */class _s extends Ue{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,_s.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 _s(e,t,r,s)}}function bl(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?_s._fromErrorAndOperation(n,i,e,r):i})}async function jm(n,e,t=!1){const r=await sr(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return an._forOperation(n,"link",r)}/**
1022 * @license
1023 * Copyright 2019 Google LLC
1024 *
1025 * Licensed under the Apache License, Version 2.0 (the "License");
1026 * you may not use this file except in compliance with the License.
1027 * You may obtain a copy of the License at
1028 *
1029 *   http://www.apache.org/licenses/LICENSE-2.0
1030 *
1031 * Unless required by applicable law or agreed to in writing, software
1032 * distributed under the License is distributed on an "AS IS" BASIS,
1033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1034 * See the License for the specific language governing permissions and
1035 * limitations under the License.
1036 */async function $m(n,e,t=!1){const{auth:r}=n;
vendor: 4,163 bytes, lines 1036-1100
1036if(Ye(r.app))return Promise.reject(Et(r));const s="reauthenticate";try{const i=await sr(n,bl(r,s,e,n),t);M(i.idToken,r,"internal-error");const a=mo(i.idToken);M(a,r,"internal-error");const{sub:u}=a;return M(n.uid===u,r,"user-mismatch"),an._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Me(r,"user-mismatch"),i}}/**
1037 * @license
1038 * Copyright 2020 Google LLC
1039 *
1040 * Licensed under the Apache License, Version 2.0 (the "License");
1041 * you may not use this file except in compliance with the License.
1042 * You may obtain a copy of the License at
1043 *
1044 *   http://www.apache.org/licenses/LICENSE-2.0
1045 *
1046 * Unless required by applicable law or agreed to in writing, software
1047 * distributed under the License is distributed on an "AS IS" BASIS,
1048 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1049 * See the License for the specific language governing permissions and
1050 * limitations under the License.
1051 */async function Sl(n,e,t=!1){if(Ye(n.app))return Promise.reject(Et(n));const r="signIn",s=await bl(n,r,e),i=await an._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function zm(n,e){return Sl(_n(n),e)}/**
1052 * @license
1053 * Copyright 2020 Google LLC
1054 *
1055 * Licensed under the Apache License, Version 2.0 (the "License");
1056 * you may not use this file except in compliance with the License.
1057 * You may obtain a copy of the License at
1058 *
1059 *   http://www.apache.org/licenses/LICENSE-2.0
1060 *
1061 * Unless required by applicable law or agreed to in writing, software
1062 * distributed under the License is distributed on an "AS IS" BASIS,
1063 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1064 * See the License for the specific language governing permissions and
1065 * limitations under the License.
1066 */async function Hm(n){const e=_n(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function cI(n,e,t){return Ye(n.app)?Promise.reject(Et(n)):zm(Y(n),yn.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Hm(n),r})}/**
1067 * @license
1068 * Copyright 2020 Google LLC
1069 *
1070 * Licensed under the Apache License, Version 2.0 (the "License");
1071 * you may not use this file except in compliance with the License.
1072 * You may obtain a copy of the License at
1073 *
1074 *   http://www.apache.org/licenses/LICENSE-2.0
1075 *
1076 * Unless required by applicable law or agreed to in writing, software
1077 * distributed under the License is distributed on an "AS IS" BASIS,
1078 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1079 * See the License for the specific language governing permissions and
1080 * limitations under the License.
1081 */function uI(n,e){return Y(n).setPersistence(e)}function Wm(n,e,t,r){return Y(n).onIdTokenChanged(e,t,r)}function Km(n,e,t){return Y(n).beforeAuthStateChanged(e,t)}function lI(n,e,t,r){return Y(n).onAuthStateChanged(e,t,r)}function hI(n){return Y(n).signOut()}const ys="__sak";/**
1082 * @license
1083 * Copyright 2019 Google LLC
1084 *
1085 * Licensed under the Apache License, Version 2.0 (the "License");
1086 * you may not use this file except in compliance with the License.
1087 * You may obtain a copy of the License at
1088 *
1089 *   http://www.apache.org/licenses/LICENSE-2.0
1090 *
1091 * Unless required by applicable law or agreed to in writing, software
1092 * distributed under the License is distributed on an "AS IS" BASIS,
1093 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1094 * See the License for the specific language governing permissions and
1095 * limitations under the License.
1096 */class Cl{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(ys,"1"),this.storage.removeItem(ys),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()}}/**
1097 * @license
1098 * Copyright 2020 Google LLC
1099 *
1100 * Licensed under the Apache License, Version 2.0 (the "License");
1101 * you may not use this file except in compliance with the License.
1102 * You may obtain a copy of the License at
1103 *
1104 *   http://www.apache.org/licenses/LICENSE-2.0
1105 *
1106 * Unless required by applicable law or agreed to in writing, software
1107 * distributed under the License is distributed on an "AS IS" BASIS,
1108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1109 * See the License for the specific language governing permissions and
1110 * limitations under the License.
1111 */const Gm=1e3,Qm=10;class kl extends Cl{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Il(),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,u,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);_m()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Qm):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)})},Gm)}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]),Ob
1111ject.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]}}kl.type="LOCAL";const Ym=kl;/**
1112 * @license
1113 * Copyright 2020 Google LLC
1114 *
1115 * Licensed under the Apache License, Version 2.0 (the "License");
1116 * you may not use this file except in compliance with the License.
1117 * You may obtain a copy of the License at
1118 *
1119 *   http://www.apache.org/licenses/LICENSE-2.0
1120 *
1121 * Unless required by applicable law or agreed to in writing, software
1122 * distributed under the License is distributed on an "AS IS" BASIS,
1123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124 * See the License for the specific language governing permissions and
1125 * limitations under the License.
1126 */class Nl extends Cl{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Nl.type="SESSION";const Dl=Nl;/**
1127 * @license
1128 * Copyright 2019 Google LLC
1129 *
1130 * Licensed under the Apache License, Version 2.0 (the "License");
1131 * you may not use this file except in compliance with the License.
1132 * You may obtain a copy of the License at
1133 *
1134 *   http://www.apache.org/licenses/LICENSE-2.0
1135 *
1136 * Unless required by applicable law or agreed to in writing, software
1137 * distributed under the License is distributed on an "AS IS" BASIS,
1138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1139 * See the License for the specific language governing permissions and
1140 * limitations under the License.
1141 */function Xm(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1142 * @license
1143 * Copyright 2019 Google LLC
1144 *
1145 * Licensed under the Apache License, Version 2.0 (the "License");
1146 * you may not use this file except in compliance with the License.
1147 * You may obtain a copy of the License at
1148 *
1149 *   http://www.apache.org/licenses/LICENSE-2.0
1150 *
1151 * Unless required by applicable law or agreed to in writing, software
1152 * distributed under the License is distributed on an "AS IS" BASIS,
1153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1154 * See the License for the specific language governing permissions and
1155 * limitations under the License.
1156 */class Ds{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 Ds(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 u=Array.from(a).map(async d=>d(t.origin,i)),l=await Xm(u);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)}}Ds.receivers=[];/**
1157 * @license
1158 * Copyright 2020 Google LLC
1159 *
1160 * Licensed under the Apache License, Version 2.0 (the "License");
1161 * you may not use this file except in compliance with the License.
1162 * You may obtain a copy of the License at
1163 *
1164 *   http://www.apache.org/licenses/LICENSE-2.0
1165 *
1166 * Unless required by applicable law or agreed to in writing, software
1167 * distributed under the License is distributed on an "AS IS" BASIS,
1168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1169 * See the License for the specific language governing permissions and
1170 * limitations under the License.
1171 */function vo(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
1172 * @license
1173 * Copyright 2019 Google LLC
1174 *
1175 * Licensed under the Apache License, Version 2.0 (the "License");
1176 * you may not use this file except in compliance with the License.
1177 * You may obtain a copy of the License at
1178 *
1179 *   http://www.apache.org/licenses/LICENSE-2.0
1180 *
1181 * Unless required by applicable law or agreed to in writing, software
1182 * distributed under the License is distributed on an "AS IS" BASIS,
1183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1184 * See the License for the specific language governing permissions and
1185 * limitations under the License.
1186 */class Jm{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((u,l)=>{const d=vo("",20);s.port1.start();const p=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(y){const I=y;if(I.data.eventId===d)switch(I.data.status){case"ack":clearTimeout(p),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),u(I.data.response);break;default:clearTimeout(p),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)})}}/**
1187 * @license
1188 * Copyright 2020 Google LLC
1189 *
1190 * Licensed under the Apache License, Version 2.0 (the "License");
1191 * you may not use this file except in compliance with the License.
1192 * You may obtain a copy of the License at
1193 *
1194 *   http://www.apache.org/licenses/LICENSE-2.0
1195 *
1196 * Unless required by applicable law or agreed to in writing, software
1197 * distributed under the License is distributed on an "AS IS" BASIS,
1198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1199 * See the License for the specific language governing permissions and
1200 * limitations under the License.
1201 */function qe(){return window}function Zm(n){qe().location.href=n}/**
1202 * @license
1203 * Copyright 2020 Google LLC.
1204 *
1205 * Licensed under the Apache License, Version 2.0 (the "License");
1206 * you may not use this file except in compliance with the License.
1207 * You may obtain a copy of the License at
1208 *
1209 *   http://www.apache.org/licenses/LICENSE-2.0
1210 *
1211 * Unless required by applicable law or agreed to in writing, software
1212 * distributed under the License is distributed on an "AS IS" BASIS,
1213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1214 * See the License for the specific language governing permissions and
1215 * limitations under the License.
1216 */function Vl(){return typeof qe().WorkerGlobalScope<"u"&&typeof qe().importScripts=="function"}async function eg(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function tg(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function ng(){return Vl()?self:null}/**
1217 * @license
1218 * Copyright 2019 Google LLC
1219 *
1220 * Licensed under the Apache License, Version 2.0 (the "License");
1221 * you may not use this file except in compliance with the License.
1222 * You may obtain a copy of the License at
1223 *
1224 *   http://www.apache.org/licenses/LICENSE-2.0
1225 *
1226 * Unless required by applicable law or agreed to in writing, software
1227 * distributed under the License is distributed on an "AS IS" BASIS,
1228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229 * See the License for the specific language governing permissions and
1230 * limitations under the License.
1231 */const Ol="firebaseLocalStorageDb",rg=1,vs="firebaseLocalStorage",Ll="fbase_key";class yr{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 Vs(n,e){return n.transaction([vs],e?"readwrite":"readonly").objectStore(vs)}function sg(){const n=indexedDB.deleteDatabase(Ol);return new yr(n).toPromise()}function zi(){const n=indexedDB.open(Ol,rg);return new Promise((e,t)=>
1231{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(vs,{keyPath:Ll})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(vs)?e(r):(r.close(),await sg(),e(await zi()))})})}async function zc(n,e,t){const r=Vs(n,!0).put({[Ll]:e,value:t});return new yr(r).toPromise()}async function ig(n,e){const t=Vs(n,!1).get(e),r=await new yr(t).toPromise();return r===void 0?null:r.value}function Hc(n,e){const t=Vs(n,!0).delete(e);return new yr(t).toPromise()}const og=800,ag=3;class Ml{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 zi(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>ag)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Vl()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ds._getInstance(ng()),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 eg(),!this.activeServiceWorker)return;this.sender=new Jm(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||tg()!==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 zi();return await zc(e,ys,"1"),await Hc(e,ys),!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=>zc(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>ig(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Hc(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Vs(s,!1).getAll();return new yr(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(),og)}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]),Ob
vendor: 4,315 bytes, lines 1231-1280
1231ject.keys(this.listeners).length===0&&this.stopPolling()}}Ml.type="LOCAL";const cg=Ml;new gr(3e4,6e4);/**
1232 * @license
1233 * Copyright 2021 Google LLC
1234 *
1235 * Licensed under the Apache License, Version 2.0 (the "License");
1236 * you may not use this file except in compliance with the License.
1237 * You may obtain a copy of the License at
1238 *
1239 *   http://www.apache.org/licenses/LICENSE-2.0
1240 *
1241 * Unless required by applicable law or agreed to in writing, software
1242 * distributed under the License is distributed on an "AS IS" BASIS,
1243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1244 * See the License for the specific language governing permissions and
1245 * limitations under the License.
1246 */function ug(n,e){return e?Ze(e):(M(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1247 * @license
1248 * Copyright 2019 Google LLC
1249 *
1250 * Licensed under the Apache License, Version 2.0 (the "License");
1251 * you may not use this file except in compliance with the License.
1252 * You may obtain a copy of the License at
1253 *
1254 *   http://www.apache.org/licenses/LICENSE-2.0
1255 *
1256 * Unless required by applicable law or agreed to in writing, software
1257 * distributed under the License is distributed on an "AS IS" BASIS,
1258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1259 * See the License for the specific language governing permissions and
1260 * limitations under the License.
1261 */class Eo extends _o{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rn(e,this._buildIdpRequest())}_linkToIdToken(e,t){return rn(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return rn(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 lg(n){return Sl(n.auth,new Eo(n),n.bypassAuthState)}function hg(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),$m(t,new Eo(n),n.bypassAuthState)}async function dg(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),jm(t,new Eo(n),n.bypassAuthState)}/**
1262 * @license
1263 * Copyright 2020 Google LLC
1264 *
1265 * Licensed under the Apache License, Version 2.0 (the "License");
1266 * you may not use this file except in compliance with the License.
1267 * You may obtain a copy of the License at
1268 *
1269 *   http://www.apache.org/licenses/LICENSE-2.0
1270 *
1271 * Unless required by applicable law or agreed to in writing, software
1272 * distributed under the License is distributed on an "AS IS" BASIS,
1273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1274 * See the License for the specific language governing permissions and
1275 * limitations under the License.
1276 */class xl{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:u}=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(u)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return lg;case"linkViaPopup":case"linkViaRedirect":return dg;case"reauthViaPopup":case"reauthViaRedirect":return hg;default:Me(this.auth,"internal-error")}}resolve(e){st(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){st(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()}}/**
1277 * @license
1278 * Copyright 2020 Google LLC
1279 *
1280 * Licensed under the Apache License, Version 2.0 (the "License");
1281 * you may not use this file except in compliance with the License.
1282 * You may obtain a copy of the License at
1283 *
1284 *   http://www.apache.org/licenses/LICENSE-2.0
1285 *
1286 * Unless required by applicable law or agreed to in writing, software
1287 * distributed under the License is distributed on an "AS IS" BASIS,
1288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1289 * See the License for the specific language governing permissions and
1290 * limitations under the License.
1291 */const fg=new gr(2e3,1e4);class en extends xl{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,en.currentPopupAction&&en.currentPopupAction.cancel(),en.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return M(e,this.auth,"internal-error"),e}async onExecution(){st(this.filter.length===1,"Popup operations only handle one event");const e=vo();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(Be(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(Be(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,en.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(Be(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,fg.get())};e()}}en.currentPopupAction=null;/**
1292 * @license
1293 * Copyright 2020 Google LLC
1294 *
1295 * Licensed under the Apache License, Version 2.0 (the "License");
1296 * you may not use this file except in compliance with the License.
1297 * You may obtain a copy of the License at
1298 *
1299 *   http://www.apache.org/licenses/LICENSE-2.0
1300 *
1301 * Unless required by applicable law or agreed to in writing, software
1302 * distributed under the License is distributed on an "AS IS" BASIS,
1303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1304 * See the License for the specific language governing permissions and
1305 * limitations under the License.
1306 */const pg="pendingRedirect",os=new Map;class mg extends xl{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=os.get(this.auth._key());if(!e){try{const r=await gg(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}os.set(this.auth._key(),e)}return this.bypassAuthState||os.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 gg(n,e){const t=vg(e),r=yg(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function _g(n,e){os.set(n._key(),e)}function yg(n){return Ze(n._redirectPersistence)}function vg(n){return is(pg,n.config.apiKey,n.name)}async function Eg(n,e,t=!1){if(Ye(n.app))return Promise.reject(Et(n));const r=_n(n),s=ug(r,e),a=await new mg(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
1307 * @license
1308 * Copyright 2020 Google LLC
1309 *
1310 * Licensed under the Apache License, Version 2.0 (the "License");
1311 * you may not use this file except in compliance with the License.
1312 * You may obtain a copy of the License at
1313 *
1314 *   http://www.apache.org/licenses/LICENSE-2.0
1315 *
1316 * Unless required by applicable law or agreed to in writing, softw
1316are
1317 * distributed under the License is distributed on an "AS IS" BASIS,
1318 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1319 * See the License for the specific language governing permissions and
1320 * limitations under the License.
1321 */const Tg=10*60*1e3;class Ig{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||!wg(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Ul(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(Be(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>=Tg&&this.cachedEventUids.clear(),this.cachedEventUids.has(Wc(e))}saveEventToCache(e){this.cachedEventUids.add(Wc(e)),this.lastProcessedEventTime=Date.now()}}function Wc(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Ul({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function wg(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ul(n);default:return!1}}/**
1322 * @license
1323 * Copyright 2020 Google LLC
1324 *
1325 * Licensed under the Apache License, Version 2.0 (the "License");
1326 * you may not use this file except in compliance with the License.
1327 * You may obtain a copy of the License at
1328 *
1329 *   http://www.apache.org/licenses/LICENSE-2.0
1330 *
1331 * Unless required by applicable law or agreed to in writing, software
1332 * distributed under the License is distributed on an "AS IS" BASIS,
1333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334 * See the License for the specific language governing permissions and
1335 * limitations under the License.
1336 */async function Ag(n,e={}){return Rt(n,"GET","/v1/projects",e)}/**
1337 * @license
1338 * Copyright 2020 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 */const Rg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Pg=/^https?/;async function bg(n){if(n.config.emulator)return;const{authorizedDomains:e}=await Ag(n);for(const t of e)try{if(Sg(t))return}catch{}Me(n,"unauthorized-domain")}function Sg(n){const e=ji(),{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(!Pg.test(t))return!1;if(Rg.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1352 * @license
1353 * Copyright 2020 Google LLC.
1354 *
1355 * Licensed under the Apache License, Version 2.0 (the "License");
1356 * you may not use this file except in compliance with the License.
1357 * You may obtain a copy of the License at
1358 *
1359 *   http://www.apache.org/licenses/LICENSE-2.0
1360 *
1361 * Unless required by applicable law or agreed to in writing, softw
1361are
1362 * distributed under the License is distributed on an "AS IS" BASIS,
1363 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1364 * See the License for the specific language governing permissions and
1365 * limitations under the License.
1366 */const Cg=new gr(3e4,6e4);function Kc(){const n=qe().___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 kg(n){return new Promise((e,t)=>{var r,s,i;function a(){Kc(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Kc(),t(Be(n,"network-request-failed"))},timeout:Cg.get()})}if(!((s=(r=qe().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=qe().gapi)===null||i===void 0)&&i.load)a();else{const u=Pm("iframefcb");return qe()[u]=()=>{gapi.load?a():t(Be(n,"network-request-failed"))},Al(`${Rm()}?onload=${u}`).catch(l=>t(l))}}).catch(e=>{throw as=null,e})}let as=null;function Ng(n){return as=as||kg(n),as}/**
1367 * @license
1368 * Copyright 2020 Google LLC.
1369 *
1370 * Licensed under the Apache License, Version 2.0 (the "License");
1371 * you may not use this file except in compliance with the License.
1372 * You may obtain a copy of the License at
1373 *
1374 *   http://www.apache.org/licenses/LICENSE-2.0
1375 *
1376 * Unless required by applicable law or agreed to in writing, software
1377 * distributed under the License is distributed on an "AS IS" BASIS,
1378 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379 * See the License for the specific language governing permissions and
1380 * limitations under the License.
1381 */const Dg=new gr(5e3,15e3),Vg="__/auth/iframe",Og="emulator/auth/iframe",Lg={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Mg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function xg(n){const e=n.config;M(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?po(e,Og):`https://${n.config.authDomain}/${Vg}`,r={apiKey:e.apiKey,appName:n.name,v:$t},s=Mg.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${mr(r).slice(1)}`}async function Ug(n){const e=await Ng(n),t=qe().gapi;return M(t,n,"internal-error"),e.open({where:document.body,url:xg(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Lg,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=Be(n,"network-request-failed"),u=qe().setTimeout(()=>{i(a)},Dg.get());function l(){qe().clearTimeout(u),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
1382 * @license
1383 * Copyright 2020 Google LLC.
1384 *
1385 * Licensed under the Apache License, Version 2.0 (the "License");
1386 * you may not use this file except in compliance with the License.
1387 * You may obtain a copy of the License at
1388 *
1389 *   http://www.apache.org/licenses/LICENSE-2.0
1390 *
1391 * Unless required by applicable law or agreed to in writing, software
1392 * distributed under the License is distributed on an "AS IS" BASIS,
1393 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1394 * See the License for the specific language governing permissions and
1395 * limitations under the License.
1396 */const Fg={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Bg=500,qg=600,jg="_blank",$g="http://localhost";class Gc{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function zg(n,e,t,r=Bg,s=qg){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let u="";const l=Object.assign(Object.assign({},Fg),{width:r.toString(),height:s.toString(),top:i,left:a}),d=we().toLowerCase();t&&(u=_l(d)?jg:t),ml(d)&&(e=e||$g,l.scrollbars="yes");const p=Object.entries(l).reduce((I,[P,k])=>`${I}${P}=${k},`,"");if(gm(d)&&u!=="_self")return Hg(e||"",u),new Gc(null);const y=window.open(e||"",u,p);M(y,n,"popup-blocked");try{y.focus()}catch{}return new Gc(y)}function Hg(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
1396r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
1397 * @license
1398 * Copyright 2021 Google LLC
1399 *
1400 * Licensed under the Apache License, Version 2.0 (the "License");
1401 * you may not use this file except in compliance with the License.
1402 * You may obtain a copy of the License at
1403 *
1404 *   http://www.apache.org/licenses/LICENSE-2.0
1405 *
1406 * Unless required by applicable law or agreed to in writing, software
1407 * distributed under the License is distributed on an "AS IS" BASIS,
1408 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1409 * See the License for the specific language governing permissions and
1410 * limitations under the License.
1411 */const Wg="__/auth/handler",Kg="emulator/auth/handler",Gg=encodeURIComponent("fac");async function Qc(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:$t,eventId:s};if(e instanceof Pl){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",Bf(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[p,y]of Object.entries({}))a[p]=y}if(e instanceof _r){const p=e.getScopes().filter(y=>y!=="");p.length>0&&(a.scopes=p.join(","))}n.tenantId&&(a.tid=n.tenantId);const u=a;for(const p of Object.keys(u))u[p]===void 0&&delete u[p];const l=await n._getAppCheckToken(),d=l?`#${Gg}=${encodeURIComponent(l)}`:"";return`${Qg(n)}?${mr(u).slice(1)}${d}`}function Qg({config:n}){return n.emulator?po(n,Kg):`https://${n.authDomain}/${Wg}`}/**
1412 * @license
1413 * Copyright 2020 Google LLC
1414 *
1415 * Licensed under the Apache License, Version 2.0 (the "License");
1416 * you may not use this file except in compliance with the License.
1417 * You may obtain a copy of the License at
1418 *
1419 *   http://www.apache.org/licenses/LICENSE-2.0
1420 *
1421 * Unless required by applicable law or agreed to in writing, software
1422 * distributed under the License is distributed on an "AS IS" BASIS,
1423 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424 * See the License for the specific language governing permissions and
1425 * limitations under the License.
1426 */const bi="webStorageSupport";class Yg{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Dl,this._completeRedirectFn=Eg,this._overrideRedirectResult=_g}async _openPopup(e,t,r,s){var i;st((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const a=await Qc(e,t,r,ji(),s);return zg(e,a,vo())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await Qc(e,t,r,ji(),s);return Zm(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):(st(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 Ug(e),r=new Ig(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(bi,{type:bi},s=>{var i;const a=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[bi];a!==void 0&&t(!!a),Me(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=bg(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Il()||gl()||go()}}const Xg=Yg;var Yc="@firebase/auth",Xc="1.7.9";/**
1427 * @license
1428 * Copyright 2020 Google LLC
1429 *
1430 * Licensed under the Apache License, Version 2.0 (the "License");
1431 * you may not use this file except in compliance with the License.
1432 * You may obtain a copy of the License at
1433 *
1434 *   http://www.apache.org/licenses/LICENSE-2.0
1435 *
1436 * Unless required by applicable law or agreed to in writing, softw
1436are
1437 * distributed under the License is distributed on an "AS IS" BASIS,
1438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1439 * See the License for the specific language governing permissions and
1440 * limitations under the License.
1441 */class Jg{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()}}/**
1442 * @license
1443 * Copyright 2020 Google LLC
1444 *
1445 * Licensed under the Apache License, Version 2.0 (the "License");
1446 * you may not use this file except in compliance with the License.
1447 * You may obtain a copy of the License at
1448 *
1449 *   http://www.apache.org/licenses/LICENSE-2.0
1450 *
1451 * Unless required by applicable law or agreed to in writing, software
1452 * distributed under the License is distributed on an "AS IS" BASIS,
1453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1454 * See the License for the specific language governing permissions and
1455 * limitations under the License.
1456 */function Zg(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 e_(n){rt(new ze("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:u}=r.options;M(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:u,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wl(n)},d=new Im(r,s,i,l);return Nm(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),rt(new ze("auth-internal",e=>{const t=_n(e.getProvider("auth").getImmediate());return(r=>new Jg(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Oe(Yc,Xc,Zg(n)),Oe(Yc,Xc,"esm2017")}/**
1457 * @license
1458 * Copyright 2021 Google LLC
1459 *
1460 * Licensed under the Apache License, Version 2.0 (the "License");
1461 * you may not use this file except in compliance with the License.
1462 * You may obtain a copy of the License at
1463 *
1464 *   http://www.apache.org/licenses/LICENSE-2.0
1465 *
1466 * Unless required by applicable law or agreed to in writing, software
1467 * distributed under the License is distributed on an "AS IS" BASIS,
1468 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1469 * See the License for the specific language governing permissions and
1470 * limitations under the License.
1471 */const t_=5*60,n_=Zu("authIdTokenMaxAge")||t_;let Jc=null;const r_=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>n_)return;const s=t==null?void 0:t.token;Jc!==s&&(Jc=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function dI(n=rl()){const e=gn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=km(n,{popupRedirectResolver:Xg,persistence:[cg,Ym,Dl]}),r=Zu("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=r_(i.toString());Km(t,a,()=>a(t.currentUser)),Wm(t,u=>a(u))}}const s=Xu("auth");return s&&Dm(t,`http://${s}`),t}function s_(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}wm({loadJS(n){return new Promise((e,t)=>
vendor: 54,510 bytes, lines 1471-1527
1471{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=Be("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",s_().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="});e_("Browser");var i_="firebase",o_="10.14.1";/**
1472 * @license
1473 * Copyright 2020 Google LLC
1474 *
1475 * Licensed under the Apache License, Version 2.0 (the "License");
1476 * you may not use this file except in compliance with the License.
1477 * You may obtain a copy of the License at
1478 *
1479 *   http://www.apache.org/licenses/LICENSE-2.0
1480 *
1481 * Unless required by applicable law or agreed to in writing, software
1482 * distributed under the License is distributed on an "AS IS" BASIS,
1483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1484 * See the License for the specific language governing permissions and
1485 * limitations under the License.
1486 */Oe(i_,o_,"app");var Zc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1487Copyright The Closure Library Authors.
1488SPDX-License-Identifier: Apache-2.0
1489*/var Ot,Fl;(function(){var n;/** @license
1490
1491 Copyright The Closure Library Authors.
1492 SPDX-License-Identifier: Apache-2.0
1493*/function e(E,m){function _(){}_.prototype=m.prototype,E.D=m.prototype,E.prototype=new _,E.prototype.constructor=E,E.C=function(v,T,A){for(var g=Array(arguments.length-2),Ke=2;Ke<arguments.length;Ke++)g[Ke-2]=arguments[Ke];return m.prototype[T].apply(v,g)}}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(E,m,_){_||(_=0);var v=Array(16);if(typeof m=="string")for(var T=0;16>T;++T)v[T]=m.charCodeAt(_++)|m.charCodeAt(_++)<<8|m.charCodeAt(_++)<<16|m.charCodeAt(_++)<<24;else for(T=0;16>T;++T)v[T]=m[_++]|m[_++]<<8|m[_++]<<16|m[_++]<<24;m=E.g[0],_=E.g[1],T=E.g[2];var A=E.g[3],g=m+(A^_&(T^A))+v[0]+3614090360&4294967295;m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+v[1]+3905402710&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+v[2]+606105819&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+v[3]+3250441966&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+v[4]+4118548399&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+v[5]+1200080426&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+v[6]+2821735955&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+v[7]+4249261313&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+v[8]+1770035416&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+v[9]+2336552879&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+v[10]+4294925233&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+v[11]+2304563134&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+v[12]+1804603682&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+v[13]+4254626195&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+v[14]+2792965006&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+v[15]+1236535329&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(T^A&(_^T))+v[1]+4129170786&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+v[6]+3225465664&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+v[11]+643717713&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+v[0]+3921069994&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+v[5]+3593408605&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+v[10]+38016083&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+v[15]+3634488961&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+v[4]+3889429448&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+v[9]+568446438&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+v[14]+3275163606&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+v[3]+4107603335&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+v[8]+1163531501&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+v[13]+2850285829&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+v[2]+4243563512&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+v[7]+1735328473&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+v[12]+2368359562&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(_^T^A)+v[5]+4294588738&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+v[8]+2272392833&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+v[11]+1839030562&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+v[14]+4259657740&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+v[1]+2763975236&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+v[4]+1272893353&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+v[7]+4139469664&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+v[10]+3200236656&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+v[13]+681279174&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+v[0]+3936430074&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+v[3]+3572445317&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+v[6]+76029189&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+v[9]+3654602809&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+v[12]+3873151461&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+v[15]+530742520&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+v[2]+3299628645&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(T^(_|~A))+v[0]+4096336452&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+v[7]+1126891415&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+v[14]+2878612391&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+v[5]+4237533241&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+v[12]+1700485571&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+v[3]+2399980690&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+v[10]+4293915773&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+v[1]+2240044497&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+v[8]+1873313359&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+v[15]+4264355552&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+v[6]+2734768916&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+v[13]+1309151649&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+v[4]+4149444226&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+v[11]+3174756917&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+v[2]+718787259&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+v[9]+3951481745&4294967295,E.g[0]=E.g[0]+m&4294967295,E.g[1]=E.g[1]+(T+(g<<21&4294967295|g>>>11))&4294967295,E.g[2]=E.g[2]+T&4294967295,E.g[3]=E.g[3]+A&4294967295}r.prototype.u=function(E,m){m===void 0&&(m=E.length);for(var _=m-this.blockSize,v=this.B,T=this.h,A=0;A<m;){if(T==0)for(;A<=_;)s(this,E,A),A+=this.blockSize;if(typeof E=="string"){for(;A<m;)if(v[T++]=E.charCodeAt(A++),T==this.blockSize){s(this,v),T=0;break}}else for(;A<m;)if(v[T++]=E[A++],T==this.blockSize){s(this,v),T=0;break}}this.h=T,this.o+=m},r.prototype.v=function(){var E=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);E[0]=128;for(var m=1;m<E.length-8;++m)E[m]=0;var _=8*this.o;for(m=E.length-8;m<E.length;++m)E[m]=_&255,_/=256;for(this.u(E),E=Array(16),m=_=0;4>m;++m)for(var v=0;32>v;v+=8)E[_++]=this.g[m]>>>v&255;return E};function i(E,m){var _=u;return Object.prototype.hasOwnProperty.call(_,E)?_[E]:_[E]=m(E)}function a(E,m){this.h=m;for(var _=[],v=!0,T=E.length-1;0<=T;T--){var A=E[T]|0;v&&A==m||(_[T]=A,v=!1)}this.g=_}var u={};function l(E){return-128<=E&&128>E?i(E,function(m){return new a([m|0],0>m?-1:0)}):new a([E|0],0>E?-1:0)}function d(E){if(isNaN(E)||!isFinite(E))return y;if(0>E)return C(d(-E));for(var m=[],_=1,v=0;E>=_;v++)m[v]=E/_|0,_*=4294967296;return new a(m,0)}function p(E,m){if(E.length==0)throw Error("number format error: empty string");if(m=m||10,2>m||36<m)throw Error("radix out of range: "+m);if(E.charAt(0)=="-")return C(p(E.substring(1),m));if(0<=E.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=d(Math.pow(m,8)),v=y,T=0;T<E.length;T+=8){var A=Math.min(8,E.length-T),g=parseInt(E.substring(T,T+A),m);8>A?(A=d(Math.pow(m,A)),v=v.j(A).add(d(g))):(v=v.j(_),v=v.add(d(g)))}return v}var y=l(0),I=l(1),P=l(16777216);n=a.prototype,n.m=function(){if(V(this))return-C(this).m();for(var E=0,m=1,_=0;_<this.g.length;_++){var v=this.i(_);E+=(0<=v?v:4294967296+v)*m,m*=4294967296}return E},n.toString=function(E){if(E=E||10,2>E||36<E)throw Error("radix out of range: "+E);if(k(this))return"0";if(V(this))return"-"+C(this).toString(E);for(var m=d(Math.pow(E,6)),_=this,v="";;){var T=$(_,m).g;_=B(_,T.j(m));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(E);if(_=T,k(_))return A+v;for(;6>A.length;)A="0"+A;v=A+v}},n.i=function(E){return 0>E?0:E<this.g.length?this.g[E]:this.h};function k(E){if(E.h!=0)return!1;for(var m=0;m<E.g.length;m++)if(E.g[m]!=0)return!1;return!0}function V(E){return E.h==-1}n.l=function(E){return E=B(this,E),V(E)?-1:k(E)?0:1};function C(E){for(var m=E.g.length,_=[],v=0;v<m;v++)_[v]=~E.g[v];return new a(_,~E.h).add(I)}n.abs=function(){return V(this)?C(this):this},n.add=function(E){for(var m=Math.max(this.g.length,E.g.length),_=[],v=0,T=0;T<=m;T++){var A=v+(this.i(T)&65535)+(E.i(T)&65535),g=(A>>>16)+(this.i(T)>>>16)+(E.i(T)>>>16);v=g>>>16,A&=65535,g&=65535,_[T]=g<<16|A}return new a(_,_[_.length-1]&-2147483648?-1:0)};function B(E,m){return E.add(C(m))}n.j=function(E){if(k(this)||k(E))return y;if(V(this))return V(E)?C(this).j(C(E)):C(C(this).j(E));if(V(E))return C(this.j(C(E)));if(0>this.l(P)&&0>E.l(P))return d(this.m()*E.m());for(var m=this.g.length+E.g.length,_=[],v=0;v<2*m;v++)_[v]=0;for(v=0;v<this.g.length;v++)for(var T=0;T<E.g.length;T++){var A=this.i(v)>>>16,g=this.i(v)&65535,Ke=E.i(T)>>>16,Pn=E.i(T)&65535;_[2*v+2*T]+=g*Pn,j(_,2*v+2*T),_[2*v+2*T+1]+=A*Pn,j(_,2*v+2*T+1),_[2*v+2*T+1]+=g*Ke,j(_,2*v+2*T+1),_[2*v+2*T+2]+=A*Ke,j(_,2*v+2*T+2)}for(v=0;v<m;v++)_[v]=_[2*v+1]<<16|_[2*v];for(v=m;v<2*m;v++)_[v]=0;return new a(_,0)};function j(E,m){for(;(E[m]&65535)!=E[m];)E[m+1]+=E[m]>>>16,E[m]&=65535,m++}function q(E,m){this.g=E,this.h=m}function $(E,m){if(k(m))throw Error("division by zero");if(k(E))return new q(y,y);if(V(E))return m=$(C(E),m),new q(C(m.g),C(m.h));if(V(m))return m=$(E,C(m)),new q(C(m.g),m.h);if(30<E.g.length){if(V(E)||V(m))throw Error("slowDivide_ only works with positive integers.");for(var _=I,v=m;0>=v.l(E);)_=le(_),v=le(v);var T=J(_,1),A=J(v,1);for(v=J(v,2),_=J(_,2);!k(v);){var g=A.add(v);0>=g.l(E)&&(T=T.add(_),A=g),v=J(v,1),_=J(_,1)}return m=B(E,T.j(m)),new q(T,m)}for(T=y;0<=E.l(m);){for(_=Math.max(1,Math.floor(E.m()/m.m())),v=Math.ceil(Math.log(_)/Math.LN2),v=48>=v?1:Math.pow(2,v-48),A=d(_),g=A.j(m);V(g)||0<g.l(E);)_-=v,A=d(_),g=A.j(m);k(A)&&(A=I),T=T.add(A),E=B(E,g)}return new q(T,E)}n.A=function(E){return $(this,E).h},n.and=function(E){for(var m=Math.max(this.g.length,E.g.length),_=[],v=0;v<m;v++)_[v]=this.i(v)&E.i(v);return new a(_,this.h&E.h)},n.or=function(E){for(var m=Math.max(this.g.length,E.g.length),_=[],v=0;v<m;v++)_[v]=this.i(v)|E.i(v);return new a(_,this.h|E.h)},n.xor=function(E){for(var m=Math.max(this.g.length,E.g.length),_=[],v=0;v<m;v++)_[v]=this.i(v)^E.i(v);return new a(_,this.h^E.h)};function le(E){for(var m=E.g.length+1,_=[],v=0;v<m;v++)_[v]=E.i(v)<<1|E.i(v-1)>>>31;return new a(_,E.h)}function J(E,m){var _=m>>5;m%=32;for(var v=E.g.length-_,T=[],A=0;A<v;A++)T[A]=0<m?E.i(A+_)>>>m|E.i(A+_+1)<<32-m:E.i(A+_);return new a(T,E.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,Fl=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=p,Ot=a}).apply(typeof Zc<"u"?Zc:typeof self<"u"?self:typeof window<"u"?window:{});var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1494Copyright The Closure Library Authors.
1495SPDX-License-Identifier: Apache-2.0
1496*/var Bl,Kn,ql,cs,Hi,jl,$l,zl;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,c,h){return o==Array.prototype||o==Object.prototype||(o[c]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof Jr=="object"&&Jr];for(var c=0;c<o.length;++c){var h=o[c];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function s(o,c){if(c)e:{var h=r;o=o.split(".");for(var f=0;f<o.length-1;f++){var w=o[f];if(!(w in h))break e;h=h[w]}o=o[o.length-1],f=h[o],c=c(f),c!=f&&c!=null&&e(h,o,{configurable:!0,writable:!0,value:c})}}function i(o,c){o instanceof String&&(o+="");var h=0,f=!1,w={next:function(){if(!f&&h<o.length){var R=h++;return{value:c(R,o[R]),done:!1}}return f=!0,{done:!0,value:void 0}}};return w[Symbol.iterator]=function(){return w},w}s("Array.prototype.values",function(o){return o||function(){return i(this,function(c,h){return h})}});/** @license
1497
1498 Copyright The Closure Library Authors.
1499 SPDX-License-Identifier: Apache-2.0
1500*/var a=a||{},u=this||self;function l(o){var c=typeof o;return c=c!="object"?c:o?Array.isArray(o)?"array":c:"null",c=="array"||c=="object"&&typeof o.length=="number"}function d(o){var c=typeof o;return c=="object"&&o!=null||c=="function"}function p(o,c,h){return o.call.apply(o.bind,arguments)}function y(o,c,h){if(!o)throw Error();if(2<arguments.length){var f=Array.prototype.slice.call(arguments,2);return function(){var w=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(w,f),o.apply(c,w)}}return function(){return o.apply(c,arguments)}}function I(o,c,h){return I=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?p:y,I.apply(null,arguments)}function P(o,c){var h=Array.prototype.slice.call(arguments,1);return function(){var f=h.slice();return f.push.apply(f,arguments),o.apply(this,f)}}function k(o,c){function h(){}h.prototype=c.prototype,o.aa=c.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(f,w,R){for(var N=Array(arguments.length-2),X=2;X<arguments.length;X++)N[X-2]=arguments[X];return c.prototype[w].apply(f,N)}}function V(o){const c=o.length;if(0<c){const h=Array(c);for(let f=0;f<c;f++)h[f]=o[f];return h}return[]}function C(o,c){for(let h=1;h<arguments.length;h++){const f=arguments[h];if(l(f)){const w=o.length||0,R=f.length||0;o.length=w+R;for(let N=0;N<R;N++)o[w+N]=f[N]}else o.push(f)}}class B{constructor(c,h){this.i=c,this.j=h,this.h=0,this.g=null}get(){let c;return 0<this.h?(this.h--,c=this.g,this.g=c.next,c.next=null):c=this.i(),c}}function j(o){return/^[\s\xa0]*$/.test(o)}function q(){var o=u.navigator;return o&&(o=o.userAgent)?o:""}function $(o){return $[" "](o),o}$[" "]=function(){};var le=q().indexOf("Gecko")!=-1&&!(q().toLowerCase().indexOf("webkit")!=-1&&q().indexOf("Edge")==-1)&&!(q().indexOf("Trident")!=-1||q().indexOf("MSIE")!=-1)&&q().indexOf("Edge")==-1;function J(o,c,h){for(const f in o)c.call(h,o[f],f,o)}function E(o,c){for(const h in o)c.call(void 0,o[h],h,o)}function m(o){const c={};for(const h in o)c[h]=o[h];return c}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function v(o,c){let h,f;for(let w=1;w<arguments.length;w++){f=arguments[w];for(h in f)o[h]=f[h];for(let R=0;R<_.length;R++)h=_[R],Object.prototype.hasOwnProperty.call(f,h)&&(o[h]=f[h])}}function T(o){var c=1;o=o.split(":");const h=[];for(;0<c&&o.length;)h.push(o.shift()),c--;return o.length&&h.push(o.join(":")),h}function A(o){u.setTimeout(()=>{throw o},0)}function g(){var o=Xs;let c=null;return o.g&&(c=o.g,o.g=o.g.next,o.g||(o.h=null),c.next=null),c}class Ke{constructor(){this.h=this.g=null}add(c,h){const f=Pn.get();f.set(c,h),this.h?this.h.next=f:this.g=f,this.h=f}}var Pn=new B(()=>new Md,o=>o.reset());class Md{constructor(){this.next=this.g=this.h=null}set(c,h){this.h=c,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let bn,Sn=!1,Xs=new Ke,wa=()=>{const o=u.Promise.resolve(void 0);bn=()=>{o.then(xd)}};var xd=()=>{for(var o;o=g();){try{o.h.call(o.g)}catch(h){A(h)}var c=Pn;c.j(o),100>c.h&&(c.h++,o.next=c.g,c.g=o)}Sn=!1};function ct(){this.s=this.s,this.C=this.C}ct.prototype.s=!1,ct.prototype.ma=function(){this.s||(this.s=!0,this.N())},ct.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function ge(o,c){this.type=o,this.g=this.target=c,this.defaultPrevented=!1}ge.prototype.h=function(){this.defaultPrevented=!0};var Ud=function(){if(!u.addEventListener||!Object.defineProperty)return!1;var o=!1,c=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};u.addEventListener("test",h,c),u.removeEventListener("test",h,c)}catch{}return o}();function Cn(o,c){if(ge.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,f=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=c,c=o.relatedTarget){if(le){e:{try{$(c.nodeName);var w=!0;break e}catch{}w=!1}w||(c=null)}}else h=="mouseover"?c=o.fromElement:h=="mouseout"&&(c=o.toElement);this.relatedTarget=c,f?(this.clientX=f.clientX!==void 0?f.clientX:f.pageX,this.clientY=f.clientY!==void 0?f.clientY:f.pageY,this.screenX=f.screenX||0,this.screenY=f.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:Fd[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&Cn.aa.h.call(this)}}k(Cn,ge);var Fd={2:"touch",3:"pen",4:"mouse"};Cn.prototype.h=function(){Cn.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var Dr="closure_listenable_"+(1e6*Math.random()|0),Bd=0;function qd(o,c,h,f,w){this.listener=o,this.proxy=null,this.src=c,this.type=h,this.capture=!!f,this.ha=w,this.key=++Bd,this.da=this.fa=!1}function Vr(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function Or(o){this.src=o,this.g={},this.h=0}Or.prototype.add=function(o,c,h,f,w){var R=o.toString();o=this.g[R],o||(o=this.g[R]=[],this.h++);var N=Zs(o,c,f,w);return-1<N?(c=o[N],h||(c.fa=!1)):(c=new qd(c,this.src,R,!!f,w),c.fa=h,o.push(c)),c};function Js(o,c){var h=c.type;if(h in o.g){var f=o.g[h],w=Array.prototype.indexOf.call(f,c,void 0),R;(R=0<=w)&&Array.prototype.splice.call(f,w,1),R&&(Vr(c),o.g[h].length==0&&(delete o.g[h],o.h--))}}function Zs(o,c,h,f){for(var w=0;w<o.length;++w){var R=o[w];if(!R.da&&R.listener==c&&R.capture==!!h&&R.ha==f)return w}return-1}var ei="closure_lm_"+(1e6*Math.random()|0),ti={};function Aa(o,c,h,f,w){if(Array.isArray(c)){for(var R=0;R<c.length;R++)Aa(o,c[R],h,f,w);return null}return h=ba(h),o&&o[Dr]?o.K(c,h,d(f)?!!f.capture:!1,w):jd(o,c,h,!1,f,w)}function jd(o,c,h,f,w,R){if(!c)throw Error("Invalid event type");var N=d(w)?!!w.capture:!!w,X=ri(o);if(X||(o[ei]=X=new Or(o)),h=X.add(c,h,f,N,R),h.proxy)return h;if(f=$d(),h.proxy=f,f.src=o,f.listener=h,o.addEventListener)Ud||(w=N),w===void 0&&(w=!1),o.addEventListener(c.toString(),f,w);else if(o.attachEvent)o.attachEvent(Pa(c.toString()),f);else if(o.addListener&&o.removeListener)o.addListener(f);else throw Error("addEventListener and attachEvent are unavailable.");return h}function $d(){function o(h){return c.call(o.src,o.listener,h)}const c=zd;return o}function Ra(o,c,h,f,w){if(Array.isArray(c))for(var R=0;R<c.length;R++)Ra(o,c[R],h,f,w);else f=d(f)?!!f.capture:!!f,h=ba(h),o&&o[Dr]?(o=o.i,c=String(c).toString(),c in o.g&&(R=o.g[c],h=Zs(R,h,f,w),-1<h&&(Vr(R[h]),Array.prototype.splice.call(R,h,1),R.length==0&&(delete o.g[c],o.h--)))):o&&(o=ri(o))&&(c=o.g[c.toString()],o=-1,c&&(o=Zs(c,h,f,w)),(h=-1<o?c[o]:null)&&ni(h))}function ni(o){if(typeof o!="number"&&o&&!o.da){var c=o.src;if(c&&c[Dr])Js(c.i,o);else{var h=o.type,f=o.proxy;c.removeEventListener?c.removeEventListener(h,f,o.capture):c.detachEvent?c.detachEvent(Pa(h),f):c.addListener&&c.removeListener&&c.removeListener(f),(h=ri(c))?(Js(h,o),h.h==0&&(h.src=null,c[ei]=null)):Vr(o)}}}function Pa(o){return o in ti?ti[o]:ti[o]="on"+o}function zd(o,c){if(o.da)o=!0;else{c=new Cn(c,this);var h=o.listener,f=o.ha||o.src;o.fa&&ni(o),o=h.call(f,c)}return o}function ri(o){return o=o[ei],o instanceof Or?o:null}var si="__closure_events_fn_"+(1e9*Math.random()>>>0);function ba(o){return typeof o=="function"?o:(o[si]||(o[si]=function(c){return o.handleEvent(c)}),o[si])}function _e(){ct.call(this),this.i=new Or(this),this.M=this,this.F=null}k(_e,ct),_e.prototype[Dr]=!0,_e.prototype.removeEventListener=function(o,c,h,f){Ra(this,o,c,h,f)};function Ae(o,c){var h,f=o.F;if(f)for(h=[];f;f=f.F)h.push(f);if(o=o.M,f=c.type||c,typeof c=="string")c=new ge(c,o);else if(c instanceof ge)c.target=c.target||o;else{var w=c;c=new ge(f,o),v(c,w)}if(w=!0,h)for(var R=h.length-1;0<=R;R--){var N=c.g=h[R];w=Lr(N,f,!0,c)&&w}if(N=c.g=o,w=Lr(N,f,!0,c)&&w,w=Lr(N,f,!1,c)&&w,h)for(R=0;R<h.length;R++)N=c.g=h[R],w=Lr(N,f,!1,c)&&w}_e.prototype.N=function(){if(_e.aa.N.call(this),this.i){var o=this.i,c;for(c in o.g){for(var h=o.g[c],f=0;f<h.length;f++)Vr(h[f]);delete o.g[c],o.h--}}this.F=null},_e.prototype.K=function(o,c,h,f){return this.i.add(String(o),c,!1,h,f)},_e.prototype.L=function(o,c,h,f){return this.i.add(String(o),c,!0,h,f)};function Lr(o,c,h,f){if(c=o.i.g[String(c)],!c)return!0;c=c.concat();for(var w=!0,R=0;R<c.length;++R){var N=c[R];if(N&&!N.da&&N.capture==h){var X=N.listener,he=N.ha||N.src;N.fa&&Js(o.i,N),w=X.call(he,f)!==!1&&w}}return w&&!f.defaultPrevented}function Sa(o,c,h){if(typeof o=="function")h&&(o=I(o,h));else if(o&&typeof o.handleEvent=="function")o=I(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(c)?-1:u.setTimeout(o,c||0)}function Ca(o){o.g=Sa(()=>{o.g=null,o.i&&(o.i=!1,Ca(o))},o.l);const c=o.h;o.h=null,o.m.apply(null,c)}class Hd extends ct{constructor(c,h){super(),this.m=c,this.l=h,this.h=null,this.i=!1,this.g=null}j(c){this.h=arguments,this.g?this.i=!0:Ca(this)}N(){super.N(),this.g&&(u.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function kn(o){ct.call(this),this.h=o,this.g={}}k(kn,ct);var ka=[];function Na(o){J(o.g,function(c,h){this.g.hasOwnProperty(h)&&ni(c)},o),o.g={}}kn.prototype.N=function(){kn.aa.N.call(this),Na(this)},kn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ii=u.JSON.stringify,Wd=u.JSON.parse,Kd=class{stringify(o){return u.JSON.stringify(o,void 0)}parse(o){return u.JSON.parse(o,void 0)}};function oi(){}oi.prototype.h=null;function Da(o){return o.h||(o.h=o.i())}function Va(){}var Nn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function ai(){ge.call(this,"d")}k(ai,ge);function ci(){ge.call(this,"c")}k(ci,ge);var bt={},Oa=null;function Mr(){return Oa=Oa||new _e}bt.La="serverreachability";function La(o){ge.call(this,bt.La,o)}k(La,ge);function Dn(o){const c=Mr();Ae(c,new La(c))}bt.STAT_EVENT="statevent";function Ma(o,c){ge.call(this,bt.STAT_EVENT,o),this.stat=c}k(Ma,ge);function Re(o){const c=Mr();Ae(c,new Ma(c,o))}bt.Ma="timingevent";function xa(o,c){ge.call(this,bt.Ma,o),this.size=c}k(xa,ge);function Vn(o,c){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return u.setTimeout(function(){o()},c)}function On(){this.g=!0}On.prototype.xa=function(){this.g=!1};function Gd(o,c,h,f,w,R){o.info(function(){if(o.g)if(R)for(var N="",X=R.split("&"),he=0;he<X.length;he++){var K=X[he].split("=");if(1<K.length){var ye=K[0];K=K[1];var ve=ye.split("_");N=2<=ve.length&&ve[1]=="type"?N+(ye+"="+K+"&"):N+(ye+"=redacted&")}}else N=null;else N=R;return"XMLHTTP REQ ("+f+") [attempt "+w+"]: "+c+`
1501`+h+`
1502`+N})}function Qd(o,c,h,f,w,R,N){o.info(function(){return"XMLHTTP RESP ("+f+") [ attempt "+w+"]: "+c+`
1503`+h+`
1504`+R+" "+N})}function Kt(o,c,h,f){o.info(function(){return"XMLHTTP TEXT ("+c+"): "+Xd(o,h)+(f?" "+f:"")})}function Yd(o,c){o.info(function(){return"TIMEOUT: "+c})}On.prototype.info=function(){};function Xd(o,c){if(!o.g)return c;if(!c)return null;try{var h=JSON.parse(c);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var f=h[o];if(!(2>f.length)){var w=f[1];if(Array.isArray(w)&&!(1>w.length)){var R=w[0];if(R!="noop"&&R!="stop"&&R!="close")for(var N=1;N<w.length;N++)w[N]=""}}}}return ii(h)}catch{return c}}var xr={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ua={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},ui;function Ur(){}k(Ur,oi),Ur.prototype.g=function(){return new XMLHttpRequest},Ur.prototype.i=function(){return{}},ui=new Ur;function ut(o,c,h,f){this.j=o,this.i=c,this.l=h,this.R=f||1,this.U=new kn(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 Fa}function Fa(){this.i=null,this.g="",this.h=!1}var Ba={},li={};function hi(o,c,h){o.L=1,o.v=jr(Ge(c)),o.m=h,o.P=!0,qa(o,null)}function qa(o,c){o.F=Date.now(),Fr(o),o.A=Ge(o.v);var h=o.A,f=o.R;Array.isArray(f)||(f=[String(f)]),tc(h.i,"t",f),o.C=0,h=o.j.J,o.h=new Fa,o.g=vc(o.j,h?c:null,!o.m),0<o.O&&(o.M=new Hd(I(o.Y,o,o.g),o.O)),c=o.U,h=o.g,f=o.ca;var w="readystatechange";Array.isArray(w)||(w&&(ka[0]=w.toString()),w=ka);for(var R=0;R<w.length;R++){var N=Aa(h,w[R],f||c.handleEvent,!1,c.h||c);if(!N)break;c.g[N.key]=N}c=o.H?m(o.H):{},o.m?(o.u||(o.u="POST"),c["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,c)):(o.u="GET",o.g.ea(o.A,o.u,null,c)),Dn(),Gd(o.i,o.u,o.A,o.l,o.R,o.m)}ut.prototype.ca=function(o){o=o.target;const c=this.M;c&&Qe(o)==3?c.j():this.Y(o)},ut.prototype.Y=function(o){try{if(o==this.g)e:{const ve=Qe(this.g);var c=this.g.Ba();const Yt=this.g.Z();if(!(3>ve)&&(ve!=3||this.g&&(this.h.h||this.g.oa()||cc(this.g)))){this.J||ve!=4||c==7||(c==8||0>=Yt?Dn(3):Dn(2)),di(this);var h=this.g.Z();this.X=h;t:if(ja(this)){var f=cc(this.g);o="";var w=f.length,R=Qe(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){St(this),Ln(this);var N="";break t}this.h.i=new u.TextDecoder}for(c=0;c<w;c++)this.h.h=!0,o+=this.h.i.decode(f[c],{stream:!(R&&c==w-1)});f.length=0,this.h.g+=o,this.C=0,N=this.h.g}else N=this.g.oa();if(this.o=h==200,Qd(this.i,this.u,this.A,this.l,this.R,ve,h),this.o){if(this.T&&!this.K){t:{if(this.g){var X,he=this.g;if((X=he.g?he.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!j(X)){var K=X;break t}}K=null}if(h=K)Kt(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,fi(this,h);else{this.o=!1,this.s=3,Re(12),St(this),Ln(this);break e}}if(this.P){h=!0;let Le;for(;!this.J&&this.C<N.length;)if(Le=Jd(this,N),Le==li){ve==4&&(this.s=4,Re(14),h=!1),Kt(this.i,this.l,null,"[Incomplete Response]");break}else if(Le==Ba){this.s=4,Re(15),Kt(this.i,this.l,N,"[Invalid Chunk]"),h=!1;break}else Kt(this.i,this.l,Le,null),fi(this,Le);if(ja(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),ve!=4||N.length!=0||this.h.h||(this.s=1,Re(16),h=!1),this.o=this.o&&h,!h)Kt(this.i,this.l,N,"[Invalid Chunked Response]"),St(this),Ln(this);else if(0<N.length&&!this.W){this.W=!0;var ye=this.j;ye.g==this&&ye.ba&&!ye.M&&(ye.j.info("Great, no buffering proxy detected. Bytes received: "+N.length),vi(ye),ye.M=!0,Re(11))}}else Kt(this.i,this.l,N,null),fi(this,N);ve==4&&St(this),this.o&&!this.J&&(ve==4?mc(this.j,this):(this.o=!1,Fr(this)))}else gf(this.g),h==400&&0<N.indexOf("Unknown SID")?(this.s=3,Re(12)):(this.s=0,Re(13)),St(this),Ln(this)}}}catch{}finally{}};function ja(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function Jd(o,c){var h=o.C,f=c.indexOf(`
1505`,h);return f==-1?li:(h=Number(c.substring(h,f)),isNaN(h)?Ba:(f+=1,f+h>c.length?li:(c=c.slice(f,f+h),o.C=f+h,c)))}ut.prototype.cancel=function(){this.J=!0,St(this)};function Fr(o){o.S=Date.now()+o.I,$a(o,o.I)}function $a(o,c){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Vn(I(o.ba,o),c)}function di(o){o.B&&(u.clearTimeout(o.B),o.B=null)}ut.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(Yd(this.i,this.A),this.L!=2&&(Dn(),Re(17)),St(this),this.s=2,Ln(this)):$a(this,this.S-o)};function Ln(o){o.j.G==0||o.J||mc(o.j,o)}function St(o){di(o);var c=o.M;c&&typeof c.ma=="function"&&c.ma(),o.M=null,Na(o.U),o.g&&(c=o.g,o.g=null,c.abort(),c.ma())}function fi(o,c){try{var h=o.j;if(h.G!=0&&(h.g==o||pi(h.h,o))){if(!o.K&&pi(h.h,o)&&h.G==3){try{var f=h.Da.g.parse(c)}catch{f=null}if(Array.isArray(f)&&f.length==3){var w=f;if(w[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)Gr(h),Wr(h);else break e;yi(h),Re(18)}}else h.za=w[1],0<h.za-h.T&&37500>w[2]&&h.F&&h.v==0&&!h.C&&(h.C=Vn(I(h.Za,h),6e3));if(1>=Wa(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else kt(h,11)}else if((o.K||h.g==o)&&Gr(h),!j(c))for(w=h.Da.g.parse(c),c=0;c<w.length;c++){let K=w[c];if(h.T=K[0],K=K[1],h.G==2)if(K[0]=="c"){h.K=K[1],h.ia=K[2];const ye=K[3];ye!=null&&(h.la=ye,h.j.info("VER="+h.la));const ve=K[4];ve!=null&&(h.Aa=ve,h.j.info("SVER="+h.Aa));const Yt=K[5];Yt!=null&&typeof Yt=="number"&&0<Yt&&(f=1.5*Yt,h.L=f,h.j.info("backChannelRequestTimeoutMs_="+f)),f=h;const Le=o.g;if(Le){const Yr=Le.g?Le.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Yr){var R=f.h;R.g||Yr.indexOf("spdy")==-1&&Yr.indexOf("quic")==-1&&Yr.indexOf("h2")==-1||(R.j=R.l,R.g=new Set,R.h&&(mi(R,R.h),R.h=null))}if(f.D){const Ei=Le.g?Le.g.getResponseHeader("X-HTTP-Session-Id"):null;Ei&&(f.ya=Ei,Z(f.I,f.D,Ei))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),f=h;var N=o;if(f.qa=yc(f,f.J?f.ia:null,f.W),N.K){Ka(f.h,N);var X=N,he=f.L;he&&(X.I=he),X.B&&(di(X),Fr(X)),f.g=N}else fc(f);0<h.i.length&&Kr(h)}else K[0]!="stop"&&K[0]!="close"||kt(h,7);else h.G==3&&(K[0]=="stop"||K[0]=="close"?K[0]=="stop"?kt(h,7):_i(h):K[0]!="noop"&&h.l&&h.l.ta(K),h.v=0)}}Dn(4)}catch{}}var Zd=class{constructor(o,c){this.g=o,this.map=c}};function za(o){this.l=o||10,u.PerformanceNavigationTiming?(o=u.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(u.chrome&&u.chrome.loadTimes&&u.chrome.loadTimes()&&u.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 Ha(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function Wa(o){return o.h?1:o.g?o.g.size:0}function pi(o,c){return o.h?o.h==c:o.g?o.g.has(c):!1}function mi(o,c){o.g?o.g.add(c):o.h=c}function Ka(o,c){o.h&&o.h==c?o.h=null:o.g&&o.g.has(c)&&o.g.delete(c)}za.prototype.cancel=function(){if(this.i=Ga(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 Ga(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let c=o.i;for(const h of o.g.values())c=c.concat(h.D);return c}return V(o.i)}function ef(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 c=[],h=o.length,f=0;f<h;f++)c.push(o[f]);return c}c=[],h=0;for(f in o)c[h++]=o[f];return c}function tf(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 c=[];o=o.length;for(var h=0;h<o;h++)c.push(h);return c}c=[],h=0;for(const f in o)c[h++]=f;return c}}}function Qa(o,c){if(o.forEach&&typeof o.forEach=="function")o.forEach(c,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,c,void 0);else for(var h=tf(o),f=ef(o),w=f.length,R=0;R<w;R++)c.call(void 0,f[R],h&&h[R],o)}var Ya=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function nf(o,c){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var f=o[h].indexOf("="),w=null;if(0<=f){var R=o[h].substring(0,f);w=o[h].substring(f+1)}else R=o[h];c(R,w?decodeURIComponent(w.replace(/\+/g," ")):"")}}}function Ct(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof Ct){this.h=o.h,Br(this,o.j),this.o=o.o,this.g=o.g,qr(this,o.s),this.l=o.l;var c=o.i,h=new Un;h.i=c.i,c.g&&(h.g=new Map(c.g),h.h=c.h),Xa(this,h),this.m=o.m}else o&&(c=String(o).match(Ya))?(this.h=!1,Br(this,c[1]||"",!0),this.o=Mn(c[2]||""),this.g=Mn(c[3]||"",!0),qr(this,c[4]),this.l=Mn(c[5]||"",!0),Xa(this,c[6]||"",!0),this.m=Mn(c[7]||"")):(this.h=!1,this.i=new Un(null,this.h))}Ct.prototype.toString=function(){var o=[],c=this.j;c&&o.push(xn(c,Ja,!0),":");var h=this.g;return(h||c=="file")&&(o.push("//"),(c=this.o)&&o.push(xn(c,Ja,!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(xn(h,h.charAt(0)=="/"?of:sf,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",xn(h,cf)),o.join("")};function Ge(o){return new Ct(o)}function Br(o,c,h){o.j=h?Mn(c,!0):c,o.j&&(o.j=o.j.replace(/:$/,""))}function qr(o,c){if(c){if(c=Number(c),isNaN(c)||0>c)throw Error("Bad port number "+c);o.s=c}else o.s=null}function Xa(o,c,h){c instanceof Un?(o.i=c,uf(o.i,o.h)):(h||(c=xn(c,af)),o.i=new Un(c,o.h))}function Z(o,c,h){o.i.set(c,h)}function jr(o){return Z(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Mn(o,c){return o?c?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function xn(o,c,h){return typeof o=="string"?(o=encodeURI(o).replace(c,rf),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function rf(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var Ja=/[#\/\?@]/g,sf=/[#\?:]/g,of=/[#\?]/g,af=/[#\?@]/g,cf=/#/g;function Un(o,c){this.h=this.g=null,this.i=o||null,this.j=!!c}function lt(o){o.g||(o.g=new Map,o.h=0,o.i&&nf(o.i,function(c,h){o.add(decodeURIComponent(c.replace(/\+/g," ")),h)}))}n=Un.prototype,n.add=function(o,c){lt(this),this.i=null,o=Gt(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(c),this.h+=1,this};function Za(o,c){lt(o),c=Gt(o,c),o.g.has(c)&&(o.i=null,o.h-=o.g.get(c).length,o.g.delete(c))}function ec(o,c){return lt(o),c=Gt(o,c),o.g.has(c)}n.forEach=function(o,c){lt(this),this.g.forEach(function(h,f){h.forEach(function(w){o.call(c,w,f,this)},this)},this)},n.na=function(){lt(this);const o=Array.from(this.g.values()),c=Array.from(this.g.keys()),h=[];for(let f=0;f<c.length;f++){const w=o[f];for(let R=0;R<w.length;R++)h.push(c[f])}return h},n.V=function(o){lt(this);let c=[];if(typeof o=="string")ec(this,o)&&(c=c.concat(this.g.get(Gt(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)c=c.concat(o[h])}return c},n.set=function(o,c){return lt(this),this.i=null,o=Gt(this,o),ec(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[c]),this.h+=1,this},n.get=function(o,c){return o?(o=this.V(o),0<o.length?String(o[0]):c):c};function tc(o,c,h){Za(o,c),0<h.length&&(o.i=null,o.g.set(Gt(o,c),V(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],c=Array.from(this.g.keys());for(var h=0;h<c.length;h++){var f=c[h];const R=encodeURIComponent(String(f)),N=this.V(f);for(f=0;f<N.length;f++){var w=R;N[f]!==""&&(w+="="+encodeURIComponent(String(N[f]))),o.push(w)}}return this.i=o.join("&")};function Gt(o,c){return c=String(c),o.j&&(c=c.toLowerCase()),c}function uf(o,c){c&&!o.j&&(lt(o),o.i=null,o.g.forEach(function(h,f){var w=f.toLowerCase();f!=w&&(Za(this,f),tc(this,w,h))},o)),o.j=c}function lf(o,c){const h=new On;if(u.Image){const f=new Image;f.onload=P(ht,h,"TestLoadImage: loaded",!0,c,f),f.onerror=P(ht,h,"TestLoadImage: error",!1,c,f),f.onabort=P(ht,h,"TestLoadImage: abort",!1,c,f),f.ontimeout=P(ht,h,"TestLoadImage: timeout",!1,c,f),u.setTimeout(function(){f.ontimeout&&f.ontimeout()},1e4),f.src=o}else c(!1)}function hf(o,c){const h=new On,f=new AbortController,w=setTimeout(()=>{f.abort(),ht(h,"TestPingServer: timeout",!1,c)},1e4);fetch(o,{signal:f.signal}).then(R=>{clearTimeout(w),R.ok?ht(h,"TestPingServer: ok",!0,c):ht(h,"TestPingServer: server error",!1,c)}).catch(()=>{clearTimeout(w),ht(h,"TestPingServer: error",!1,c)})}function ht(o,c,h,f,w){try{w&&(w.onload=null,w.onerror=null,w.onabort=null,w.ontimeout=null),f(h)}catch{}}function df(){this.g=new Kd}function ff(o,c,h){const f=h||"";try{Qa(o,function(w,R){let N=w;d(w)&&(N=ii(w)),c.push(f+R+"="+encodeURIComponent(N))})}catch(w){throw c.push(f+"type="+encodeURIComponent("_badmap")),w}}function $r(o){this.l=o.Ub||null,this.j=o.eb||!1}k($r,oi),$r.prototype.g=function(){return new zr(this.l,this.j)},$r.prototype.i=function(o){return function(){return o}}({});function zr(o,c){_e.call(this),this.D=o,this.o=c,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}k(zr,_e),n=zr.prototype,n.open=function(o,c){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=c,this.readyState=1,Bn(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const c={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(c.body=o),(this.D||u).fetch(new Request(this.A,c)).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,Fn(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,Bn(this)),this.g&&(this.readyState=3,Bn(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof u.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;nc(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function nc(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 c=o.value?o.value:new Uint8Array(0);(c=this.v.decode(c,{stream:!o.done}))&&(this.response=this.responseText+=c)}o.done?Fn(this):Bn(this),this.readyState==3&&nc(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,Fn(this))},n.Qa=function(o){this.g&&(this.response=o,Fn(this))},n.ga=function(){this.g&&Fn(this)};function Fn(o){o.readyState=4,o.l=null,o.j=null,o.v=null,Bn(o)}n.setRequestHeader=function(o,c){this.u.append(o,c)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],c=this.h.entries();for(var h=c.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=c.next();return o.join(`\r
1506`)};function Bn(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(zr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function rc(o){let c="";return J(o,function(h,f){c+=f,c+=":",c+=h,c+=`\r
1507`}),c}function gi(o,c,h){e:{for(f in h){var f=!1;break e}f=!0}f||(h=rc(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):Z(o,c,h))}function ne(o){_e.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}k(ne,_e);var pf=/^https?$/i,mf=["POST","PUT"];n=ne.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,c,h,f){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);c=c?c.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():ui.g(),this.v=this.o?Da(this.o):Da(ui),this.g.onreadystatechange=I(this.Ea,this);try{this.B=!0,this.g.open(c,String(o),!0),this.B=!1}catch(R){sc(this,R);return}if(o=h||"",h=new Map(this.headers),f)if(Object.getPrototypeOf(f)===Object.prototype)for(var w in f)h.set(w,f[w]);else if(typeof f.keys=="function"&&typeof f.get=="function")for(const R of f.keys())h.set(R,f.get(R));else throw Error("Unknown input type for opt_headers: "+String(f));f=Array.from(h.keys()).find(R=>R.toLowerCase()=="content-type"),w=u.FormData&&o instanceof u.FormData,!(0<=Array.prototype.indexOf.call(mf,c,void 0))||f||w||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[R,N]of h)this.g.setRequestHeader(R,N);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{ac(this),this.u=!0,this.g.send(o),this.u=!1}catch(R){sc(this,R)}};function sc(o,c){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=c,o.m=5,ic(o),Hr(o)}function ic(o){o.A||(o.A=!0,Ae(o,"complete"),Ae(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,Ae(this,"complete"),Ae(this,"abort"),Hr(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Hr(this,!0)),ne.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?oc(this):this.bb())},n.bb=function(){oc(this)};function oc(o){if(o.h&&typeof a<"u"&&(!o.v[1]||Qe(o)!=4||o.Z()!=2)){if(o.u&&Qe(o)==4)Sa(o.Ea,0,o);else if(Ae(o,"readystatechange"),Qe(o)==4){o.h=!1;try{const N=o.Z();e:switch(N){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break e;default:c=!1}var h;if(!(h=c)){var f;if(f=N===0){var w=String(o.D).match(Ya)[1]||null;!w&&u.self&&u.self.location&&(w=u.self.location.protocol.slice(0,-1)),f=!pf.test(w?w.toLowerCase():"")}h=f}if(h)Ae(o,"complete"),Ae(o,"success");else{o.m=6;try{var R=2<Qe(o)?o.g.statusText:""}catch{R=""}o.l=R+" ["+o.Z()+"]",ic(o)}}finally{Hr(o)}}}}function Hr(o,c){if(o.g){ac(o);const h=o.g,f=o.v[0]?()=>{}:null;o.g=null,o.v=null,c||Ae(o,"ready");try{h.onreadystatechange=f}catch{}}}function ac(o){o.I&&(u.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function Qe(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<Qe(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 c=this.g.responseText;return o&&c.indexOf(o)==0&&(c=c.substring(o.length)),Wd(c)}};function cc(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 gf(o){const c={};o=(o.g&&2<=Qe(o)&&o.g.getAllResponseHeaders()||"").split(`\r
1508`);for(let f=0;f<o.length;f++){if(j(o[f]))continue;var h=T(o[f]);const w=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const R=c[w]||[];c[w]=R,R.push(h)}E(c,function(f){return f.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function qn(o,c,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||c}function uc(o){this.Aa=0,this.i=[],this.j=new On,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=qn("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=qn("baseRetryDelayMs",5e3,o),this.cb=qn("retryDelaySeedMs",1e4,o),this.Wa=qn("forwardChannelMaxRetries",2,o),this.wa=qn("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 za(o&&o.concurrentRequestLimit),this.Da=new df,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=uc.prototype,n.la=8,n.G=1,n.connect=function(o,c,h,f){Re(0),this.W=o,this.H=c||{},h&&f!==void 0&&(this.H.OSID=h,this.H.OAID=f),this.F=this.X,this.I=yc(this,null,this.W),Kr(this)};function _i(o){if(lc(o),o.G==3){var c=o.U++,h=Ge(o.I);if(Z(h,"SID",o.K),Z(h,"RID",c),Z(h,"TYPE","terminate"),jn(o,h),c=new ut(o,o.j,c),c.L=2,c.v=jr(Ge(h)),h=!1,u.navigator&&u.navigator.sendBeacon)try{h=u.navigator.sendBeacon(c.v.toString(),"")}catch{}!h&&u.Image&&(new Image().src=c.v,h=!0),h||(c.g=vc(c.j,null),c.g.ea(c.v)),c.F=Date.now(),Fr(c)}_c(o)}function Wr(o){o.g&&(vi(o),o.g.cancel(),o.g=null)}function lc(o){Wr(o),o.u&&(u.clearTimeout(o.u),o.u=null),Gr(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&u.clearTimeout(o.s),o.s=null)}function Kr(o){if(!Ha(o.h)&&!o.s){o.s=!0;var c=o.Ga;bn||wa(),Sn||(bn(),Sn=!0),Xs.add(c,o),o.B=0}}function _f(o,c){return Wa(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=c.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Vn(I(o.Ga,o,c),gc(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 w=new ut(this,this.j,o);let R=this.o;if(this.S&&(R?(R=m(R),v(R,this.S)):R=this.S),this.m!==null||this.O||(w.H=R,R=null),this.P)e:{for(var c=0,h=0;h<this.i.length;h++){t:{var f=this.i[h];if("__data__"in f.map&&(f=f.map.__data__,typeof f=="string")){f=f.length;break t}f=void 0}if(f===void 0)break;if(c+=f,4096<c){c=h;break e}if(c===4096||h===this.i.length-1){c=h+1;break e}}c=1e3}else c=1e3;c=dc(this,w,c),h=Ge(this.I),Z(h,"RID",o),Z(h,"CVER",22),this.D&&Z(h,"X-HTTP-Session-Id",this.D),jn(this,h),R&&(this.O?c="headers="+encodeURIComponent(String(rc(R)))+"&"+c:this.m&&gi(h,this.m,R)),mi(this.h,w),this.Ua&&Z(h,"TYPE","init"),this.P?(Z(h,"$req",c),Z(h,"SID","null"),w.T=!0,hi(w,h,null)):hi(w,h,c),this.G=2}}else this.G==3&&(o?hc(this,o):this.i.length==0||Ha(this.h)||hc(this))};function hc(o,c){var h;c?h=c.l:h=o.U++;const f=Ge(o.I);Z(f,"SID",o.K),Z(f,"RID",h),Z(f,"AID",o.T),jn(o,f),o.m&&o.o&&gi(f,o.m,o.o),h=new ut(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),c&&(o.i=c.D.concat(o.i)),c=dc(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),mi(o.h,h),hi(h,f,c)}function jn(o,c){o.H&&J(o.H,function(h,f){Z(c,f,h)}),o.l&&Qa({},function(h,f){Z(c,f,h)})}function dc(o,c,h){h=Math.min(o.i.length,h);var f=o.l?I(o.l.Na,o.l,o):null;e:{var w=o.i;let R=-1;for(;;){const N=["count="+h];R==-1?0<h?(R=w[0].g,N.push("ofs="+R)):R=0:N.push("ofs="+R);let X=!0;for(let he=0;he<h;he++){let K=w[he].g;const ye=w[he].map;if(K-=R,0>K)R=Math.max(0,w[he].g-100),X=!1;else try{ff(ye,N,"req"+K+"_")}catch{f&&f(ye)}}if(X){f=N.join("&");break e}}}return o=o.i.splice(0,h),c.D=o,f}function fc(o){if(!o.g&&!o.u){o.Y=1;var c=o.Fa;bn||wa(),Sn||(bn(),Sn=!0),Xs.add(c,o),o.v=0}}function yi(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Vn(I(o.Fa,o),gc(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,pc(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=Vn(I(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,Re(10),Wr(this),pc(this))};function vi(o){o.A!=null&&(u.clearTimeout(o.A),o.A=null)}function pc(o){o.g=new ut(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var c=Ge(o.qa);Z(c,"RID","rpc"),Z(c,"SID",o.K),Z(c,"AID",o.T),Z(c,"CI",o.F?"0":"1"),!o.F&&o.ja&&Z(c,"TO",o.ja),Z(c,"TYPE","xmlhttp"),jn(o,c),o.m&&o.o&&gi(c,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=jr(Ge(c)),h.m=null,h.P=!0,qa(h,o)}n.Za=function(){this.C!=null&&(this.C=null,Wr(this),yi(this),Re(19))};function Gr(o){o.C!=null&&(u.clearTimeout(o.C),o.C=null)}function mc(o,c){var h=null;if(o.g==c){Gr(o),vi(o),o.g=null;var f=2}else if(pi(o.h,c))h=c.D,Ka(o.h,c),f=1;else return;if(o.G!=0){if(c.o)if(f==1){h=c.m?c.m.length:0,c=Date.now()-c.F;var w=o.B;f=Mr(),Ae(f,new xa(f,h)),Kr(o)}else fc(o);else if(w=c.s,w==3||w==0&&0<c.X||!(f==1&&_f(o,c)||f==2&&yi(o)))switch(h&&0<h.length&&(c=o.h,c.i=c.i.concat(h)),w){case 1:kt(o,5);break;case 4:kt(o,10);break;case 3:kt(o,6);break;default:kt(o,2)}}}function gc(o,c){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*c}function kt(o,c){if(o.j.info("Error code "+c),c==2){var h=I(o.fb,o),f=o.Xa;const w=!f;f=new Ct(f||"//www.google.com/images/cleardot.gif"),u.location&&u.location.protocol=="http"||Br(f,"https"),jr(f),w?lf(f.toString(),h):hf(f.toString(),h)}else Re(2);o.G=0,o.l&&o.l.sa(c),_c(o),lc(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Re(2)):(this.j.info("Failed to ping google.com"),Re(1))};function _c(o){if(o.G=0,o.ka=[],o.l){const c=Ga(o.h);(c.length!=0||o.i.length!=0)&&(C(o.ka,c),C(o.ka,o.i),o.h.i.length=0,V(o.i),o.i.length=0),o.l.ra()}}function yc(o,c,h){var f=h instanceof Ct?Ge(h):new Ct(h);if(f.g!="")c&&(f.g=c+"."+f.g),qr(f,f.s);else{var w=u.location;f=w.protocol,c=c?c+"."+w.hostname:w.hostname,w=+w.port;var R=new Ct(null);f&&Br(R,f),c&&(R.g=c),w&&qr(R,w),h&&(R.l=h),f=R}return h=o.D,c=o.ya,h&&c&&Z(f,h,c),Z(f,"VER",o.la),jn(o,f),f}function vc(o,c,h){if(c&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return c=o.Ca&&!o.pa?new ne(new $r({eb:h})):new ne(o.pa),c.Ha(o.J),c}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function Ec(){}n=Ec.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Qr(){}Qr.prototype.g=function(o,c){return new De(o,c)};function De(o,c){_e.call(this),this.g=new uc(c),this.l=o,this.h=c&&c.messageUrlParams||null,o=c&&c.messageHeaders||null,c&&c.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=c&&c.initMessageHeaders||null,c&&c.messageContentType&&(o?o["X-WebChannel-Content-Type"]=c.messageContentType:o={"X-WebChannel-Content-Type":c.messageContentType}),c&&c.va&&(o?o["X-WebChannel-Client-Profile"]=c.va:o={"X-WebChannel-Client-Profile":c.va}),this.g.S=o,(o=c&&c.Sb)&&!j(o)&&(this.g.m=o),this.v=c&&c.supportsCrossDomainXhr||!1,this.u=c&&c.sendRawJson||!1,(c=c&&c.httpSessionIdParam)&&!j(c)&&(this.g.D=c,o=this.h,o!==null&&c in o&&(o=this.h,c in o&&delete o[c])),this.j=new Qt(this)}k(De,_e),De.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},De.prototype.close=function(){_i(this.g)},De.prototype.o=function(o){var c=this.g;if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=ii(o),o=h);c.i.push(new Zd(c.Ya++,o)),c.G==3&&Kr(c)},De.prototype.N=function(){this.g.l=null,delete this.j,_i(this.g),delete this.g,De.aa.N.call(this)};function Tc(o){ai.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var c=o.__sm__;if(c){e:{for(const h in c){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,c=c!==null&&o in c?c[o]:void 0),this.data=c}else this.data=o}k(Tc,ai);function Ic(){ci.call(this),this.status=1}k(Ic,ci);function Qt(o){this.g=o}k(Qt,Ec),Qt.prototype.ua=function(){Ae(this.g,"a")},Qt.prototype.ta=function(o){Ae(this.g,new Tc(o))},Qt.prototype.sa=function(o){Ae(this.g,new Ic)},Qt.prototype.ra=function(){Ae(this.g,"b")},Qr.prototype.createWebChannel=Qr.prototype.g,De.prototype.send=De.prototype.o,De.prototype.open=De.prototype.m,De.prototype.close=De.prototype.close,zl=function(){return new Qr},$l=function(){return Mr()},jl=bt,Hi={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},xr.NO_ERROR=0,xr.TIMEOUT=8,xr.HTTP_ERROR=6,cs=xr,Ua.COMPLETE="complete",ql=Ua,Va.EventType=Nn,Nn.OPEN="a",Nn.CLOSE="b",Nn.ERROR="c",Nn.MESSAGE="d",_e.prototype.listen=_e.prototype.K,Kn=Va,ne.prototype.listenOnce=ne.prototype.L,ne.prototype.getLastError=ne.prototype.Ka,ne.prototype.getLastErrorCode=ne.prototype.Ba,ne.prototype.getStatus=ne.prototype.Z,ne.prototype.getResponseJson=ne.prototype.Oa,ne.prototype.getResponseText=ne.prototype.oa,ne.prototype.send=ne.prototype.ea,ne.prototype.setWithCredentials=ne.prototype.Ha,Bl=ne}).apply(typeof Jr<"u"?Jr:typeof self<"u"?self:typeof window<"u"?window:{});const eu="@firebase/firestore";/**
1509 * @license
1510 * Copyright 2017 Google LLC
1511 *
1512 * Licensed under the Apache License, Version 2.0 (the "License");
1513 * you may not use this file except in compliance with the License.
1514 * You may obtain a copy of the License at
1515 *
1516 *   http://www.apache.org/licenses/LICENSE-2.0
1517 *
1518 * Unless required by applicable law or agreed to in writing, software
1519 * distributed under the License is distributed on an "AS IS" BASIS,
1520 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1521 * See the License for the specific language governing permissions and
1522 * limitations under the License.
1523 */class Ce{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}}Ce.UNAUTHENTICATED=new Ce(null),Ce.GOOGLE_CREDENTIALS=new Ce("google-credentials-uid"),Ce.FIRST_PARTY=new Ce("first-party-uid"),Ce.MOCK_USER=new Ce("mock-user");/**
1524 * @license
1525 * Copyright 2017 Google LLC
1526 *
1527 * Licensed under the Apache License, Version 2.0 (the "License");
1528 * you may not use this file except in compliance with the License.
1529 * You may obtain a copy of the License at
1530 *
1531 *   http://www.apache.org/licenses/LICENSE-2.0
1532 *
1533 * Unless required by applicable law or agreed to in writing, software
1534 * distributed under the License is distributed on an "AS IS" BASIS,
1535 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1536 * See the License for the specific language governing permissions and
1537 * limitations under the License.
1538 */let vn="10.14.0";/**
1539 * @license
1540 * Copyright 2017 Google LLC
1541 *
1542 * Licensed under the Apache License, Version 2.0 (the "License");
1543 * you may not use this file except in compliance with the License.
1544 * You may obtain a copy of the License at
1545 *
1546 *   http://www.apache.org/licenses/LICENSE-2.0
1547 *
1548 * Unless required by applicable law or agreed to in writing, software
1549 * distributed under the License is distributed on an "AS IS" BASIS,
1550 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1551 * See the License for the specific language governing permissions and
1552 * limitations under the License.
1553 */const xt=new uo("@firebase/firestore");function $n(){return xt.logLevel}function O(n,...e){if(xt.logLevel<=H.DEBUG){const t=e.map(To);xt.debug(`Firestore (${vn}): ${n}`,...t)}}function it(n,...e){if(xt.logLevel<=H.ERROR){const t=e.map(To);xt.error(`Firestore (${vn}): ${n}`,...t)}}function or(n,...e){if(xt.logLevel<=H.WARN){const t=e.map(To);xt.warn(`Firestore (${vn}): ${n}`,...t)}}function To(n){if(typeof n=="string")return n;try{/**
1554* @license
1555* Copyright 2020 Google LLC
1556*
1557* Licensed under the Apache License, Version 2.0 (the "License");
1558* you may not use this file except in compliance with the License.
1559* You may obtain a copy of the License at
1560*
1561*   http://www.apache.org/licenses/LICENSE-2.0
1562*
1563* Unless required by applicable law or agreed to in writing, software
1564* distributed under the License is distributed on an "AS IS" BASIS,
1565* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1566* See the License for the specific language governing permissions and
1567* limitations under the License.
1568*/return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
1569 * @license
1570 * Copyright 2017 Google LLC
1571 *
1572 * Licensed under the Apache License, Version 2.0 (the "License");
1573 * you may not use this file except in compliance with the License.
1574 * You may obtain a copy of the License at
1575 *
1576 *   http://www.apache.org/licenses/LICENSE-2.0
1577 *
1578 * Unless required by applicable law or agreed to in writing, software
1579 * distributed under the License is distributed on an "AS IS" BASIS,
1580 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1581 * See the License for the specific language governing permissions and
1582 * limitations under the License.
1583 */function x(n="Unexpected state"){const e=`FIRESTORE (${vn}) INTERNAL ASSERTION FAILED: `+n;throw it(e),new Error(e)}function Q(n,e){n||x()}function F(n,e){return n}/**
1584 * @license
1585 * Copyright 2017 Google LLC
1586 *
1587 * Licensed under the Apache License, Version 2.0 (the "License");
1588 * you may not use this file except in compliance with the License.
1589 * You may obtain a copy of the License at
1590 *
1591 *   http://www.apache.org/licenses/LICENSE-2.0
1592 *
1593 * Unless required by applicable law or agreed to in writing, software
1594 * distributed under the License is distributed on an "AS IS" BASIS,
1595 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1596 * See the License for the specific language governing permissions and
1597 * limitations under the License.
1598 */const b={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 D extends Ue{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1599 * @license
1600 * Copyright 2017 Google LLC
1601 *
1602 * Licensed under the Apache License, Version 2.0 (the "License");
1603 * you may not use this file except in compliance with the License.
1604 * You may obtain a copy of the License at
1605 *
1606 *   http://www.apache.org/licenses/LICENSE-2.0
1607 *
1608 * Unless required by applicable law or agreed to in writing, software
1609 * distributed under the License is distributed on an "AS IS" BASIS,
1610 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1611 * See the License for the specific language governing permissions and
1612 * limitations under the License.
1613 */class tt{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
1614 * @license
1615 * Copyright 2017 Google LLC
1616 *
1617 * Licensed under the Apache License, Version 2.0 (the "License");
1618 * you may not use this file except in compliance with the License.
1619 * You may obtain a copy of the License at
1620 *
1621 *   http://www.apache.org/licenses/LICENSE-2.0
1622 *
1623 * Unless required by applicable law or agreed to in writing, software
1624 * distributed under the License is distributed on an "AS IS" BASIS,
1625 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1626 * See the License for the specific language governing permissions and
1627 * limitations under the License.
1628 */class a_{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class c_{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Ce.UNAUTHENTICATED))}shutdown(){}}class u_{constructor(e){this.t=e,this.currentUser=Ce.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Q(this.o===void 0);let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new tt;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new tt,e.enqueueRetryable(()=>s(this.currentUser))};const a=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},u=l=>{O("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(l=>u(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?u(l):(O("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new tt)}},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?(O("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Q(typeof r.accessToken=="string"),new a_(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 Q(e===null||typeof e=="string"),new Ce(e)}}class l_{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=Ce.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class h_{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new l_(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(Ce.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class d_{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 f_{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){Q(this.o===void 0);const r=i=>{i.error!=null&&O("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,O("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{O("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):O("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(Q(typeof t.token=="string"),this.R=t.token,new d_(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1629 * @license
1630 * Copyright 2020 Google LLC
1631 *
1632 * Licensed under the Apache License, Version 2.0 (the "License");
1633 * you may not use this file except in compliance with the License.
1634 * You may obtain a copy of the License at
1635 *
1636 *   http://www.apache.org/licenses/LICENSE-2.0
1637 *
1638 * Unless required by applicable law or agreed to in writing, software
1639 * distributed under the License is distributed on an "AS IS" BASIS,
1640 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1641 * See the License for the specific language governing permissions and
1642 * limitations under the License.
1643 */function p_(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}/**
1644 * @license
1645 * Copyright 2017 Google LLC
1646 *
1647 * Licensed under the Apache License, Version 2.0 (the "License");
1648 * you may not use this file except in compliance with the License.
1649 * You may obtain a copy of the License at
1650 *
1651 *   http://www.apache.org/licenses/LICENSE-2.0
1652 *
1653 * Unless required by applicable law or agreed to in writing, software
1654 * distributed under the License is distributed on an "AS IS" BASIS,
1655 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1656 * See the License for the specific language governing permissions and
1657 * limitations under the License.
1658 */class Hl{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const s=p_(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%e.length))}return r}}function G(n,e){return n<e?-1:n>e?1:0}function cn(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
1659 * @license
1660 * Copyright 2017 Google LLC
1661 *
1662 * Licensed under the Apache License, Version 2.0 (the "License");
1663 * you may not use this file except in compliance with the License.
1664 * You may obtain a copy of the License at
1665 *
1666 *   http://www.apache.org/licenses/LICENSE-2.0
1667 *
1668 * Unless required by applicable law or agreed to in writing, software
1669 * distributed under the License is distributed on an "AS IS" BASIS,
1670 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1671 * See the License for the specific language governing permissions and
1672 * limitations under the License.
1673 */class ce{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new D(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new D(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new D(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new D(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ce.fromMillis(Date.now())}static fromDate(e){return ce.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new ce(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_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- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
1674 * @license
1675 * Copyright 2017 Google LLC
1676 *
1677 * Licensed under the Apache License, Version 2.0 (the "License");
1678 * you may not use this file except in compliance with the License.
1679 * You may obtain a copy of the License at
1680 *
1681 *   http://www.apache.org/licenses/LICENSE-2.0
1682 *
1683 * Unless required by applicable law or agreed to in writing, software
1684 * distributed under the License is distributed on an "AS IS" BASIS,
1685 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1686 * See the License for the specific language governing permissions and
1687 * limitations under the License.
1688 */class U{constructor(e){this.timestamp=e}static fromTimestamp(e){return new U(e)}static min(){return new U(new ce(0,0))}static max(){return new U(new ce(253402300799,999999999))}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}}/**
1689 * @license
1690 * Copyright 2017 Google LLC
1691 *
1692 * Licensed under the Apache License, Version 2.0 (the "License");
1693 * you may not use this file except in compliance with the License.
1694 * You may obtain a copy of the License at
1695 *
1696 *   http://www.apache.org/licenses/LICENSE-2.0
1697 *
1698 * Unless required by applicable law or agreed to in writing, software
1699 * distributed under the License is distributed on an "AS IS" BASIS,
1700 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1701 * See the License for the specific language governing permissions and
1702 * limitations under the License.
1703 */class ar{constructor(e,t,r){t===void 0?t=0:t>e.length&&x(),r===void 0?r=e.length-t:r>e.length-t&&x(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return ar.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof ar?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=e.get(s),a=t.get(s);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ee extends ar{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 D(b.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 m_=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class fe extends ar{construct(e,t,r){return new fe(e,t,r)}static isValidIdentifier(e){return m_.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),fe.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new fe(["__name__"])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new D(b.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 u=e[s];if(u==="\\"){if(s+1===e.length)throw new D(b.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new D(b.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else u==="`"?(a=!a,s++):u!=="."||a?(r+=u,s++):(i(),s++)}if(i(),a)throw new D(b.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new fe(t)}static emptyPath(){return new fe([])}}/**
1704 * @license
1705 * Copyright 2017 Google LLC
1706 *
1707 * Licensed under the Apache License, Version 2.0 (the "License");
1708 * you may not use this file except in compliance with the License.
1709 * You may obtain a copy of the License at
1710 *
1711 *   http://www.apache.org/licenses/LICENSE-2.0
1712 *
1713 * Unless required by applicable law or agreed to in writing, software
1714 * distributed under the License is distributed on an "AS IS" BASIS,
1715 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1716 * See the License for the specific language governing permissions and
1717 * limitations under the License.
1718 */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()))}}function g_(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=U.fromTimestamp(r===1e9?new ce(t+1,0):new ce(t,r));return new It(s,L.empty(),e)}function __(n){return new It(n.readTime,n.key,-1)}class It{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new It(U.min(),L.empty(),-1)}static max(){return new It(U.max(),L.empty(),-1)}}function y_(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))}/**
1719 * @license
1720 * Copyright 2020 Google LLC
1721 *
1722 * Licensed under the Apache License, Version 2.0 (the "License");
1723 * you may not use this file except in compliance with the License.
1724 * You may obtain a copy of the License at
1725 *
1726 *   http://www.apache.org/licenses/LICENSE-2.0
1727 *
1728 * Unless required by applicable law or agreed to in writing, software
1729 * distributed under the License is distributed on an "AS IS" BASIS,
1730 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1731 * See the License for the specific language governing permissions and
1732 * limitations under the License.
1733 */const v_="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class E_{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
1734 * @license
1735 * Copyright 2017 Google LLC
1736 *
1737 * Licensed under the Apache License, Version 2.0 (the "License");
1738 * you may not use this file except in compliance with the License.
1739 * You may obtain a copy of the License at
1740 *
1741 *   http://www.apache.org/licenses/LICENSE-2.0
1742 *
1743 * Unless required by applicable law or agreed to in writing, software
1744 * distributed under the License is distributed on an "AS IS" BASIS,
1745 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1746 * See the License for the specific language governing permissions and
1747 * limitations under the License.
1748 */async function vr(n){if(n.code!==b.FAILED_PRECONDITION||n.message!==v_)throw n;O("LocalStore","Unexpectedly lost primary lease")}/**
1749 * @license
1750 * Copyright 2017 Google LLC
1751 *
1752 * Licensed under the Apache License, Version 2.0 (the "License");
1753 * you may not use this file except in compliance with the License.
1754 * You may obtain a copy of the License at
1755 *
1756 *   http://www.apache.org/licenses/LICENSE-2.0
1757 *
1758 * Unless required by applicable law or agreed to in writing, software
1759 * distributed under the License is distributed on an "AS IS" BASIS,
1760 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1761 * See the License for the specific language governing permissions and
1762 * limitations under the License.
1763 */class S{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&&x(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new S((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 S?t:S.resolve(t)}catch(t){return S.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):S.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):S.reject(t)}static resolve(e){return new S((t,r)=>{t(e)})}static reject(e){return new S((t,r)=>{r(e)})}static waitFor(e){return new S((t,r)=>{let s=0,i=0,a=!1;e.forEach(u=>{++s,u.next(()=>{++i,a&&i===s&&t()},l=>r(l))}),a=!0,i===s&&t()})}static or(e){let t=S.resolve(!1);for(const r of e)t=t.next(s=>s?S.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 S((r,s)=>{const i=e.length,a=new Array(i);let u=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next(p=>{a[d]=p,++u,u===i&&r(a)},p=>s(p))}})}static doWhile(e,t){return new S((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function T_(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Er(n){return n.name==="IndexedDbTransactionError"}/**
1764 * @license
1765 * Copyright 2018 Google LLC
1766 *
1767 * Licensed under the Apache License, Version 2.0 (the "License");
1768 * you may not use this file except in compliance with the License.
1769 * You may obtain a copy of the License at
1770 *
1771 *   http://www.apache.org/licenses/LICENSE-2.0
1772 *
1773 * Unless required by applicable law or agreed to in writing, softw
vendor: 9,815 bytes, lines 1773-1833
1773are
1774 * distributed under the License is distributed on an "AS IS" BASIS,
1775 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1776 * See the License for the specific language governing permissions and
1777 * limitations under the License.
1778 */class Io{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.ie(r),this.se=r=>t.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}Io.oe=-1;function Os(n){return n==null}function Es(n){return n===0&&1/n==-1/0}function I_(n){return typeof n=="number"&&Number.isInteger(n)&&!Es(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
1779 * @license
1780 * Copyright 2017 Google LLC
1781 *
1782 * Licensed under the Apache License, Version 2.0 (the "License");
1783 * you may not use this file except in compliance with the License.
1784 * You may obtain a copy of the License at
1785 *
1786 *   http://www.apache.org/licenses/LICENSE-2.0
1787 *
1788 * Unless required by applicable law or agreed to in writing, software
1789 * distributed under the License is distributed on an "AS IS" BASIS,
1790 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1791 * See the License for the specific language governing permissions and
1792 * limitations under the License.
1793 */function tu(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function Ht(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function Wl(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1794 * @license
1795 * Copyright 2017 Google LLC
1796 *
1797 * Licensed under the Apache License, Version 2.0 (the "License");
1798 * you may not use this file except in compliance with the License.
1799 * You may obtain a copy of the License at
1800 *
1801 *   http://www.apache.org/licenses/LICENSE-2.0
1802 *
1803 * Unless required by applicable law or agreed to in writing, software
1804 * distributed under the License is distributed on an "AS IS" BASIS,
1805 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1806 * See the License for the specific language governing permissions and
1807 * limitations under the License.
1808 */class te{constructor(e,t){this.comparator=e,this.root=t||de.EMPTY}insert(e,t){return new te(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,de.BLACK,null,null))}remove(e){return new te(this.comparator,this.root.remove(e,this.comparator).copy(null,null,de.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 Zr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Zr(this.root,e,this.comparator,!1)}getReverseIterator(){return new Zr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Zr(this.root,e,this.comparator,!0)}}class Zr{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 de{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??de.RED,this.left=s??de.EMPTY,this.right=i??de.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new de(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 de.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 de.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,de.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,de.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 x();const e=this.left.check();if(e!==this.right.check())throw x();return e+(this.isRed()?0:1)}}de.EMPTY=null,de.RED=!0,de.BLACK=!1;de.EMPTY=new class{constructor(){this.size=0}get key(){throw x()}get value(){throw x()}get color(){throw x()}get left(){throw x()}get right(){throw x()}copy(e,t,r,s,i){return this}insert(e,t,r){return new de(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}};/**
1809 * @license
1810 * Copyright 2017 Google LLC
1811 *
1812 * Licensed under the Apache License, Version 2.0 (the "License");
1813 * you may not use this file except in compliance with the License.
1814 * You may obtain a copy of the License at
1815 *
1816 *   http://www.apache.org/licenses/LICENSE-2.0
1817 *
1818 * Unless required by applicable law or agreed to in writing, software
1819 * distributed under the License is distributed on an "AS IS" BASIS,
1820 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1821 * See the License for the specific language governing permissions and
1822 * limitations under the License.
1823 */class pe{constructor(e){this.comparator=e,this.data=new te(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 nu(this.data.getIterator())}getIteratorFrom(e){return new nu(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 pe)||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 pe(this.comparator);return t.data=e,t}}class nu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1824 * @license
1825 * Copyright 2020 Google LLC
1826 *
1827 * Licensed under the Apache License, Version 2.0 (the "License");
1828 * you may not use this file except in compliance with the License.
1829 * You may obtain a copy of the License at
1830 *
1831 *   http://www.apache.org/licenses/LICENSE-2.0
1832 *
1833 * Unless required by applicable law or agreed to in writing, softw
1833are
1834 * distributed under the License is distributed on an "AS IS" BASIS,
1835 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1836 * See the License for the specific language governing permissions and
1837 * limitations under the License.
1838 */class Ve{constructor(e){this.fields=e,e.sort(fe.comparator)}static empty(){return new Ve([])}unionWith(e){let t=new pe(fe.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Ve(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return cn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
1839 * @license
1840 * Copyright 2023 Google LLC
1841 *
1842 * Licensed under the Apache License, Version 2.0 (the "License");
1843 * you may not use this file except in compliance with the License.
1844 * You may obtain a copy of the License at
1845 *
1846 *   http://www.apache.org/licenses/LICENSE-2.0
1847 *
1848 * Unless required by applicable law or agreed to in writing, software
1849 * distributed under the License is distributed on an "AS IS" BASIS,
1850 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1851 * See the License for the specific language governing permissions and
1852 * limitations under the License.
1853 */class Kl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
1854 * @license
1855 * Copyright 2020 Google LLC
1856 *
1857 * Licensed under the Apache License, Version 2.0 (the "License");
1858 * you may not use this file except in compliance with the License.
1859 * You may obtain a copy of the License at
1860 *
1861 *   http://www.apache.org/licenses/LICENSE-2.0
1862 *
1863 * Unless required by applicable law or agreed to in writing, software
1864 * distributed under the License is distributed on an "AS IS" BASIS,
1865 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1866 * See the License for the specific language governing permissions and
1867 * limitations under the License.
1868 */class me{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 Kl("Invalid base64 string: "+i):i}}(e);return new me(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 me(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}}me.EMPTY_BYTE_STRING=new me("");const w_=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function wt(n){if(Q(!!n),typeof n=="string"){let e=0;const t=w_.exec(n);if(Q(!!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:ie(n.seconds),nanos:ie(n.nanos)}}function ie(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Ut(n){return typeof n=="string"?me.fromBase64String(n):me.fromUint8Array(n)}/**
1869 * @license
1870 * Copyright 2020 Google LLC
1871 *
1872 * Licensed under the Apache License, Version 2.0 (the "License");
1873 * you may not use this file except in compliance with the License.
1874 * You may obtain a copy of the License at
1875 *
1876 *   http://www.apache.org/licenses/LICENSE-2.0
1877 *
1878 * Unless required by applicable law or agreed to in writing, software
1879 * distributed under the License is distributed on an "AS IS" BASIS,
1880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1881 * See the License for the specific language governing permissions and
1882 * limitations under the License.
1883 */function wo(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function Ao(n){const e=n.mapValue.fields.__previous_value__;return wo(e)?Ao(e):e}function cr(n){const e=wt(n.mapValue.fields.__local_write_time__.timestampValue);return new ce(e.seconds,e.nanos)}/**
1884 * @license
1885 * Copyright 2017 Google LLC
1886 *
1887 * Licensed under the Apache License, Version 2.0 (the "License");
1888 * you may not use this file except in compliance with the License.
1889 * You may obtain a copy of the License at
1890 *
1891 *   http://www.apache.org/licenses/LICENSE-2.0
1892 *
1893 * Unless required by applicable law or agreed to in writing, software
1894 * distributed under the License is distributed on an "AS IS" BASIS,
1895 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1896 * See the License for the specific language governing permissions and
1897 * limitations under the License.
1898 */class A_{constructor(e,t,r,s,i,a,u,l,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=u,this.longPollingOptions=l,this.useFetchStreams=d}}class ur{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new ur("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof ur&&e.projectId===this.projectId&&e.database===this.database}}/**
1899 * @license
1900 * Copyright 2020 Google LLC
1901 *
1902 * Licensed under the Apache License, Version 2.0 (the "License");
1903 * you may not use this file except in compliance with the License.
1904 * You may obtain a copy of the License at
1905 *
1906 *   http://www.apache.org/licenses/LICENSE-2.0
1907 *
1908 * Unless required by applicable law or agreed to in writing, software
1909 * distributed under the License is distributed on an "AS IS" BASIS,
1910 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1911 * See the License for the specific language governing permissions and
1912 * limitations under the License.
1913 */const es={mapValue:{}};function Ft(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?wo(n)?4:P_(n)?9007199254740991:R_(n)?10:11:x()}function He(n,e){if(n===e)return!0;const t=Ft(n);if(t!==Ft(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return cr(n).isEqual(cr(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=wt(s.timestampValue),u=wt(i.timestampValue);return a.seconds===u.seconds&&a.nanos===u.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return Ut(s.bytesValue).isEqual(Ut(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return ie(s.geoPointValue.latitude)===ie(i.geoPointValue.latitude)&&ie(s.geoPointValue.longitude)===ie(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return ie(s.integerValue)===ie(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=ie(s.doubleValue),u=ie(i.doubleValue);return a===u?Es(a)===Es(u):isNaN(a)&&isNaN(u)}return!1}(n,e);case 9:return cn(n.arrayValue.values||[],e.arrayValue.values||[],He);case 10:case 11:return function(s,i){const a=s.mapValue.fields||{},u=i.mapValue.fields||{};if(tu(a)!==tu(u))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(u[l]===void 0||!He(a[l],u[l])))return!1;return!0}(n,e);default:return x()}}function lr(n,e){return(n.values||[]).find(t=>He(t,e))!==void 0}function un(n,e){if(n===e)return 0;const t=Ft(n),r=Ft(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 u=ie(i.integerValue||i.doubleValue),l=ie(a.integerValue||a.doubleValue);return u<l?-1:u>l?1:u===l?0:isNaN(u)?isNaN(l)?0:-1:1}(n,e);case 3:return ru(n.timestampValue,e.timestampValue);case 4:return ru(cr(n),cr(e));case 5:return G(n.stringValue,e.stringValue);case 6:return function(i,a){const u=Ut(i),l=Ut(a);return u.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(i,a){const u=i.split("/"),l=a.split("/");for(let d=0;d<u.length&&d<l.length;d++){const p=G(u[d],l[d]);if(p!==0)return p}return G(u.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,a){const u=G(ie(i.latitude),ie(a.latitude));return u!==0?u:G(ie(i.longitude),ie(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return su(n.arrayValue,e.arrayValue);case 10:return function(i,a){var u,l,d,p;const y=i.fields||{},I=a.fields||{},P=(u=y.value)===null||u===void 0?void 0:u.arrayValue,k=(l=I.value)===null||l===void 0?void 0:l.arrayValue,V=G(((d=P==null?void 0:P.values)===null||d===void 0?void 0:d.length)||0,((p=k==null?void 0:k.values)===null||p===void 0?void 0:p.length)||0);return V!==0?V:su(P,k)}(n.mapValue,e.mapValue);case 11:return function(i,a){if(i===es.mapValue&&a===es.mapValue)return 0;if(i===es.mapValue)return 1;if(a===es.mapValue)return-1;const u=i.fields||{},l=Object.keys(u),d=a.fields||{},p=Object.keys(d);l.sort(),p.sort();for(let y=0;y<l.length&&y<p.length;++y){const I=G(l[y],p[y]);if(I!==0)return I;const P=un(u[l[y]],d[p[y]]);if(P!==0)return P}return G(l.length,p.length)}(n.mapValue,e.mapValue);default:throw x()}}function ru(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return G(n,e);const t=wt(n),r=wt(e),s=G(t.seconds,r.seconds);return s!==0?s:G(t.nanos,r.nanos)}function su(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;
1913++s){const i=un(t[s],r[s]);if(i)return i}return G(t.length,r.length)}function ln(n){return Wi(n)}function Wi(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=wt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Ut(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+=Wi(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}:${Wi(t.fields[a])}`;return s+"}"}(n.mapValue):x()}function iu(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function Ki(n){return!!n&&"integerValue"in n}function Ro(n){return!!n&&"arrayValue"in n}function ou(n){return!!n&&"nullValue"in n}function au(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function us(n){return!!n&&"mapValue"in n}function R_(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="__vector__"}function Jn(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 Ht(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=Jn(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Jn(n.arrayValue.values[t]);return e}return Object.assign({},n)}function P_(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
1914 * @license
1915 * Copyright 2017 Google LLC
1916 *
1917 * Licensed under the Apache License, Version 2.0 (the "License");
1918 * you may not use this file except in compliance with the License.
1919 * You may obtain a copy of the License at
1920 *
1921 *   http://www.apache.org/licenses/LICENSE-2.0
1922 *
1923 * Unless required by applicable law or agreed to in writing, software
1924 * distributed under the License is distributed on an "AS IS" BASIS,
1925 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1926 * See the License for the specific language governing permissions and
1927 * limitations under the License.
1928 */class ke{constructor(e){this.value=e}static empty(){return new ke({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)],!us(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Jn(t)}setAll(e){let t=fe.emptyPath(),r={},s=[];e.forEach((a,u)=>{if(!t.isImmediateParentOf(u)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=u.popLast()}a?r[u.lastSegment()]=Jn(a):s.push(u.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());us(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return He(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)];us(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){Ht(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new ke(Jn(this.value))}}function Gl(n){const e=[];return Ht(n.fields,(t,r)=>{const s=new fe([t]);if(us(r)){const i=Gl(r.mapValue).fields;
vendor: 4,168 bytes, lines 1928-1968
1928if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)}),new Ve(e)}/**
1929 * @license
1930 * Copyright 2017 Google LLC
1931 *
1932 * Licensed under the Apache License, Version 2.0 (the "License");
1933 * you may not use this file except in compliance with the License.
1934 * You may obtain a copy of the License at
1935 *
1936 *   http://www.apache.org/licenses/LICENSE-2.0
1937 *
1938 * Unless required by applicable law or agreed to in writing, software
1939 * distributed under the License is distributed on an "AS IS" BASIS,
1940 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1941 * See the License for the specific language governing permissions and
1942 * limitations under the License.
1943 */class Te{constructor(e,t,r,s,i,a,u){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=u}static newInvalidDocument(e){return new Te(e,0,U.min(),U.min(),U.min(),ke.empty(),0)}static newFoundDocument(e,t,r,s){return new Te(e,1,t,U.min(),r,s,0)}static newNoDocument(e,t){return new Te(e,2,t,U.min(),U.min(),ke.empty(),0)}static newUnknownDocument(e,t){return new Te(e,3,t,U.min(),U.min(),ke.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(U.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=ke.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ke.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=U.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 Te&&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 Te(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}})`}}/**
1944 * @license
1945 * Copyright 2022 Google LLC
1946 *
1947 * Licensed under the Apache License, Version 2.0 (the "License");
1948 * you may not use this file except in compliance with the License.
1949 * You may obtain a copy of the License at
1950 *
1951 *   http://www.apache.org/licenses/LICENSE-2.0
1952 *
1953 * Unless required by applicable law or agreed to in writing, software
1954 * distributed under the License is distributed on an "AS IS" BASIS,
1955 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1956 * See the License for the specific language governing permissions and
1957 * limitations under the License.
1958 */class Ts{constructor(e,t){this.position=e,this.inclusive=t}}function cu(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=un(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function uu(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(!He(n.position[t],e.position[t]))return!1;return!0}/**
1959 * @license
1960 * Copyright 2022 Google LLC
1961 *
1962 * Licensed under the Apache License, Version 2.0 (the "License");
1963 * you may not use this file except in compliance with the License.
1964 * You may obtain a copy of the License at
1965 *
1966 *   http://www.apache.org/licenses/LICENSE-2.0
1967 *
1968 * Unless required by applicable law or agreed to in writing, softw
1968are
1969 * distributed under the License is distributed on an "AS IS" BASIS,
1970 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1971 * See the License for the specific language governing permissions and
1972 * limitations under the License.
1973 */class hr{constructor(e,t="asc"){this.field=e,this.dir=t}}function b_(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
1974 * @license
1975 * Copyright 2022 Google LLC
1976 *
1977 * Licensed under the Apache License, Version 2.0 (the "License");
1978 * you may not use this file except in compliance with the License.
1979 * You may obtain a copy of the License at
1980 *
1981 *   http://www.apache.org/licenses/LICENSE-2.0
1982 *
1983 * Unless required by applicable law or agreed to in writing, software
1984 * distributed under the License is distributed on an "AS IS" BASIS,
1985 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1986 * See the License for the specific language governing permissions and
1987 * limitations under the License.
1988 */class Ql{}class ae extends Ql{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 C_(e,t,r):t==="array-contains"?new D_(e,r):t==="in"?new V_(e,r):t==="not-in"?new O_(e,r):t==="array-contains-any"?new L_(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new k_(e,r):new N_(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(un(t,this.value)):t!==null&&Ft(this.value)===Ft(t)&&this.matchesComparison(un(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 x()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class xe extends Ql{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new xe(e,t)}matches(e){return Yl(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function Yl(n){return n.op==="and"}function Xl(n){return S_(n)&&Yl(n)}function S_(n){for(const e of n.filters)if(e instanceof xe)return!1;return!0}function Gi(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+ln(n.value);if(Xl(n))return n.filters.map(e=>Gi(e)).join(",");{const e=n.filters.map(t=>Gi(t)).join(",");return`${n.op}(${e})`}}function Jl(n,e){return n instanceof ae?function(r,s){return s instanceof ae&&r.op===s.op&&r.field.isEqual(s.field)&&He(r.value,s.value)}(n,e):n instanceof xe?function(r,s){return s instanceof xe&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,a,u)=>i&&Jl(a,s.filters[u]),!0):!1}(n,e):void x()}function Zl(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${ln(t.value)}`}(n):n instanceof xe?function(t){return t.op.toString()+" {"+t.getFilters().map(Zl).join(" ,")+"}"}(n):"Filter"}class C_ 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 k_ extends ae{constructor(e,t){super(e,"in",t),this.keys=eh("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class N_ extends ae{constructor(e,t){super(e,"not-in",t),this.keys=eh("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function eh(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>L.fromName(r.referenceValue))}class D_ extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Ro(t)&&lr(t.arrayValue,this.value)}}class V_ extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&lr(this.value.arrayValue,t)}}class O_ extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(lr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!lr(this.value.arrayValue,t)}}class L_ extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Ro(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>lr(this.value.arrayValue,r))}}/**
1989 * @license
1990 * Copyright 2019 Google LLC
1991 *
1992 * Licensed under the Apache License, Version 2.0 (the "License");
1993 * you may not use this file except in compliance with the License.
1994 * You may obtain a copy of the License at
1995 *
1996 *   http://www.apache.org/licenses/LICENSE-2.0
1997 *
1998 * Unless required by applicable law or agreed to in writing, software
1999 * distributed under the License is distributed on an "AS IS" BASIS,
2000 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2001 * See the License for the specific language governing permissions and
2002 * limitations under the License.
2003 */class M_{constructor(e,t=null,r=[],s=[],i=null,a=null,u=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=u,this.ue=null}}function lu(n,e=null,t=[],r=[],s=null,i=null,a=null){return new M_(n,e,t,r,s,i,a)}function Po(n){const e=F(n);if(e.ue===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>Gi(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),Os(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>ln(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>ln(r)).join(",")),e.ue=t}return e.ue}function bo(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(!b_(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(!Jl(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!uu(n.startAt,e.startAt)&&uu(n.endAt,e.endAt)}function Qi(n){return L.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2004 * @license
2005 * Copyright 2017 Google LLC
2006 *
2007 * Licensed under the Apache License, Version 2.0 (the "License");
2008 * you may not use this file except in compliance with the License.
2009 * You may obtain a copy of the License at
2010 *
2011 *   http://www.apache.org/licenses/LICENSE-2.0
2012 *
2013 * Unless required by applicable law or agreed to in writing, software
2014 * distributed under the License is distributed on an "AS IS" BASIS,
2015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016 * See the License for the specific language governing permissions and
2017 * limitations under the License.
2018 */class En{constructor(e,t=null,r=[],s=[],i=null,a="F",u=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=u,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function x_(n,e,t,r,s,i,a,u){return new En(n,e,t,r,s,i,a,u)}function Ls(n){return new En(n)}function hu(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 th(n){return n.collectionGroup!==null}function Zn(n){const e=F(n);if(e.ce===null){e.ce=[];const t=new Set;for(const i of e.explicitOrderBy)e.ce.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let u=new pe(fe.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(u=u.add(d.field))})}),u})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.ce.push(new hr(i,r))}),t.has(fe.keyField().canonicalString())||e.ce.push(new hr(fe.keyField(),r))}return e.ce}function je(n){const e=F(n);return e.le||(e.le=U_(e,Zn(n))),e.le}function U_(n,e){if(n.limitType==="F")return lu(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 hr(s.field,i)});const t=n.endAt?new Ts(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Ts(n.startAt.position,n.startAt.inclusive):null;return lu(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function Yi(n,e){const t=n.filters.concat([e]);return new En(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function Is(n,e,t){return new En(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function Ms(n,e){return bo(je(n),je(e))&&n.limitType===e.limitType}function nh(n){return`${Po(je(n))}|lt:${n.limitType}`}function Xt(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=>Zl(s)).join(", ")}]`),Os(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=>ln(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>ln(s)).join(",")),`Target(${r})`}(je(n))}; limitType=${n.limitType})`}function xs(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 Zn(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,u,l){const d=cu(a,u,l);return a.inclusive?d<=0:d<0}(r.startAt,Zn(r),s)||r.endAt&&!function(a,u,l){const d=cu(a,u,l);return a.inclusive?d>=0:d>0}(r.endAt,Zn(r),s))}(n,e)}function F_(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function rh(n){return(e,t)=>{let r=!1;for(const s of Zn(n)){const i=B_(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function B_(n,e,t){const r=n.field.isKeyField()?L.comparator(e.key,t.key):function(i,a,u){const l=a.data.field(i),d=u.data.field(i);return l!==null&&d!==null?un(l,d):x()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return x()}}/**
2019 * @license
2020 * Copyright 2017 Google LLC
2021 *
2022 * Licensed under the Apache License, Version 2.0 (the "License");
2023 * you may not use this file except in compliance with the License.
2024 * You may obtain a copy of the License at
2025 *
2026 *   http://www.apache.org/licenses/LICENSE-2.0
2027 *
2028 * Unless required by applicable law or agreed to in writing, software
2029 * distributed under the License is distributed on an "AS IS" BASIS,
2030 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2031 * See the License for the specific language governing permissions and
2032 * limitations under the License.
2033 */class Tn{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){Ht(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return Wl(this.inner)}size(){return this.innerSize}}/**
2034 * @license
2035 * Copyright 2017 Google LLC
2036 *
2037 * Licensed under the Apache License, Version 2.0 (the "License");
2038 * you may not use this file except in compliance with the License.
2039 * You may obtain a copy of the License at
2040 *
2041 *   http://www.apache.org/licenses/LICENSE-2.0
2042 *
2043 * Unless required by applicable law or agreed to in writing, software
2044 * distributed under the License is distributed on an "AS IS" BASIS,
2045 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2046 * See the License for the specific language governing permissions and
2047 * limitations under the License.
2048 */const q_=new te(L.comparator);function ot(){return q_}const sh=new te(L.comparator);function Gn(...n){let e=sh;for(const t of n)e=e.insert(t.key,t);return e}function ih(n){let e=sh;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function Dt(){return er()}function oh(){return er()}function er(){return new Tn(n=>n.toString(),(n,e)=>n.isEqual(e))}const j_=new te(L.comparator),$_=new pe(L.comparator);function z(...n){let e=$_;for(const t of n)e=e.add(t);return e}const z_=new pe(G);function H_(){return z_}/**
2049 * @license
2050 * Copyright 2020 Google LLC
2051 *
2052 * Licensed under the Apache License, Version 2.0 (the "License");
2053 * you may not use this file except in compliance with the License.
2054 * You may obtain a copy of the License at
2055 *
2056 *   http://www.apache.org/licenses/LICENSE-2.0
2057 *
2058 * Unless required by applicable law or agreed to in writing, software
2059 * distributed under the License is distributed on an "AS IS" BASIS,
2060 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2061 * See the License for the specific language governing permissions and
2062 * limitations under the License.
2063 */function So(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:Es(e)?"-0":e}}function ah(n){return{integerValue:""+n}}function ch(n,e){return I_(e)?ah(e):So(n,e)}/**
2064 * @license
2065 * Copyright 2018 Google LLC
2066 *
2067 * Licensed under the Apache License, Version 2.0 (the "License");
2068 * you may not use this file except in compliance with the License.
2069 * You may obtain a copy of the License at
2070 *
2071 *   http://www.apache.org/licenses/LICENSE-2.0
2072 *
2073 * Unless required by applicable law or agreed to in writing, software
2074 * distributed under the License is distributed on an "AS IS" BASIS,
2075 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2076 * See the License for the specific language governing permissions and
2077 * limitations under the License.
2078 */class Us{constructor(){this._=void 0}}function W_(n,e,t){return n instanceof dr?function(s,i){const a={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&wo(i)&&(i=Ao(i)),i&&(a.fields.__previous_value__=i),{mapValue:a}}(t,e):n instanceof hn?lh(n,e):n instanceof fr?hh(n,e):function(s,i){const a=uh(s,i),u=du(a)+du(s.Pe);return Ki(a)&&Ki(s.Pe)?ah(u):So(s.serializer,u)}(n,e)}function K_(n,e,t){return n instanceof hn?lh(n,e):n instanceof fr?hh(n,e):t}function uh(n,e){return n instanceof pr?function(r){return Ki(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class dr extends Us{}class hn extends Us{constructor(e){super(),this.elements=e}}function lh(n,e){const t=dh(e);for(const r of n.elements)t.some(s=>He(s,r))||t.push(r);return{arrayValue:{values:t}}}class fr extends Us{constructor(e){super(),this.elements=e}}function hh(n,e){let t=dh(e);for(const r of n.elements)t=t.filter(s=>!He(s,r));return{arrayValue:{values:t}}}
2078class pr extends Us{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function du(n){return ie(n.integerValue||n.doubleValue)}function dh(n){return Ro(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}/**
2079 * @license
2080 * Copyright 2017 Google LLC
2081 *
2082 * Licensed under the Apache License, Version 2.0 (the "License");
2083 * you may not use this file except in compliance with the License.
2084 * You may obtain a copy of the License at
2085 *
2086 *   http://www.apache.org/licenses/LICENSE-2.0
2087 *
2088 * Unless required by applicable law or agreed to in writing, software
2089 * distributed under the License is distributed on an "AS IS" BASIS,
2090 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2091 * See the License for the specific language governing permissions and
2092 * limitations under the License.
2093 */class Co{constructor(e,t){this.field=e,this.transform=t}}function G_(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof hn&&s instanceof hn||r instanceof fr&&s instanceof fr?cn(r.elements,s.elements,He):r instanceof pr&&s instanceof pr?He(r.Pe,s.Pe):r instanceof dr&&s instanceof dr}(n.transform,e.transform)}class Q_{constructor(e,t){this.version=e,this.transformResults=t}}class Se{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Se}static exists(e){return new Se(void 0,e)}static updateTime(e){return new Se(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 ls(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class Fs{}function fh(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Bs(n.key,Se.none()):new Tr(n.key,n.data,Se.none());{const t=n.data,r=ke.empty();let s=new pe(fe.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 Pt(n.key,r,new Ve(s.toArray()),Se.none())}}function Y_(n,e,t){n instanceof Tr?function(s,i,a){const u=s.value.clone(),l=pu(s.fieldTransforms,i,a.transformResults);u.setAll(l),i.convertToFoundDocument(a.version,u).setHasCommittedMutations()}(n,e,t):n instanceof Pt?function(s,i,a){if(!ls(s.precondition,i))return void i.convertToUnknownDocument(a.version);const u=pu(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(ph(s)),l.setAll(u),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function tr(n,e,t,r){return n instanceof Tr?function(i,a,u,l){if(!ls(i.precondition,a))return u;const d=i.value.clone(),p=mu(i.fieldTransforms,l,a);return d.setAll(p),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof Pt?function(i,a,u,l){if(!ls(i.precondition,a))return u;const d=mu(i.fieldTransforms,l,a),p=a.data;return p.setAll(ph(i)),p.setAll(d),a.convertToFoundDocument(a.version,p).setHasLocalMutations(),u===null?null:u.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(y=>y.field))}(n,e,t,r):function(i,a,u){return ls(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):u}(n,e,t)}function X_(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=uh(r.transform,s||null);i!=null&&(t===null&&(t=ke.empty()),t.set(r.field,i))}return t||null}function fu(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)&&cn(r,s,(i,a)=>G_(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 Tr extends Fs{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 Pt extends Fs{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.prec
2093ondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function ph(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 pu(n,e,t){const r=new Map;Q(n.length===t.length);for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,u=e.data.field(i.field);r.set(i.field,K_(a,u,t[s]))}return r}function mu(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,W_(i,a,e))}return r}class Bs extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class J_ extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2094 * @license
2095 * Copyright 2017 Google LLC
2096 *
2097 * Licensed under the Apache License, Version 2.0 (the "License");
2098 * you may not use this file except in compliance with the License.
2099 * You may obtain a copy of the License at
2100 *
2101 *   http://www.apache.org/licenses/LICENSE-2.0
2102 *
2103 * Unless required by applicable law or agreed to in writing, software
2104 * distributed under the License is distributed on an "AS IS" BASIS,
2105 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2106 * See the License for the specific language governing permissions and
2107 * limitations under the License.
2108 */class Z_{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)&&Y_(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=tr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=tr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=oh();return this.mutations.forEach(s=>{const i=e.get(s.key),a=i.overlayedDocument;let u=this.applyToLocalView(a,i.mutatedFields);u=t.has(s.key)?null:u;const l=fh(a,u);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(U.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),z())}isEqual(e){return this.batchId===e.batchId&&cn(this.mutations,e.mutations,(t,r)=>fu(t,r))&&cn(this.baseMutations,e.baseMutations,(t,r)=>fu(t,r))}}class ko{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){Q(e.mutations.length===r.length);let s=function(){return j_}();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new ko(e,t,r,s)}}/**
2109 * @license
2110 * Copyright 2022 Google LLC
2111 *
2112 * Licensed under the Apache License, Version 2.0 (the "License");
2113 * you may not use this file except in compliance with the License.
2114 * You may obtain a copy of the License at
2115 *
2116 *   http://www.apache.org/licenses/LICENSE-2.0
2117 *
2118 * Unless required by applicable law or agreed to in writing, software
2119 * distributed under the License is distributed on an "AS IS" BASIS,
2120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121 * See the License for the specific language governing permissions and
2122 * limitations under the License.
2123 */class ey{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{
2124      largestBatchId: ${this.largestBatchId},
2125      mutation: ${this.mutation.toString()}
2126    }`}}/**
2127 * @license
2128 * Copyright 2017 Google LLC
2129 *
2130 * Licensed under the Apache License, Version 2.0 (the "License");
2131 * you may not use this file except in compliance with the License.
2132 * You may obtain a copy of the License at
2133 *
2134 *   http://www.apache.org/licenses/LICENSE-2.0
2135 *
2136 * Unless required by applicable law or agreed to in writing, software
2137 * distributed under the License is distributed on an "AS IS" BASIS,
2138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2139 * See the License for the specific language governing permissions and
2140 * limitations under the License.
2141 */class ty{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
2142 * @license
2143 * Copyright 2017 Google LLC
2144 *
2145 * Licensed under the Apache License, Version 2.0 (the "License");
2146 * you may not use this file except in compliance with the License.
2147 * You may obtain a copy of the License at
2148 *
2149 *   http://www.apache.org/licenses/LICENSE-2.0
2150 *
2151 * Unless required by applicable law or agreed to in writing, software
2152 * distributed under the License is distributed on an "AS IS" BASIS,
2153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2154 * See the License for the specific language governing permissions and
2155 * limitations under the License.
2156 */var oe,W;function ny(n){switch(n){default:return x();case b.CANCELLED:case b.UNKNOWN:case b.DEADLINE_EXCEEDED:case b.RESOURCE_EXHAUSTED:case b.INTERNAL:case b.UNAVAILABLE:case b.UNAUTHENTICATED:return!1;case b.INVALID_ARGUMENT:case b.NOT_FOUND:case b.ALREADY_EXISTS:case b.PERMISSION_DENIED:case b.FAILED_PRECONDITION:case b.ABORTED:case b.OUT_OF_RANGE:case b.UNIMPLEMENTED:case b.DATA_LOSS:return!0}}function mh(n){if(n===void 0)return it("GRPC error has no .code"),b.UNKNOWN;switch(n){case oe.OK:return b.OK;case oe.CANCELLED:return b.CANCELLED;case oe.UNKNOWN:return b.UNKNOWN;case oe.DEADLINE_EXCEEDED:return b.DEADLINE_EXCEEDED;case oe.RESOURCE_EXHAUSTED:return b.RESOURCE_EXHAUSTED;case oe.INTERNAL:return b.INTERNAL;case oe.UNAVAILABLE:return b.UNAVAILABLE;case oe.UNAUTHENTICATED:return b.UNAUTHENTICATED;case oe.INVALID_ARGUMENT:return b.INVALID_ARGUMENT;case oe.NOT_FOUND:return b.NOT_FOUND;case oe.ALREADY_EXISTS:return b.ALREADY_EXISTS;case oe.PERMISSION_DENIED:return b.PERMISSION_DENIED;case oe.FAILED_PRECONDITION:return b.FAILED_PRECONDITION;case oe.ABORTED:return b.ABORTED;case oe.OUT_OF_RANGE:return b.OUT_OF_RANGE;case oe.UNIMPLEMENTED:return b.UNIMPLEMENTED;case oe.DATA_LOSS:return b.DATA_LOSS;default:return x()}}(W=oe||(oe={}))[W.OK=0]="OK",W[W.CANCELLED=1]="CANCELLED",W[W.UNKNOWN=2]="UNKNOWN",W[W.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",W[W.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",W[W.NOT_FOUND=5]="NOT_FOUND",W[W.ALREADY_EXISTS=6]="ALREADY_EXISTS",W[W.PERMISSION_DENIED=7]="PERMISSION_DENIED",W[W.UNAUTHENTICATED=16]="UNAUTHENTICATED",W[W.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",W[W.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",W[W.ABORTED=10]="ABORTED",W[W.OUT_OF_RANGE=11]="OUT_OF_RANGE",W[W.UNIMPLEMENTED=12]="UNIMPLEMENTED",W[W.INTERNAL=13]="INTERNAL",W[W.UNAVAILABLE=14]="UNAVAILABLE",W[W.DATA_LOSS=15]="DATA_LOSS";/**
2157 * @license
2158 * Copyright 2023 Google LLC
2159 *
2160 * Licensed under the Apache License, Version 2.0 (the "License");
2161 * you may not use this file except in compliance with the License.
2162 * You may obtain a copy of the License at
2163 *
2164 *   http://www.apache.org/licenses/LICENSE-2.0
2165 *
2166 * Unless required by applicable law or agreed to in writing, software
2167 * distributed under the License is distributed on an "AS IS" BASIS,
2168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2169 * See the License for the specific language governing permissions and
2170 * limitations under the License.
2171 */function ry(){return new TextEncoder}/**
2172 * @license
2173 * Copyright 2022 Google LLC
2174 *
2175 * Licensed under the Apache License, Version 2.0 (the "License");
2176 * you may not use this file except in compliance with the License.
2177 * You may obtain a copy of the License at
2178 *
2179 *   http://www.apache.org/licenses/LICENSE-2.0
2180 *
2181 * Unless required by applicable law or agreed to in writing, software
2182 * distributed under the License is distributed on an "AS IS" BASIS,
2183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2184 * See the License for the specific language governing permissions and
2185 * limitations under the License.
2186 */const sy=new Ot([4294967295,4294967295],0);function gu(n){const e=ry().encode(n),t=new Fl;return t.update(e),new Uint8Array(t.digest())}function _u(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 Ot([t,r],0),new Ot([s,i],0)]}class No{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new Qn(`Invalid padding: ${t}`);if(r<0)throw new Qn(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Qn(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new Qn(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=Ot.fromNumber(this.Ie)}Ee(e,t,r){let s=e.add(t.multiply(Ot.fromNumber(r)));return s.compare(sy)===1&&(s=new Ot([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Ie===0)return!1;const t=gu(e),[r,s]=_u(t);for(let i=0;i<this.hashCount;i++){const a=this.Ee(r,s,i);if(!this.de(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 No(i,s,t);return r.forEach(u=>a.insert(u)),a}insert(e){if(this.Ie===0)return;const t=gu(e),[r,s]=_u(t);for(let i=0;i<this.hashCount;i++){const a=this.Ee(r,s,i);this.Ae(a)}}Ae(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}
2186class Qn extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2187 * @license
2188 * Copyright 2017 Google LLC
2189 *
2190 * Licensed under the Apache License, Version 2.0 (the "License");
2191 * you may not use this file except in compliance with the License.
2192 * You may obtain a copy of the License at
2193 *
2194 *   http://www.apache.org/licenses/LICENSE-2.0
2195 *
2196 * Unless required by applicable law or agreed to in writing, software
2197 * distributed under the License is distributed on an "AS IS" BASIS,
2198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2199 * See the License for the specific language governing permissions and
2200 * limitations under the License.
2201 */class qs{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,Ir.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new qs(U.min(),s,new te(G),ot(),z())}}class Ir{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 Ir(r,t,z(),z(),z())}}/**
2202 * @license
2203 * Copyright 2017 Google LLC
2204 *
2205 * Licensed under the Apache License, Version 2.0 (the "License");
2206 * you may not use this file except in compliance with the License.
2207 * You may obtain a copy of the License at
2208 *
2209 *   http://www.apache.org/licenses/LICENSE-2.0
2210 *
2211 * Unless required by applicable law or agreed to in writing, software
2212 * distributed under the License is distributed on an "AS IS" BASIS,
2213 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2214 * See the License for the specific language governing permissions and
2215 * limitations under the License.
2216 */class hs{constructor(e,t,r,s){this.Re=e,this.removedTargetIds=t,this.key=r,this.Ve=s}}class gh{constructor(e,t){this.targetId=e,this.me=t}}class _h{constructor(e,t,r=me.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class yu{constructor(){this.fe=0,this.ge=Eu(),this.pe=me.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=z(),t=z(),r=z();return this.ge.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:x()}}),new Ir(this.pe,this.ye,e,t,r)}Ce(){this.we=!1,this.ge=Eu()}Fe(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,Q(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class iy{constructor(e){this.Le=e,this.Be=new Map,this.ke=ot(),this.qe=vu(),this.Qe=new te(G)}Ke(e){for(const t of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(t,e.Ve):this.Ue(t,e.key,e.Ve);for(const t of e.removedTargetIds)this.Ue(t,e.key,e.Ve)}We(e){this.forEachTarget(e,t=>{const r=this.Ge(t);switch(e.state){case 0:this.ze(t)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(t);break;case 3:this.ze(t)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(t)&&(this.je(t),r.De(e.resumeToken));break;default:x()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach((r,s)=>{this.ze(s)&&t(s)})}He(e){const t=e.targetId,r=e.me.count,s=this.Je(t);if(s){const i=s.target;if(Qi(i))if(r===0){const a=new L(i.path);this.Ue(t,a,Te.newNoDocument(a,U.min()))}else Q(r===1);else{const a=this.Ye(t);if(a!==r){const u=this.Ze(e),l=u?this.Xe(u,e,a):1;if(l!==0){this.je(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,d)}}}}}Ze(e){const t=e.me.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,u;try{a=Ut(r).toUint8Array()}catch(l){if(l instanceof Kl)return or("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{u=new No(a,s,i)}catch(l){return or(l instanceof Qn?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return u.Ie===0?null:u}Xe(e,t,r){return t.me.count===r-this.nt(e,t.targetId)?0:2}nt(e,t){const r=this.Le.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>
2216{const a=this.Le.tt(),u=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(u)||(this.Ue(t,i,null),s++)}),s}rt(e){const t=new Map;this.Be.forEach((i,a)=>{const u=this.Je(a);if(u){if(i.current&&Qi(u.target)){const l=new L(u.target.path);this.ke.get(l)!==null||this.it(a,l)||this.Ue(a,l,Te.newNoDocument(l,e))}i.be&&(t.set(a,i.ve()),i.Ce())}});let r=z();this.qe.forEach((i,a)=>{let u=!0;a.forEachWhile(l=>{const d=this.Je(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(u=!1,!1)}),u&&(r=r.add(i))}),this.ke.forEach((i,a)=>a.setReadTime(e));const s=new qs(e,t,this.Qe,this.ke,r);return this.ke=ot(),this.qe=vu(),this.Qe=new te(G),s}$e(e,t){if(!this.ze(e))return;const r=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,r),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}Ue(e,t,r){if(!this.ze(e))return;const s=this.Ge(e);this.it(e,t)?s.Fe(t,1):s.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),r&&(this.ke=this.ke.insert(t,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const t=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let t=this.Be.get(e);return t||(t=new yu,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new pe(G),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||O("WatchChangeAggregator","Detected inactive target",e),t}Je(e){const t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new yu),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function vu(){return new te(L.comparator)}function Eu(){return new te(L.comparator)}const oy={asc:"ASCENDING",desc:"DESCENDING"},ay={"<":"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"},cy={and:"AND",or:"OR"};class uy{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Xi(n,e){return n.useProto3Json||Os(e)?e:{value:e}}function ws(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 yh(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function ly(n,e){return ws(n,e.toTimestamp())}function $e(n){return Q(!!n),U.fromTimestamp(function(t){const r=wt(t);return new ce(r.seconds,r.nanos)}(n))}function Do(n,e){return Ji(n,e).canonicalString()}function Ji(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 vh(n){const e=ee.fromString(n);return Q(Ah(e)),e}function Zi(n,e){return Do(n.databaseId,e.path)}function Si(n,e){const t=vh(e);if(t.get(1)!==n.databaseId.projectId)throw new D(b.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 D(b.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new L(Th(t))}function Eh(n,e){return Do(n.databaseId,e)}function hy(n){const e=vh(n);return e.length===4?ee.emptyPath():Th(e)}function eo(n){return new ee(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Th(n){return Q(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function Tu(n,e,t){return{name:Zi(n,e),fields:t.value.mapValue.fields}}function dy(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:x()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(d,p){return d.useProto3Json?(Q(p===void 0||typeof p=="string"),me.fromBase64String(p||"")):(Q(p===void 0||p instanceof Buffer||p instanceof Uint8Array),me.fromUint8Array(p||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,u=a&&function(d){const p=d.code===void 0?b.UNKNOWN:mh(d.code);return new D(p,d.message||"")}(a);t=new _h(r,s,i,u||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Si(n,r.document.name),i=$e(r.document.updateTime),a=r.document.createTime?$e(r.document.createTime):U.min(),u=new ke({mapValue:{fields:r.document.fields}}),l=Te.newFoundDocument(s,i,a,u),d=r.targetIds||[],p=r.removedTargetIds||[];t=new hs(d,p,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Si(n,r.document),i=r.readTime?$e(r.readTime):U.min(),a=Te.newNoDocument(s,i),u=r.removedTargetIds||[];t=new hs([],u,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Si(n,r.document),i=r.removedTargetIds||[];t=new hs([],i,s,null)}else{if(!("filter"in e))return x();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new ty(s,i),u=r.targetId;t=new gh(u,a)}}return t}function fy(n,e){let t;if(e instanceof Tr)t={update:Tu(n,e.key,e.value)};else if(e instanceof Bs)t={delete:Zi(n,e.key)};else if(e instanceof Pt)t={update:Tu(n,e.key,e.data),updateMask:Iy(e.fieldMask)};else{if(!(e instanceof J_))return x();t={verify:Zi(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,a){const u=a.transform;if(u instanceof dr)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(u instanceof hn)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:u.elements}};if(u instanceof fr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:u.elements}};if(u instanceof pr)return{fieldPath:a.field.canonicalString(),increment:u.Pe};throw x()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:ly(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:x()}(n,e.precondition)),t}function py(n,e){return n&&n.length>0?(Q(e!==void 0),n.map(t=>function(s,i){let a=s.updateTime?$e(s.updateTime):$e(i);return a.isEqual(U.min())&&(a=$e(i)),new Q_(a,s.transformResults||[])}(t,e))):[]}function my(n,e){return{documents:[Eh(n,e.path)]}}function gy(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=Eh(n,s);const i=function(d){if(d.length!==0)return wh(xe.create(d,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const a=function(d){if(d.length!==0)return d.map(p=>function(I){return{field:Jt(I.field),direction:vy(I.dir)}}(p))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const u=Xi(n,e.limit);return u!==null&&(t.structuredQuery.limit=u),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)),{_t:t,parent:s}}function _y(n){let e=hy(n.parent);
2216const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){Q(r===1);const p=t.from[0];p.allDescendants?s=p.collectionId:e=e.child(p.collectionId)}let i=[];t.where&&(i=function(y){const I=Ih(y);return I instanceof xe&&Xl(I)?I.getFilters():[I]}(t.where));let a=[];t.orderBy&&(a=function(y){return y.map(I=>function(k){return new hr(Zt(k.field),function(C){switch(C){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(k.direction))}(I))}(t.orderBy));let u=null;t.limit&&(u=function(y){let I;return I=typeof y=="object"?y.value:y,Os(I)?null:I}(t.limit));let l=null;t.startAt&&(l=function(y){const I=!!y.before,P=y.values||[];return new Ts(P,I)}(t.startAt));let d=null;return t.endAt&&(d=function(y){const I=!y.before,P=y.values||[];return new Ts(P,I)}(t.endAt)),x_(e,s,a,i,u,"F",l,d)}function yy(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 x()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function Ih(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=Zt(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Zt(t.unaryFilter.field);return ae.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Zt(t.unaryFilter.field);return ae.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=Zt(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});default:return x()}}(n):n.fieldFilter!==void 0?function(t){return ae.create(Zt(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 x()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return xe.create(t.compositeFilter.filters.map(r=>Ih(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return x()}}(t.compositeFilter.op))}(n):x()}function vy(n){return oy[n]}function Ey(n){return ay[n]}function Ty(n){return cy[n]}function Jt(n){return{fieldPath:n.canonicalString()}}function Zt(n){return fe.fromServerFormat(n.fieldPath)}function wh(n){return n instanceof ae?function(t){if(t.op==="=="){if(au(t.value))return{unaryFilter:{field:Jt(t.field),op:"IS_NAN"}};if(ou(t.value))return{unaryFilter:{field:Jt(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(au(t.value))return{unaryFilter:{field:Jt(t.field),op:"IS_NOT_NAN"}};if(ou(t.value))return{unaryFilter:{field:Jt(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Jt(t.field),op:Ey(t.op),value:t.value}}}(n):n instanceof xe?function(t){const r=t.getFilters().map(s=>wh(s));return r.length===1?r[0]:{compositeFilter:{op:Ty(t.op),filters:r}}}(n):x()}function Iy(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Ah(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
2217 * @license
2218 * Copyright 2017 Google LLC
2219 *
2220 * Licensed under the Apache License, Version 2.0 (the "License");
2221 * you may not use this file except in compliance with the License.
2222 * You may obtain a copy of the License at
2223 *
2224 *   http://www.apache.org/licenses/LICENSE-2.0
2225 *
2226 * Unless required by applicable law or agreed to in writing, software
2227 * distributed under the License is distributed on an "AS IS" BASIS,
2228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2229 * See the License for the specific language governing permissions and
2230 * limitations under the License.
2231 */class yt{constructor(e,t,r,s,i=U.min(),a=U.min(),u=me.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=u,this.expectedCount=l}withSequenceNumber(e){return new yt(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new yt(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new yt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new yt(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
2232 * @license
2233 * Copyright 2017 Google LLC
2234 *
2235 * Licensed under the Apache License, Version 2.0 (the "License");
2236 * you may not use this file except in compliance with the License.
2237 * You may obtain a copy of the License at
2238 *
2239 *   http://www.apache.org/licenses/LICENSE-2.0
2240 *
2241 * Unless required by applicable law or agreed to in writing, software
2242 * distributed under the License is distributed on an "AS IS" BASIS,
2243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2244 * See the License for the specific language governing permissions and
2245 * limitations under the License.
2246 */class wy{constructor(e){this.ct=e}}function Ay(n){const e=_y({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?Is(e,e.limit,"L"):e}/**
2247 * @license
2248 * Copyright 2019 Google LLC
2249 *
2250 * Licensed under the Apache License, Version 2.0 (the "License");
2251 * you may not use this file except in compliance with the License.
2252 * You may obtain a copy of the License at
2253 *
2254 *   http://www.apache.org/licenses/LICENSE-2.0
2255 *
2256 * Unless required by applicable law or agreed to in writing, software
2257 * distributed under the License is distributed on an "AS IS" BASIS,
2258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2259 * See the License for the specific language governing permissions and
2260 * limitations under the License.
2261 */class Ry{constructor(){this.un=new Py}addToCollectionParentIndex(e,t){return this.un.add(t),S.resolve()}getCollectionParents(e,t){return S.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return S.resolve()}deleteFieldIndex(e,t){return S.resolve()}deleteAllFieldIndexes(e){return S.resolve()}createTargetIndexes(e,t){return S.resolve()}getDocumentsMatchingTarget(e,t){return S.resolve(null)}getIndexType(e,t){return S.resolve(0)}getFieldIndexes(e,t){return S.resolve([])}getNextCollectionGroupToUpdate(e){return S.resolve(null)}getMinOffset(e,t){return S.resolve(It.min())}getMinOffsetFromCollectionGroup(e,t){return S.resolve(It.min())}updateCollectionGroup(e,t,r){return S.resolve()}updateIndexEntries(e,t){return S.resolve()}}class Py{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new pe(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 pe(ee.comparator)).toArray()}}/**
2262 * @license
2263 * Copyright 2017 Google LLC
2264 *
2265 * Licensed under the Apache License, Version 2.0 (the "License");
2266 * you may not use this file except in compliance with the License.
2267 * You may obtain a copy of the License at
2268 *
2269 *   http://www.apache.org/licenses/LICENSE-2.0
2270 *
2271 * Unless required by applicable law or agreed to in writing, software
2272 * distributed under the License is distributed on an "AS IS" BASIS,
2273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2274 * See the License for the specific language governing permissions and
2275 * limitations under the License.
2276 */class dn{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new dn(0)}static kn(){return new dn(-1)}}/**
2277 * @license
2278 * Copyright 2017 Google LLC
2279 *
2280 * Licensed under the Apache License, Version 2.0 (the "License");
2281 * you may not use this file except in compliance with the License.
2282 * You may obtain a copy of the License at
2283 *
2284 *   http://www.apache.org/licenses/LICENSE-2.0
2285 *
2286 * Unless required by applicable law or agreed to in writing, software
2287 * distributed under the License is distributed on an "AS IS" BASIS,
2288 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2289 * See the License for the specific language governing permissions and
2290 * limitations under the License.
2291 */class by{constructor(){this.changes=new Tn(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,Te.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?S.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)}
vendor: 9,236 bytes, lines 2291-2370
2291assertNotApplied(){}}/**
2292 * @license
2293 * Copyright 2017 Google LLC
2294 *
2295 * Licensed under the Apache License, Version 2.0 (the "License");
2296 * you may not use this file except in compliance with the License.
2297 * You may obtain a copy of the License at
2298 *
2299 *   http://www.apache.org/licenses/LICENSE-2.0
2300 *
2301 * Unless required by applicable law or agreed to in writing, software
2302 * distributed under the License is distributed on an "AS IS" BASIS,
2303 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2304 * See the License for the specific language governing permissions and
2305 * limitations under the License.
2306 *//**
2307 * @license
2308 * Copyright 2022 Google LLC
2309 *
2310 * Licensed under the Apache License, Version 2.0 (the "License");
2311 * you may not use this file except in compliance with the License.
2312 * You may obtain a copy of the License at
2313 *
2314 *   http://www.apache.org/licenses/LICENSE-2.0
2315 *
2316 * Unless required by applicable law or agreed to in writing, software
2317 * distributed under the License is distributed on an "AS IS" BASIS,
2318 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2319 * See the License for the specific language governing permissions and
2320 * limitations under the License.
2321 */class Sy{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
2322 * @license
2323 * Copyright 2017 Google LLC
2324 *
2325 * Licensed under the Apache License, Version 2.0 (the "License");
2326 * you may not use this file except in compliance with the License.
2327 * You may obtain a copy of the License at
2328 *
2329 *   http://www.apache.org/licenses/LICENSE-2.0
2330 *
2331 * Unless required by applicable law or agreed to in writing, software
2332 * distributed under the License is distributed on an "AS IS" BASIS,
2333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2334 * See the License for the specific language governing permissions and
2335 * limitations under the License.
2336 */class Cy{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&&tr(r.mutation,s,Ve.empty(),ce.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,z()).next(()=>r))}getLocalViewOfDocuments(e,t,r=z()){const s=Dt();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let a=Gn();return i.forEach((u,l)=>{a=a.insert(u,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=Dt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,z()))}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,u)=>{t.set(a,u)})})}computeViews(e,t,r,s){let i=ot();const a=er(),u=function(){return er()}();return t.forEach((l,d)=>{const p=r.get(d.key);s.has(d.key)&&(p===void 0||p.mutation instanceof Pt)?i=i.insert(d.key,d):p!==void 0?(a.set(d.key,p.mutation.getFieldMask()),tr(p.mutation,d,p.mutation.getFieldMask(),ce.now())):a.set(d.key,Ve.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((d,p)=>a.set(d,p)),t.forEach((d,p)=>{var y;return u.set(d,new Sy(p,(y=a.get(d))!==null&&y!==void 0?y:null))}),u))}recalculateAndSaveOverlays(e,t){const r=er();let s=new te((a,u)=>a-u),i=z();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const u of a)u.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let p=r.get(l)||Ve.empty();p=u.applyToLocalView(d,p),r.set(l,p);const y=(s.get(u.batchId)||z()).add(l);s=s.insert(u.batchId,y)})}).next(()=>{const a=[],u=s.getReverseIterator();for(;u.hasNext();){const l=u.getNext(),d=l.key,p=l.value,y=oh();p.forEach(I=>{if(!i.has(I)){const P=fh(t.get(I),r.get(I));P!==null&&y.set(I,P),i=i.add(I)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,y))}return S.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):th(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):S.resolve(Dt());let u=-1,l=i;return a.next(d=>S.forEach(d,(p,y)=>(u<y.largestBatchId&&(u=y.largestBatchId),i.get(p)?S.resolve():this.remoteDocumentCache.getEntry(e,p).next(I=>{l=l.insert(p,I)}))).next(()=>this.populateOverlays(e,d,i)).next(()=>this.computeViews(e,l,d,z())).next(p=>({batchId:u,changes:ih(p)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new L(t)).next(r=>{let s=Gn();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=Gn();return this.indexManager.getCollectionParents(e,i).next(u=>S.forEach(u,l=>{const d=function(y,I){return new En(I,null,y.explicitOrderBy.slice(),y.filters.slice(),y.limit,y.limitType,y.startAt,y.endAt)}(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next(p=>{p.forEach((y,I)=>{a=a.insert(y,I)})})}).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 p=d.getKey();a.get(p)===null&&(a=a.insert(p,Te.newInvalidDocument(p)))});let u=Gn();return a.forEach((l,d)=>{const p=i.get(l);p!==void 0&&tr(p.mutation,d,Ve.empty(),ce.now()),xs(t,d)&&(u=u.insert(l,d))}),u})}}/**
2337 * @license
2338 * Copyright 2020 Google LLC
2339 *
2340 * Licensed under the Apache License, Version 2.0 (the "License");
2341 * you may not use this file except in compliance with the License.
2342 * You may obtain a copy of the License at
2343 *
2344 *   http://www.apache.org/licenses/LICENSE-2.0
2345 *
2346 * Unless required by applicable law or agreed to in writing, software
2347 * distributed under the License is distributed on an "AS IS" BASIS,
2348 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2349 * See the License for the specific language governing permissions and
2350 * limitations under the License.
2351 */class ky{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return S.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:$e(s.createTime)}}(t)),S.resolve()}getNamedQuery(e,t){return S.resolve(this.Pr.get(t))}saveNamedQuery(e,t){return this.Pr.set(t.name,function(s){return{name:s.name,query:Ay(s.bundledQuery),readTime:$e(s.readTime)}}(t)),S.resolve()}}/**
2352 * @license
2353 * Copyright 2022 Google LLC
2354 *
2355 * Licensed under the Apache License, Version 2.0 (the "License");
2356 * you may not use this file except in compliance with the License.
2357 * You may obtain a copy of the License at
2358 *
2359 *   http://www.apache.org/licenses/LICENSE-2.0
2360 *
2361 * Unless required by applicable law or agreed to in writing, software
2362 * distributed under the License is distributed on an "AS IS" BASIS,
2363 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2364 * See the License for the specific language governing permissions and
2365 * limitations under the License.
2366 */class Ny{constructor(){this.overlays=new te(L.comparator),this.Ir=new Map}getOverlay(e,t){return S.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Dt();return S.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.ht(e,t,i)}),S.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Ir.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Ir.delete(r)),S.resolve()}getOverlaysForCollection(e,t,r){const s=Dt(),i=t.length+1,a=new L(t.child("")),u=this.overlays.getIteratorFrom(a);for(;u.hasNext();){const l=u.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return S.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new te((d,p)=>d-p);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let p=i.get(d.largestBatchId);p===null&&(p=Dt(),i=i.insert(d.largestBatchId,p)),p.set(d.getKey(),d)}}const u=Dt(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,p)=>u.set(d,p)),!(u.size()>=s)););return S.resolve(u)}ht(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Ir.get(s.largestBatchId).delete(r.key);this.Ir.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new ey(t,r));let i=this.Ir.get(t);i===void 0&&(i=z(),this.Ir.set(t,i)),this.Ir.set(t,i.add(r.key))}}/**
2367 * @license
2368 * Copyright 2024 Google LLC
2369 *
2370 * Licensed under the Apache License, Version 2.0 (the "License");
2371 * you may not use this file except in compliance with the License.
2372 * You may obtain a copy of the License at
2373 *
2374 *   http://www.apache.org/licenses/LICENSE-2.0
2375 *
2376 * Unless required by applicable law or agreed to in writing, software
2377 * distributed under the License is distributed on an "AS IS" BASIS,
2378 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2379 * See the License for the specific language governing permissions and
2380 * limitations under the License.
2381 */class Dy{constructor(){this.sessionToken=me.EMPTY_BYTE_STRING}getSessionToken(e){return S.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,S.resolve()}}/**
2382 * @license
2383 * Copyright 2017 Google LLC
2384 *
2385 * Licensed under the Apache License, Version 2.0 (the "License");
2386 * you may not use this file except in compliance with the License.
2387 * You may obtain a copy of the License at
2388 *
2389 *   http://www.apache.org/licenses/LICENSE-2.0
2390 *
2391 * Unless required by applicable law or agreed to in writing, software
2392 * distributed under the License is distributed on an "AS IS" BASIS,
2393 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2394 * See the License for the specific language governing permissions and
2395 * limitations under the License.
2396 */class Vo{constructor(){this.Tr=new pe(ue.Er),this.dr=new pe(ue.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const r=new ue(e,t);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Vr(new ue(e,t))}mr(e,t){e.forEach(r=>this.removeReference(r,t))}gr(e){const t=new L(new ee([])),r=new ue(t,e),s=new ue(t,e+1),i=[];return this.dr.forEachInRange([r,s],a=>{this.Vr(a),i.push(a.key)}),i}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const t=new L(new ee([])),r=new ue(t,e),s=new ue(t,e+1);let i=z();return this.dr.forEachInRange([r,s],a=>{i=i.add(a.key)}),i}containsKey(e){const t=new ue(e,0),r=this.Tr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class ue{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return L.comparator(e.key,t.key)||G(e.wr,t.wr)}static Ar(e,t){return G(e.wr,t.wr)||L.comparator(e.key,t.key)}}/**
2397 * @license
2398 * Copyright 2017 Google LLC
2399 *
2400 * Licensed under the Apache License, Version 2.0 (the "License");
2401 * you may not use this file except in compliance with the License.
2402 * You may obtain a copy of the License at
2403 *
2404 *   http://www.apache.org/licenses/LICENSE-2.0
2405 *
2406 * Unless required by applicable law or agreed to in writing, software
2407 * distributed under the License is distributed on an "AS IS" BASIS,
2408 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2409 * See the License for the specific language governing permissions and
2410 * limitations under the License.
2411 */class Vy{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new pe(ue.Er)}checkEmpty(e){return S.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new Z_(i,t,r,s);this.mutationQueue.push(a);for(const u of s)this.br=this.br.add(new ue(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast());return S.resolve(a)}lookupMutationBatch(e,t){return S.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.vr(r),i=s<0?0:s;return S.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return S.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return S.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new ue(t,0),s=new ue(t,Number.POSITIVE_INFINITY),i=[];return this.br.forEachInRange([r,s],a=>{const u=this.Dr(a.wr);i.push(u)}),S.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new pe(G);return t.forEach(s=>{const i=new ue(s,0),a=new ue(s,Number.POSITIVE_INFINITY);this.br.forEachInRange([i,a],u=>{r=r.add(u.wr)})}),S.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;L.isDocumentKey(i)||(i=i.child(""));const a=new ue(new L(i),0);let u=new pe(G);return this.br.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(u=u.add(l.wr)),!0)},a),S.resolve(this.Cr(u))}Cr(e){const t=[];return e.forEach(r=>{const s=this.Dr(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){Q(this.Fr(t.batchId,"removed")===0),this.mutation
2411Queue.shift();let r=this.br;return S.forEach(t.mutations,s=>{const i=new ue(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,t){const r=new ue(t,0),s=this.br.firstAfterOrEqual(r);return S.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,S.resolve()}Fr(e,t){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const t=this.vr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2412 * @license
2413 * Copyright 2017 Google LLC
2414 *
2415 * Licensed under the Apache License, Version 2.0 (the "License");
2416 * you may not use this file except in compliance with the License.
2417 * You may obtain a copy of the License at
2418 *
2419 *   http://www.apache.org/licenses/LICENSE-2.0
2420 *
2421 * Unless required by applicable law or agreed to in writing, software
2422 * distributed under the License is distributed on an "AS IS" BASIS,
2423 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2424 * See the License for the specific language governing permissions and
2425 * limitations under the License.
2426 */class Oy{constructor(e){this.Mr=e,this.docs=function(){return new te(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.Mr(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 S.resolve(r?r.document.mutableCopy():Te.newInvalidDocument(t))}getEntries(e,t){let r=ot();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Te.newInvalidDocument(s))}),S.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=ot();const a=t.path,u=new L(a.child("")),l=this.docs.getIteratorFrom(u);for(;l.hasNext();){const{key:d,value:{document:p}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||y_(__(p),r)<=0||(s.has(p.key)||xs(t,p))&&(i=i.insert(p.key,p.mutableCopy()))}return S.resolve(i)}getAllFromCollectionGroup(e,t,r,s){x()}Or(e,t){return S.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new Ly(this)}getSize(e){return S.resolve(this.size)}}class Ly extends by{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];
vendor: 9,444 bytes, lines 2426-2501
2426return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.cr.addEntry(e,s)):this.cr.removeEntry(r)}),S.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}/**
2427 * @license
2428 * Copyright 2017 Google LLC
2429 *
2430 * Licensed under the Apache License, Version 2.0 (the "License");
2431 * you may not use this file except in compliance with the License.
2432 * You may obtain a copy of the License at
2433 *
2434 *   http://www.apache.org/licenses/LICENSE-2.0
2435 *
2436 * Unless required by applicable law or agreed to in writing, software
2437 * distributed under the License is distributed on an "AS IS" BASIS,
2438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2439 * See the License for the specific language governing permissions and
2440 * limitations under the License.
2441 */class My{constructor(e){this.persistence=e,this.Nr=new Tn(t=>Po(t),bo),this.lastRemoteSnapshotVersion=U.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Vo,this.targetCount=0,this.kr=dn.Bn()}forEachTarget(e,t){return this.Nr.forEach((r,s)=>t(s)),S.resolve()}getLastRemoteSnapshotVersion(e){return S.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return S.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),S.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.Lr&&(this.Lr=t),S.resolve()}Kn(e){this.Nr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.kr=new dn(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,S.resolve()}updateTargetData(e,t){return this.Kn(t),S.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,S.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.Nr.forEach((a,u)=>{u.sequenceNumber<=t&&r.get(u.targetId)===null&&(this.Nr.delete(a),i.push(this.removeMatchingKeysForTargetId(e,u.targetId)),s++)}),S.waitFor(i).next(()=>s)}getTargetCount(e){return S.resolve(this.targetCount)}getTargetData(e,t){const r=this.Nr.get(t)||null;return S.resolve(r)}addMatchingKeys(e,t,r){return this.Br.Rr(t,r),S.resolve()}removeMatchingKeys(e,t,r){this.Br.mr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),S.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),S.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Br.yr(t);return S.resolve(r)}containsKey(e,t){return S.resolve(this.Br.containsKey(t))}}/**
2442 * @license
2443 * Copyright 2017 Google LLC
2444 *
2445 * Licensed under the Apache License, Version 2.0 (the "License");
2446 * you may not use this file except in compliance with the License.
2447 * You may obtain a copy of the License at
2448 *
2449 *   http://www.apache.org/licenses/LICENSE-2.0
2450 *
2451 * Unless required by applicable law or agreed to in writing, software
2452 * distributed under the License is distributed on an "AS IS" BASIS,
2453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2454 * See the License for the specific language governing permissions and
2455 * limitations under the License.
2456 */class xy{constructor(e,t){this.qr={},this.overlays={},this.Qr=new Io(0),this.Kr=!1,this.Kr=!0,this.$r=new Dy,this.referenceDelegate=e(this),this.Ur=new My(this),this.indexManager=new Ry,this.remoteDocumentCache=function(s){return new Oy(s)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new wy(t),this.Gr=new ky(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Ny,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.qr[e.toKey()];return r||(r=new Vy(t,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,t,r){O("MemoryPersistence","Starting transaction:",e);const s=new Uy(this.Qr.next());return this.referenceDelegate.zr(),r(s).next(i=>this.referenceDelegate.jr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Hr(e,t){return S.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,t)))}}class Uy extends E_{constructor(e){super(),this.currentSequenceNumber=e}}class Oo{constructor(e){this.persistence=e,this.Jr=new Vo,this.Yr=null}static Zr(e){return new Oo(e)}get Xr(){if(this.Yr)return this.Yr;throw x()}addReference(e,t,r){return this.Jr.addReference(r,t),this.Xr.delete(r.toString()),S.resolve()}removeReference(e,t,r){return this.Jr.removeReference(r,t),this.Xr.add(r.toString()),S.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),S.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(s=>this.Xr.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.Xr.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return S.forEach(this.Xr,r=>{const s=L.fromPath(r);return this.ei(e,s).next(i=>{i||t.removeEntry(s,U.min())})}).next(()=>(this.Yr=null,t.apply(e)))}updateLimboDocument(e,t){return this.ei(e,t).next(r=>{r?this.Xr.delete(t.toString()):this.Xr.add(t.toString())})}Wr(e){return 0}ei(e,t){return S.or([()=>S.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}/**
2457 * @license
2458 * Copyright 2017 Google LLC
2459 *
2460 * Licensed under the Apache License, Version 2.0 (the "License");
2461 * you may not use this file except in compliance with the License.
2462 * You may obtain a copy of the License at
2463 *
2464 *   http://www.apache.org/licenses/LICENSE-2.0
2465 *
2466 * Unless required by applicable law or agreed to in writing, software
2467 * distributed under the License is distributed on an "AS IS" BASIS,
2468 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2469 * See the License for the specific language governing permissions and
2470 * limitations under the License.
2471 */class Lo{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.$i=r,this.Ui=s}static Wi(e,t){let r=z(),s=z();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 Lo(e,t.fromCache,r,s)}}/**
2472 * @license
2473 * Copyright 2023 Google LLC
2474 *
2475 * Licensed under the Apache License, Version 2.0 (the "License");
2476 * you may not use this file except in compliance with the License.
2477 * You may obtain a copy of the License at
2478 *
2479 *   http://www.apache.org/licenses/LICENSE-2.0
2480 *
2481 * Unless required by applicable law or agreed to in writing, software
2482 * distributed under the License is distributed on an "AS IS" BASIS,
2483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2484 * See the License for the specific language governing permissions and
2485 * limitations under the License.
2486 */class Fy{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2487 * @license
2488 * Copyright 2019 Google LLC
2489 *
2490 * Licensed under the Apache License, Version 2.0 (the "License");
2491 * you may not use this file except in compliance with the License.
2492 * You may obtain a copy of the License at
2493 *
2494 *   http://www.apache.org/licenses/LICENSE-2.0
2495 *
2496 * Unless required by applicable law or agreed to in writing, software
2497 * distributed under the License is distributed on an "AS IS" BASIS,
2498 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2499 * See the License for the specific language governing permissions and
2500 * limitations under the License.
2501 */class By{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return Of()?8:T_(we())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.Yi(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.Zi(e,t,s,r).next(a=>{i.result=a})}).next(()=>{if(i.result)return;const a=new Fy;return this.Xi(e,t,a).next(u=>{if(i.result=u,this.zi)return this.es(e,t,a,u.size)})}).next(()=>i.result)}es(e,t,r,s){return r.documentReadCount<this.ji?($n()<=H.DEBUG&&O("QueryEngine","SDK will not create cache indexes for query:",Xt(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),S.resolve()):($n()<=H.DEBUG&&O("QueryEngine","Query:",Xt(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Hi*s?($n()<=H.DEBUG&&O("QueryEngine","The SDK decides to create cache indexes for query:",Xt(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,je(t))):S.resolve())}Yi(e,t){if(hu(t))return S.resolve(null);let r=je(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=Is(t,null,"F"),r=je(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const a=z(...i);return this.Ji.getDocuments(e,a).next(u=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.ts(t,u);return this.ns(t,d,a,l.readTime)?this.Yi(e,Is(t,null,"F")):this.rs(e,d,t,l)}
2501))})))}Zi(e,t,r,s){return hu(t)||s.isEqual(U.min())?S.resolve(null):this.Ji.getDocuments(e,r).next(i=>{const a=this.ts(t,i);return this.ns(t,a,r,s)?S.resolve(null):($n()<=H.DEBUG&&O("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Xt(t)),this.rs(e,a,t,g_(s,-1)).next(u=>u))})}ts(e,t){let r=new pe(rh(e));return t.forEach((s,i)=>{xs(e,i)&&(r=r.add(i))}),r}ns(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)}Xi(e,t,r){return $n()<=H.DEBUG&&O("QueryEngine","Using full collection scan to execute query:",Xt(t)),this.Ji.getDocumentsMatchingQuery(e,t,It.min(),r)}rs(e,t,r,s){return this.Ji.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}}/**
2502 * @license
2503 * Copyright 2020 Google LLC
2504 *
2505 * Licensed under the Apache License, Version 2.0 (the "License");
2506 * you may not use this file except in compliance with the License.
2507 * You may obtain a copy of the License at
2508 *
2509 *   http://www.apache.org/licenses/LICENSE-2.0
2510 *
2511 * Unless required by applicable law or agreed to in writing, software
2512 * distributed under the License is distributed on an "AS IS" BASIS,
2513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2514 * See the License for the specific language governing permissions and
2515 * limitations under the License.
2516 */class qy{constructor(e,t,r,s){this.persistence=e,this.ss=t,this.serializer=s,this.os=new te(G),this._s=new Tn(i=>Po(i),bo),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Cy(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.os))}}function jy(n,e,t,r){return new qy(n,e,t,r)}async function Rh(n,e){const t=F(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.ls(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const a=[],u=[];let l=z();for(const d of s){a.push(d.batchId);for(const p of d.mutations)l=l.add(p.key)}for(const d of i){u.push(d.batchId);for(const p of d.mutations)l=l.add(p.key)}return t.localDocuments.getDocuments(r,l).next(d=>({hs:d,removedBatchIds:a,addedBatchIds:u}))})})}function $y(n,e){const t=F(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.cs.newChangeBuffer({trackRemovals:!0});return function(u,l,d,p){const y=d.batch,I=y.keys();let P=S.resolve();return I.forEach(k=>{P=P.next(()=>p.getEntry(l,k)).next(V=>{const C=d.docVersions.get(k);Q(C!==null),V.version.compareTo(C)<0&&(y.applyToRemoteDocument(V,d),V.isValidDocument()&&(V.setReadTime(d.commitVersion),p.addEntry(V)))})}),P.next(()=>u.mutationQueue.removeMutationBatch(l,y))}(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(u){let l=z();for(let d=0;d<u.mutationResults.length;++d)u.mutationResults[d].transformResults.length>0&&(l=l.add(u.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Ph(n){const e=F(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function zy(n,e){const t=F(n),r=e.snapshotVersion;let s=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const a=t.cs.newChangeBuffer({trackRemovals:!0});s=t.os;const u=[];
vendor: 1,276 bytes, line 2516
2516e.targetChanges.forEach((p,y)=>{const I=s.get(y);if(!I)return;u.push(t.Ur.removeMatchingKeys(i,p.removedDocuments,y).next(()=>t.Ur.addMatchingKeys(i,p.addedDocuments,y)));let P=I.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(y)!==null?P=P.withResumeToken(me.EMPTY_BYTE_STRING,U.min()).withLastLimboFreeSnapshotVersion(U.min()):p.resumeToken.approximateByteSize()>0&&(P=P.withResumeToken(p.resumeToken,r)),s=s.insert(y,P),function(V,C,B){return V.resumeToken.approximateByteSize()===0||C.snapshotVersion.toMicroseconds()-V.snapshotVersion.toMicroseconds()>=3e8?!0:B.addedDocuments.size+B.modifiedDocuments.size+B.removedDocuments.size>0}(I,P,p)&&u.push(t.Ur.updateTargetData(i,P))});let l=ot(),d=z();if(e.documentUpdates.forEach(p=>{e.resolvedLimboDocuments.has(p)&&u.push(t.persistence.referenceDelegate.updateLimboDocument(i,p))}),u.push(Hy(i,a,e.documentUpdates).next(p=>{l=p.Ps,d=p.Is})),!r.isEqual(U.min())){const p=t.Ur.getLastRemoteSnapshotVersion(i).next(y=>t.Ur.setTargetsMetadata(i,i.currentSequenceNumber,r));u.push(p)}return S.waitFor(u).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,l,d)).next(()=>l)}).then(i=>(t.os=s,i))}function Hy(n,e,t){let r=z(),s=z();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>
2516{let a=ot();return t.forEach((u,l)=>{const d=i.get(u);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(u)),l.isNoDocument()&&l.version.isEqual(U.min())?(e.removeEntry(u,l.readTime),a=a.insert(u,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(u,l)):O("LocalStore","Ignoring outdated watch update for ",u,". Current version:",d.version," Watch version:",l.version)}),{Ps:a,Is:s}})}function Wy(n,e){const t=F(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function Ky(n,e){const t=F(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Ur.getTargetData(r,e).next(i=>i?(s=i,S.resolve(s)):t.Ur.allocateTargetId(r).next(a=>(s=new yt(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Ur.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.os.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.os=t.os.insert(r.targetId,r),t._s.set(e,r.targetId)),r})}async function to(n,e,t){const r=F(n),s=r.os.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(!Er(a))throw a;O("LocalStore",`Failed to update sequence numbers for target ${e}: ${a}`)}r.os=r.os.remove(e),r._s.delete(s.target)}function Iu(n,e,t){const r=F(n);let s=U.min(),i=z();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,p){const y=F(l),I=y._s.get(p);return I!==void 0?S.resolve(y.os.get(I)):y.Ur.getTargetData(d,p)}(r,a,je(e)).next(u=>{if(u)return s=u.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(a,u.targetId).next(l=>{i=l})}).next(()=>r.ss.getDocumentsMatchingQuery(a,e,t?s:U.min(),t?i:z())).next(u=>(Gy(r,F_(e),u),{documents:u,Ts:i})))}function Gy(n,e,t){let r=n.us.get(e)||U.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.us.set(e,r)}class wu{constructor(){this.activeTargetIds=H_()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Qy{constructor(){this.so=new wu,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,t,r){this.oo[e]=t}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new wu,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2517 * @license
2518 * Copyright 2019 Google LLC
2519 *
2520 * Licensed under the Apache License, Version 2.0 (the "License");
2521 * you may not use this file except in compliance with the License.
2522 * You may obtain a copy of the License at
2523 *
2524 *   http://www.apache.org/licenses/LICENSE-2.0
2525 *
2526 * Unless required by applicable law or agreed to in writing, software
2527 * distributed under the License is distributed on an "AS IS" BASIS,
2528 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2529 * See the License for the specific language governing permissions and
2530 * limitations under the License.
2531 */class Yy{_o(e){}shutdown(){}}/**
2532 * @license
2533 * Copyright 2019 Google LLC
2534 *
2535 * Licensed under the Apache License, Version 2.0 (the "License");
2536 * you may not use this file except in compliance with the License.
2537 * You may obtain a copy of the License at
2538 *
2539 *   http://www.apache.org/licenses/LICENSE-2.0
2540 *
2541 * Unless required by applicable law or agreed to in writing, software
2542 * distributed under the License is distributed on an "AS IS" BASIS,
2543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2544 * See the License for the specific language governing permissions and
2545 * limitations under the License.
2546 */class Au{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){O("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){O("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2547 * @license
2548 * Copyright 2023 Google LLC
2549 *
2550 * Licensed under the Apache License, Version 2.0 (the "License");
2551 * you may not use this file except in compliance with the License.
2552 * You may obtain a copy of the License at
2553 *
2554 *   http://www.apache.org/licenses/LICENSE-2.0
2555 *
2556 * Unless required by applicable law or agreed to in writing, software
2557 * distributed under the License is distributed on an "AS IS" BASIS,
2558 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2559 * See the License for the specific language governing permissions and
2560 * limitations under the License.
2561 */let ts=null;function Ci(){return ts===null?ts=function(){return 268435456+Math.round(2147483648*Math.random())}():ts++,"0x"+ts.toString(16)}/**
2562 * @license
2563 * Copyright 2020 Google LLC
2564 *
2565 * Licensed under the Apache License, Version 2.0 (the "License");
2566 * you may not use this file except in compliance with the License.
2567 * You may obtain a copy of the License at
2568 *
2569 *   http://www.apache.org/licenses/LICENSE-2.0
2570 *
2571 * Unless required by applicable law or agreed to in writing, software
2572 * distributed under the License is distributed on an "AS IS" BASIS,
2573 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2574 * See the License for the specific language governing permissions and
2575 * limitations under the License.
2576 */const Xy={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
2577 * @license
2578 * Copyright 2017 Google LLC
2579 *
2580 * Licensed under the Apache License, Version 2.0 (the "License");
2581 * you may not use this file except in compliance with the License.
2582 * You may obtain a copy of the License at
2583 *
2584 *   http://www.apache.org/licenses/LICENSE-2.0
2585 *
2586 * Unless required by applicable law or agreed to in writing, software
2587 * distributed under the License is distributed on an "AS IS" BASIS,
2588 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2589 * See the License for the specific language governing permissions and
2590 * limitations under the License.
2591 */class Jy{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
2592 * @license
2593 * Copyright 2017 Google LLC
2594 *
2595 * Licensed under the Apache License, Version 2.0 (the "License");
2596 * you may not use this file except in compliance with the License.
2597 * You may obtain a copy of the License at
2598 *
2599 *   http://www.apache.org/licenses/LICENSE-2.0
2600 *
2601 * Unless required by applicable law or agreed to in writing, software
2602 * distributed under the License is distributed on an "AS IS" BASIS,
2603 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2604 * See the License for the specific language governing permissions and
2605 * limitations under the License.
2606 */const Ee="WebChannelConnection";class Zy extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+t.host,this.vo=`projects/${s}/databases/${i}`,this.Co=this.databaseId.database==="(default)"?`project_id=${s}`:`project_id=${s}&database_id=${i}`}get Fo(){return!1}Mo(t,r,s,i,a){const u=Ci(),l=this.xo(t,r.toUriEncodedString());O("RestConnection",`Sending RPC '${t}' ${u}:`,l,s);const d={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(d,i,a),this.No(t,l,d,s).then(p=>(O("RestConnection",`Received RPC '${t}' ${u}: `,p),p),p=>{throw or("RestConnection",`RPC '${t}' ${u} failed with error: `,p,"url: ",l,"request:",s),p})}Lo(t,r,s,i,a,u){return this.Mo(t,r,s,i,a)}Oo(t,r,s){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+vn}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,a)=>t[a]=i),s&&s.headers.forEach((i,a)=>t[a]=i)}xo(t,r){const s=Xy[t];return`${this.Do}/v1/${r}:${s}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,t,r,s){const i=Ci();return new Promise((a,u)=>{const l=new Bl;l.setWithCredentials(!0),l.listenOnce(ql.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case cs.NO_ERROR:const p=l.getResponseJson();O(Ee,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(p)),a(p);break;case cs.TIMEOUT:O(Ee,`RPC '${e}' ${i} timed out`),u(new D(b.DEADLINE_EXCEEDED,"Request time out"));break;case cs.HTTP_ERROR:const y=l.getStatus();if(O(Ee,`RPC '${e}' ${i} failed with status:`,y,"response text:",l.getResponseText()),y>0){let I=l.getResponseJson();Array.isArray(I)&&(I=I[0]);const P=I==null?void 0:I.error;if(P&&P.status&&P.message){const k=function(C){const B=C.toLowerCase().replace(/_/g,"-");return Object.values(b).indexOf(B)>=0?B:b.UNKNOWN}(P.status);u(new D(k,P.message))}else u(new D(b.UNKNOWN,"Server responded with status "+l.getStatus()))}else u(new D(b.UNAVAILABLE,"Connection failed."));break;default:x()}}finally{O(Ee,`RPC '${e}' ${i} completed.`)}});const d=JSON.stringify(s);O(Ee,`RPC '${e}' ${i} sending request:`,s),l.send(t,"POST",d,r,15)})}Bo(e,t,r){const s=Ci(),i=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=zl(),u=$l(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`}
vendor: 4,232 bytes, lines 2606-2646
2606,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.Oo(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const p=i.join("");O(Ee,`Creating RPC '${e}' stream ${s}: ${p}`,l);const y=a.createWebChannel(p,l);let I=!1,P=!1;const k=new Jy({Io:C=>{P?O(Ee,`Not sending because RPC '${e}' stream ${s} is closed:`,C):(I||(O(Ee,`Opening RPC '${e}' stream ${s} transport.`),y.open(),I=!0),O(Ee,`RPC '${e}' stream ${s} sending:`,C),y.send(C))},To:()=>y.close()}),V=(C,B,j)=>{C.listen(B,q=>{try{j(q)}catch($){setTimeout(()=>{throw $},0)}})};return V(y,Kn.EventType.OPEN,()=>{P||(O(Ee,`RPC '${e}' stream ${s} transport opened.`),k.yo())}),V(y,Kn.EventType.CLOSE,()=>{P||(P=!0,O(Ee,`RPC '${e}' stream ${s} transport closed`),k.So())}),V(y,Kn.EventType.ERROR,C=>{P||(P=!0,or(Ee,`RPC '${e}' stream ${s} transport errored:`,C),k.So(new D(b.UNAVAILABLE,"The operation could not be completed")))}),V(y,Kn.EventType.MESSAGE,C=>{var B;if(!P){const j=C.data[0];Q(!!j);const q=j,$=q.error||((B=q[0])===null||B===void 0?void 0:B.error);if($){O(Ee,`RPC '${e}' stream ${s} received error:`,$);const le=$.status;let J=function(_){const v=oe[_];if(v!==void 0)return mh(v)}(le),E=$.message;J===void 0&&(J=b.INTERNAL,E="Unknown error status: "+le+" with message "+$.message),P=!0,k.So(new D(J,E)),y.close()}else O(Ee,`RPC '${e}' stream ${s} received:`,j),k.bo(j)}}),V(u,jl.STAT_EVENT,C=>{C.stat===Hi.PROXY?O(Ee,`RPC '${e}' stream ${s} detected buffering proxy`):C.stat===Hi.NOPROXY&&O(Ee,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{k.wo()},0),k}}function ki(){return typeof document<"u"?document:null}/**
2607 * @license
2608 * Copyright 2020 Google LLC
2609 *
2610 * Licensed under the Apache License, Version 2.0 (the "License");
2611 * you may not use this file except in compliance with the License.
2612 * You may obtain a copy of the License at
2613 *
2614 *   http://www.apache.org/licenses/LICENSE-2.0
2615 *
2616 * Unless required by applicable law or agreed to in writing, software
2617 * distributed under the License is distributed on an "AS IS" BASIS,
2618 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2619 * See the License for the specific language governing permissions and
2620 * limitations under the License.
2621 */function js(n){return new uy(n,!0)}/**
2622 * @license
2623 * Copyright 2017 Google LLC
2624 *
2625 * Licensed under the Apache License, Version 2.0 (the "License");
2626 * you may not use this file except in compliance with the License.
2627 * You may obtain a copy of the License at
2628 *
2629 *   http://www.apache.org/licenses/LICENSE-2.0
2630 *
2631 * Unless required by applicable law or agreed to in writing, software
2632 * distributed under the License is distributed on an "AS IS" BASIS,
2633 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2634 * See the License for the specific language governing permissions and
2635 * limitations under the License.
2636 */class bh{constructor(e,t,r=1e3,s=1.5,i=6e4){this.ui=e,this.timerId=t,this.ko=r,this.qo=s,this.Qo=i,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const t=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),s=Math.max(0,t-r);s>0&&O("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,s,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
2637 * @license
2638 * Copyright 2017 Google LLC
2639 *
2640 * Licensed under the Apache License, Version 2.0 (the "License");
2641 * you may not use this file except in compliance with the License.
2642 * You may obtain a copy of the License at
2643 *
2644 *   http://www.apache.org/licenses/LICENSE-2.0
2645 *
2646 * Unless required by applicable law or agreed to in writing, softw
2646are
2647 * distributed under the License is distributed on an "AS IS" BASIS,
2648 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2649 * See the License for the specific language governing permissions and
2650 * limitations under the License.
2651 */class Sh{constructor(e,t,r,s,i,a,u,l){this.ui=e,this.Ho=r,this.Jo=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=u,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new bh(e,t)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,t){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():t&&t.code===b.RESOURCE_EXHAUSTED?(it(t.toString()),it("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===b.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(t)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),t=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Yo===t&&this.P_(r,s)},r=>{e(()=>{const s=new D(b.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(s)})})}P_(e,t){const r=this.h_(this.Yo);this.stream=this.T_(e,t),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(s=>{r(()=>this.I_(s))}),this.stream.onMessage(s=>{r(()=>++this.e_==1?this.E_(s):this.onNext(s))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return O("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(O("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ev extends Sh{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}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=dy(this.serializer,e),r=function(i){if(!("targetChange"in i))return U.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?U.min():a.readTime?$e(a.readTime):U.min()}(e);return this.listener.d_(t,r)}A_(e){const t={};t.database=eo(this.serializer),t.addTarget=function(i,a){let u;const l=a.target;if(u=Qi(l)?{documents:my(i,l)}:{query:gy(i,l)._t},u.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){u.resumeToken=yh(i,a.resumeToken);const d=Xi(i,a.expectedCount);d!==null&&(u.expectedCount=d)}else if(a.snapshotVersion.compareTo(U.min())>0){u.readTime=ws(i,a.snapshotVersion.toTimestamp());const d=Xi(i,a.expectedCount);d!==null&&(u.expectedCount=d)}return u}(this.serializer,e);const r=yy(this.serializer,e);r&&(t.labels=r),this.a_(t)}R_(e){const t={};t.database=eo(this.serializer),t.removeTarget=e,this.a_(t)}}class tv extends Sh{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 V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,t){return this.connection.Bo("Write",e,t)}E_(e){return Q(!!e.streamToken),this.lastStreamToken=e.streamToken,Q(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){Q(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=py(e.writeResults,e.commitTime),r=$e(e.commitTime);return this.listener.g_(r,t)}p_(){const e={};e.database=eo(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>fy(this.serializer,r))};this.a_(t)}}/**
2652 * @license
2653 * Copyright 2017 Google LLC
2654 *
2655 * Licensed under the Apache License, Version 2.0 (the "License");
2656 * you may not use this file except in compliance with the License.
2657 * You may obtain a copy of the License at
2658 *
2659 *   http://www.apache.org/licenses/LICENSE-2.0
2660 *
2661 * Unless required by applicable law or agreed to in writing, software
2662 * distributed under the License is distributed on an "AS IS" BASIS,
2663 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2664 * See the License for the specific language governing permissions and
2665 * limitations under the License.
2666 */class nv extends class{}{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.y_=!1}w_(){if(this.y_)throw new D(b.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,r,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.Mo(e,Ji(t,r),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===b.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new D(b.UNKNOWN,i.toString())})}Lo(e,t,r,s,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,u])=>this.connection.Lo(e,Ji(t,r),s,a,u,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===b.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new D(b.UNKNOWN,a.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class rv{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const t=`Could not reach Cloud Firestore backend. ${e}
2667This 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.D_?(it(t),this.D_=!1):O("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
2668 * @license
2669 * Copyright 2017 Google LLC
2670 *
2671 * Licensed under the Apache License, Version 2.0 (the "License");
2672 * you may not use this file except in compliance with the License.
2673 * You may obtain a copy of the License at
2674 *
2675 *   http://www.apache.org/licenses/LICENSE-2.0
2676 *
2677 * Unless required by applicable law or agreed to in writing, software
2678 * distributed under the License is distributed on an "AS IS" BASIS,
2679 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2680 * See the License for the specific language governing permissions and
2681 * limitations under the License.
2682 */class sv{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=i,this.k_._o(a=>{r.enqueueAndForget(async()=>{Wt(this)&&(O("RemoteStore","Restarting streams for network reachability change."),await async function(l){const d=F(l);d.L_.add(4),await wr(d),d.q_.set("Unknown"),d.L_.delete(4),await $s(d)}(this))})}),this.q_=new rv(r,s)}}async function $s(n){if(Wt(n))for(const e of n.B_)await e(!0)}async function wr(n){for(const e of n.B_)await e(!1)}function Ch(n,e){const t=F(n);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),Fo(t)?Uo(t):In(t).r_()&&xo(t,e))}function Mo(n,e){const t=F(n),r=In(t);t.N_.delete(e),r.r_()&&kh(t,e),t.N_.size===0&&(r.r_()?r.o_():Wt(t)&&t.q_.set("Unknown"))}function xo(n,e){if(n.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(U.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}In(n).A_(e)}function kh(n,e){n.Q_.xe(e),In(n).R_(e)}function Uo(n){n.Q_=new iy({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>n.N_.get(e)||null,tt:()=>n.datastore.serializer.databaseId}),In(n).start(),n.q_.v_()}function Fo(n){return Wt(n)&&!In(n).n_()&&n.N_.size>0}function Wt(n){return F(n).L_.size===0}function Nh(n){n.Q_=void 0}async function iv(n){n.q_.set("Online")}async function ov(n){n.N_.forEach((e,t)=>{xo(n,e)})}async function av(n,e){Nh(n),Fo(n)?(n.q_.M_(e),Uo(n)):n.q_.set("Unknown")}async function cv(n,e,t){if(n.q_.set("Online"),e instanceof _h&&e.state===2&&e.cause)try{await async function(s,i){const a=i.cause;for(const u of i.targetIds)s.N_.has(u)&&(await s.remoteSyncer.rejectListen(u,a),s.N_.delete(u),s.Q_.removeTarget(u))}(n,e)}catch(r){O("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await As(n,r)}else if(e instanceof hs?n.Q_.Ke(e):e instanceof gh?n.Q_.He(e):n.Q_.We(e),!t.isEqual(U.min()))try{const r=await Ph(n.localStore);t.compareTo(r)>=0&&await function(i,a){const u=i.Q_.rt(a);
2682return u.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const p=i.N_.get(d);p&&i.N_.set(d,p.withResumeToken(l.resumeToken,a))}}),u.targetMismatches.forEach((l,d)=>{const p=i.N_.get(l);if(!p)return;i.N_.set(l,p.withResumeToken(me.EMPTY_BYTE_STRING,p.snapshotVersion)),kh(i,l);const y=new yt(p.target,l,d,p.sequenceNumber);xo(i,y)}),i.remoteSyncer.applyRemoteEvent(u)}(n,t)}catch(r){O("RemoteStore","Failed to raise snapshot:",r),await As(n,r)}}async function As(n,e,t){if(!Er(e))throw e;n.L_.add(1),await wr(n),n.q_.set("Offline"),t||(t=()=>Ph(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{O("RemoteStore","Retrying IndexedDB access"),await t(),n.L_.delete(1),await $s(n)})}function Dh(n,e){return e().catch(t=>As(n,t,e))}async function zs(n){const e=F(n),t=At(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;uv(e);)try{const s=await Wy(e.localStore,r);if(s===null){e.O_.length===0&&t.o_();break}r=s.batchId,lv(e,s)}catch(s){await As(e,s)}Vh(e)&&Oh(e)}function uv(n){return Wt(n)&&n.O_.length<10}function lv(n,e){n.O_.push(e);const t=At(n);t.r_()&&t.V_&&t.m_(e.mutations)}function Vh(n){return Wt(n)&&!At(n).n_()&&n.O_.length>0}function Oh(n){At(n).start()}async function hv(n){At(n).p_()}async function dv(n){const e=At(n);for(const t of n.O_)e.m_(t.mutations)}async function fv(n,e,t){const r=n.O_.shift(),s=ko.from(r,e,t);await Dh(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await zs(n)}async function pv(n,e){e&&At(n).V_&&await async function(r,s){if(function(a){return ny(a)&&a!==b.ABORTED}(s.code)){const i=r.O_.shift();At(r).s_(),await Dh(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await zs(r)}}(n,e),Vh(n)&&Oh(n)}async function Ru(n,e){const t=F(n);t.asyncQueue.verifyOperationInProgress(),O("RemoteStore","RemoteStore received new credentials");const r=Wt(t);t.L_.add(3),await wr(t),r&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await $s(t)}async function mv(n,e){const t=F(n);e?(t.L_.delete(2),await $s(t)):e||(t.L_.add(2),await wr(t),t.q_.set("Unknown"))}function In(n){return n.K_||(n.K_=function(t,r,s){const i=F(t);return i.w_(),new ev(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Eo:iv.bind(null,n),Ro:ov.bind(null,n),mo:av.bind(null,n),d_:cv.bind(null,n)}),n.B_.push(async e=>{e?(n.K_.s_(),Fo(n)?Uo(n):n.q_.set("Unknown")):(await n.K_.stop(),Nh(n))})),n.K_}function At(n){return n.U_||(n.U_=function(t,r,s){const i=F(t);return i.w_(),new tv(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Eo:()=>Promise.resolve(),Ro:hv.bind(null,n),mo:pv.bind(null,n),f_:dv.bind(null,n),g_:fv.bind(null,n)}),n.B_.push(async e=>{e?(n.U_.s_(),await zs(n)):(await n.U_.stop(),n.O_.length>0&&(O("RemoteStore",`Stopping write stream with ${n.O_.length} pending writes`),n.O_=[]))})),n.U_}/**
2683 * @license
2684 * Copyright 2017 Google LLC
2685 *
2686 * Licensed under the Apache License, Version 2.0 (the "License");
2687 * you may not use this file except in compliance with the License.
2688 * You may obtain a copy of the License at
2689 *
2690 *   http://www.apache.org/licenses/LICENSE-2.0
2691 *
2692 * Unless required by applicable law or agreed to in writing, software
2693 * distributed under the License is distributed on an "AS IS" BASIS,
2694 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2695 * See the License for the specific language governing permissions and
2696 * limitations under the License.
2697 */class Bo{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new tt,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,u=new Bo(e,t,a,s,i);return u.start(r),u}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new D(b.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 qo(n,e){if(it("AsyncQueue",`${e}: ${n}`),Er(n))return new D(b.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2698 * @license
2699 * Copyright 2017 Google LLC
2700 *
2701 * Licensed under the Apache License, Version 2.0 (the "License");
2702 * you may not use this file except in compliance with the License.
2703 * You may obtain a copy of the License at
2704 *
2705 *   http://www.apache.org/licenses/LICENSE-2.0
2706 *
2707 * Unless required by applicable law or agreed to in writing, software
2708 * distributed under the License is distributed on an "AS IS" BASIS,
2709 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2710 * See the License for the specific language governing permissions and
2711 * limitations under the License.
2712 */class sn{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=Gn(),this.sortedSet=new te(this.comparator)}static emptySet(e){return new sn(e.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 sn)||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 (
2713  `+e.join(`  
2714`)+`
2715)`}copy(e,t){const r=new sn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
2716 * @license
2717 * Copyright 2017 Google LLC
2718 *
2719 * Licensed under the Apache License, Version 2.0 (the "License");
2720 * you may not use this file except in compliance with the License.
2721 * You may obtain a copy of the License at
2722 *
2723 *   http://www.apache.org/licenses/LICENSE-2.0
2724 *
2725 * Unless required by applicable law or agreed to in writing, software
2726 * distributed under the License is distributed on an "AS IS" BASIS,
2727 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2728 * See the License for the specific language governing permissions and
2729 * limitations under the License.
2730 */class Pu{constructor(){this.W_=new te(L.comparator)}track(e){const t=e.doc.key,r=this.W_.get(t);r?e.type!==0&&r.type===3?this.W_=this.W_.insert(t,e):e.type===3&&r.type!==1?this.W_=this.W_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.W_=this.W_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.W_=this.W_.remove(t):e.type===1&&r.type===2?this.W_=this.W_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):x():this.W_=this.W_.insert(t,e)}G_(){const e=[];return this.W_.inorderTraversal((t,r)=>{e.push(r)}),e}}class fn{constructor(e,t,r,s,i,a,u,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=u,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach(u=>{a.push({type:0,doc:u})}),new fn(e,t,sn.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)&&Ms(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}}/**
2731 * @license
2732 * Copyright 2017 Google LLC
2733 *
2734 * Licensed under the Apache License, Version 2.0 (the "License");
2735 * you may not use this file except in compliance with the License.
2736 * You may obtain a copy of the License at
2737 *
2738 *   http://www.apache.org/licenses/LICENSE-2.0
2739 *
2740 * Unless required by applicable law or agreed to in writing, softw
2740are
2741 * distributed under the License is distributed on an "AS IS" BASIS,
2742 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2743 * See the License for the specific language governing permissions and
2744 * limitations under the License.
2745 */class gv{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class _v{constructor(){this.queries=bu(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,r){const s=F(t),i=s.queries;s.queries=bu(),i.forEach((a,u)=>{for(const l of u.j_)l.onError(r)})})(this,new D(b.ABORTED,"Firestore shutting down"))}}function bu(){return new Tn(n=>nh(n),Ms)}async function jo(n,e){const t=F(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.H_()&&e.J_()&&(r=2):(i=new gv,r=e.J_()?0:1);try{switch(r){case 0:i.z_=await t.onListen(s,!0);break;case 1:i.z_=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const u=qo(a,`Initialization of query '${Xt(e.query)}' failed`);return void e.onError(u)}t.queries.set(s,i),i.j_.push(e),e.Z_(t.onlineState),i.z_&&e.X_(i.z_)&&zo(t)}async function $o(n,e){const t=F(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.j_.indexOf(e);a>=0&&(i.j_.splice(a,1),i.j_.length===0?s=e.J_()?0:1:!i.H_()&&e.J_()&&(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 yv(n,e){const t=F(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const u of a.j_)u.X_(s)&&(r=!0);a.z_=s}}r&&zo(t)}function vv(n,e,t){const r=F(n),s=r.queries.get(e);if(s)for(const i of s.j_)i.onError(t);r.queries.delete(e)}function zo(n){n.Y_.forEach(e=>{e.next()})}var no,Su;(Su=no||(no={})).ea="default",Su.Cache="cache";class Ho{constructor(e,t,r){this.query=e,this.ta=t,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new fn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.na?this.ia(e)&&(this.ta.next(e),t=!0):this.sa(e,this.onlineState)&&(this.oa(e),t=!0),this.ra=e,t}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let t=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),t=!0),t}sa(e,t){if(!e.fromCache||!this.J_())return!0;const r=t!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const t=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}oa(e){e=fn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==no.Cache}}/**
2746 * @license
2747 * Copyright 2017 Google LLC
2748 *
2749 * Licensed under the Apache License, Version 2.0 (the "License");
2750 * you may not use this file except in compliance with the License.
2751 * You may obtain a copy of the License at
2752 *
2753 *   http://www.apache.org/licenses/LICENSE-2.0
2754 *
2755 * Unless required by applicable law or agreed to in writing, software
2756 * distributed under the License is distributed on an "AS IS" BASIS,
2757 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2758 * See the License for the specific language governing permissions and
2759 * limitations under the License.
2760 */class Lh{constructor(e){this.key=e}}class Mh{constructor(e){this.key=e}}class Ev{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=z(),this.mutatedKeys=z(),this.Aa=rh(e),this.Ra=new sn(this.Aa)}get Va(){return this.Ta}ma(e,t){const r=t?t.fa:new Pu,s=t?t.Ra:this.Ra;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,u=!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((p,y)=>{const I=s.get(p),P=xs(this.query,y)?y:null,k=!!I&&this.mutatedKeys.has(I.key),V=!!P&&(P.hasLocalMutations||this.mutatedKeys.has(P.key)&&P.hasCommittedMutations);let C=!1;I&&P?I.data.isEqual(P.data)?k!==V&&(r.track({type:3,doc:P}),C=!0):this.ga(I,P)||(r.track({type:2,doc:P}),C=!0,(l&&this.Aa(P,l)>0||d&&this.Aa(P,d)<0)&&(u=!0)):!I&&P?(r.track({type:0,doc:P}),C=!0):I&&!P&&(r.track({type:1,doc:I}),C=!0,(l||d)&&(u=!0)),C&&(P?(a=a.add(P),i=V?i.add(p):i.delete(p)):(a=a.delete(p),i=i.delete(p)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const p=this.query.limitType==="F"?a.last():a.first();a=a.delete(p.key),i=i.delete(p.key),r.track({type:1,doc:p})}return{Ra:a,fa:r,ns:u,mutatedKeys:i}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}
2760applyChanges(e,t,r,s){const i=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const a=e.fa.G_();a.sort((p,y)=>function(P,k){const V=C=>{switch(C){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return x()}};return V(P)-V(k)}(p.type,y.type)||this.Aa(p.doc,y.doc)),this.pa(r),s=s!=null&&s;const u=t&&!s?this.ya():[],l=this.da.size===0&&this.current&&!s?1:0,d=l!==this.Ea;return this.Ea=l,a.length!==0||d?{snapshot:new fn(this.query,e.Ra,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:u}:{wa:u}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new Pu,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(t=>this.Ta=this.Ta.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ta=this.Ta.delete(t)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=z(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const t=[];return e.forEach(r=>{this.da.has(r)||t.push(new Mh(r))}),this.da.forEach(r=>{e.has(r)||t.push(new Lh(r))}),t}ba(e){this.Ta=e.Ts,this.da=z();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return fn.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class Tv{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class Iv{constructor(e){this.key=e,this.va=!1}}class wv{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.Ca={},this.Fa=new Tn(u=>nh(u),Ms),this.Ma=new Map,this.xa=new Set,this.Oa=new te(L.comparator),this.Na=new Map,this.La=new Vo,this.Ba={},this.ka=new Map,this.qa=dn.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function Av(n,e,t=!0){const r=jh(n);let s;const i=r.Fa.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Da()):s=await xh(r,e,t,!0),s}async function Rv(n,e){const t=jh(n);await xh(t,e,!0,!1)}async function xh(n,e,t,r){const s=await Ky(n.localStore,je(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let u;return r&&(u=await Pv(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&Ch(n.remoteStore,s),u}async function Pv(n,e,t,r,s){n.Ka=(y,I,P)=>async function(V,C,B,j){let q=C.view.ma(B);q.ns&&(q=await Iu(V.localStore,C.query,!1).then(({documents:E})=>C.view.ma(E,q)));const $=j&&j.targetChanges.get(C.targetId),le=j&&j.targetMismatches.get(C.targetId)!=null,J=C.view.applyChanges(q,V.isPrimaryClient,$,le);return ku(V,C.targetId,J.wa),J.snapshot}(n,y,I,P);const i=await Iu(n.localStore,e,!0),a=new Ev(e,i.Ts),u=a.ma(i.documents),l=Ir.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(u,n.isPrimaryClient,l);ku(n,t,d.wa);const p=new Tv(e,t,a);return n.Fa.set(e,p),n.Ma.has(t)?n.Ma.get(t).push(e):n.Ma.set(t,[e]),d.snapshot}async function bv(n,e,t){const r=F(n),s=r.Fa.get(e),i=r.Ma.get(s.targetId);if(i.length>1)return r.Ma.set(s.targetId,i.filter(a=>!Ms(a,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedCl
2760ientState.isActiveQueryTarget(s.targetId)||await to(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&Mo(r.remoteStore,s.targetId),ro(r,s.targetId)}).catch(vr)):(ro(r,s.targetId),await to(r.localStore,s.targetId,!0))}async function Sv(n,e){const t=F(n),r=t.Fa.get(e),s=t.Ma.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),Mo(t.remoteStore,r.targetId))}async function Cv(n,e,t){const r=Mv(n);try{const s=await function(a,u){const l=F(a),d=ce.now(),p=u.reduce((P,k)=>P.add(k.key),z());let y,I;return l.persistence.runTransaction("Locally write mutations","readwrite",P=>{let k=ot(),V=z();return l.cs.getEntries(P,p).next(C=>{k=C,k.forEach((B,j)=>{j.isValidDocument()||(V=V.add(B))})}).next(()=>l.localDocuments.getOverlayedDocuments(P,k)).next(C=>{y=C;const B=[];for(const j of u){const q=X_(j,y.get(j.key).overlayedDocument);q!=null&&B.push(new Pt(j.key,q,Gl(q.value.mapValue),Se.exists(!0)))}return l.mutationQueue.addMutationBatch(P,d,B,u)}).next(C=>{I=C;const B=C.applyToLocalDocumentSet(y,V);return l.documentOverlayCache.saveOverlays(P,C.batchId,B)})}).then(()=>({batchId:I.batchId,changes:ih(y)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(a,u,l){let d=a.Ba[a.currentUser.toKey()];d||(d=new te(G)),d=d.insert(u,l),a.Ba[a.currentUser.toKey()]=d}(r,s.batchId,t),await Ar(r,s.changes),await zs(r.remoteStore)}catch(s){const i=qo(s,"Failed to persist write");t.reject(i)}}async function Uh(n,e){const t=F(n);try{const r=await zy(t.localStore,e);
2760e.targetChanges.forEach((s,i)=>{const a=t.Na.get(i);a&&(Q(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?a.va=!0:s.modifiedDocuments.size>0?Q(a.va):s.removedDocuments.size>0&&(Q(a.va),a.va=!1))}),await Ar(t,r,e)}catch(r){await vr(r)}}function Cu(n,e,t){const r=F(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.Fa.forEach((i,a)=>{const u=a.view.Z_(e);u.snapshot&&s.push(u.snapshot)}),function(a,u){const l=F(a);l.onlineState=u;let d=!1;l.queries.forEach((p,y)=>{for(const I of y.j_)I.Z_(u)&&(d=!0)}),d&&zo(l)}(r.eventManager,e),s.length&&r.Ca.d_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function kv(n,e,t){const r=F(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Na.get(e),i=s&&s.key;if(i){let a=new te(L.comparator);a=a.insert(i,Te.newNoDocument(i,U.min()));const u=z().add(i),l=new qs(U.min(),new Map,new te(G),a,u);await Uh(r,l),r.Oa=r.Oa.remove(i),r.Na.delete(e),Wo(r)}else await to(r.localStore,e,!1).then(()=>ro(r,e,t)).catch(vr)}async function Nv(n,e){const t=F(n),r=e.batch.batchId;try{const s=await $y(t.localStore,e);Bh(t,r,null),Fh(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await Ar(t,s)}catch(s){await vr(s)}}async function Dv(n,e,t){const r=F(n);try{const s=await function(a,u){const l=F(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let p;return l.mutationQueue.lookupMutationBatch(d,u).next(y=>(Q(y!==null),p=y.keys(),l.mutationQueue.removeMutationBatch(d,y))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,p,u)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,p)).next(()=>l.localDocuments.getDocuments(d,p))})}(r.localStore,e);Bh(r,e,t),Fh(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await Ar(r,s)}catch(s){await vr(s)}}function Fh(n,e){(n.ka.get(e)||[]).forEach(t=>{t.resolve()}),n.ka.delete(e)}function Bh(n,e,t){const r=F(n);let s=r.Ba[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Ba[r.currentUser.toKey()]=s}}function ro(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Ma.get(e))n.Fa.delete(r),t&&n.Ca.$a(r,t);n.Ma.delete(e),n.isPrimaryClient&&n.La.gr(e).forEach(r=>{n.La.containsKey(r)||qh(n,r)})}function qh(n,e){n.xa.delete(e.path.canonicalString());const t=n.Oa.get(e);t!==null&&(Mo(n.remoteStore,t),n.Oa=n.Oa.remove(e),n.Na.delete(t),Wo(n))}function ku(n,e,t){for(const r of t)r instanceof Lh?(n.La.addReference(r.key,e),Vv(n,r)):r instanceof Mh?(O("SyncEngine","Document no longer in limbo: "+r.key),n.La.removeReference(r.key,e),n.La.containsKey(r.key)||qh(n,r.key)):x()}function Vv(n,e){const t=e.key,r=t.path.canonicalString();n.Oa.get(t)||n.xa.has(r)||(O("SyncEngine","New document in limbo: "+t),n.xa.add(r),Wo(n))}function Wo(n){for(;n.xa.size>0&&n.Oa.size<n.maxConcurrentLimboResolutions;){const e=n.xa.values().next().value;n.xa.delete(e);const t=new L(ee.fromString(e)),r=n.qa.next();n.Na.set(r,new Iv(t)),n.Oa=n.Oa.insert(t,r),Ch(n.remoteStore,new yt(je(Ls(t.path)),r,"TargetPurposeLimboResolution",Io.oe))}}async function Ar(n,e,t){const r=F(n),s=[],i=[],a=[];r.Fa.isEmpty()||(r.Fa.forEach((u,l)=>{a.push(r.Ka(l,e,t).then(d=>{var p;if((d||t)&&r.isPrimaryClient){const y=d?!d.fromCache:(p=t==null?void 0:t.targetChanges.get(l.targetId))===null||p===void 0?void 0:p.current;
2760r.sharedClientState.updateQueryState(l.targetId,y?"current":"not-current")}if(d){s.push(d);const y=Lo.Wi(l.targetId,d);i.push(y)}}))}),await Promise.all(a),r.Ca.d_(s),await async function(l,d){const p=F(l);try{await p.persistence.runTransaction("notifyLocalViewChanges","readwrite",y=>S.forEach(d,I=>S.forEach(I.$i,P=>p.persistence.referenceDelegate.addReference(y,I.targetId,P)).next(()=>S.forEach(I.Ui,P=>p.persistence.referenceDelegate.removeReference(y,I.targetId,P)))))}catch(y){if(!Er(y))throw y;O("LocalStore","Failed to update sequence numbers: "+y)}for(const y of d){const I=y.targetId;if(!y.fromCache){const P=p.os.get(I),k=P.snapshotVersion,V=P.withLastLimboFreeSnapshotVersion(k);p.os=p.os.insert(I,V)}}}(r.localStore,i))}async function Ov(n,e){const t=F(n);if(!t.currentUser.isEqual(e)){O("SyncEngine","User change. New user:",e.toKey());const r=await Rh(t.localStore,e);t.currentUser=e,function(i,a){i.ka.forEach(u=>{u.forEach(l=>{l.reject(new D(b.CANCELLED,a))})}),i.ka.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ar(t,r.hs)}}function Lv(n,e){const t=F(n),r=t.Na.get(e);if(r&&r.va)return z().add(r.key);{let s=z();const i=t.Ma.get(e);if(!i)return s;for(const a of i){const u=t.Fa.get(a);s=s.unionWith(u.view.Va)}return s}}function jh(n){const e=F(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Uh.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Lv.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=kv.bind(null,e),e.Ca.d_=yv.bind(null,e.eventManager),e.Ca.$a=vv.bind(null,e.eventManager),e}function Mv(n){const e=F(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Nv.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Dv.bind(null,e),e}class Rs{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=js(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,t){return null}Ha(e,t){return null}za(e){return jy(this.persistence,new By,e.initialUser,this.serializer)}Ga(e){return new xy(Oo.Zr,this.serializer)}Wa(e){return new Qy}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()}}Rs.provider={build:()=>new Rs};class so{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=>Cu(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=Ov.bind(null,this.syncEngine),await mv(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new _v}()}createDatastore(e){const t=js(e.databaseInfo.databaseId),r=function(i){return new Zy(i)}(e.databaseInfo);return function(i,a,u,l){return new nv(i,a,u,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,a,u){return new sv(r,s,i,a,u)}(this.localStore,this.datastore,e.asyncQueue,t=>Cu(this.syncEngine,t,0),function(){return Au.D()?new Au:new Yy}())}createSyncEngine(e,t){return function(s,i,a,u,l,d,p){const y=new wv(s,i,a,u,l,d);return p&&(y.Qa=!0),y}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=F(s);O("RemoteStore","RemoteStore shutting down."),i.L_.add(5),await wr(i),i.k_.shutdown(),i.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}so.provider={build:()=>new so};/**
2761 * @license
2762 * Copyright 2020 Google LLC
2763 *
2764 * Licensed under the Apache License, Version 2.0 (the "License");
2765 * you may not use this file except in compliance with the License.
2766 * You may obtain a copy of the License at
2767 *
2768 *   http://www.apache.org/licenses/LICENSE-2.0
2769 *
2770 * Unless required by applicable law or agreed to in writing, software
2771 * distributed under the License is distributed on an "AS IS" BASIS,
2772 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2773 * See the License for the specific language governing permissions and
2774 * limitations under the License.
2775 *//**
2776 * @license
2777 * Copyright 2017 Google LLC
2778 *
2779 * Licensed under the Apache License, Version 2.0 (the "License");
2780 * you may not use this file except in compliance with the License.
2781 * You may obtain a copy of the License at
2782 *
2783 *   http://www.apache.org/licenses/LICENSE-2.0
2784 *
2785 * Unless required by applicable law or agreed to in writing, software
2786 * distributed under the License is distributed on an "AS IS" BASIS,
2787 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2788 * See the License for the specific language governing permissions and
2789 * limitations under the License.
2790 */class Ko{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):it("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
2791 * @license
2792 * Copyright 2017 Google LLC
2793 *
2794 * Licensed under the Apache License, Version 2.0 (the "License");
2795 * you may not use this file except in compliance with the License.
2796 * You may obtain a copy of the License at
2797 *
2798 *   http://www.apache.org/licenses/LICENSE-2.0
2799 *
2800 * Unless required by applicable law or agreed to in writing, software
2801 * distributed under the License is distributed on an "AS IS" BASIS,
2802 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2803 * See the License for the specific language governing permissions and
2804 * limitations under the License.
2805 */class xv{constructor(e,t,r,s,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=Ce.UNAUTHENTICATED,this.clientId=Hl.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async a=>{O("FirestoreClient","Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(r,a=>(O("FirestoreClient","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 tt;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=qo(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Ni(n,e){n.asyncQueue.verifyOperationInProgress(),O("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Rh(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Nu(n,e){n.asyncQueue.verifyOperationInProgress();const t=await Uv(n);O("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>Ru(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>Ru(e.remoteStore,s)),n._onlineComponents=e}async function Uv(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){O("FirestoreClient","Using user provided OfflineComponentProvider");try{await Ni(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(s){return s.name==="FirebaseError"?s.code===b.FAILED_PRECONDITION||s.code===b.UNIMPLEMENT
2805ED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(t))throw t;or("Error using user provided cache. Falling back to memory cache: "+t),await Ni(n,new Rs)}}else O("FirestoreClient","Using default OfflineComponentProvider"),await Ni(n,new Rs);return n._offlineComponents}async function $h(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(O("FirestoreClient","Using user provided OnlineComponentProvider"),await Nu(n,n._uninitializedComponentsProvider._online)):(O("FirestoreClient","Using default OnlineComponentProvider"),await Nu(n,new so))),n._onlineComponents}function Fv(n){return $h(n).then(e=>e.syncEngine)}async function Ps(n){const e=await $h(n),t=e.eventManager;return t.onListen=Av.bind(null,e.syncEngine),t.onUnlisten=bv.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=Rv.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=Sv.bind(null,e.syncEngine),t}function Bv(n,e,t={}){const r=new tt;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,u,l,d){const p=new Ko({next:I=>{p.Za(),a.enqueueAndForget(()=>$o(i,y));const P=I.docs.has(u);!P&&I.fromCache?d.reject(new D(b.UNAVAILABLE,"Failed to get document because the client is offline.")):P&&I.fromCache&&l&&l.source==="server"?d.reject(new D(b.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(I)},error:I=>d.reject(I)}),y=new Ho(Ls(u.path),p,{includeMetadataChanges:!0,_a:!0});return jo(i,y)}(await Ps(n),n.asyncQueue,e,t,r)),r.promise}function qv(n,e,t={}){const r=new tt;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,u,l,d){const p=new Ko({next:I=>{p.Za(),a.enqueueAndForget(()=>$o(i,y)),I.fromCache&&l.source==="server"?d.reject(new D(b.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(I)},error:I=>d.reject(I)}),y=new Ho(u,p,{includeMetadataChanges:!0,_a:!0});return jo(i,y)}(await Ps(n),n.asyncQueue,e,t,r)),r.promise}/**
2806 * @license
2807 * Copyright 2023 Google LLC
2808 *
2809 * Licensed under the Apache License, Version 2.0 (the "License");
2810 * you may not use this file except in compliance with the License.
2811 * You may obtain a copy of the License at
2812 *
2813 *   http://www.apache.org/licenses/LICENSE-2.0
2814 *
2815 * Unless required by applicable law or agreed to in writing, software
2816 * distributed under the License is distributed on an "AS IS" BASIS,
2817 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2818 * See the License for the specific language governing permissions and
2819 * limitations under the License.
2820 */function zh(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
2821 * @license
2822 * Copyright 2020 Google LLC
2823 *
2824 * Licensed under the Apache License, Version 2.0 (the "License");
2825 * you may not use this file except in compliance with the License.
2826 * You may obtain a copy of the License at
2827 *
2828 *   http://www.apache.org/licenses/LICENSE-2.0
2829 *
2830 * Unless required by applicable law or agreed to in writing, software
2831 * distributed under the License is distributed on an "AS IS" BASIS,
2832 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2833 * See the License for the specific language governing permissions and
2834 * limitations under the License.
2835 */const Du=new Map;/**
2836 * @license
2837 * Copyright 2017 Google LLC
2838 *
2839 * Licensed under the Apache License, Version 2.0 (the "License");
2840 * you may not use this file except in compliance with the License.
2841 * You may obtain a copy of the License at
2842 *
2843 *   http://www.apache.org/licenses/LICENSE-2.0
2844 *
2845 * Unless required by applicable law or agreed to in writing, software
2846 * distributed under the License is distributed on an "AS IS" BASIS,
2847 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2848 * See the License for the specific language governing permissions and
2849 * limitations under the License.
2850 */function Hh(n,e,t){if(!t)throw new D(b.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function jv(n,e,t,r){if(e===!0&&r===!0)throw new D(b.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Vu(n){if(!L.isDocumentKey(n))throw new D(b.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Ou(n){if(L.isDocumentKey(n))throw new D(b.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function Hs(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":x()}function Ne(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new D(b.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Hs(n);throw new D(b.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function $v(n,e){if(e<=0)throw new D(b.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
2851 * @license
2852 * Copyright 2020 Google LLC
2853 *
2854 * Licensed under the Apache License, Version 2.0 (the "License");
2855 * you may not use this file except in compliance with the License.
2856 * You may obtain a copy of the License at
2857 *
2858 *   http://www.apache.org/licenses/LICENSE-2.0
2859 *
2860 * Unless required by applicable law or agreed to in writing, software
2861 * distributed under the License is distributed on an "AS IS" BASIS,
2862 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2863 * See the License for the specific language governing permissions and
2864 * limitations under the License.
2865 */class Lu{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new D(b.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new D(b.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}jv("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=zh((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new D(b.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new D(b.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new D(b.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 Go{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 Lu({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new D(b.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 D(b.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 Lu(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new c_;switch(r.type){case"firstParty":return new h_(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new D(b.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=Du.get(t);r&&(O("ComponentProvider","Removing Datastore"),Du.delete(t),r.terminate())}(this),Promise.resolve()}}/**
2866 * @license
2867 * Copyright 2020 Google LLC
2868 *
2869 * Licensed under the Apache License, Version 2.0 (the "License");
2870 * you may not use this file except in compliance with the License.
2871 * You may obtain a copy of the License at
2872 *
2873 *   http://www.apache.org/licenses/LICENSE-2.0
2874 *
2875 * Unless required by applicable law or agreed to in writing, software
2876 * distributed under the License is distributed on an "AS IS" BASIS,
2877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2878 * See the License for the specific language governing permissions and
2879 * limitations under the License.
2880 */class at{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new at(this.firestore,e,this._query)}}class Ie{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 Tt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ie(this.firestore,e,this._key)}}class Tt extends at{constructor(e,t,r){super(e,t,Ls(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 Ie(this.firestore,null,new L(e))}withConverter(e){return new Tt(this.firestore,e,this._path)}}function gI(n,e,...t){if(n=Y(n),Hh("collection","path",e),n instanceof Go){const r=ee.fromString(e,...t);return Ou(r),new Tt(n,null,r)}{if(!(n instanceof Ie||n instanceof Tt))throw new D(b.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 Ou(r),new Tt(n.firestore,null,r)}}function zv(n,e,...t){if(n=Y(n),arguments.length===1&&(e=Hl.newId()),Hh("doc","path",e),n instanceof Go){const r=ee.fromString(e,...t);return Vu(r),new Ie(n,null,new L(r))}{if(!(n instanceof Ie||n instanceof Tt))throw new D(b.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 Vu(r),new Ie(n.firestore,n instanceof Tt?n.converter:null,new L(r))}}/**
2881 * @license
2882 * Copyright 2020 Google LLC
2883 *
2884 * Licensed under the Apache License, Version 2.0 (the "License");
2885 * you may not use this file except in compliance with the License.
2886 * You may obtain a copy of the License at
2887 *
2888 *   http://www.apache.org/licenses/LICENSE-2.0
2889 *
2890 * Unless required by applicable law or agreed to in writing, software
2891 * distributed under the License is distributed on an "AS IS" BASIS,
2892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2893 * See the License for the specific language governing permissions and
2894 * limitations under the License.
2895 */class Mu{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new bh(this,"async_queue_retry"),this.Vu=()=>{const r=ki();r&&O("AsyncQueue","Visibility state changed to "+r.visibilityState),this.t_.jo()},this.mu=e;const t=ki();t&&typeof t.addEventListener=="function"&&t.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;const t=ki();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const t=new tt;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(this.Pu.length!==0){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!Er(e))throw e;O("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){const t=this.mu.then(()=>(this.du=!0,e().catch(r=>{this.Eu=r,this.du=!1;const s=function(a){let u=a.message||"";return a.stack&&(u=a.stack.includes(a.message)?a.stack:a.message+`
2896`+a.stack),u}(r);throw it("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.du=!1,r))));return this.mu=t,t}enqueueAfterDelay(e,t,r){this.fu(),this.Ru.indexOf(e)>-1&&(t=0);const s=Bo.createAndSchedule(this,e,t,r,i=>this.yu(i));return this.Tu.push(s),s}fu(){this.Eu&&x()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(const t of this.Tu)if(t.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{this.Tu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.Tu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){const t=this.Tu.indexOf(e);this.Tu.splice(t,1)}}function xu(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 We extends Go{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=new Mu,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Mu(e),this._firestoreClient=void 0,await e}}}function _I(n,e,t){t||(t="(default)");const r=gn(n,"firestore");if(r.isInitialized(t)){const s=r.getImmediate({identifier:t}),i=r.getOptions(t);if(on(i,e))return s;throw new D(b.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(e.cacheSizeBytes!==void 0&&e.localCache!==void 0)throw new D(b.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");
2896if(e.cacheSizeBytes!==void 0&&e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new D(b.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return r.initialize({options:e,instanceIdentifier:t})}function Rr(n){if(n._terminated)throw new D(b.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||Hv(n),n._firestoreClient}function Hv(n){var e,t,r;const s=n._freezeSettings(),i=function(u,l,d,p){return new A_(u,l,d,p.host,p.ssl,p.experimentalForceLongPolling,p.experimentalAutoDetectLongPolling,zh(p.experimentalLongPollingOptions),p.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 xv(n._authCredentials,n._appCheckCredentials,n._queue,i,n._componentsProvider&&function(u){const l=u==null?void 0:u._online.build();return{_offline:u==null?void 0:u._offline.build(l),_online:l}}(n._componentsProvider))}/**
2897 * @license
2898 * Copyright 2020 Google LLC
2899 *
2900 * Licensed under the Apache License, Version 2.0 (the "License");
2901 * you may not use this file except in compliance with the License.
2902 * You may obtain a copy of the License at
2903 *
2904 *   http://www.apache.org/licenses/LICENSE-2.0
2905 *
2906 * Unless required by applicable law or agreed to in writing, software
2907 * distributed under the License is distributed on an "AS IS" BASIS,
2908 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2909 * See the License for the specific language governing permissions and
2910 * limitations under the License.
2911 */class pn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new pn(me.fromBase64String(e))}catch(t){throw new D(b.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new pn(me.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)}}/**
2912 * @license
2913 * Copyright 2020 Google LLC
2914 *
2915 * Licensed under the Apache License, Version 2.0 (the "License");
2916 * you may not use this file except in compliance with the License.
2917 * You may obtain a copy of the License at
2918 *
2919 *   http://www.apache.org/licenses/LICENSE-2.0
2920 *
2921 * Unless required by applicable law or agreed to in writing, software
2922 * distributed under the License is distributed on an "AS IS" BASIS,
2923 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2924 * See the License for the specific language governing permissions and
2925 * limitations under the License.
2926 */class Pr{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new D(b.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new fe(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
2927 * @license
2928 * Copyright 2020 Google LLC
2929 *
2930 * Licensed under the Apache License, Version 2.0 (the "License");
2931 * you may not use this file except in compliance with the License.
2932 * You may obtain a copy of the License at
2933 *
2934 *   http://www.apache.org/licenses/LICENSE-2.0
2935 *
2936 * Unless required by applicable law or agreed to in writing, software
2937 * distributed under the License is distributed on an "AS IS" BASIS,
2938 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2939 * See the License for the specific language governing permissions and
2940 * limitations under the License.
2941 */class wn{constructor(e){this._methodName=e}}/**
2942 * @license
2943 * Copyright 2017 Google LLC
2944 *
2945 * Licensed under the Apache License, Version 2.0 (the "License");
2946 * you may not use this file except in compliance with the License.
2947 * You may obtain a copy of the License at
2948 *
2949 *   http://www.apache.org/licenses/LICENSE-2.0
2950 *
2951 * Unless required by applicable law or agreed to in writing, softw
2951are
2952 * distributed under the License is distributed on an "AS IS" BASIS,
2953 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2954 * See the License for the specific language governing permissions and
2955 * limitations under the License.
2956 */class Qo{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new D(b.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new D(b.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)}}/**
2957 * @license
2958 * Copyright 2024 Google LLC
2959 *
2960 * Licensed under the Apache License, Version 2.0 (the "License");
2961 * you may not use this file except in compliance with the License.
2962 * You may obtain a copy of the License at
2963 *
2964 *   http://www.apache.org/licenses/LICENSE-2.0
2965 *
2966 * Unless required by applicable law or agreed to in writing, software
2967 * distributed under the License is distributed on an "AS IS" BASIS,
2968 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2969 * See the License for the specific language governing permissions and
2970 * limitations under the License.
2971 */class Yo{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)}}/**
2972 * @license
2973 * Copyright 2017 Google LLC
2974 *
2975 * Licensed under the Apache License, Version 2.0 (the "License");
2976 * you may not use this file except in compliance with the License.
2977 * You may obtain a copy of the License at
2978 *
2979 *   http://www.apache.org/licenses/LICENSE-2.0
2980 *
2981 * Unless required by applicable law or agreed to in writing, software
2982 * distributed under the License is distributed on an "AS IS" BASIS,
2983 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2984 * See the License for the specific language governing permissions and
2985 * limitations under the License.
2986 */const Wv=/^__.*__$/;class Kv{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Pt(e,this.data,this.fieldMask,t,this.fieldTransforms):new Tr(e,this.data,t,this.fieldTransforms)}}class Wh{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new Pt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function Kh(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw x()}}class Ws{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.vu(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new Ws(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Mu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Fu({path:r,xu:!1});return s.Ou(e),s}Nu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Fu({path:r,xu:!1});return s.vu(),s}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return bs(e,this.settings.methodName,this.settings.ku||!1,this.path,this.settings.qu)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}vu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Ou(this.path.get(e))}Ou(e){if(e.length===0)throw this.Bu("Document fields must not be empty");if(Kh(this.Cu)&&Wv.test(e))throw this.Bu('Document fields cannot begin and end with "__"')}}class Gv{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||js(e)}Qu(e,t,r,s=!1){return new Ws({Cu:e,methodName:t,qu:r,path:fe.emptyPath(),xu:!1,ku:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function br(n){const e=n._freezeSettings(),t=js(n._databaseId);return new Gv(n._databaseId,!!e.ignoreUndefinedProperties,t)}function Xo(n,e,t,r,s,i={}){const a=n.Qu(i.merge||i.mergeFields?2:0,e,t,s);ta("Data must be an object, but it was:",a,r);const u=Yh(r,a);let l,d;if(i.merge)l=new Ve(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const p=[];for(const y of i.mergeFields){const I=io(e,y,t);if(!a.contains(I))throw new D(b.INVALID_ARGUMENT,`Field '${I}' is specified in your field mask but missing from your input data.`);Jh(p,I)||p.push(I)}l=new Ve(p),d=a.fieldTransforms.filter(y=>l.covers(y.field))}else l=null,d=a.fieldTransforms;return new Kv(new ke(u),l,d)}class Sr extends wn{_toFieldTransform(e){if(e.Cu!==2)throw e.Cu===1?e.Bu(`${this._methodName}() can only appear at the top level of your update data`):e.Bu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Sr}}function Qv(n,e,t){return new Ws({Cu:3,qu:e.settings.qu,methodName:n._methodName,xu:t},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class Jo extends wn{_toFieldTransform(e){return new Co(e.path,new dr)}isEqual(e){return e instanceof Jo}}class Zo extends wn{constructor(e,t){super(e),this.Ku=t}_toFieldTransform(e){const t=Qv(this,e,!0),r=this.Ku.map(i=>An(i,t)),s=new hn(r);return new Co(e.path,s)}isEqual(e){return e instanceof Zo&&on(this.Ku,e.Ku)}}class ea extends wn{constructor(e,t){super(e),this.$u=t}_toFieldTransform(e){const t=new pr(e.serializer,ch(e.serializer,this.$u));return new Co(e.path,t)}isEqual(e){return e instanceof ea&&this.$u===e.$u}}function Gh(n,e,t,r){const s=n.Qu(1,e,t);ta("Data must be an object, but it was:",s,r);const i=[],a=ke.empty();Ht(r,(l,d)=>{const p=na(e,l,t);d=Y(d);const y=s.Nu(p);if(d instanceof Sr)i.push(p);else{const I=An(d,y);I!=null&&(i.push(p),a.set(p,I))}});const u=new Ve(i);return new Wh(a,u,s.fieldTransforms)}function Qh(n,e,t,r,s,i){const a=n.Qu(1,e,t),u=[io(e,r,t)],l=[s];if(i.length%2!=0)throw new D(b.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let I=0;I<i.length;I+=2)u.push(io(e,i[I])),l.push(i[I+1]);const d=[],p=ke.empty();for(let I=u.length-1;I>=0;--I)if(!Jh(d,u[I])){const P=u[I];
2986let k=l[I];k=Y(k);const V=a.Nu(P);if(k instanceof Sr)d.push(P);else{const C=An(k,V);C!=null&&(d.push(P),p.set(P,C))}}const y=new Ve(d);return new Wh(p,y,a.fieldTransforms)}function Yv(n,e,t,r=!1){return An(t,n.Qu(r?4:3,e))}function An(n,e){if(Xh(n=Y(n)))return ta("Unsupported field value:",e,n),Yh(n,e);if(n instanceof wn)return function(r,s){if(!Kh(s.Cu))throw s.Bu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Bu(`${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.xu&&e.Cu!==4)throw e.Bu("Nested arrays are not supported");return function(r,s){const i=[];let a=0;for(const u of r){let l=An(u,s.Lu(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=Y(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return ch(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=ce.fromDate(r);return{timestampValue:ws(s.serializer,i)}}if(r instanceof ce){const i=new ce(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:ws(s.serializer,i)}}if(r instanceof Qo)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof pn)return{bytesValue:yh(s.serializer,r._byteString)};if(r instanceof Ie){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.Bu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Do(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Yo)return function(a,u){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:a.toArray().map(l=>{if(typeof l!="number")throw u.Bu("VectorValues must only contain numeric values.");return So(u.serializer,l)})}}}}}}(r,s);throw s.Bu(`Unsupported field value: ${Hs(r)}`)}(n,e)}function Yh(n,e){const t={};return Wl(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ht(n,(r,s)=>{const i=An(s,e.Mu(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function Xh(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ce||n instanceof Qo||n instanceof pn||n instanceof Ie||n instanceof wn||n instanceof Yo)}function ta(n,e,t){if(!Xh(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=Hs(t);throw r==="an object"?e.Bu(n+" a custom object"):e.Bu(n+" "+r)}}function io(n,e,t){if((e=Y(e))instanceof Pr)return e._internalPath;if(typeof e=="string")return na(n,e);throw bs("Field path arguments must be of type string or ",n,!1,void 0,t)}const Xv=new RegExp("[~\\*/\\[\\]]");function na(n,e,t){if(e.search(Xv)>=0)throw bs(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Pr(...e.split("."))._internalPath}catch{throw bs(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function bs(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let u=`Function ${e}() called with invalid data`;t&&(u+=" (via `toFirestore()`)"),u+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new D(b.INVALID_ARGUMENT,u+n+l)}function Jh(n,e){return n.some(t=>t.isEqual(e))}/**
2987 * @license
2988 * Copyright 2020 Google LLC
2989 *
2990 * Licensed under the Apache License, Version 2.0 (the "License");
2991 * you may not use this file except in compliance with the License.
2992 * You may obtain a copy of the License at
2993 *
2994 *   http://www.apache.org/licenses/LICENSE-2.0
2995 *
2996 * Unless required by applicable law or agreed to in writing, software
2997 * distributed under the License is distributed on an "AS IS" BASIS,
2998 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2999 * See the License for the specific language governing permissions and
3000 * limitations under the License.
3001 */class Zh{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 Ie(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Jv(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(Ks("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class Jv extends Zh{data(){return super.data()}}function Ks(n,e){return typeof e=="string"?na(n,e):e instanceof Pr?e._internalPath:e._delegate._internalPath}/**
3002 * @license
3003 * Copyright 2020 Google LLC
3004 *
3005 * Licensed under the Apache License, Version 2.0 (the "License");
3006 * you may not use this file except in compliance with the License.
3007 * You may obtain a copy of the License at
3008 *
3009 *   http://www.apache.org/licenses/LICENSE-2.0
3010 *
3011 * Unless required by applicable law or agreed to in writing, software
3012 * distributed under the License is distributed on an "AS IS" BASIS,
3013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3014 * See the License for the specific language governing permissions and
3015 * limitations under the License.
3016 */function ed(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new D(b.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class ra{}class sa extends ra{}function yI(n,e,...t){let r=[];e instanceof ra&&r.push(e),r=r.concat(t),function(i){const a=i.filter(l=>l instanceof ia).length,u=i.filter(l=>l instanceof Gs).length;if(a>1||a>0&&u>0)throw new D(b.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 Gs extends sa{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new Gs(e,t,r)}_apply(e){const t=this._parse(e);return td(e._query,t),new at(e.firestore,e.converter,Yi(e._query,t))}_parse(e){const t=br(e.firestore);return function(i,a,u,l,d,p,y){let I;if(d.isKeyField()){if(p==="array-contains"||p==="array-contains-any")throw new D(b.INVALID_ARGUMENT,`Invalid Query. You can't perform '${p}' queries on documentId().`);if(p==="in"||p==="not-in"){Fu(y,p);const P=[];for(const k of y)P.push(Uu(l,i,k));I={arrayValue:{values:P}}}else I=Uu(l,i,y)}else p!=="in"&&p!=="not-in"&&p!=="array-contains-any"||Fu(y,p),I=Yv(u,a,y,p==="in"||p==="not-in");return ae.create(d,p,I)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function vI(n,e,t){const r=e,s=Ks("where",n);return Gs._create(s,r,t)}class ia extends ra{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ia(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]:xe.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let a=s;const u=i.getFlattenedFilters();for(const l of u)td(a,l),a=Yi(a,l)}(e._query,t),new at(e.firestore,e.converter,Yi(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class oa extends sa{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new oa(e,t)}_apply(e){const t=function(s,i,a){if(s.startAt!==null)throw new D(b.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new D(b.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new hr(i,a)}(e._query,this._field,this._direction);return new at(e.firestore,e.converter,function(s,i){const a=s.explicitOrderBy.concat([i]);return new En(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function EI(n,e="asc"){const t=e,r=Ks("orderBy",n);return oa._create(r,t)}class aa extends sa{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new aa(e,t,r)}_apply(e){return new at(e.firestore,e.converter,Is(e._query,this._limit,this._limitType))}}function TI(n){return $v("limit",n),aa._create("limit",n,"F")}function Uu(n,e,t){if(typeof(t=Y(t))=="string"){if(t==="")throw new D(b.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!th(e)&&t.indexOf("/")!==-1)throw new D(b.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 D(b.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 iu(n,new L(r))}if(t instanceof Ie)return iu(n,t._key);throw new D(b.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Hs(t)}.`)}function Fu(n,e){if(!Array.isArray(n)||n.length===0)throw new D(b.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function td(n,e){const t=function(s,i){for(const a of s)for(const u of a.getFlattenedFilters())if(i.indexOf(u.op)>=0)return u.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 D(b.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new D(b.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class Zv{convertValue(e,t="none"){switch(Ft(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ie(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(Ut(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 x()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return Ht(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.value.arrayValue)===null||r===void 0?void 0:r.values)===null||s===void 0?void 0:s.map(a=>ie(a.doubleValue));return new Yo(i)}convertGeoPoint(e){return new Qo(ie(e.latitude),ie(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Ao(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(cr(e));default:return null}}convertTimestamp(e){const t=wt(e);
vendor: 4,402 bytes, lines 3016-3050
3016return new ce(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=ee.fromString(e);Q(Ah(r));const s=new ur(r.get(1),r.get(3)),i=new L(r.popFirst(5));return s.isEqual(t)||it(`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}}/**
3017 * @license
3018 * Copyright 2020 Google LLC
3019 *
3020 * Licensed under the Apache License, Version 2.0 (the "License");
3021 * you may not use this file except in compliance with the License.
3022 * You may obtain a copy of the License at
3023 *
3024 *   http://www.apache.org/licenses/LICENSE-2.0
3025 *
3026 * Unless required by applicable law or agreed to in writing, software
3027 * distributed under the License is distributed on an "AS IS" BASIS,
3028 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3029 * See the License for the specific language governing permissions and
3030 * limitations under the License.
3031 */function ca(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}/**
3032 * @license
3033 * Copyright 2020 Google LLC
3034 *
3035 * Licensed under the Apache License, Version 2.0 (the "License");
3036 * you may not use this file except in compliance with the License.
3037 * You may obtain a copy of the License at
3038 *
3039 *   http://www.apache.org/licenses/LICENSE-2.0
3040 *
3041 * Unless required by applicable law or agreed to in writing, software
3042 * distributed under the License is distributed on an "AS IS" BASIS,
3043 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3044 * See the License for the specific language governing permissions and
3045 * limitations under the License.
3046 */class Yn{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class nd extends Zh{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 ds(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(Ks("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class ds extends nd{data(e={}){return super.data(e)}}class rd{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new Yn(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 ds(this._firestore,this._userDataWriter,r.key,r,new Yn(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 D(b.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(u=>{const l=new ds(s._firestore,s._userDataWriter,u.doc.key,u.doc,new Yn(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter);return u.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(u=>i||u.type!==3).map(u=>{const l=new ds(s._firestore,s._userDataWriter,u.doc.key,u.doc,new Yn(s._snapshot.mutatedKeys.has(u.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,p=-1;return u.type!==0&&(d=a.indexOf(u.doc.key),a=a.delete(u.doc.key)),u.type!==1&&(a=a.add(u.doc),p=a.indexOf(u.doc.key)),{type:eE(u.type),doc:l,oldIndex:d,newIndex:p}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function eE(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return x()}}/**
3047 * @license
3048 * Copyright 2020 Google LLC
3049 *
3050 * Licensed under the Apache License, Version 2.0 (the "License");
3051 * you may not use this file except in compliance with the License.
3052 * You may obtain a copy of the License at
3053 *
3054 *   http://www.apache.org/licenses/LICENSE-2.0
3055 *
3056 * Unless required by applicable law or agreed to in writing, software
3057 * distributed under the License is distributed on an "AS IS" BASIS,
3058 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3059 * See the License for the specific language governing permissions and
3060 * limitations under the License.
3061 */function II(n){n=Ne(n,Ie);const e=Ne(n.firestore,We);return Bv(Rr(e),n._key).then(t=>sd(e,n,t))}class ua extends Zv{constructor(e){super(),this.firestore=e}convertBytes(e){return new pn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ie(this.firestore,null,t)}}function wI(n){n=Ne(n,at);const e=Ne(n.firestore,We),t=Rr(e),r=new ua(e);return ed(n._query),qv(t,n._query).then(s=>new rd(e,r,n,s))}function AI(n,e,t){n=Ne(n,Ie);const r=Ne(n.firestore,We),s=ca(n.converter,e,t);return Cr(r,[Xo(br(r),"setDoc",n._key,s,n.converter!==null,t).toMutation(n._key,Se.none())])}function RI(n,e,t,...r){n=Ne(n,Ie);const s=Ne(n.firestore,We),i=br(s);let a;return a=typeof(e=Y(e))=="string"||e instanceof Pr?Qh(i,"updateDoc",n._key,e,t,r):Gh(i,"updateDoc",n._key,e),Cr(s,[a.toMutation(n._key,Se.exists(!0))])}function PI(n){return Cr(Ne(n.firestore,We),[new Bs(n._key,Se.none())])}function bI(n,e){const t=Ne(n.firestore,We),r=zv(n),s=ca(n.converter,e);return Cr(t,[Xo(br(n.firestore),"addDoc",r._key,s,n.converter!==null,{}).toMutation(r._key,Se.exists(!1))]).then(()=>r)}function SI(n,...e){var t,r,s;n=Y(n);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||xu(e[a])||(i=e[a],a++);const u={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(xu(e[a])){const y=e[a];e[a]=(t=y.next)===null||t===void 0?void 0:t.bind(y),e[a+1]=(r=y.error)===null||r===void 0?void 0:r.bind(y),e[a+2]=(s=y.complete)===null||s===void 0?void 0:s.bind(y)}let l,d,p;if(n instanceof Ie)d=Ne(n.firestore,We),p=Ls(n._key.path),l={next:y=>{e[a]&&e[a](sd(d,n,y))},error:e[a+1],complete:e[a+2]};else{const y=Ne(n,at);d=Ne(y.firestore,We),p=y._query;const I=new ua(d);l={next:P=>{e[a]&&e[a](new rd(d,I,y,P))},error:e[a+1],complete:e[a+2]},ed(n._query)}return function(I,P,k,V){const C=new Ko(V),B=new Ho(P,C,k);return I.asyncQueue.enqueueAndForget(async()=>jo(await Ps(I),B)),()=>{C.Za(),I.asyncQueue.enqueueAndForget(async()=>$o(await Ps(I),B))}}(Rr(d),p,u,l)}function Cr(n,e){return function(r,s){const i=new tt;return r.asyncQueue.enqueueAndForget(async()=>Cv(await Fv(r),s,i)),i.promise}(Rr(n),e)}function sd(n,e,t){const r=t.docs.get(e._key),s=new ua(n);return new nd(n,s,e._key,r,new Yn(t.hasPendingWrites,t.fromCache),e.converter)}/**
3062 * @license
3063 * Copyright 2020 Google LLC
3064 *
3065 * Licensed under the Apache License, Version 2.0 (the "License");
3066 * you may not use this file except in compliance with the License.
3067 * You may obtain a copy of the License at
3068 *
3069 *   http://www.apache.org/licenses/LICENSE-2.0
3070 *
3071 * Unless required by applicable law or agreed to in writing, software
3072 * distributed under the License is distributed on an "AS IS" BASIS,
3073 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3074 * See the License for the specific language governing permissions and
3075 * limitations under the License.
3076 */class tE{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=br(e)}set(e,t,r){this._verifyNotCommitted();const s=Di(e,this._firestore),i=ca(s.converter,t,r),a=Xo(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(a.toMutation(s._key,Se.none())),this}update(e,t,r,...s){this._verifyNotCommitted();const i=Di(e,this._firestore);let a;return a=typeof(t=Y(t))=="string"||t instanceof Pr?Qh(this._dataReader,"WriteBatch.update",i._key,t,r,s):Gh(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(a.toMutation(i._key,Se.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=Di(e,this._firestore);return this._mutations=this._mutations.concat(new Bs(t._key,Se.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 D(b.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function Di(n,e){if((n=Y(n)).firestore!==e)throw new D(b.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
3077 * @license
3078 * Copyright 2020 Google LLC
3079 *
3080 * Licensed under the Apache License, Version 2.0 (the "License");
3081 * you may not use this file except in compliance with the License.
3082 * You may obtain a copy of the License at
3083 *
3084 *   http://www.apache.org/licenses/LICENSE-2.0
3085 *
3086 * Unless required by applicable law or agreed to in writing, software
3087 * distributed under the License is distributed on an "AS IS" BASIS,
3088 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3089 * See the License for the specific language governing permissions and
3090 * limitations under the License.
3091 */function CI(){return new Sr("deleteField")}function kI(){return new Jo("serverTimestamp")}function NI(...n){return new Zo("arrayUnion",n)}function DI(n){return new ea("increment",n)}/**
3092 * @license
3093 * Copyright 2020 Google LLC
3094 *
3095 * Licensed under the Apache License, Version 2.0 (the "License");
3096 * you may not use this file except in compliance with the License.
3097 * You may obtain a copy of the License at
3098 *
3099 *   http://www.apache.org/licenses/LICENSE-2.0
3100 *
3101 * Unless required by applicable law or agreed to in writing, software
3102 * distributed under the License is distributed on an "AS IS" BASIS,
3103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3104 * See the License for the specific language governing permissions and
3105 * limitations under the License.
3106 */function VI(n){return Rr(n=Ne(n,We)),new tE(n,e=>Cr(n,e))}(function(e,t=!0){(function(s){vn=s})($t),rt(new ze("firestore",(r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),u=new We(new u_(r.getProvider("auth-internal")),new f_(r.getProvider("app-check-internal")),function(d,p){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new D(b.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ur(d.options.projectId,p)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),u._setSettings(i),u},"PUBLIC").setMultipleInstances(!0)),Oe(eu,"4.7.3",e),Oe(eu,"4.7.3","esm2017")})();/**
3107 * @license
3108 * Copyright 2017 Google LLC
3109 *
3110 * Licensed under the Apache License, Version 2.0 (the "License");
3111 * you may not use this file except in compliance with the License.
3112 * You may obtain a copy of the License at
3113 *
3114 *   http://www.apache.org/licenses/LICENSE-2.0
3115 *
3116 * Unless required by applicable law or agreed to in writing, software
3117 * distributed under the License is distributed on an "AS IS" BASIS,
3118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3119 * See the License for the specific language governing permissions and
3120 * limitations under the License.
3121 */const id="firebasestorage.googleapis.com",od="storageBucket",nE=2*60*1e3,rE=10*60*1e3;/**
3122 * @license
3123 * Copyright 2017 Google LLC
3124 *
3125 * Licensed under the Apache License, Version 2.0 (the "License");
3126 * you may not use this file except in compliance with the License.
3127 * You may obtain a copy of the License at
3128 *
3129 *   http://www.apache.org/licenses/LICENSE-2.0
3130 *
3131 * Unless required by applicable law or agreed to in writing, software
3132 * distributed under the License is distributed on an "AS IS" BASIS,
3133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3134 * See the License for the specific language governing permissions and
3135 * limitations under the License.
3136 */class se extends Ue{constructor(e,t,r=0){super(Vi(e),`Firebase Storage: ${t} (${Vi(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 Vi(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3137${this.customData.serverResponse}`:this.message=this._baseMessage}}var re;(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"})(re||(re={}));function Vi(n){return"storage/"+n}function la(){const n="An unknown error occurred, please check the error payload for server response.";return new se(re.UNKNOWN,n)}function sE(n){return new se(re.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function iE(n){return new se(re.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function oE(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new se(re.UNAUTHENTICATED,n)}function aE(){return new se(re.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function cE(n){return new se(re.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function uE(){return new se(re.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function lE(){return new se(re.CANCELED,"User canceled the upload/download.")}function hE(n){return new se(re.INVALID_URL,"Invalid URL '"+n+"'.")}function dE(n){return new se(re.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function fE(){return new se(re.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+od+"' property when initializing the app?")}function pE(){return new se(re.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function mE(){return new se(re.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function gE(n){return new se(re.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 oo(n){return new se(re.INVALID_ARGUMENT,n)}function ad(){return new se(re.APP_DELETED,"The Firebase app was deleted.")}function _E(n){return new se(re.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(re.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function zn(n){throw new se(re.INTERNAL_ERROR,"Internal error: "+n)}/**
3138 * @license
3139 * Copyright 2017 Google LLC
3140 *
3141 * Licensed under the Apache License, Version 2.0 (the "License");
3142 * you may not use this file except in compliance with the License.
3143 * You may obtain a copy of the License at
3144 *
3145 *   http://www.apache.org/licenses/LICENSE-2.0
3146 *
3147 * Unless required by applicable law or agreed to in writing, software
3148 * distributed under the License is distributed on an "AS IS" BASIS,
3149 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3150 * See the License for the specific language governing permissions and
3151 * limitations under the License.
3152 */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 dE(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i($){$.path.charAt($.path.length-1)==="/"&&($.path_=$.path_.slice(0,-1))}const a="(/(.*))?$",u=new RegExp("^gs://"+s+a,"i"),l={bucket:1,path:3};function d($){$.path_=decodeURIComponent($.path)}const p="v[A-Za-z0-9_]+",y=t.replace(/[.]/g,"\\."),I="(/([^?#]*).*)?$",P=new RegExp(`^https?://${y}/${p}/b/${s}/o${I}`,"i"),k={bucket:1,path:3},V=t===id?"(?:storage.googleapis.com|storage.cloud.google.com)":t,C="([^?#]*)",B=new RegExp(`^https?://${V}/${s}/${C}`,"i"),q=[{regex:u,indices:l,postModify:i},{regex:P,indices:k,postModify:d},{regex:B,indices:{bucket:1,path:2},postModify:d}];for(let $=0;$<q.length;$++){const le=q[$],J=le.regex.exec(e);if(J){const E=J[le.indices.bucket];let m=J[le.indices.path];m||(m=""),r=new be(E,m),le.postModify(r);break}}if(r==null)throw hE(e);return r}}class yE{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3153 * @license
3154 * Copyright 2017 Google LLC
3155 *
3156 * Licensed under the Apache License, Version 2.0 (the "License");
3157 * you may not use this file except in compliance with the License.
3158 * You may obtain a copy of the License at
3159 *
3160 *   http://www.apache.org/licenses/LICENSE-2.0
3161 *
3162 * Unless required by applicable law or agreed to in writing, software
3163 * distributed under the License is distributed on an "AS IS" BASIS,
3164 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3165 * See the License for the specific language governing permissions and
3166 * limitations under the License.
3167 */function vE(n,e,t){let r=1,s=null,i=null,a=!1,u=0;function l(){return u===2}let d=!1;function p(...C){d||(d=!0,e.apply(null,C))}function y(C){s=setTimeout(()=>{s=null,n(P,l())},C)}function I(){i&&clearTimeout(i)}function P(C,...B){if(d){I();return}if(C){I(),p.call(null,C,...B);return}if(l()||a){I(),p.call(null,C,...B);return}r<64&&(r*=2);let q;u===1?(u=2,q=0):q=(r+Math.random())*1e3,y(q)}let k=!1;function V(C){k||(k=!0,I(),!d&&(s!==null?(C||(u=2),clearTimeout(s),y(0)):C||(u=1)))}return y(0),i=setTimeout(()=>{a=!0,V(!0)},t),V}function EE(n){n(!1)}/**
3168 * @license
3169 * Copyright 2017 Google LLC
3170 *
3171 * Licensed under the Apache License, Version 2.0 (the "License");
3172 * you may not use this file except in compliance with the License.
3173 * You may obtain a copy of the License at
3174 *
3175 *   http://www.apache.org/licenses/LICENSE-2.0
3176 *
3177 * Unless required by applicable law or agreed to in writing, software
3178 * distributed under the License is distributed on an "AS IS" BASIS,
3179 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3180 * See the License for the specific language governing permissions and
3181 * limitations under the License.
3182 */function TE(n){return n!==void 0}function IE(n){return typeof n=="object"&&!Array.isArray(n)}function ha(n){return typeof n=="string"||n instanceof String}function Bu(n){return da()&&n instanceof Blob}function da(){return typeof Blob<"u"}function ao(n,e,t,r){if(r<e)throw oo(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw oo(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3183 * @license
3184 * Copyright 2017 Google LLC
3185 *
3186 * Licensed under the Apache License, Version 2.0 (the "License");
3187 * you may not use this file except in compliance with the License.
3188 * You may obtain a copy of the License at
3189 *
3190 *   http://www.apache.org/licenses/LICENSE-2.0
3191 *
3192 * Unless required by applicable law or agreed to in writing, software
3193 * distributed under the License is distributed on an "AS IS" BASIS,
3194 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3195 * See the License for the specific language governing permissions and
3196 * limitations under the License.
3197 */function Rn(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function cd(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 Lt;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(Lt||(Lt={}));/**
3198 * @license
3199 * Copyright 2022 Google LLC
3200 *
3201 * Licensed under the Apache License, Version 2.0 (the "License");
3202 * you may not use this file except in compliance with the License.
3203 * You may obtain a copy of the License at
3204 *
3205 *   http://www.apache.org/licenses/LICENSE-2.0
3206 *
3207 * Unless required by applicable law or agreed to in writing, software
3208 * distributed under the License is distributed on an "AS IS" BASIS,
3209 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3210 * See the License for the specific language governing permissions and
3211 * limitations under the License.
3212 */function wE(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3213 * @license
3214 * Copyright 2017 Google LLC
3215 *
3216 * Licensed under the Apache License, Version 2.0 (the "License");
3217 * you may not use this file except in compliance with the License.
3218 * You may obtain a copy of the License at
3219 *
3220 *   http://www.apache.org/licenses/LICENSE-2.0
3221 *
3222 * Unless required by applicable law or agreed to in writing, software
3223 * distributed under the License is distributed on an "AS IS" BASIS,
3224 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3225 * See the License for the specific language governing permissions and
3226 * limitations under the License.
3227 */class AE{constructor(e,t,r,s,i,a,u,l,d,p,y,I=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=u,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=p,this.connectionFactory_=y,this.retry=I,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((P,k)=>{this.resolve_=P,this.reject_=k,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new ns(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=u=>{const l=u.loaded,d=u.lengthComputable?u.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 u=i.getErrorCode()===Lt.NO_ERROR,l=i.getStatus();if(!u||wE(l,this.additionalRetryCodes_)&&this.retry){const p=i.getErrorCode()===Lt.ABORT;r(!1,new ns(!1,null,p));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new ns(d,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,u=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(u,u.getResponse());TE(l)?i(l):i()}catch(l){a(l)}else if(u!==null){const l=la();l.serverResponse=u.getErrorText(),this.errorCallback_?a(this.errorCallback_(u,l)):a(l)}else if(s.canceled){const l=this.appDelete_?ad():lE();a(l)}else{const l=uE();a(l)}};this.canceled_?t(!1,new ns(!1,null,!0)):this.backoffId_=vE(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&EE(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ns{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function RE(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function PE(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function bE(n,e){e&&(n["X-Firebase-GMPID"]=e)}function SE(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}
3227function CE(n,e,t,r,s,i,a=!0){const u=cd(n.urlParams),l=n.url+u,d=Object.assign({},n.headers);return bE(d,e),RE(d,t),PE(d,i),SE(d,r),new AE(l,n.method,d,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a)}/**
3228 * @license
3229 * Copyright 2017 Google LLC
3230 *
3231 * Licensed under the Apache License, Version 2.0 (the "License");
3232 * you may not use this file except in compliance with the License.
3233 * You may obtain a copy of the License at
3234 *
3235 *   http://www.apache.org/licenses/LICENSE-2.0
3236 *
3237 * Unless required by applicable law or agreed to in writing, software
3238 * distributed under the License is distributed on an "AS IS" BASIS,
3239 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3240 * See the License for the specific language governing permissions and
3241 * limitations under the License.
3242 */function kE(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function NE(...n){const e=kE();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(da())return new Blob(n);throw new se(re.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function DE(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3243 * @license
3244 * Copyright 2021 Google LLC
3245 *
3246 * Licensed under the Apache License, Version 2.0 (the "License");
3247 * you may not use this file except in compliance with the License.
3248 * You may obtain a copy of the License at
3249 *
3250 *   http://www.apache.org/licenses/LICENSE-2.0
3251 *
3252 * Unless required by applicable law or agreed to in writing, software
3253 * distributed under the License is distributed on an "AS IS" BASIS,
3254 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3255 * See the License for the specific language governing permissions and
3256 * limitations under the License.
3257 */function VE(n){if(typeof atob>"u")throw gE("base-64");return atob(n)}/**
3258 * @license
3259 * Copyright 2017 Google LLC
3260 *
3261 * Licensed under the Apache License, Version 2.0 (the "License");
3262 * you may not use this file except in compliance with the License.
3263 * You may obtain a copy of the License at
3264 *
3265 *   http://www.apache.org/licenses/LICENSE-2.0
3266 *
3267 * Unless required by applicable law or agreed to in writing, software
3268 * distributed under the License is distributed on an "AS IS" BASIS,
3269 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3270 * See the License for the specific language governing permissions and
3271 * limitations under the License.
3272 */const Fe={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Oi{constructor(e,t){this.data=e,this.contentType=t||null}}function OE(n,e){switch(n){case Fe.RAW:return new Oi(ud(e));case Fe.BASE64:case Fe.BASE64URL:return new Oi(ld(n,e));case Fe.DATA_URL:return new Oi(ME(e),xE(e))}throw la()}function ud(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 LE(n){let e;try{e=decodeURIComponent(n)}catch{throw nr(Fe.DATA_URL,"Malformed data URL.")}return ud(e)}function ld(n,e){switch(n){case Fe.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 Fe.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=VE(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 hd{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw nr(Fe.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=UE(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function ME(n){const e=new hd(n);return e.base64?ld(Fe.BASE64,e.rest):LE(e.rest)}function xE(n){return new hd(n).contentType}function UE(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3273 * @license
3274 * Copyright 2017 Google LLC
3275 *
3276 * Licensed under the Apache License, Version 2.0 (the "License");
3277 * you may not use this file except in compliance with the License.
3278 * You may obtain a copy of the License at
3279 *
3280 *   http://www.apache.org/licenses/LICENSE-2.0
3281 *
3282 * Unless required by applicable law or agreed to in writing, software
3283 * distributed under the License is distributed on an "AS IS" BASIS,
3284 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3285 * See the License for the specific language governing permissions and
3286 * limitations under the License.
3287 */class _t{constructor(e,t){let r=0,s="";Bu(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(Bu(this.data_)){const r=this.data_,s=DE(r,e,t);return s===null?null:new _t(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new _t(r,!0)}}static getBlob(...e){if(da()){const t=e.map(r=>r instanceof _t?r.data_:r);return new _t(NE.apply(null,t))}else{const t=e.map(a=>ha(a)?OE(Fe.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 u=0;u<a.length;u++)s[i++]=a[u]}),new _t(s,!0)}}uploadData(){return this.data_}}/**
3288 * @license
3289 * Copyright 2017 Google LLC
3290 *
3291 * Licensed under the Apache License, Version 2.0 (the "License");
3292 * you may not use this file except in compliance with the License.
3293 * You may obtain a copy of the License at
3294 *
3295 *   http://www.apache.org/licenses/LICENSE-2.0
3296 *
3297 * Unless required by applicable law or agreed to in writing, software
3298 * distributed under the License is distributed on an "AS IS" BASIS,
3299 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3300 * See the License for the specific language governing permissions and
3301 * limitations under the License.
3302 */function fa(n){let e;try{e=JSON.parse(n)}catch{return null}return IE(e)?e:null}/**
3303 * @license
3304 * Copyright 2017 Google LLC
3305 *
3306 * Licensed under the Apache License, Version 2.0 (the "License");
3307 * you may not use this file except in compliance with the License.
3308 * You may obtain a copy of the License at
3309 *
3310 *   http://www.apache.org/licenses/LICENSE-2.0
3311 *
3312 * Unless required by applicable law or agreed to in writing, software
3313 * distributed under the License is distributed on an "AS IS" BASIS,
3314 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3315 * See the License for the specific language governing permissions and
3316 * limitations under the License.
3317 */function FE(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function BE(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function dd(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3318 * @license
3319 * Copyright 2017 Google LLC
3320 *
3321 * Licensed under the Apache License, Version 2.0 (the "License");
3322 * you may not use this file except in compliance with the License.
3323 * You may obtain a copy of the License at
3324 *
3325 *   http://www.apache.org/licenses/LICENSE-2.0
3326 *
3327 * Unless required by applicable law or agreed to in writing, software
3328 * distributed under the License is distributed on an "AS IS" BASIS,
3329 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3330 * See the License for the specific language governing permissions and
3331 * limitations under the License.
3332 */function qE(n,e){return e}class Pe{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||qE}}let rs=null;function jE(n){return!ha(n)||n.length<2?n:dd(n)}function pa(){if(rs)return rs;const n=[];n.push(new Pe("bucket")),n.push(new Pe("generation")),n.push(new Pe("metageneration")),n.push(new Pe("name","fullPath",!0));function e(i,a){return jE(a)}const t=new Pe("name");t.xform=e,n.push(t);function r(i,a){return a!==void 0?Number(a):a}const s=new Pe("size");
3332return s.xform=r,n.push(s),n.push(new Pe("timeCreated")),n.push(new Pe("updated")),n.push(new Pe("md5Hash",null,!0)),n.push(new Pe("cacheControl",null,!0)),n.push(new Pe("contentDisposition",null,!0)),n.push(new Pe("contentEncoding",null,!0)),n.push(new Pe("contentLanguage",null,!0)),n.push(new Pe("contentType",null,!0)),n.push(new Pe("metadata","customMetadata",!0)),rs=n,rs}function $E(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 zE(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 $E(r,n),r}function fd(n,e,t){const r=fa(e);return r===null?null:zE(n,r,t)}function HE(n,e,t,r){const s=fa(e);if(s===null||!ha(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>{const p=n.bucket,y=n.fullPath,I="/b/"+a(p)+"/o/"+a(y),P=Rn(I,t,r),k=cd({alt:"media",token:d});return P+k})[0]}function WE(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)}/**
3333 * @license
3334 * Copyright 2019 Google LLC
3335 *
3336 * Licensed under the Apache License, Version 2.0 (the "License");
3337 * you may not use this file except in compliance with the License.
3338 * You may obtain a copy of the License at
3339 *
3340 *   http://www.apache.org/licenses/LICENSE-2.0
3341 *
3342 * Unless required by applicable law or agreed to in writing, software
3343 * distributed under the License is distributed on an "AS IS" BASIS,
3344 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3345 * See the License for the specific language governing permissions and
3346 * limitations under the License.
3347 */const qu="prefixes",ju="items";function KE(n,e,t){const r={prefixes:[],items:[],nextPageToken:t.nextPageToken};if(t[qu])for(const s of t[qu]){const i=s.replace(/\/$/,""),a=n._makeStorageReference(new be(e,i));r.prefixes.push(a)}if(t[ju])for(const s of t[ju]){const i=n._makeStorageReference(new be(e,s.name));r.items.push(i)}return r}function GE(n,e,t){const r=fa(t);return r===null?null:KE(n,e,r)}class kr{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=[]}}/**
3348 * @license
3349 * Copyright 2017 Google LLC
3350 *
3351 * Licensed under the Apache License, Version 2.0 (the "License");
3352 * you may not use this file except in compliance with the License.
3353 * You may obtain a copy of the License at
3354 *
3355 *   http://www.apache.org/licenses/LICENSE-2.0
3356 *
3357 * Unless required by applicable law or agreed to in writing, software
3358 * distributed under the License is distributed on an "AS IS" BASIS,
3359 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3360 * See the License for the specific language governing permissions and
3361 * limitations under the License.
3362 */function ma(n){if(!n)throw la()}function pd(n,e){function t(r,s){const i=fd(n,s,e);return ma(i!==null),i}return t}function QE(n,e){function t(r,s){const i=GE(n,e,s);return ma(i!==null),i}return t}function YE(n,e){function t(r,s){const i=fd(n,s,e);return ma(i!==null),HE(i,s,n.host,n._protocol)}return t}function ga(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=aE():s=oE():t.getStatus()===402?s=iE(n.bucket):t.getStatus()===403?s=cE(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function _a(n){const e=ga(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=sE(n.path)),i.serverResponse=s.serverResponse,i}return t}function XE(n,e,t){const r=e.fullServerUrl(),s=Rn(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,u=new kr(s,i,pd(n,t),a);return u.errorHandler=_a(e),u}function JE(n,e,t,r,s){const i={};e.isRoot?i.prefix="":i.prefix=e.path+"/",t.length>0&&(i.delimiter=t),r&&(i.pageToken=r),s&&(i.maxResults=s);const a=e.bucketOnlyServerUrl(),u=Rn(a,n.host,n._protocol),l="GET",d=n.maxOperationRetryTime,p=new kr(u,l,QE(n,e.bucket),d);
3362return p.urlParams=i,p.errorHandler=ga(e),p}function ZE(n,e,t){const r=e.fullServerUrl(),s=Rn(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,u=new kr(s,i,YE(n,t),a);return u.errorHandler=_a(e),u}function eT(n,e){const t=e.fullServerUrl(),r=Rn(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function a(l,d){}const u=new kr(r,s,a,i);return u.successCodes=[200,204],u.errorHandler=_a(e),u}function tT(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function nT(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=tT(null,e)),r}function rT(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function u(){let q="";for(let $=0;$<2;$++)q=q+Math.random().toString().slice(2);return q}const l=u();a["Content-Type"]="multipart/related; boundary="+l;const d=nT(e,r,s),p=WE(d,t),y="--"+l+`\r
3363Content-Type: application/json; charset=utf-8\r
3364\r
3365`+p+`\r
3366--`+l+`\r
3367Content-Type: `+d.contentType+`\r
3368\r
3369`,I=`\r
3370--`+l+"--",P=_t.getBlob(y,r,I);if(P===null)throw pE();const k={name:d.fullPath},V=Rn(i,n.host,n._protocol),C="POST",B=n.maxUploadRetryTime,j=new kr(V,C,pd(n,t),B);return j.urlParams=k,j.headers=a,j.body=P.uploadData(),j.errorHandler=ga(e),j}class sT{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Lt.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Lt.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Lt.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw zn("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 zn("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw zn("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw zn("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw zn("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 iT extends sT{initXhr(){this.xhr_.responseType="text"}}function Nr(){return new iT}/**
3371 * @license
3372 * Copyright 2019 Google LLC
3373 *
3374 * Licensed under the Apache License, Version 2.0 (the "License");
3375 * you may not use this file except in compliance with the License.
3376 * You may obtain a copy of the License at
3377 *
3378 *   http://www.apache.org/licenses/LICENSE-2.0
3379 *
3380 * Unless required by applicable law or agreed to in writing, software
3381 * distributed under the License is distributed on an "AS IS" BASIS,
3382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3383 * See the License for the specific language governing permissions and
3384 * limitations under the License.
3385 */class Bt{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 Bt(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 dd(this._location.path)}get storage(){return this._service}get parent(){const e=FE(this._location.path);if(e===null)return null;const t=new be(this._location.bucket,e);return new Bt(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw _E(e)}}function oT(n,e,t){n._throwIfRoot("uploadBytes");const r=rT(n.storage,n._location,pa(),new _t(e,!0),t);return n.storage.makeRequestWithTokens(r,Nr).then(s=>({metadata:s,ref:n}))}function aT(n){const e={prefixes:[],items:[]};return md(n,e).then(()=>e)}async function md(n,e,t){const s=await cT(n,{pageToken:t});e.prefixes.push(...s.prefixes),e.items.push(...s.items),s.nextPageToken!=null&&await md(n,e,s.nextPageToken)}function cT(n,e){e!=null&&typeof e.maxResults=="number"&&ao("options.maxResults",1,1e3,e.maxResults);const t=e||{},r=JE(n.storage,n._location,"/",t.pageToken,t.maxResults);return n.storage.makeRequestWithTokens(r,Nr)}function uT(n){n._throwIfRoot("getMetadata");const e=XE(n.storage,n._location,pa());return n.storage.makeRequestWithTokens(e,Nr)}function lT(n){n._throwIfRoot("getDownloadURL");const e=ZE(n.storage,n._location,pa());return n.storage.makeRequestWithTokens(e,Nr).then(t=>{if(t===null)throw mE();return t})}function hT(n){n._throwIfRoot("deleteObject");const e=eT(n.storage,n._location);return n.storage.makeRequestWithTokens(e,Nr)}function dT(n,e){const t=BE(n._location.path,e),r=new be(n._location.bucket,t);return new Bt(n.storage,r)}/**
3386 * @license
3387 * Copyright 2017 Google LLC
3388 *
3389 * Licensed under the Apache License, Version 2.0 (the "License");
3390 * you may not use this file except in compliance with the License.
3391 * You may obtain a copy of the License at
3392 *
3393 *   http://www.apache.org/licenses/LICENSE-2.0
3394 *
3395 * Unless required by applicable law or agreed to in writing, software
3396 * distributed under the License is distributed on an "AS IS" BASIS,
3397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3398 * See the License for the specific language governing permissions and
3399 * limitations under the License.
3400 */function fT(n){return/^[A-Za-z]+:\/\//.test(n)}function pT(n,e){return new Bt(n,e)}function gd(n,e){if(n instanceof ya){const t=n;if(t._bucket==null)throw fE();const r=new Bt(t,t._bucket);return e!=null?gd(r,e):r}else return e!==void 0?dT(n,e):n}function mT(n,e){if(e&&fT(e)){if(n instanceof ya)return pT(n,e);throw oo("To use ref(service, url), the first argument must be a Storage instance.")}else return gd(n,e)}function $u(n,e){const t=e==null?void 0:e[od];return t==null?null:be.makeFromBucketSpec(t,n)}function gT(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:s}=r;s&&(n._overrideAuthToken=typeof s=="string"?s:bf(s,n.app.options.projectId))}class ya{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=id,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=nE,this._maxUploadRetryTime=rE,this._requests=new Set,s!=null?this._bucket=be.makeFromBucketSpec(s,this._host):this._bucket=$u(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=$u(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ao("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ao("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(){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 Bt(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new yE(ad());{const a=CE(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 zu="@firebase/storage",Hu="0.13.2";/**
3401 * @license
3402 * Copyright 2020 Google LLC
3403 *
3404 * Licensed under the Apache License, Version 2.0 (the "License");
3405 * you may not use this file except in compliance with the License.
3406 * You may obtain a copy of the License at
3407 *
3408 *   http://www.apache.org/licenses/LICENSE-2.0
3409 *
3410 * Unless required by applicable law or agreed to in writing, software
3411 * distributed under the License is distributed on an "AS IS" BASIS,
3412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3413 * See the License for the specific language governing permissions and
3414 * limitations under the License.
3415 */const _d="storage";function OI(n,e,t){return n=Y(n),oT(n,e,t)}function LI(n){return n=Y(n),uT(n)}function MI(n){return n=Y(n),aT(n)}function xI(n){return n=Y(n),lT(n)}function UI(n){return n=Y(n),hT(n)}function FI(n,e){return n=Y(n),mT(n,e)}function BI(n=rl(),e){n=Y(n);const r=gn(n,_d).getImmediate({identifier:e}),s=Rf("storage");return s&&_T(r,...s),r}function _T(n,e,t,r={}){gT(n,e,t,r)}function yT(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new ya(t,r,s,e,$t)}function vT(){rt(new ze(_d,yT,"PUBLIC").setMultipleInstances(!0)),Oe(zu,Hu,""),Oe(zu,Hu,"esm2017")}vT();const yd="@firebase/installations",va="0.6.9";/**
3416 * @license
3417 * Copyright 2019 Google LLC
3418 *
3419 * Licensed under the Apache License, Version 2.0 (the "License");
3420 * you may not use this file except in compliance with the License.
3421 * You may obtain a copy of the License at
3422 *
3423 *   http://www.apache.org/licenses/LICENSE-2.0
3424 *
3425 * Unless required by applicable law or agreed to in writing, software
3426 * distributed under the License is distributed on an "AS IS" BASIS,
3427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3428 * See the License for the specific language governing permissions and
3429 * limitations under the License.
3430 */const vd=1e4,Ed=`w:${va}`,Td="FIS_v2",ET="https://firebaseinstallations.googleapis.com/v1",TT=60*60*1e3,IT="installations",wT="Installations";/**
3431 * @license
3432 * Copyright 2019 Google LLC
3433 *
3434 * Licensed under the Apache License, Version 2.0 (the "License");
3435 * you may not use this file except in compliance with the License.
3436 * You may obtain a copy of the License at
3437 *
3438 *   http://www.apache.org/licenses/LICENSE-2.0
3439 *
3440 * Unless required by applicable law or agreed to in writing, software
3441 * distributed under the License is distributed on an "AS IS" BASIS,
3442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3443 * See the License for the specific language governing permissions and
3444 * limitations under the License.
3445 */const AT={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},qt=new mn(IT,wT,AT);function Id(n){return n instanceof Ue&&n.code.includes("request-failed")}/**
3446 * @license
3447 * Copyright 2019 Google LLC
3448 *
3449 * Licensed under the Apache License, Version 2.0 (the "License");
3450 * you may not use this file except in compliance with the License.
3451 * You may obtain a copy of the License at
3452 *
3453 *   http://www.apache.org/licenses/LICENSE-2.0
3454 *
3455 * Unless required by applicable law or agreed to in writing, software
3456 * distributed under the License is distributed on an "AS IS" BASIS,
3457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3458 * See the License for the specific language governing permissions and
3459 * limitations under the License.
3460 */function wd({projectId:n}){return`${ET}/projects/${n}/installations`}function Ad(n){return{token:n.token,requestStatus:2,expiresIn:PT(n.expiresIn),creationTime:Date.now()}}async function Rd(n,e){const r=(await e.json()).error;return qt.create("request-failed",{requestName:n,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function Pd({apiKey:n}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n})}function RT(n,{refreshToken:e}){const t=Pd(n);return t.append("Authorization",bT(e)),t}async function bd(n){const e=await n();return e.status>=500&&e.status<600?n():e}function PT(n){return Number(n.replace("s","000"))}function bT(n){return`${Td} ${n}`}/**
3461 * @license
3462 * Copyright 2019 Google LLC
3463 *
3464 * Licensed under the Apache License, Version 2.0 (the "License");
3465 * you may not use this file except in compliance with the License.
3466 * You may obtain a copy of the License at
3467 *
3468 *   http://www.apache.org/licenses/LICENSE-2.0
3469 *
3470 * Unless required by applicable law or agreed to in writing, software
3471 * distributed under the License is distributed on an "AS IS" BASIS,
3472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3473 * See the License for the specific language governing permissions and
3474 * limitations under the License.
3475 */async function ST({appConfig:n,heartbeatServiceProvider:e},{fid:t}){const r=wd(n),s=Pd(n),i=e.getImmediate({optional:!0});if(i){const d=await i.getHeartbeatsHeader();d&&s.append("x-firebase-client",d)}const a={fid:t,authVersion:Td,appId:n.appId,sdkVersion:Ed},u={method:"POST",headers:s,body:JSON.stringify(a)},l=await bd(()=>fetch(r,u));if(l.ok){const d=await l.json();return{fid:d.fid||t,registrationStatus:2,refreshToken:d.refreshToken,authToken:Ad(d.authToken)}}else throw await Rd("Create Installation",l)}/**
3476 * @license
3477 * Copyright 2019 Google LLC
3478 *
3479 * Licensed under the Apache License, Version 2.0 (the "License");
3480 * you may not use this file except in compliance with the License.
3481 * You may obtain a copy of the License at
3482 *
3483 *   http://www.apache.org/licenses/LICENSE-2.0
3484 *
3485 * Unless required by applicable law or agreed to in writing, software
3486 * distributed under the License is distributed on an "AS IS" BASIS,
3487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3488 * See the License for the specific language governing permissions and
3489 * limitations under the License.
3490 */function Sd(n){return new Promise(e=>{setTimeout(e,n)})}/**
3491 * @license
3492 * Copyright 2019 Google LLC
3493 *
3494 * Licensed under the Apache License, Version 2.0 (the "License");
3495 * you may not use this file except in compliance with the License.
3496 * You may obtain a copy of the License at
3497 *
3498 *   http://www.apache.org/licenses/LICENSE-2.0
3499 *
3500 * Unless required by applicable law or agreed to in writing, software
3501 * distributed under the License is distributed on an "AS IS" BASIS,
3502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3503 * See the License for the specific language governing permissions and
3504 * limitations under the License.
3505 */function CT(n){return btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_")}/**
3506 * @license
3507 * Copyright 2019 Google LLC
3508 *
3509 * Licensed under the Apache License, Version 2.0 (the "License");
3510 * you may not use this file except in compliance with the License.
3511 * You may obtain a copy of the License at
3512 *
3513 *   http://www.apache.org/licenses/LICENSE-2.0
3514 *
3515 * Unless required by applicable law or agreed to in writing, software
3516 * distributed under the License is distributed on an "AS IS" BASIS,
3517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3518 * See the License for the specific language governing permissions and
3519 * limitations under the License.
3520 */const kT=/^[cdef][\w-]{21}$/,co="";function NT(){try{const n=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(n),n[0]=112+n[0]%16;const t=DT(n);return kT.test(t)?t:co}catch{return co}}function DT(n){return CT(n).substr(0,22)}/**
3521 * @license
3522 * Copyright 2019 Google LLC
3523 *
3524 * Licensed under the Apache License, Version 2.0 (the "License");
3525 * you may not use this file except in compliance with the License.
3526 * You may obtain a copy of the License at
3527 *
3528 *   http://www.apache.org/licenses/LICENSE-2.0
3529 *
3530 * Unless required by applicable law or agreed to in writing, software
3531 * distributed under the License is distributed on an "AS IS" BASIS,
3532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3533 * See the License for the specific language governing permissions and
3534 * limitations under the License.
3535 */function Qs(n){return`${n.appName}!${n.appId}`}/**
3536 * @license
3537 * Copyright 2019 Google LLC
3538 *
3539 * Licensed under the Apache License, Version 2.0 (the "License");
3540 * you may not use this file except in compliance with the License.
3541 * You may obtain a copy of the License at
3542 *
3543 *   http://www.apache.org/licenses/LICENSE-2.0
3544 *
3545 * Unless required by applicable law or agreed to in writing, software
3546 * distributed under the License is distributed on an "AS IS" BASIS,
3547 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3548 * See the License for the specific language governing permissions and
3549 * limitations under the License.
3550 */const Cd=new Map;function kd(n,e){const t=Qs(n);Nd(t,e),VT(t,e)}function Nd(n,e){const t=Cd.get(n);if(t)for(const r of t)r(e)}function VT(n,e){const t=OT();t&&t.postMessage({key:n,fid:e}),LT()}let Vt=null;function OT(){return!Vt&&"BroadcastChannel"in self&&(Vt=new BroadcastChannel("[Firebase] FID Change"),Vt.onmessage=n=>{Nd(n.data.key,n.data.fid)}),Vt}function LT(){Cd.size===0&&Vt&&(Vt.close(),Vt=null)}/**
3551 * @license
3552 * Copyright 2019 Google LLC
3553 *
3554 * Licensed under the Apache License, Version 2.0 (the "License");
3555 * you may not use this file except in compliance with the License.
3556 * You may obtain a copy of the License at
3557 *
3558 *   http://www.apache.org/licenses/LICENSE-2.0
3559 *
3560 * Unless required by applicable law or agreed to in writing, software
3561 * distributed under the License is distributed on an "AS IS" BASIS,
3562 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3563 * See the License for the specific language governing permissions and
3564 * limitations under the License.
3565 */const MT="firebase-installations-database",xT=1,jt="firebase-installations-store";let Li=null;function Ea(){return Li||(Li=nl(MT,xT,{upgrade:(n,e)=>
3565{switch(e){case 0:n.createObjectStore(jt)}}})),Li}async function Ss(n,e){const t=Qs(n),s=(await Ea()).transaction(jt,"readwrite"),i=s.objectStore(jt),a=await i.get(t);return await i.put(e,t),await s.done,(!a||a.fid!==e.fid)&&kd(n,e.fid),e}async function Dd(n){const e=Qs(n),r=(await Ea()).transaction(jt,"readwrite");await r.objectStore(jt).delete(e),await r.done}async function Ys(n,e){const t=Qs(n),s=(await Ea()).transaction(jt,"readwrite"),i=s.objectStore(jt),a=await i.get(t),u=e(a);return u===void 0?await i.delete(t):await i.put(u,t),await s.done,u&&(!a||a.fid!==u.fid)&&kd(n,u.fid),u}/**
3566 * @license
3567 * Copyright 2019 Google LLC
3568 *
3569 * Licensed under the Apache License, Version 2.0 (the "License");
3570 * you may not use this file except in compliance with the License.
3571 * You may obtain a copy of the License at
3572 *
3573 *   http://www.apache.org/licenses/LICENSE-2.0
3574 *
3575 * Unless required by applicable law or agreed to in writing, software
3576 * distributed under the License is distributed on an "AS IS" BASIS,
3577 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3578 * See the License for the specific language governing permissions and
3579 * limitations under the License.
3580 */async function Ta(n){let e;const t=await Ys(n.appConfig,r=>{const s=UT(r),i=FT(n,s);return e=i.registrationPromise,i.installationEntry});return t.fid===co?{installationEntry:await e}:{installationEntry:t,registrationPromise:e}}function UT(n){const e=n||{fid:NT(),registrationStatus:0};return Vd(e)}function FT(n,e){if(e.registrationStatus===0){if(!navigator.onLine){const s=Promise.reject(qt.create("app-offline"));return{installationEntry:e,registrationPromise:s}}const t={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=BT(n,t);return{installationEntry:t,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:qT(n)}:{installationEntry:e}}async function BT(n,e){try{const t=await ST(n,e);return Ss(n.appConfig,t)}catch(t){throw Id(t)&&t.customData.serverCode===409?await Dd(n.appConfig):await Ss(n.appConfig,{fid:e.fid,registrationStatus:0}),t}}async function qT(n){let e=await Wu(n.appConfig);for(;e.registrationStatus===1;)await Sd(100),e=await Wu(n.appConfig);if(e.registrationStatus===0){const{installationEntry:t,registrationPromise:r}=await Ta(n);return r||t}return e}function Wu(n){return Ys(n,e=>{if(!e)throw qt.create("installation-not-found");return Vd(e)})}function Vd(n){return jT(n)?{fid:n.fid,registrationStatus:0}:n}function jT(n){return n.registrationStatus===1&&n.registrationTime+vd<Date.now()}/**
3581 * @license
3582 * Copyright 2019 Google LLC
3583 *
3584 * Licensed under the Apache License, Version 2.0 (the "License");
3585 * you may not use this file except in compliance with the License.
3586 * You may obtain a copy of the License at
3587 *
3588 *   http://www.apache.org/licenses/LICENSE-2.0
3589 *
3590 * Unless required by applicable law or agreed to in writing, software
3591 * distributed under the License is distributed on an "AS IS" BASIS,
3592 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3593 * See the License for the specific language governing permissions and
3594 * limitations under the License.
3595 */async function $T({appConfig:n,heartbeatServiceProvider:e},t){const r=zT(n,t),s=RT(n,t),i=e.getImmediate({optional:!0});if(i){const d=await i.getHeartbeatsHeader();d&&s.append("x-firebase-client",d)}const a={installation:{sdkVersion:Ed,appId:n.appId}},u={method:"POST",headers:s,body:JSON.stringify(a)},l=await bd(()=>fetch(r,u));if(l.ok){const d=await l.json();return Ad(d)}else throw await Rd("Generate Auth Token",l)}function zT(n,{fid:e}){return`${wd(n)}/${e}/authTokens:generate`}/**
3596 * @license
3597 * Copyright 2019 Google LLC
3598 *
3599 * Licensed under the Apache License, Version 2.0 (the "License");
3600 * you may not use this file except in compliance with the License.
3601 * You may obtain a copy of the License at
3602 *
3603 *   http://www.apache.org/licenses/LICENSE-2.0
3604 *
3605 * Unless required by applicable law or agreed to in writing, software
3606 * distributed under the License is distributed on an "AS IS" BASIS,
3607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3608 * See the License for the specific language governing permissions and
3609 * limitations under the License.
3610 */async function Ia(n,e=!1){let t;const r=await Ys(n.appConfig,i=>{if(!Od(i))throw qt.create("not-registered");const a=i.authToken;if(!e&&KT(a))return i;if(a.requestStatus===1)return t=HT(n,e),i;{if(!navigator.onLine)throw qt.create("app-offline");const u=QT(i);return t=WT(n,u),u}});return t?await t:r.authToken}async function HT(n,e){let t=await Ku(n.appConfig);for(;t.authToken.requestStatus===1;)await Sd(100),t=await Ku(n.appConfig);const r=t.authToken;return r.requestStatus===0?Ia(n,e):r}function Ku(n){return Ys(n,e=>{if(!Od(e))throw qt.create("not-registered");const t=e.authToken;return YT(t)?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}async function WT(n,e){try{const t=await $T(n,e),r=Object.assign(Object.assign({},e),{authToken:t});return await Ss(n.appConfig,r),t}catch(t){if(Id(t)&&(t.customData.serverCode===401||t.customData.serverCode===404))await Dd(n.appConfig);else{const r=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await Ss(n.appConfig,r)}throw t}}function Od(n){return n!==void 0&&n.registrationStatus===2}function KT(n){return n.requestStatus===2&&!GT(n)}function GT(n){const e=Date.now();return e<n.creationTime||n.creationTime+n.expiresIn<e+TT}function QT(n){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},n),{authToken:e})}function YT(n){return n.requestStatus===1&&n.requestTime+vd<Date.now()}/**
3611 * @license
3612 * Copyright 2019 Google LLC
3613 *
3614 * Licensed under the Apache License, Version 2.0 (the "License");
3615 * you may not use this file except in compliance with the License.
3616 * You may obtain a copy of the License at
3617 *
3618 *   http://www.apache.org/licenses/LICENSE-2.0
3619 *
3620 * Unless required by applicable law or agreed to in writing, software
3621 * distributed under the License is distributed on an "AS IS" BASIS,
3622 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3623 * See the License for the specific language governing permissions and
3624 * limitations under the License.
3625 */async function XT(n){const e=n,{installationEntry:t,registrationPromise:r}=await Ta(e);return r?r.catch(console.error):Ia(e).catch(console.error),t.fid}/**
3626 * @license
3627 * Copyright 2019 Google LLC
3628 *
3629 * Licensed under the Apache License, Version 2.0 (the "License");
3630 * you may not use this file except in compliance with the License.
3631 * You may obtain a copy of the License at
3632 *
3633 *   http://www.apache.org/licenses/LICENSE-2.0
3634 *
3635 * Unless required by applicable law or agreed to in writing, software
3636 * distributed under the License is distributed on an "AS IS" BASIS,
3637 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3638 * See the License for the specific language governing permissions and
3639 * limitations under the License.
3640 */async function JT(n,e=!1){const t=n;return await ZT(t),(await Ia(t,e)).token}async function ZT(n){const{registrationPromise:e}=await Ta(n);e&&await e}/**
3641 * @license
3642 * Copyright 2019 Google LLC
3643 *
3644 * Licensed under the Apache License, Version 2.0 (the "License");
3645 * you may not use this file except in compliance with the License.
3646 * You may obtain a copy of the License at
3647 *
3648 *   http://www.apache.org/licenses/LICENSE-2.0
3649 *
3650 * Unless required by applicable law or agreed to in writing, software
3651 * distributed under the License is distributed on an "AS IS" BASIS,
3652 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3653 * See the License for the specific language governing permissions and
3654 * limitations under the License.
3655 */function eI(n){if(!n||!n.options)throw Mi("App Configuration");if(!n.name)throw Mi("App Name");const e=["projectId","apiKey","appId"];for(const t of e)if(!n.options[t])throw Mi(t);return{appName:n.name,projectId:n.options.projectId,apiKey:n.options.apiKey,appId:n.options.appId}}function Mi(n){return qt.create("missing-app-config-values",{valueName:n})}/**
3656 * @license
3657 * Copyright 2020 Google LLC
3658 *
3659 * Licensed under the Apache License, Version 2.0 (the "License");
3660 * you may not use this file except in compliance with the License.
3661 * You may obtain a copy of the License at
3662 *
3663 *   http://www.apache.org/licenses/LICENSE-2.0
3664 *
3665 * Unless required by applicable law or agreed to in writing, software
3666 * distributed under the License is distributed on an "AS IS" BASIS,
3667 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3668 * See the License for the specific language governing permissions and
3669 * limitations under the License.
3670 */const Ld="installations",tI="installations-internal",nI=n=>{const e=n.getProvider("app").getImmediate(),t=eI(e),r=gn(e,"heartbeat");return{app:e,appConfig:t,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},rI=n=>{const e=n.getProvider("app").getImmediate(),t=gn(e,Ld).getImmediate();return{getId:()=>XT(t),getToken:s=>JT(t,s)}};function sI(){rt(new ze(Ld,nI,"PUBLIC")),rt(new ze(tI,rI,"PRIVATE"))}sI();Oe(yd,va);Oe(yd,va,"esm2017");export{kI as A,TI as B,ze as C,FI as D,xI as E,Ue as F,OI as G,VI as H,SI as I,UI as J,AI as K,mn as L,Mf as M,Lf as N,iI as O,nl as P,oI as Q,CI as R,MI as S,ce as T,LI as U,aI as V,rt as _,gn as a,Y as b,Rf as c,_I as d,dI as e,BI as f,rl as g,Dl as h,qp as i,II as j,zv as k,gI as l,wI as m,hI as n,lI as o,cI as p,yI as q,Oe as r,uI as s,DI as t,RI as u,NI as v,vI as w,EI as x,PI as y,bI as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.