PageSourceSearch

https://iteratingly.com/assets/js/brand.924cec70.js

js iteratingly.com collected 2026-10-02 01:32:31 UTC 474,734 bytes, 3,226 lines download raw bytes

1/**
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 Hc={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"};/**
17 * @license
18 * Copyright 2017 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 */const Kh=function(n,e){if(!n)throw Qh(e)},Qh=function(n){return new Error("Firebase Database ("+Hc.SDK_VERSION+") INTERNAL ASSERT FAILED: "+n)};/**
32 * @license
33 * Copyright 2017 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 Kc=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},Jh=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const o=n[t++];e[r++]=String.fromCharCode((i&31)<<6|o&63)}else if(i>239&&i<365){const o=n[t++],a=n[t++],u=n[t++],h=((i&7)<<18|(o&63)<<12|(a&63)<<6|u&63)-65536;e[r++]=String.fromCharCode(55296+(h>>10)),e[r++]=String.fromCharCode(56320+(h&1023))}else{const o=n[t++],a=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(o&63)<<6|a&63)}}return e.join("")},Qc={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 i=0;i<n.length;i+=3){const o=n[i],a=i+1<n.length,u=a?n[i+1]:0,h=i+2<n.length,d=h?n[i+2]:0,p=o>>2,y=(o&3)<<4|u>>4;let A=(u&15)<<2|d>>6,S=d&63;h||(S=64,a||(A=64)),r.push(t[p],t[y],t[A],t[S])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Kc(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Jh(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){const o=t[n.charAt(i++)],u=i<n.length?t[n.charAt(i)]:0;++i;const d=i<n.length?t[n.charAt(i)]:64;++i;const y=i<n.length?t[n.charAt(i)]:64;if(++i,o==null||u==null||d==null||y==null)throw new Xh;const A=o<<2|u>>4;if(r.push(A),d!==64){const S=u<<4&240|d>>2;if(r.push(S),y!==64){const V=d<<6&192|y;r.push(V)}}}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)}}};
46class Xh extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Yh=function(n){const e=Kc(n);return Qc.encodeByteArray(e,!0)},qr=function(n){return Yh(n).replace(/\./g,"")},$r=function(n){try{return Qc.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
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 */function iv(n){return Jc(void 0,n)}function Jc(n,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:const t=e;return new Date(t.getTime());case Object:n===void 0&&(n={});break;case Array:n=[];break;default:return e}for(const t in e)!e.hasOwnProperty(t)||!Zh(t)||(n[t]=Jc(n[t],e[t]));return n}function Zh(n){return n!=="__proto__"}/**
62 * @license
63 * Copyright 2022 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 ed(){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.")}/**
77 * @license
78 * Copyright 2022 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 */const td=()=>ed().__FIREBASE_DEFAULTS__,nd=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n={}.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},rd=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&$r(n[1]);return e&&JSON.parse(e)},ai=()=>{try{return td()||nd()||rd()}catch(n){`${n}`;return}},Xc=n=>{var e,t;return(t=(e=ai())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Yc=n=>{const e=Xc(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]},Zc=()=>{var n;return(n=ai())===null||n===void 0?void 0:n.config},eu=n=>{var e;return(e=ai())===null||e===void 0?void 0:e[`_${n}`]};/**
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 */class id{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))}}}/**
107 * @license
108 * Copyright 2021 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 sd(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",i=n.iat||0,o=n.sub||n.user_id;if(!o)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:o,user_id:o,firebase:{sign_in_provider:"custom",identities:{}}},n),u="";return[qr(JSON.stringify(t)),qr(JSON.stringify(a)),u].join(".")}/**
122 * @license
123 * Copyright 2017 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 Ee(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function od(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ee())}function ad(){var n;const e=(n=ai())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function cd(){return typeof window<"u"||tu()}function tu(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function ud(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function ld(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function hd(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function dd(){const n=Ee();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function sv(){return Hc.NODE_ADMIN===!0}function fd(){return!ad()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function pd(){try{return typeof indexedDB=="object"}catch{return!1}}function md(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{var o;e(((o=i.error)===null||o===void 0?void 0:o.message)||"")}}catch(t){e(t)}})}/**
137 * @license
138 * Copyright 2017 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 gd="FirebaseError";
151class De extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=gd,Object.setPrototypeOf(this,De.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Jn.prototype.create)}}class Jn{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,o=this.errors[e],a=o?_d(o,r):"Error",u=`${this.serviceName}: ${a} (${i}).`;return new De(i,u,r)}}function _d(n,e){return n.replace(yd,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const yd=/\{\$([^}]+)}/g;/**
152 * @license
153 * Copyright 2017 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 */function Ca(n){return JSON.parse(n)}function ov(n){return JSON.stringify(n)}/**
167 * @license
168 * Copyright 2017 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 */const nu=function(n){let e={},t={},r={},i="";try{const o=n.split(".");e=Ca($r(o[0])||""),t=Ca($r(o[1])||""),i=o[2],r=t.d||{},delete t.d}catch{}return{header:e,claims:t,data:r,signature:i}},av=function(n){const e=nu(n),t=e.claims;return!!t&&typeof t=="object"&&t.hasOwnProperty("iat")},cv=function(n){const e=nu(n).claims;return typeof e=="object"&&e.admin===!0};/**
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 */function uv(n,e){return Object.prototype.hasOwnProperty.call(n,e)}function lv(n,e){if(Object.prototype.hasOwnProperty.call(n,e))return n[e]}function vd(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function hv(n,e,t){const r={};for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=e.call(t,n[i],i,n));return r}function zr(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const i of t){if(!r.includes(i))return!1;const o=n[i],a=e[i];if(ka(o)&&ka(a)){if(!zr(o,a))return!1}else if(o!==a)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function ka(n){return n!==null&&typeof n=="object"}/**
197 * @license
198 * Copyright 2017 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 */function Xn(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>
211{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}/**
212 * @license
213 * Copyright 2017 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 */class dv{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=512/8,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(e,t){t||(t=0);const r=this.W_;if(typeof e=="string")for(let y=0;y<16;y++)r[y]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let y=0;y<16;y++)r[y]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let y=16;y<80;y++){const A=r[y-3]^r[y-8]^r[y-14]^r[y-16];r[y]=(A<<1|A>>>31)&4294967295}let i=this.chain_[0],o=this.chain_[1],a=this.chain_[2],u=this.chain_[3],h=this.chain_[4],d,p;for(let y=0;y<80;y++){y<40?y<20?(d=u^o&(a^u),p=1518500249):(d=o^a^u,p=1859775393):y<60?(d=o&a|u&(o|a),p=2400959708):(d=o^a^u,p=3395469782);const A=(i<<5|i>>>27)+d+h+p+r[y]&4294967295;h=u,u=a,a=(o<<30|o>>>2)&4294967295,o=i,i=A}this.chain_[0]=this.chain_[0]+i&4294967295,this.chain_[1]=this.chain_[1]+o&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+u&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295}update(e,t){if(e==null)return;t===void 0&&(t=e.length);const r=t-this.blockSize;let i=0;const o=this.buf_;let a=this.inbuf_;for(;i<t;){if(a===0)for(;i<=r;)this.compress_(e,i),i+=this.blockSize;if(typeof e=="string"){for(;i<t;)if(o[a]=e.charCodeAt(i),++a,++i,a===this.blockSize){this.compress_(o),a=0;break}}else for(;i<t;)if(o[a]=e[i],++a,++i,a===this.blockSize){this.compress_(o),a=0;break}}this.inbuf_=a,this.total_+=t}digest(){const e=[];let t=this.total_*8;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let i=this.blockSize-1;i>=56;i--)this.buf_[i]=t&255,t/=256;this.compress_(this.buf_);let r=0;for(let i=0;i<5;i++)for(let o=24;o>=0;o-=8)e[r]=this.chain_[i]>>o&255,++r;return e}}function Ed(n,e){const t=new Td(n,e);return t.subscribe.bind(t)}class Td{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 i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");Id(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=Xi),i.error===void 0&&(i.error=Xi),i.complete===void 0&&(i.complete=Xi);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),o}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Id(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 Xi(){}function fv(n,e){return`${n} failed: ${e} argument `}/**
227 * @license
228 * Copyright 2017 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 pv=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);if(i>=55296&&i<=56319){const o=i-55296;r++,Kh(r<n.length,"Surrogate pair missing trail surrogate.");const a=n.charCodeAt(r)-56320;i=65536+(o<<10)+a}i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):i<65536?(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},mv=function(n){let e=0;for(let t=0;t<n.length;t++){const r=n.charCodeAt(t);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,t++):e+=3}return e};/**
242 * @license
243 * Copyright 2021 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 */function se(n){return n&&n._delegate?n._delegate:n}class ft{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}}/**
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 wt="[DEFAULT]";/**
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 wd{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 id;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(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(o){if(i)return null;throw o}else{if(i)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(Rd(e))try{this.getOrInitializeService({instanceIdentifier:wt})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const o=this.getOrInitializeService({instanceIdentifier:i});r.resolve(o)}catch{}}}}clearInstance(e=wt){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=wt){return this.instances.has(e)}getOptions(e=wt){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 i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[o,a]of this.instancesDeferred.entries()){const u=this.normalizeInstanceIdentifier(o);r===u&&a.resolve(i)}return i}onInit(e,t){var r;const i=this.normalizeInstanceIdentifier(t),o=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;o.add(e),this.onInitCallbacks.set(i,o);const a=this.instances.get(i);return a&&e(a,i),()=>{o.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const i of r)try{i(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:Ad(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=wt){return this.component?this.component.multipleInstances?e:wt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Ad(n){return n===wt?void 0:n}function Rd(n){return n.instantiationMode==="EAGER"}/**
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 */class ru{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 wd(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
302 * @license
303 * Copyright 2017 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, software
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 Vs=[];var B;(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"})(B||(B={}));const iu={debug:B.DEBUG,verbose:B.VERBOSE,info:B.INFO,warn:B.WARN,error:B.ERROR,silent:B.SILENT},bd=B.INFO,Sd={[B.DEBUG]:"log",[B.VERBOSE]:"log",[B.INFO]:"info",[B.WARN]:"warn",[B.ERROR]:"error"},Pd=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=Sd[e];if(i)console[i](`[${r}]  ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Ds{constructor(e){this.name=e,this._logLevel=bd,this._logHandler=Pd,this._userLogHandler=null,Vs.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in B))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?iu[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,B.DEBUG,...e),this._logHandler(this,B.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,B.VERBOSE,...e),this._logHandler(this,B.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,B.INFO,...e),this._logHandler(this,B.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,B.WARN,...e),this._logHandler(this,B.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,B.ERROR,...e),this._logHandler(this,B.ERROR,...e)}}function Cd(n){Vs.forEach(e=>{e.setLogLevel(n)})}function kd(n,e){for(const t of Vs){let r=null;e&&e.level&&(r=iu[e.level]),n===null?t.userLogHandler=null:t.userLogHandler=(i,o,...a)=>{const u=a.map(h=>{if(h==null)return null;if(typeof h=="string")return h;if(typeof h=="number"||typeof h=="boolean")return h.toString();if(h instanceof Error)return h.message;try{return JSON.stringify(h)}catch{return null}}).filter(h=>h).join(" ");o>=(r??i.logLevel)&&n({level:B[o].toLowerCase(),message:u,args:a,type:i.name})}}}const Vd=(n,e)=>e.some(t=>n instanceof t);let Va,Da;function Dd(){return Va||(Va=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Nd(){return Da||(Da=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const su=new WeakMap,cs=new WeakMap,ou=new WeakMap,Yi=new WeakMap,Ns=new WeakMap;function Od(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",o),n.removeEventListener("error",a)},o=()=>{t(lt(n.result)),i()},a=()=>{r(n.error),i()};n.addEventListener("success",o),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&su.set(t,n)}).catch(()=>{}),Ns.set(e,n),e}function Md(n){if(cs.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",o),n.removeEventListener("error",a),n.removeEventListener("abort",a)},o=()=>{t(),i()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",o),n.addEventListener("error",a),n.addEventListener("abort",a)});cs.set(n,e)}let us={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return cs.get(n);if(e==="objectStoreNames")return n.objectStoreNames||ou.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return lt(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 Ld(n){us=n(us)}
316function xd(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Zi(this),e,...t);return ou.set(r,e.sort?e.sort():[e]),lt(r)}:Nd().includes(n)?function(...e){return n.apply(Zi(this),e),lt(su.get(this))}:function(...e){return lt(n.apply(Zi(this),e))}}function Ud(n){return typeof n=="function"?xd(n):(n instanceof IDBTransaction&&Md(n),Vd(n,Dd())?new Proxy(n,us):n)}function lt(n){if(n instanceof IDBRequest)return Od(n);if(Yi.has(n))return Yi.get(n);const e=Ud(n);return e!==n&&(Yi.set(n,e),Ns.set(e,n)),e}const Zi=n=>Ns.get(n);function Fd(n,e,{blocked:t,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(n,e),u=lt(a);return r&&a.addEventListener("upgradeneeded",h=>{r(lt(a.result),h.oldVersion,h.newVersion,lt(a.transaction),h)}),t&&a.addEventListener("blocked",h=>t(h.oldVersion,h.newVersion,h)),u.then(h=>{o&&h.addEventListener("close",()=>o()),i&&h.addEventListener("versionchange",d=>i(d.oldVersion,d.newVersion,d))}).catch(()=>{}),u}const Bd=["get","getKey","getAll","getAllKeys","count"],jd=["put","add","delete","clear"],es=new Map;function Na(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(es.get(e))return es.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=jd.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Bd.includes(t)))return;const o=async function(a,...u){const h=this.transaction(a,i?"readwrite":"readonly");let d=h.store;return r&&(d=d.index(u.shift())),(await Promise.all([d[t](...u),i&&h.done]))[0]};return es.set(e,o),o}Ld(n=>({...n,get:(e,t,r)=>Na(e,t)||n.get(e,t,r),has:(e,t)=>!!Na(e,t)||n.has(e,t)}));/**
317 * @license
318 * Copyright 2019 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 */class qd{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if($d(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function $d(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Wr="@firebase/app",ls="0.10.13";/**
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 */const Ke=new Ds("@firebase/app"),zd="@firebase/app-compat",Wd="@firebase/analytics-compat",Gd="@firebase/analytics",Hd="@firebase/app-check-compat",Kd="@firebase/app-check",Qd="@firebase/auth",Jd="@firebase/auth-compat",Xd="@firebase/database",Yd="@firebase/data-connect",Zd="@firebase/database-compat",ef="@firebase/functions",tf="@firebase/functions-compat",nf="@firebase/installations",rf="@firebase/installations-compat",sf="@firebase/messaging",of="@firebase/messaging-compat",af="@firebase/performance",cf="@firebase/performance-compat",uf="@firebase/remote-config",lf="@firebase/remote-config-compat",hf="@firebase/storage",df="@firebase/storage-compat",ff="@firebase/firestore",pf="@firebase/vertexai-preview",mf="@firebase/firestore-compat",gf="firebase",_f="10.14.1";/**
347 * @license
348 * Copyright 2019 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 Fn="[DEFAULT]",yf={[Wr]:"fire-core",[zd]:"fire-core-compat",[Gd]:"fire-analytics",[Wd]:"fire-analytics-compat",[Kd]:"fire-app-check",[Hd]:"fire-app-check-compat",[Qd]:"fire-auth",[Jd]:"fire-auth-compat",[Xd]:"fire-rtdb",[Yd]:"fire-data-connect",[Zd]:"fire-rtdb-compat",[ef]:"fire-fn",[tf]:"fire-fn-compat",[nf]:"fire-iid",[rf]:"fire-iid-compat",[sf]:"fire-fcm",[of]:"fire-fcm-compat",[af]:"fire-perf",[cf]:"fire-perf-compat",[uf]:"fire-rc",[lf]:"fire-rc-compat",[hf]:"fire-gcs",[df]:"fire-gcs-compat",[ff]:"fire-fst",[mf]:"fire-fst-compat",[pf]:"fire-vertex","fire-js":"fire-js",[gf]:"fire-js-all"};/**
362 * @license
363 * Copyright 2019 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 */const pt=new Map,Kt=new Map,Qt=new Map;function hs(n,e){try{n.container.addComponent(e)}catch(t){Ke.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function vf(n,e){n.container.addOrOverwriteComponent(e)}function mt(n){const e=n.name;if(Qt.has(e))return Ke.debug(`There were multiple attempts to register component ${e}.`),!1;Qt.set(e,n);for(const t of pt.values())hs(t,n);for(const t of Kt.values())hs(t,n);return!0}function sn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Ef(n,e,t=Fn){sn(n,e).clearInstance(t)}function au(n){return n.options!==void 0}function Ne(n){return n.settings!==void 0}function Tf(){Qt.clear()}/**
377 * @license
378 * Copyright 2019 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 */const If={"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
391d-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."},Se=new Jn("app","Firebase",If);/**
392 * @license
393 * Copyright 2019 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 */class cu{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 ft("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 Se.create("app-deleted",{appName:this._name})}}/**
407 * @license
408 * Copyright 2023 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 wf extends cu{constructor(e,t,r,i){const o=t.automaticDataCollectionEnabled!==void 0?t.automaticDataCollectionEnabled:!1,a={name:r,automaticDataCollectionEnabled:o};if(e.apiKey!==void 0)super(e,a,i);else{const u=e;super(u.options,a,i)}this._serverConfig=Object.assign({automaticDataCollectionEnabled:o},t),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,Pe(Wr,ls,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){lu(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw Se.create("server-app-deleted")}}/**
422 * @license
423 * Copyright 2019 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 */const Vt=_f;function uu(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Fn,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw Se.create("bad-app-name",{appName:String(i)});if(t||(t=Zc()),!t)throw Se.create("no-options");const o=pt.get(i);if(o){if(zr(t,o.options)&&zr(r,o.config))return o;throw Se.create("duplicate-app",{appName:i})}const a=new ru(i);for(const h of Qt.values())a.addComponent(h);const u=new cu(t,r,a);return pt.set(i,u),u}function Af(n,e){if(cd()&&!tu())throw Se.create("invalid-server-app-environment");e.automaticDataCollectionEnabled===void 0&&(e.automaticDataCollectionEnabled=!1);let t;au(n)?t=n.options:t=n;const r=Object.assign(Object.assign({},e),t);r.releaseOnDeref!==void 0&&delete r.releaseOnDeref;const i=d=>[...d].reduce((p,y)=>Math.imul(31,p)+y.charCodeAt(0)|0,0);if(e.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw Se.create("finalization-registry-not-supported",{});const o=""+i(JSON.stringify(r)),a=Kt.get(o);if(a)return a.incRefCount(e.releaseOnDeref),a;const u=new ru(o);for(const d of Qt.values())u.addComponent(d);const h=new wf(t,e,o,u);return Kt.set(o,h),h}function ci(n=Fn){const e=pt.get(n);if(!e&&n===Fn&&Zc())return uu();if(!e)throw Se.create("no-app",{appName:n});return e}function Rf(){return Array.from(pt.values())}async function lu(n){let e=!1;const t=n.name;pt.has(t)?(e=!0,pt.delete(t)):Kt.has(t)&&n.decRefCount()<=0&&(Kt.delete(t),e=!0),e&&(await Promise.all(n.container.getProviders().map(r=>r.delete())),n.isDeleted=!0)}function Pe(n,e,t){var r;let i=(r=yf[n])!==null&&r!==void 0?r:n;t&&(i+=`-${t}`);const o=i.match(/\s|\//),a=e.match(/\s|\//);if(o||a){const u=[`Unable to register library "${i}" with version "${e}":`];o&&u.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&a&&u.push("and"),a&&u.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Ke.warn(u.join(" "));return}mt(new ft(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function bf(n,e){if(n!==null&&typeof n!="function")throw Se.create("invalid-log-argument");kd(n,e)}function Sf(n){Cd(n)}/**
437 * @license
438 * Copyright 2021 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, softw
446are
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 */const Pf="firebase-heartbeat-database",Cf=1,Bn="firebase-heartbeat-store";let ts=null;function hu(){return ts||(ts=Fd(Pf,Cf,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(Bn)}catch(t){console.warn(t)}}}}).catch(n=>{throw Se.create("idb-open",{originalErrorMessage:n.message})})),ts}async function kf(n){try{const t=(await hu()).transaction(Bn),r=await t.objectStore(Bn).get(du(n));return await t.done,r}catch(e){if(e instanceof De)Ke.warn(e.message);else{const t=Se.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Ke.warn(t.message)}}}async function Oa(n,e){try{const r=(await hu()).transaction(Bn,"readwrite");await r.objectStore(Bn).put(e,du(n)),await r.done}catch(t){if(t instanceof De)Ke.warn(t.message);else{const r=Se.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});Ke.warn(r.message)}}}function du(n){return`${n.name}!${n.options.appId}`}/**
452 * @license
453 * Copyright 2021 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 Vf=1024,Df=30*24*60*60*1e3;class Nf{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Mf(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=Ma();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===o||this._heartbeatsCache.heartbeats.some(a=>a.date===o)?void 0:(this._heartbeatsCache.heartbeats.push({date:o,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const u=new Date(a.date).valueOf();return Date.now()-u<=Df}),this._storage.overwrite(this._heartbeatsCache))}catch(r){Ke.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=Ma(),{heartbeatsToSend:r,unsentEntries:i}=Of(this._heartbeatsCache.heartbeats),o=qr(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(t){return Ke.warn(t),""}}}function Ma(){return new Date().toISOString().substring(0,10)}function Of(n,e=Vf){const t=[];let r=n.slice();for(const i of n){const o=t.find(a=>a.agent===i.agent);if(o){if(o.dates.push(i.date),La(t)>e){o.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),La(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Mf{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return pd()?md().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await kf(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Oa(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return Oa(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function La(n){return qr(JSON.stringify({version:2,heartbeats:n})).length}/**
467 * @license
468 * Copyright 2019 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 */function Lf(n){mt(new ft("platform-logger",e=>new qd(e),"PRIVATE")),mt(new ft("heartbeat",e=>new Nf(e),"PRIVATE")),Pe(Wr,ls,n),Pe(Wr,ls,"esm2017"),Pe("fire-js","")}Lf("");var xf="firebase",Uf="10.14.1";/**
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 */Pe(xf,Uf,"app");const gv=Object.freeze(Object.defineProperty({__proto__:null,FirebaseError:De,SDK_VERSION:Vt,_DEFAULT_ENTRY_NAME:Fn,_addComponent:hs,_addOrOverwriteComponent:vf,_apps:pt,_clearComponents:Tf,_components:Qt,_getProvider:sn,_isFirebaseApp:au,_isFirebaseServerApp:Ne,_registerComponent:mt,_removeServiceInstance:Ef,_serverApps:Kt,deleteApp:lu,getApp:ci,getApps:Rf,initializeApp:uu,initializeServerApp:Af,onLog:bf,registerVersion:Pe,setLogLevel:Sf},Symbol.toStringTag,{value:"Module"}));var xa=function(){return xa=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},xa.apply(this,arguments)};function Os(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 i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}function fu(){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 Ff=fu,pu=new Jn("auth","Firebase",fu());/**
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 */const Gr=new Ds("@firebase/auth");function Bf(n,...e){Gr.logLevel<=B.WARN&&Gr.warn(`Auth (${Vt}): ${n}`,...e)}function Nr(n,...e){Gr.logLevel<=B.ERROR&&Gr.error(`Auth (${Vt}): ${n}`,...e)}/**
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 */function Qe(n,...e){throw Ms(n,...e)}function Oe(n,...e){return Ms(n,...e)}function mu(n,e,t){const r=Object.assign(Object.assign({},Ff()),{[e]:t});return new Jn("auth","Firebase",r).create(e,{appName:n.name})}function ht(n){return mu(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}
526function Ms(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 pu.create(n,...e)}function L(n,e,...t){if(!n)throw Ms(e,...t)}function qe(n){const e="INTERNAL ASSERTION FAILED: "+n;throw Nr(e),new Error(e)}function Je(n,e){n||qe(e)}/**
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 */function ds(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function jf(){return Ua()==="http:"||Ua()==="https:"}function Ua(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
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 */function qf(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(jf()||ld()||"connection"in navigator)?navigator.onLine:!0}function $f(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
557 * @license
558 * Copyright 2020 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 */class Yn{constructor(e,t){this.shortDelay=e,this.longDelay=t,Je(t>e,"Short delay should be less than long delay!"),this.isMobile=od()||hd()}get(){return qf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
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 */function Ls(n,e){Je(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
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 gu{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;qe("Could not find fetch implementation, make sure you call FetchProvi
601der.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;qe("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;qe("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
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 */const zf={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"};/**
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 Wf=new Yn(3e4,6e4);function Zn(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Dt(n,e,t,r,i={}){return _u(n,i,async()=>{let o={},a={};r&&(e==="GET"?a=r:o={body:JSON.stringify(r)});const u=Xn(Object.assign({key:n.config.apiKey},a)).slice(1),h=await n._getAdditionalHeaders();h["Content-Type"]="application/json",n.languageCode&&(h["X-Firebase-Locale"]=n.languageCode);const d=Object.assign({method:e,headers:h},o);return ud()||(d.referrerPolicy="no-referrer"),gu.fetch()(vu(n,n.config.apiHost,t,u),d)})}async function _u(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},zf),e);try{const i=new Gf(n),o=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const a=await o.json();if("needConfirmation"in a)throw Pr(n,"account-exists-with-different-credential",a);if(o.ok&&!("errorMessage"in a))return a;{const u=o.ok?a.errorMessage:a.error.message,[h,d]=u.split(" : ");if(h==="FEDERATED_USER_ID_ALREADY_LINKED")throw Pr(n,"credential-already-in-use",a);if(h==="EMAIL_EXISTS")throw Pr(n,"email-already-in-use",a);if(h==="USER_DISABLED")throw Pr(n,"user-disabled",a);const p=r[h]||h.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw mu(n,p,d);Qe(n,p)}}catch(i){if(i instanceof De)throw i;Qe(n,"network-request-failed",{message:String(i)})}}async function yu(n,e,t,r,i={}){const o=await Dt(n,e,t,r,i);return"mfaPendingCredential"in o&&Qe(n,"multi-factor-auth-required",{_serverResponse:o}),o}function vu(n,e,t,r){const i=`${e}${t}?${r}`;return n.config.emulator?Ls(n.config,i):`${n.config.apiScheme}://${i}`}class Gf{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(Oe(this.auth,"network-request-failed")),Wf.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function Pr(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=Oe(n,e,r);return i.customData._tokenResponse=t,i}/**
632 * @license
633 * Copyright 2020 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 */async function Hf(n,e){return Dt(n,"POST","/v1/accounts:delete",e)}async function Eu(n,e){return Dt(n,"POST","/v1/accounts:lookup",e)}/**
647 * @license
648 * Copyright 2020 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 On(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Kf(n,e=!1){const t=se(n),r=await t.getIdToken(e),i=xs(r);L(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const o=typeof i.firebase=="object"?i.firebase:void 0,a=o==null?void 0:o.sign_in_provider;return{claims:i,token:r,authTime:On(ns(i.auth_time)),issuedAtTime:On(ns(i.iat)),expirationTime:On(ns(i.exp)),signInProvider:a||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function ns(n){return Number(n)*1e3}function xs(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return Nr("JWT malformed, contained fewer than 3 sections"),null;try{const i=$r(t);return i?JSON.parse(i):(Nr("Failed to decode base64 JWT payload"),null)}catch(i){return Nr("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function Fa(n){const e=xs(n);return L(e,"internal-error"),L(typeof e.exp<"u","internal-error"),L(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
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 */async function jn(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof De&&Qf(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Qf({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
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 */class Jf{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 i=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,i)}}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()}}/**
692 * @license
693 * Copyright 2020 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 fs{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=On(this.lastLoginAt),this.creationTime=On(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
707 * @license
708 * Copyright 2019 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 Hr(n){var e;const t=n.auth,r=await n.getIdToken(),i=await jn(n,Eu(t,{idToken:r}));L(i==null?void 0:i.users.length,t,"internal-error");const o=i.users[0];n._notifyReloadListener(o);const a=!((e=o.providerUserInfo)===null||e===void 0)&&e.length?Tu(o.providerUserInfo):[],u=Yf(n.providerData,a),h=n.isAnonymous,d=!(n.email&&o.passwordHash)&&!(u!=null&&u.length),p=h?d:!1,y={uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:u,metadata:new fs(o.createdAt,o.lastLoginAt),isAnonymous:p};Object.assign(n,y)}async function Xf(n){const e=se(n);await Hr(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Yf(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Tu(n){return n.map(e=>{var{providerId:t}=e,r=Os(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
722 * @license
723 * Copyright 2020 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 */async function Zf(n,e){const t=await _u(n,{},async()=>{const r=Xn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:o}=n.config,a=vu(n,i,"/v1/token",`key=${o}`),u=await n._getAdditionalHeaders();return u["Content-Type"]="application/x-www-form-urlencoded",gu.fetch()(a,{method:"POST",headers:u,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function ep(n,e){return Dt(n,"POST","/v2/accounts:revokeToken",Zn(n,e))}/**
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 $t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){L(e.idToken,"internal-error"),L(typeof e.idToken<"u","internal-error"),L(typeof e.refreshToken<"u","internal-error");
751const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Fa(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){L(e.length!==0,"internal-error");const t=Fa(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(L(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:i,expiresIn:o}=await Zf(e,t);this.updateTokensAndExpiration(r,i,Number(o))}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:i,expirationTime:o}=t,a=new $t;return r&&(L(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(L(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),o&&(L(typeof o=="number","internal-error",{appName:e}),a.expirationTime=o),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 $t,this.toJSON())}_performRefresh(){return qe("not implemented")}}/**
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 */function it(n,e){L(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class $e{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,o=Os(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Jf(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=o.displayName||null,this.email=o.email||null,this.emailVerified=o.emailVerified||!1,this.phoneNumber=o.phoneNumber||null,this.photoURL=o.photoURL||null,this.isAnonymous=o.isAnonymous||!1,this.tenantId=o.tenantId||null,this.providerData=o.providerData?[...o.providerData]:[],this.metadata=new fs(o.createdAt||void 0,o.lastLoginAt||void 0)}async getIdToken(e){const t=await jn(this,this.stsTokenManager.getToken(this.auth,e));return L(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Kf(this,e)}reload(){return Xf(this)}_assign(e){this!==e&&(L(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 $e(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){L(!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 Hr(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Ne(this.auth.app))return Promise.reject(ht(this.auth));const e=await this.getIdToken();return await jn(this,Hf(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
766nonymous: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,i,o,a,u,h,d,p;const y=(r=t.displayName)!==null&&r!==void 0?r:void 0,A=(i=t.email)!==null&&i!==void 0?i:void 0,S=(o=t.phoneNumber)!==null&&o!==void 0?o:void 0,V=(a=t.photoURL)!==null&&a!==void 0?a:void 0,O=(u=t.tenantId)!==null&&u!==void 0?u:void 0,k=(h=t._redirectEventId)!==null&&h!==void 0?h:void 0,q=(d=t.createdAt)!==null&&d!==void 0?d:void 0,G=(p=t.lastLoginAt)!==null&&p!==void 0?p:void 0,{uid:H,emailVerified:ee,isAnonymous:Re,providerData:te,stsTokenManager:E}=t;L(H&&E,e,"internal-error");const m=$t.fromJSON(this.name,E);L(typeof H=="string",e,"internal-error"),it(y,e.name),it(A,e.name),L(typeof ee=="boolean",e,"internal-error"),L(typeof Re=="boolean",e,"internal-error"),it(S,e.name),it(V,e.name),it(O,e.name),it(k,e.name),it(q,e.name),it(G,e.name);const _=new $e({uid:H,auth:e,email:A,emailVerified:ee,displayName:y,isAnonymous:Re,photoURL:V,phoneNumber:S,tenantId:O,stsTokenManager:m,createdAt:q,lastLoginAt:G});return te&&Array.isArray(te)&&(_.providerData=te.map(v=>Object.assign({},v))),k&&(_._redirectEventId=k),_}static async _fromIdTokenResponse(e,t,r=!1){const i=new $t;i.updateFromServerResponse(t);const o=new $e({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Hr(o),o}static async _fromGetAccountInfoResponse(e,t,r){const i=t.users[0];L(i.localId!==void 0,"internal-error");const o=i.providerUserInfo!==void 0?Tu(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!(o!=null&&o.length),u=new $t;u.updateFromIdToken(r);const h=new $e({uid:i.localId,auth:e,stsTokenManager:u,isAnonymous:a}),d={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:o,metadata:new fs(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(o!=null&&o.length)};return Object.assign(h,d),h}}/**
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 */const Ba=new Map;function ze(n){Je(n instanceof Function,"Expected a class definition");let e=Ba.get(n);return e?(Je(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Ba.set(n,e),e)}/**
782 * @license
783 * Copyright 2019 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 Iu{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){}}Iu.type="NONE";const ja=Iu;/**
797 * @license
798 * Copyright 2019 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 */function Or(n,e,t){return`firebase:${n}:${e}:${t}`}class zt{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:o}=this.auth;this.fullUserKey=Or(this.userKey,i.apiKey,o),this.fullPersistenceKey=Or("persistence",i.apiKey,o),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?$e._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 zt(ze(ja),e,r);const i=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=i[0]||ze(ja);const a=Or(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=$e._fromJSON(e,p);d!==o&&(u=y),o=d;break}}catch{}const h=i.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!h.length?new zt(o,e,r):(o=h[0],u&&await o._set(a,u.toJSON()),await Promise.all(t.map(async d=>{if(d!==o)try{await d._remove(a)}catch{}})),new zt(o,e,r))}}/**
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 */function qa(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bu(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(wu(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Pu(e))return"Blackberry";if(Cu(e))return"Webos";if(Au(e))return"Safari";if((e.includes("chrome/")||Ru(e))&&!e.includes("edge/"))return"Chrome";if(Su(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 wu(n=Ee()){return/firefox\//i.test(n)}function Au(n=Ee()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Ru(n=Ee()){return/crios\//i.test(n)}function bu(n=Ee()){return/iemobile/i.test(n)}function Su(n=Ee()){return/android/i.test(n)}function Pu(n=Ee()){return/blackberry/i.test(n)}function Cu(n=Ee()){return/webos/i.test(n)}function Us(n=Ee()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function tp(n=Ee()){var e;return Us(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function np(){return dd()&&document.documentMode===10}function ku(n=Ee()){return Us(n)||Su(n)||Cu(n)||Pu(n)||/windows phone/i.test(n)||bu(n)}/**
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, software
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 */function Vu(n,e=[]){let t;switch(n){case"Browser":t=qa(Ee());break;case"Worker":t=`${qa(Ee())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Vt}/${r}`}/**
842 * @license
843 * Copyright 2022 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 */class rp{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=o=>new Promise((a,u)=>{try{const h=e(o);a(h)}catch(h){u(h)}});r.onAbort=t,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>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 i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
857 * @license
858 * Copyright 2023 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 */async function ip(n,e={}){return Dt(n,"GET","/v2/passwordPolicy",Zn(n,e))}/**
872 * @license
873 * Copyright 2023 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 */const sp=6;class op{constructor(e){var t,r,i,o;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:sp,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=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(o=e.forceUpgradeOnSignin)!==null&&o!==void 0?o:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,i,o,a,u;const h={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,h),this.validatePasswordCharacterOptions(e,h),h.isValid&&
vendor: 2,092 bytes, lines 886-900
886(h.isValid=(t=h.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),h.isValid&&(h.isValid=(r=h.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),h.isValid&&(h.isValid=(i=h.containsLowercaseLetter)!==null&&i!==void 0?i:!0),h.isValid&&(h.isValid=(o=h.containsUppercaseLetter)!==null&&o!==void 0?o:!0),h.isValid&&(h.isValid=(a=h.containsNumericCharacter)!==null&&a!==void 0?a:!0),h.isValid&&(h.isValid=(u=h.containsNonAlphanumericCharacter)!==null&&u!==void 0?u:!0),h}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,o){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=o))}}/**
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 ap{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new $a(this),this.idTokenSubscription=new $a(this),this.beforeStateQueue=new rp(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=pu,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=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=ze(t)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await zt.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=((i=this.currentUser)===null||i===void 0?void 0:i.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 Eu(this,{idToken:e}),r=await $e._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(Ne(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 i=r,o=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,u=i==null?void 0:i._redirectEventId,h=await this.tryRedirectSignIn(e);(!a||a===u)&&(h!=null&&h.user)&&(i=h.user,o=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(o)try{await this.beforeStateQueue.runMiddleware(i)}catch(a){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return L(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}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 Hr(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=$f()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Ne(this.app))return Promise.reject(ht(this));const t=e?se(e):null;return t&&L(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&&L(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 Ne(this.app)?Promise.reject(ht(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Ne(this.app)?Promise.reject(ht(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 ip(this),t=new op(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Jn("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
901{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 ep(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;L(t,this,"argument-error"),this.redirectPersistenceManager=await zt.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,i){if(this._deleted)return()=>{};const o=typeof t=="function"?t:t.next.bind(t);let a=!1;const u=this._isInitialized?Promise.resolve():this._initializationPromise;if(L(u,this,"internal-error"),u.then(()=>{a||o(this.currentUser)}),typeof t=="function"){const h=e.addObserver(t,r,i);return()=>{a=!0,h()}}else{const h=e.addObserver(t);return()=>{a=!0,h()}}}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 L(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Vu(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 i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),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&&Bf(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function ui(n){return se(n)}class $a{constructor(e){this.auth=e,this.observer=null,this.addObserver=Ed(t=>this.observer=t)}get next(){return L(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
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 */let Fs={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function cp(n){Fs=n}function up(n){return Fs.loadJS(n)}function lp(){return Fs.gapiScript}function hp(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/**
917 * @license
918 * Copyright 2020 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 */function dp(n,e){const t=sn(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),o=t.getOptions();if(zr(o,e??{}))return i;Qe(i,"already-initialized")}return t.initialize({options:e})}function fp(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 pp(n,e,t){const r=ui(n);L(r._canInitEmulator,r,"emulator-config-failed"),L(/^https?:\/\//.test(e),r,"invali
931d-emulator-scheme");const i=!!(t!=null&&t.disableWarnings),o=Du(e),{host:a,port:u}=mp(e),h=u===null?"":`:${u}`;r.config.emulator={url:`${o}//${a}${h}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:u,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||gp()}function Du(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function mp(n){const e=Du(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const o=i[1];return{host:o,port:za(r.substr(o.length+1))}}else{const[o,a]=r.split(":");return{host:o,port:za(a)}}}function za(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function gp(){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 window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
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 Nu{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return qe("not implemented")}_getIdTokenResponse(e){return qe("not implemented")}_linkToIdToken(e,t){return qe("not implemented")}_getReauthenticationResolver(e){return qe("not implemented")}}async function _p(n,e){return Dt(n,"POST","/v1/accounts:update",Zn(n,e))}/**
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 */async function Wt(n,e){return yu(n,"POST","/v1/accounts:signInWithIdp",Zn(n,e))}/**
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 */const yp="http://localhost";class bt extends Nu{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new bt(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):Qe("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
976once: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:i}=t,o=Os(t,["providerId","signInMethod"]);if(!r||!i)return null;const a=new bt(r,i);return a.idToken=o.idToken||void 0,a.accessToken=o.accessToken||void 0,a.secret=o.secret,a.nonce=o.nonce,a.pendingToken=o.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return Wt(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,Wt(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,Wt(e,t)}buildRequest(){const e={requestUri:yp,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=Xn(t)}return e}}/**
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 Ou{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}}/**
992 * @license
993 * Copyright 2019 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 er extends Ou{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
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 st extends er{constructor(){super("facebook.com")}static credential(e){return bt._fromParams({providerId:st.PROVIDER_ID,signInMethod:st.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return st.credentialFromTaggedObject(e)}static credentialFromError(e){return st.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return st.credential(e.oauthAccessToken)}catch{return null}}}st.FACEBOOK_SIGN_IN_METHOD="facebook.com";st.PROVIDER_ID="facebook.com";/**
1022 * @license
1023 * Copyright 2020 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, softw
1031are
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 */class ot extends er{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return bt._fromParams({providerId:ot.PROVIDER_ID,signInMethod:ot.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return ot.credentialFromTaggedObject(e)}static credentialFromError(e){return ot.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return ot.credential(t,r)}catch{return null}}}ot.GOOGLE_SIGN_IN_METHOD="google.com";ot.PROVIDER_ID="google.com";/**
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 */class at extends er{constructor(){super("github.com")}static credential(e){return bt._fromParams({providerId:at.PROVIDER_ID,signInMethod:at.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return at.credentialFromTaggedObject(e)}static credentialFromError(e){return at.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return at.credential(e.oauthAccessToken)}catch{return null}}}at.GITHUB_SIGN_IN_METHOD="github.com";at.PROVIDER_ID="github.com";/**
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 */class ct extends er{constructor(){super("twitter.com")}static credential(e,t){return bt._fromParams({providerId:ct.PROVIDER_ID,signInMethod:ct.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return ct.credentialFromTaggedObject(e)}static credentialFromError(e){return ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return ct.credential(t,r)}catch{return null}}}ct.TWITTER_SIGN_IN_METHOD="twitter.com";ct.PROVIDER_ID="twitter.com";/**
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 */class St{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){const o=await $e._fromIdTokenResponse(e,r,i),a=Wa(r);return new St({user:o,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=Wa(r);return new St({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function Wa(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1082 * @license
1083 * Copyright 2020 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 Kr extends De{constructor(e,t,r,i){var o;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,Kr.prototype),this.customData={appName:e.name,tenantId:(o=e.tenantId)!==null&&o!==void 0?o:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new Kr(e,t,r,i)}}function Mu(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Kr._fromErrorAndOperation(n,o,e,r):o})}async function vp(n,e,t=!1){const r=await jn(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return St._forOperation(n,"link",r)}/**
1097 * @license
1098 * Copyright 2019 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 */async function Ep(n,e,t=!1){const{auth:r}=n;if(Ne(r.app))return Promise.reject(ht(r));const i="reauthenticate";try{const o=await jn(n,Mu(r,i,e,n),t);L(o.idToken,r,"internal-error");const a=xs(o.idToken);L(a,r,"internal-error");const{sub:u}=a;return L(n.uid===u,r,"user-mismatch"),St._forOperation(n,i,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Qe(r,"user-mismatch"),o}}/**
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 */async function Tp(n,e,t=!1){if(Ne(n.app))return Promise.reject(ht(n));const r="signIn",i=await Mu(n,r,e),o=await St._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(o.user),o}/**
1127 * @license
1128 * Copyright 2020 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 */async function Ip(n,e){return yu(n,"POST","/v1/accounts:signInWithCustomToken",Zn(n,e))}/**
1142 * @license
1143 * Copyright 2020 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 */async function _v(n,e){if(Ne(n.app))return Promise.reject(ht(n));const t=ui(n),r=await Ip(t,{token:e,returnSecureToken:!0}),i=await St._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(i.user),i}async function yv(n,e){await _p(se(n),{oobCode:e})}function wp(n,e,t,r){return se(n).onIdTokenChanged(e,t,r)}function Ap(n,e,t){return se(n).beforeAuthStateChanged(e,t)}function vv(n,e,t,r){return se(n).onAuthStateChanged(e,t,r)}function Ev(n){return se(n).signOut()}const Qr="__sak";/**
1157 * @license
1158 * Copyright 2019 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 */class Lu{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Qr,"1"),this.storage.removeItem(Qr),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()}}/**
1172 * @license
1173 * Copyright 2020 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 */const Rp=1e3,bp=10;class xu extends Lu{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ku(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((a,u,h)=>{this.notifyListeners(a,h)});return}const r=e.key;t?this.detachListener():this.stopPolling();const i=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},o=this.storage.getItem(r);np()&&o!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,bp):i()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(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)})},Rp)}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
1186ject.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]}}xu.type="LOCAL";const Sp=xu;/**
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 */class Uu extends Lu{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Uu.type="SESSION";const Fu=Uu;/**
1202 * @license
1203 * Copyright 2019 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 Pp(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
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 */class li{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;const r=new li(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:o}=t.data,a=this.handlersMap[i];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const u=Array.from(a).map(async d=>d(t.origin,o)),h=await Pp(u);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:h})}_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)}}li.receivers=[];/**
1232 * @license
1233 * Copyright 2020 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 Bs(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
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 Cp{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 i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let o,a;return new Promise((u,h)=>{const d=Bs("",20);i.port1.start();const p=setTimeout(()=>{h(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(y){const A=y;if(A.data.eventId===d)switch(A.data.status){case"ack":clearTimeout(p),o=setTimeout(()=>{h(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),u(A.data.response);break;default:clearTimeout(p),clearTimeout(o),h(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
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 */function Me(){return window}function kp(n){Me().location.href=n}/**
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 */function Bu(){return typeof Me().WorkerGlobalScope<"u"&&typeof Me().importScripts=="function"}async function Vp(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Dp(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Np(){return Bu()?self:null}/**
1292 * @license
1293 * Copyright 2019 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 ju="firebaseLocalStorageDb",Op=1,Jr="firebaseLocalStorage",qu="fbase_key";class tr{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 hi(n,e){return n.transaction([Jr],e?"readwrite":"readonly").objectStore(Jr)}function Mp(){const n=indexedDB.deleteDatabase(ju);return new tr(n).toPromise()}function ps(){const n=indexedDB.open(ju,Op);return new Promise((e,t)=>
1306{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Jr,{keyPath:qu})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Jr)?e(r):(r.close(),await Mp(),e(await ps()))})})}async function Ga(n,e,t){const r=hi(n,!0).put({[qu]:e,value:t});return new tr(r).toPromise()}async function Lp(n,e){const t=hi(n,!1).get(e),r=await new tr(t).toPromise();return r===void 0?null:r.value}function Ha(n,e){const t=hi(n,!0).delete(e);return new tr(t).toPromise()}const xp=800,Up=3;class $u{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 ps(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Up)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Bu()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=li._getInstance(Np()),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 Vp(),!this.activeServiceWorker)return;this.sender=new Cp(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||Dp()!==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 ps();return await Ga(e,Qr,"1"),await Ha(e,Qr),!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=>Ga(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Lp(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Ha(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const o=hi(i,!1).getAll();return new tr(o).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:o}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(o)&&(this.notifyListeners(i,o),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),xp)}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
1306ject.keys(this.listeners).length===0&&this.stopPolling()}}$u.type="LOCAL";const Fp=$u;new Yn(3e4,6e4);/**
1307 * @license
1308 * Copyright 2021 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, software
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 */function Bp(n,e){return e?ze(e):(L(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1322 * @license
1323 * Copyright 2019 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 */class js extends Nu{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Wt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Wt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Wt(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 jp(n){return Tp(n.auth,new js(n),n.bypassAuthState)}function qp(n){const{auth:e,user:t}=n;return L(t,e,"internal-error"),Ep(t,new js(n),n.bypassAuthState)}async function $p(n){const{auth:e,user:t}=n;return L(t,e,"internal-error"),vp(t,new js(n),n.bypassAuthState)}/**
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 */class zu{constructor(e,t,r,i,o=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=o,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:i,tenantId:o,error:a,type:u}=e;if(a){this.reject(a);return}const h={auth:this.auth,requestUri:t,sessionId:r,tenantId:o||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(u)(h))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return jp;case"linkViaPopup":case"linkViaRedirect":return $p;case"reauthViaPopup":case"reauthViaRedirect":return qp;default:Qe(this.auth,"internal-error")}}resolve(e){Je(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Je(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()}}/**
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, software
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 zp=new Yn(2e3,1e4);class qt extends zu{constructor(e,t,r,i,o){super(e,t,i,o),this.provider=r,this.authWindow=null,this.pollId=null,qt.currentPopupAction&&qt.currentPopupAction.cancel(),qt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return L(e,this.auth,"internal-error"),e}async onExecution(){Je(this.filter.length===1,"Popup operations only handle one event");const e=Bs();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(Oe(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(Oe(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,qt.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(Oe(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,zp.get())};e()}}qt.currentPopupAction=null;/**
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 Wp="pendingRedirect",Mr=new Map;class Gp extends zu{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Mr.get(this.auth._key());if(!e){try{const r=await Hp(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Mr.set(this.auth._key(),e)}return this.bypassAuthState||Mr.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 Hp(n,e){const t=Jp(e),r=Qp(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function Kp(n,e){Mr.set(n._key(),e)}function Qp(n){return ze(n._redirectPersistence)}function Jp(n){return Or(Wp,n.config.apiKey,n.name)}async function Xp(n,e,t=!1){if(Ne(n.app))return Promise.reject(ht(n));const r=ui(n),i=Bp(r,e),a=await new Gp(r,i,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),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, softw
1391are
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 Yp=10*60*1e3;class Zp{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||!em(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Wu(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(Oe(this.auth,i))}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>=Yp&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ka(e))}saveEventToCache(e){this.cachedEventUids.add(Ka(e)),this.lastProcessedEventTime=Date.now()}}function Ka(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Wu({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function em(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Wu(n);default:return!1}}/**
1397 * @license
1398 * Copyright 2020 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 */async function tm(n,e={}){return Dt(n,"GET","/v1/projects",e)}/**
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 nm=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,rm=/^https?/;async function im(n){if(n.config.emulator)return;const{authorizedDomains:e}=await tm(n);for(const t of e)try{if(sm(t))return}catch{}Qe(n,"unauthorized-domain")}function sm(n){const e=ds(),{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(!rm.test(t))return!1;if(nm.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
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 */const om=new Yn(3e4,6e4);function Qa(){const n=Me().___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 am(n){return new Promise((e,t)=>{var r,i,o;function a(){Qa(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Qa(),t(Oe(n,"network-request-failed"))},timeout:om.get()})}if(!((i=(r=Me().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((o=Me().gapi)===null||o===void 0)&&o.load)a();else{const u=hp("iframefcb");return Me()[u]=()=>{gapi.load?a():t(Oe(n,"network-request-failed"))},up(`${lp()}?onload=${u}`).catch(h=>t(h))}}).catch(e=>{throw Lr=null,e})}let Lr=null;function cm(n){return Lr=Lr||am(n),Lr}/**
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 */const um=new Yn(5e3,15e3),lm="__/auth/iframe",hm="emulator/auth/iframe",dm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},fm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function pm(n){const e=n.config;L(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Ls(e,hm):`https://${n.config.authDomain}/${lm}`,r={apiKey:e.apiKey,appName:n.name,v:Vt},i=fm.get(n.config.apiHost);i&&(r.eid=i);const o=n._getFrameworks();return o.length&&(r.fw=o.join(",")),`${t}?${Xn(r).slice(1)}`}async function mm(n){const e=await cm(n),t=Me().gapi;return L(t,n,"internal-error"),e.open({where:document.body,url:pm(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:dm,dontclear:!0},r=>new Promise(async(i,o)=>{await r.restyle({setHideOnLeave:!1});const a=Oe(n,"network-request-failed"),u=Me().setTimeout(()=>{o(a)},um.get());function h(){Me().clearTimeout(u),i(r)}r.ping(h).then(h,()=>{o(a)})}))}/**
1457 * @license
1458 * Copyright 2020 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 gm={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},_m=500,ym=600,vm="_blank",Em="http://localhost";class Ja{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function Tm(n,e,t,r=_m,i=ym){const o=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let u="";const h=Object.assign(Object.assign({},gm),{width:r.toString(),height:i.toString(),top:o,left:a}),d=Ee().toLowerCase();t&&(u=Ru(d)?vm:t),wu(d)&&(e=e||Em,h.scrollbars="yes");const p=Object.entries(h).reduce((A,[S,V])=>`${A}${S}=${V},`,"");if(tp(d)&&u!=="_self")return Im(e||"",u),new Ja(null);const y=window.open(e||"",u,p);L(y,n,"popup-blocked");try{y.focus()}catch{}return new Ja(y)}function Im(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
1471r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
1472 * @license
1473 * Copyright 2021 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 */const wm="__/auth/handler",Am="emulator/auth/handler",Rm=encodeURIComponent("fac");async function Xa(n,e,t,r,i,o){L(n.config.authDomain,n,"auth-domain-config-required"),L(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:Vt,eventId:i};if(e instanceof Ou){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",vd(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[p,y]of Object.entries(o||{}))a[p]=y}if(e instanceof er){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 h=await n._getAppCheckToken(),d=h?`#${Rm}=${encodeURIComponent(h)}`:"";return`${bm(n)}?${Xn(u).slice(1)}${d}`}function bm({config:n}){return n.emulator?Ls(n,Am):`https://${n.authDomain}/${wm}`}/**
1487 * @license
1488 * Copyright 2020 Google LLC
1489 *
1490 * Licensed under the Apache License, Version 2.0 (the "License");
1491 * you may not use this file except in compliance with the License.
1492 * You may obtain a copy of the License at
1493 *
1494 *   http://www.apache.org/licenses/LICENSE-2.0
1495 *
1496 * Unless required by applicable law or agreed to in writing, software
1497 * distributed under the License is distributed on an "AS IS" BASIS,
1498 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1499 * See the License for the specific language governing permissions and
1500 * limitations under the License.
1501 */const rs="webStorageSupport";class Sm{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Fu,this._completeRedirectFn=Xp,this._overrideRedirectResult=Kp}async _openPopup(e,t,r,i){var o;Je((o=this.eventManagers[e._key()])===null||o===void 0?void 0:o.manager,"_initialize() not called before _openPopup()");const a=await Xa(e,t,r,ds(),i);return Tm(e,a,Bs())}
1501async _openRedirect(e,t,r,i){await this._originValidation(e);const o=await Xa(e,t,r,ds(),i);return kp(o),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:o}=this.eventManagers[t];return i?Promise.resolve(i):(Je(o,"If manager is not set, promise should be"),o)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await mm(e),r=new Zp(e);return t.register("authEvent",i=>(L(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.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(rs,{type:rs},i=>{var o;const a=(o=i==null?void 0:i[0])===null||o===void 0?void 0:o[rs];a!==void 0&&t(!!a),Qe(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=im(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return ku()||Au()||Us()}}const Pm=Sm;var Ya="@firebase/auth",Za="1.7.9";/**
1502 * @license
1503 * Copyright 2020 Google LLC
1504 *
1505 * Licensed under the Apache License, Version 2.0 (the "License");
1506 * you may not use this file except in compliance with the License.
1507 * You may obtain a copy of the License at
1508 *
1509 *   http://www.apache.org/licenses/LICENSE-2.0
1510 *
1511 * Unless required by applicable law or agreed to in writing, software
1512 * distributed under the License is distributed on an "AS IS" BASIS,
1513 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1514 * See the License for the specific language governing permissions and
1515 * limitations under the License.
1516 */class Cm{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(){L(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1517 * @license
1518 * Copyright 2020 Google LLC
1519 *
1520 * Licensed under the Apache License, Version 2.0 (the "License");
1521 * you may not use this file except in compliance with the License.
1522 * You may obtain a copy of the License at
1523 *
1524 *   http://www.apache.org/licenses/LICENSE-2.0
1525 *
1526 * Unless required by applicable law or agreed to in writing, software
1527 * distributed under the License is distributed on an "AS IS" BASIS,
1528 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1529 * See the License for the specific language governing permissions and
1530 * limitations under the License.
1531 */function km(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 Vm(n){mt(new ft("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:a,authDomain:u}=r.options;L(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const h={apiKey:a,authDomain:u,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Vu(n)},d=new ap(r,i,o,h);return fp(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),mt(new ft("auth-internal",e=>{const t=ui(e.getProvider("auth").getImmediate());return(r=>new Cm(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Pe(Ya,Za,km(n)),Pe(Ya,Za,"esm2017")}/**
1532 * @license
1533 * Copyright 2021 Google LLC
1534 *
1535 * Licensed under the Apache License, Version 2.0 (the "License");
1536 * you may not use this file except in compliance with the License.
1537 * You may obtain a copy of the License at
1538 *
1539 *   http://www.apache.org/licenses/LICENSE-2.0
1540 *
1541 * Unless required by applicable law or agreed to in writing, software
1542 * distributed under the License is distributed on an "AS IS" BASIS,
1543 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1544 * See the License for the specific language governing permissions and
1545 * limitations under the License.
1546 */const Dm=5*60,Nm=eu("authIdTokenMaxAge")||Dm;let ec=null;const Om=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>Nm)return;const i=t==null?void 0:t.token;ec!==i&&(ec=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Tv(n=ci()){const e=sn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=dp(n,{popupRedirectResolver:Pm,persistence:[Fp,Sp,Fu]}),r=eu("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const a=Om(o.toString());Ap(t,a,()=>a(t.currentUser)),wp(t,u=>a(u))}}const i=Xc("auth");return i&&pp(t,`http://${i}`),t}function Mm(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}cp({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const o=Oe("internal-error");o.customData=i,t(o)},r.type="text/javascript",r.charset="UTF-8",Mm().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="});Vm("Browser");var tc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1547Copyright The Closure Library Authors.
1548SPDX-License-Identifier: Apache-2.0
1549*/var Rt,Gu;(function(){var n;/** @license
1550
1551 Copyright The Closure Library Authors.
1552 SPDX-License-Identifier: Apache-2.0
1553*/function e(E,m){function _(){}_.prototype=m.prototype,E.D=m.prototype,E.prototype=new _,E.prototype.constructor=E,E.C=function(v,T,w){for(var g=Array(arguments.length-2),Fe=2;Fe<arguments.length;Fe++)g[Fe-2]=arguments[Fe];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 i(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 w=E.g[3],g=m+(w^_&(T^w))+v[0]+3614090360&4294967295;m=_+(g<<7&4294967295|g>>>25),g=w+(T^m&(_^T))+v[1]+3905402710&4294967295,w=m+(g<<12&4294967295|g>>>20),g=T+(_^w&(m^_))+v[2]+606105819&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(m^T&(w^m))+v[3]+3250441966&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(w^_&(T^w))+v[4]+4118548399&4294967295,m=_+(g<<7&4294967295|g>>>25),g=w+(T^m&(_^T))+v[5]+1200080426&4294967295,w=m+(g<<12&4294967295|g>>>20),g=T+(_^w&(m^_))+v[6]+2821735955&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(m^T&(w^m))+v[7]+4249261313&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(w^_&(T^w))+v[8]+1770035416&4294967295,m=_+(g<<7&4294967295|g>>>25),g=w+(T^m&(_^T))+v[9]+2336552879&4294967295,w=m+(g<<12&4294967295|g>>>20),g=T+(_^w&(m^_))+v[10]+4294925233&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(m^T&(w^m))+v[11]+2304563134&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(w^_&(T^w))+v[12]+1804603682&4294967295,m=_+(g<<7&4294967295|g>>>25),g=w+(T^m&(_^T))+v[13]+4254626195&4294967295,w=m+(g<<12&4294967295|g>>>20),g=T+(_^w&(m^_))+v[14]+2792965006&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(m^T&(w^m))+v[15]+1236535329&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(T^w&(_^T))+v[1]+4129170786&4294967295,m=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(m^_))+v[6]+3225465664&4294967295,w=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(w^m))+v[11]+643717713&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^m&(T^w))+v[0]+3921069994&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^w&(_^T))+v[5]+3593408605&4294967295,m=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(m^_))+v[10]+38016083&4294967295,w=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(w^m))+v[15]+3634488961&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^m&(T^w))+v[4]+3889429448&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^w&(_^T))+v[9]+568446438&4294967295,m=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(m^_))+v[14]+3275163606&4294967295,w=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(w^m))+v[3]+4107603335&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^m&(T^w))+v[8]+1163531501&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^w&(_^T))+v[13]+2850285829&4294967295,m=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(m^_))+v[2]+4243563512&4294967295,w=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(w^m))+v[7]+1735328473&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^m&(T^w))+v[12]+2368359562&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(_^T^w)+v[5]+4294588738&4294967295,m=_+(g<<4&4294967295|g>>>28),g=w+(m^_^T)+v[8]+2272392833&4294967295,w=m+(g<<11&4294967295|g>>>21),g=T+(w^m^_)+v[11]+1839030562&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^m)+v[14]+4259657740&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^w)+v[1]+2763975236&4294967295,m=_+(g<<4&4294967295|g>>>28),g=w+(m^_^T)+v[4]+1272893353&4294967295,w=m+(g<<11&4294967295|g>>>21),g=T+(w^m^_)+v[7]+4139469664&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^m)+v[10]+3200236656&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^w)+v[13]+681279174&4294967295,m=_+(g<<4&4294967295|g>>>28),g=w+(m^_^T)+v[0]+3936430074&4294967295,w=m+(g<<11&4294967295|g>>>21),g=T+(w^m^_)+v[3]+3572445317&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^m)+v[6]+76029189&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^w)+v[9]+3654602809&4294967295,m=_+(g<<4&4294967295|g>>>28),g=w+(m^_^T)+v[12]+3873151461&4294967295,w=m+(g<<11&4294967295|g>>>21),g=T+(w^m^_)+v[15]+530742520&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^m)+v[2]+3299628645&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(T^(_|~w))+v[0]+4096336452&4294967295,m=_+(g<<6&4294967295|g>>>26),g=w+(_^(m|~T))+v[7]+1126891415&4294967295,w=m+(g<<10&4294967295|g>>>22),g=T+(m^(w|~_))+v[14]+2878612391&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~m))+v[5]+4237533241&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~w))+v[12]+1700485571&4294967295,m=_+(g<<6&4294967295|g>>>26),g=w+(_^(m|~T))+v[3]+2399980690&4294967295,w=m+(g<<10&4294967295|g>>>22),g=T+(m^(w|~_))+v[10]+4293915773&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~m))+v[1]+2240044497&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~w))+v[8]+1873313359&4294967295,m=_+(g<<6&4294967295|g>>>26),g=w+(_^(m|~T))+v[15]+4264355552&4294967295,w=m+(g<<10&4294967295|g>>>22),g=T+(m^(w|~_))+v[6]+2734768916&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~m))+v[13]+1309151649&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~w))+v[4]+4149444226&4294967295,m=_+(g<<6&4294967295|g>>>26),g=w+(_^(m|~T))+v[11]+3174756917&4294967295,w=m+(g<<10&4294967295|g>>>22),g=T+(m^(w|~_))+v[2]+718787259&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(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]+w&4294967295}r.prototype.u=function(E,m){m===void 0&&(m=E.length);for(var _=m-this.blockSize,v=this.B,T=this.h,w=0;w<m;){if(T==0)for(;w<=_;)i(this,E,w),w+=this.blockSize;if(typeof E=="string"){for(;w<m;)if(v[T++]=E.charCodeAt(w++),T==this.blockSize){i(this,v),T=0;break}}else for(;w<m;)if(v[T++]=E[w++],T==this.blockSize){i(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 o(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 w=E[T]|0;v&&w==m||(_[T]=w,v=!1)}this.g=_}var u={};function h(E){return-128<=E&&128>E?o(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 k(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);
vendor: 6,024 bytes, lines 1553-1560
1553if(E.charAt(0)=="-")return k(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 w=Math.min(8,E.length-T),g=parseInt(E.substring(T,T+w),m);8>w?(w=d(Math.pow(m,w)),v=v.j(w).add(d(g))):(v=v.j(_),v=v.add(d(g)))}return v}var y=h(0),A=h(1),S=h(16777216);n=a.prototype,n.m=function(){if(O(this))return-k(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(V(this))return"0";if(O(this))return"-"+k(this).toString(E);for(var m=d(Math.pow(E,6)),_=this,v="";;){var T=ee(_,m).g;_=q(_,T.j(m));var w=((0<_.g.length?_.g[0]:_.h)>>>0).toString(E);if(_=T,V(_))return w+v;for(;6>w.length;)w="0"+w;v=w+v}},n.i=function(E){return 0>E?0:E<this.g.length?this.g[E]:this.h};function V(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 O(E){return E.h==-1}n.l=function(E){return E=q(this,E),O(E)?-1:V(E)?0:1};function k(E){for(var m=E.g.length,_=[],v=0;v<m;v++)_[v]=~E.g[v];return new a(_,~E.h).add(A)}n.abs=function(){return O(this)?k(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 w=v+(this.i(T)&65535)+(E.i(T)&65535),g=(w>>>16)+(this.i(T)>>>16)+(E.i(T)>>>16);v=g>>>16,w&=65535,g&=65535,_[T]=g<<16|w}return new a(_,_[_.length-1]&-2147483648?-1:0)};function q(E,m){return E.add(k(m))}n.j=function(E){if(V(this)||V(E))return y;if(O(this))return O(E)?k(this).j(k(E)):k(k(this).j(E));if(O(E))return k(this.j(k(E)));if(0>this.l(S)&&0>E.l(S))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 w=this.i(v)>>>16,g=this.i(v)&65535,Fe=E.i(T)>>>16,hn=E.i(T)&65535;_[2*v+2*T]+=g*hn,G(_,2*v+2*T),_[2*v+2*T+1]+=w*hn,G(_,2*v+2*T+1),_[2*v+2*T+1]+=g*Fe,G(_,2*v+2*T+1),_[2*v+2*T+2]+=w*Fe,G(_,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 G(E,m){for(;(E[m]&65535)!=E[m];)E[m+1]+=E[m]>>>16,E[m]&=65535,m++}function H(E,m){this.g=E,this.h=m}function ee(E,m){if(V(m))throw Error("division by zero");if(V(E))return new H(y,y);if(O(E))return m=ee(k(E),m),new H(k(m.g),k(m.h));if(O(m))return m=ee(E,k(m)),new H(k(m.g),m.h);if(30<E.g.length){if(O(E)||O(m))throw Error("slowDivide_ only works with positive integers.");for(var _=A,v=m;0>=v.l(E);)_=Re(_),v=Re(v);var T=te(_,1),w=te(v,1);for(v=te(v,2),_=te(_,2);!V(v);){var g=w.add(v);0>=g.l(E)&&(T=T.add(_),w=g),v=te(v,1),_=te(_,1)}return m=q(E,T.j(m)),new H(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),w=d(_),g=w.j(m);O(g)||0<g.l(E);)_-=v,w=d(_),g=w.j(m);V(w)&&(w=A),T=T.add(w),E=q(E,g)}return new H(T,E)}n.A=function(E){return ee(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 Re(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 te(E,m){var _=m>>5;m%=32;for(var v=E.g.length-_,T=[],w=0;w<v;w++)T[w]=0<m?E.i(w+_)>>>m|E.i(w+_+1)<<32-m:E.i(w+_);return new a(T,E.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,Gu=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,Rt=a}).apply(typeof tc<"u"?tc:typeof self<"u"?self:typeof window<"u"?window:{});var Cr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1554Copyright The Closure Library Authors.
1555SPDX-License-Identifier: Apache-2.0
1556*/var Hu,kn,Ku,xr,ms,Qu,Ju,Xu;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(s,c,l){return s==Array.prototype||s==Object.prototype||(s[c]=l.value),s};function t(s){s=[typeof globalThis=="object"&&globalThis,s,typeof window=="object"&&window,typeof self=="object"&&self,typeof Cr=="object"&&Cr];for(var c=0;c<s.length;++c){var l=s[c];if(l&&l.Math==Math)return l}throw Error("Cannot find global object")}var r=t(this);function i(s,c){if(c)e:{var l=r;s=s.split(".");for(var f=0;f<s.length-1;f++){var I=s[f];if(!(I in l))break e;l=l[I]}s=s[s.length-1],f=l[s],c=c(f),c!=f&&c!=null&&e(l,s,{configurable:!0,writable:!0,value:c})}}function o(s,c){s instanceof String&&(s+="");var l=0,f=!1,I={next:function(){if(!f&&l<s.length){var R=l++;return{value:c(R,s[R]),done:!1}}return f=!0,{done:!0,value:void 0}}};return I[Symbol.iterator]=function(){return I},I}i("Array.prototype.values",function(s){return s||function(){return o(this,function(c,l){return l})}});/** @license
1557
1558 Copyright The Closure Library Authors.
1559 SPDX-License-Identifier: Apache-2.0
1560*/var a=a||{},u=this||self;function h(s){var c=typeof s;return c=c!="object"?c:s?Array.isArray(s)?"array":c:"null",c=="array"||c=="object"&&typeof s.length=="number"}function d(s){var c=typeof s;return c=="object"&&s!=null||c=="function"}function p(s,c,l){return s.call.apply(s.bind,arguments)}function y(s,c,l){if(!s)throw Error();if(2<arguments.length){var f=Array.prototype.slice.call(arguments,2);return function(){var I=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(I,f),s.apply(c,I)}}return function(){return s.apply(c,arguments)}}function A(s,c,l){return A=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?p:y,A.apply(null,arguments)}
1560function S(s,c){var l=Array.prototype.slice.call(arguments,1);return function(){var f=l.slice();return f.push.apply(f,arguments),s.apply(this,f)}}function V(s,c){function l(){}l.prototype=c.prototype,s.aa=c.prototype,s.prototype=new l,s.prototype.constructor=s,s.Qb=function(f,I,R){for(var C=Array(arguments.length-2),Q=2;Q<arguments.length;Q++)C[Q-2]=arguments[Q];return c.prototype[I].apply(f,C)}}function O(s){const c=s.length;if(0<c){const l=Array(c);for(let f=0;f<c;f++)l[f]=s[f];return l}return[]}function k(s,c){for(let l=1;l<arguments.length;l++){const f=arguments[l];if(h(f)){const I=s.length||0,R=f.length||0;s.length=I+R;for(let C=0;C<R;C++)s[I+C]=f[C]}else s.push(f)}}class q{constructor(c,l){this.i=c,this.j=l,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 G(s){return/^[\s\xa0]*$/.test(s)}function H(){var s=u.navigator;return s&&(s=s.userAgent)?s:""}function ee(s){return ee[" "](s),s}ee[" "]=function(){};var Re=H().indexOf("Gecko")!=-1&&!(H().toLowerCase().indexOf("webkit")!=-1&&H().indexOf("Edge")==-1)&&!(H().indexOf("Trident")!=-1||H().indexOf("MSIE")!=-1)&&H().indexOf("Edge")==-1;function te(s,c,l){for(const f in s)c.call(l,s[f],f,s)}function E(s,c){for(const l in s)c.call(void 0,s[l],l,s)}function m(s){const c={};for(const l in s)c[l]=s[l];return c}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function v(s,c){let l,f;for(let I=1;I<arguments.length;I++){f=arguments[I];for(l in f)s[l]=f[l];for(let R=0;R<_.length;R++)l=_[R],Object.prototype.hasOwnProperty.call(f,l)&&(s[l]=f[l])}}function T(s){var c=1;s=s.split(":");const l=[];for(;0<c&&s.length;)l.push(s.shift()),c--;return s.length&&l.push(s.join(":")),l}function w(s){u.setTimeout(()=>{throw s},0)}function g(){var s=bi;let c=null;return s.g&&(c=s.g,s.g=s.g.next,s.g||(s.h=null),c.next=null),c}class Fe{constructor(){this.h=this.g=null}add(c,l){const f=hn.get();f.set(c,l),this.h?this.h.next=f:this.g=f,this.h=f}}var hn=new q(()=>new ph,s=>s.reset());class ph{constructor(){this.next=this.g=this.h=null}set(c,l){this.h=c,this.g=l,this.next=null}reset(){this.next=this.g=this.h=null}}let dn,fn=!1,bi=new Fe,Po=()=>{const s=u.Promise.resolve(void 0);dn=()=>{s.then(mh)}};var mh=()=>{for(var s;s=g();){try{s.h.call(s.g)}catch(l){w(l)}var c=hn;c.j(s),100>c.h&&(c.h++,s.next=c.g,c.g=s)}fn=!1};function et(){this.s=this.s,this.C=this.C}et.prototype.s=!1,et.prototype.ma=function(){this.s||(this.s=!0,this.N())},et.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function fe(s,c){this.type=s,this.g=this.target=c,this.defaultPrevented=!1}fe.prototype.h=function(){this.defaultPrevented=!0};var gh=function(){if(!u.addEventListener||!Object.defineProperty)return!1;var s=!1,c=Object.defineProperty({},"passive",{get:function(){s=!0}});try{const l=()=>{};u.addEventListener("test",l,c),u.removeEventListener("test",l,c)}catch{}return s}();function pn(s,c){if(fe.call(this,s?s.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,s){var l=this.type=s.type,f=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:null;if(this.target=s.target||s.srcElement,this.g=c,c=s.relatedTarget){if(Re){e:{try{ee(c.nodeName);var I=!0;break e}catch{}I=!1}I||(c=null)}}else l=="mouseover"?c=s.fromElement:l=="mouseout"&&(c=s.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=s.clientX!==void 0?s.clientX:s.pageX,this.clientY=s.clientY!==void 0?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0),this.button=s.button,this.key=s.key||"",this.ctrlKey=s.ctrlKey,this.altKey=s.altKey,this.shiftKey=s.shiftKey,this.metaKey=s.metaKey,this.pointerId=s.pointerId||0,this.pointerType=typeof s.pointerType=="string"?s.pointerType:_h[s.pointerType]||"",this.state=s.state,this.i=s,s.defaultPrevented&&pn.aa.h.call(this)}}V(pn,fe);var _h={2:"touch",3:"pen",4:"mouse"};pn.prototype.h=function(){pn.aa.h.call(this);var s=this.i;s.preventDefault?s.preventDefault():s.returnValue=!1};var mn="closure_listenable_"+(1e6*Math.random()|0),yh=0;function vh(s,c,l,f,I){this.listener=s,this.proxy=null,this.src=c,this.type=l,this.capture=!!f,this.ha=I,this.key=++yh,this.da=this.fa=!1}
vendor: 35,048 bytes, lines 1560-1572
1560function lr(s){s.da=!0,s.listener=null,s.proxy=null,s.src=null,s.ha=null}function hr(s){this.src=s,this.g={},this.h=0}hr.prototype.add=function(s,c,l,f,I){var R=s.toString();s=this.g[R],s||(s=this.g[R]=[],this.h++);var C=Pi(s,c,f,I);return-1<C?(c=s[C],l||(c.fa=!1)):(c=new vh(c,this.src,R,!!f,I),c.fa=l,s.push(c)),c};function Si(s,c){var l=c.type;if(l in s.g){var f=s.g[l],I=Array.prototype.indexOf.call(f,c,void 0),R;(R=0<=I)&&Array.prototype.splice.call(f,I,1),R&&(lr(c),s.g[l].length==0&&(delete s.g[l],s.h--))}}function Pi(s,c,l,f){for(var I=0;I<s.length;++I){var R=s[I];if(!R.da&&R.listener==c&&R.capture==!!l&&R.ha==f)return I}return-1}var Ci="closure_lm_"+(1e6*Math.random()|0),ki={};function Co(s,c,l,f,I){if(f&&f.once)return Vo(s,c,l,f,I);if(Array.isArray(c)){for(var R=0;R<c.length;R++)Co(s,c[R],l,f,I);return null}return l=Oi(l),s&&s[mn]?s.K(c,l,d(f)?!!f.capture:!!f,I):ko(s,c,l,!1,f,I)}function ko(s,c,l,f,I,R){if(!c)throw Error("Invalid event type");var C=d(I)?!!I.capture:!!I,Q=Di(s);if(Q||(s[Ci]=Q=new hr(s)),l=Q.add(c,l,f,C,R),l.proxy)return l;if(f=Eh(),l.proxy=f,f.src=s,f.listener=l,s.addEventListener)gh||(I=C),I===void 0&&(I=!1),s.addEventListener(c.toString(),f,I);else if(s.attachEvent)s.attachEvent(No(c.toString()),f);else if(s.addListener&&s.removeListener)s.addListener(f);else throw Error("addEventListener and attachEvent are unavailable.");return l}function Eh(){function s(l){return c.call(s.src,s.listener,l)}const c=Th;return s}function Vo(s,c,l,f,I){if(Array.isArray(c)){for(var R=0;R<c.length;R++)Vo(s,c[R],l,f,I);return null}return l=Oi(l),s&&s[mn]?s.L(c,l,d(f)?!!f.capture:!!f,I):ko(s,c,l,!0,f,I)}function Do(s,c,l,f,I){if(Array.isArray(c))for(var R=0;R<c.length;R++)Do(s,c[R],l,f,I);else f=d(f)?!!f.capture:!!f,l=Oi(l),s&&s[mn]?(s=s.i,c=String(c).toString(),c in s.g&&(R=s.g[c],l=Pi(R,l,f,I),-1<l&&(lr(R[l]),Array.prototype.splice.call(R,l,1),R.length==0&&(delete s.g[c],s.h--)))):s&&(s=Di(s))&&(c=s.g[c.toString()],s=-1,c&&(s=Pi(c,l,f,I)),(l=-1<s?c[s]:null)&&Vi(l))}function Vi(s){if(typeof s!="number"&&s&&!s.da){var c=s.src;if(c&&c[mn])Si(c.i,s);else{var l=s.type,f=s.proxy;c.removeEventListener?c.removeEventListener(l,f,s.capture):c.detachEvent?c.detachEvent(No(l),f):c.addListener&&c.removeListener&&c.removeListener(f),(l=Di(c))?(Si(l,s),l.h==0&&(l.src=null,c[Ci]=null)):lr(s)}}}function No(s){return s in ki?ki[s]:ki[s]="on"+s}function Th(s,c){if(s.da)s=!0;else{c=new pn(c,this);var l=s.listener,f=s.ha||s.src;s.fa&&Vi(s),s=l.call(f,c)}return s}function Di(s){return s=s[Ci],s instanceof hr?s:null}var Ni="__closure_events_fn_"+(1e9*Math.random()>>>0);function Oi(s){return typeof s=="function"?s:(s[Ni]||(s[Ni]=function(c){return s.handleEvent(c)}),s[Ni])}function pe(){et.call(this),this.i=new hr(this),this.M=this,this.F=null}V(pe,et),pe.prototype[mn]=!0,pe.prototype.removeEventListener=function(s,c,l,f){Do(this,s,c,l,f)};function Te(s,c){var l,f=s.F;if(f)for(l=[];f;f=f.F)l.push(f);if(s=s.M,f=c.type||c,typeof c=="string")c=new fe(c,s);else if(c instanceof fe)c.target=c.target||s;else{var I=c;c=new fe(f,s),v(c,I)}if(I=!0,l)for(var R=l.length-1;0<=R;R--){var C=c.g=l[R];I=dr(C,f,!0,c)&&I}if(C=c.g=s,I=dr(C,f,!0,c)&&I,I=dr(C,f,!1,c)&&I,l)for(R=0;R<l.length;R++)C=c.g=l[R],I=dr(C,f,!1,c)&&I}pe.prototype.N=function(){if(pe.aa.N.call(this),this.i){var s=this.i,c;for(c in s.g){for(var l=s.g[c],f=0;f<l.length;f++)lr(l[f]);delete s.g[c],s.h--}}this.F=null},pe.prototype.K=function(s,c,l,f){return this.i.add(String(s),c,!1,l,f)},pe.prototype.L=function(s,c,l,f){return this.i.add(String(s),c,!0,l,f)};function dr(s,c,l,f){if(c=s.i.g[String(c)],!c)return!0;c=c.concat();for(var I=!0,R=0;R<c.length;++R){var C=c[R];if(C&&!C.da&&C.capture==l){var Q=C.listener,ce=C.ha||C.src;C.fa&&Si(s.i,C),I=Q.call(ce,f)!==!1&&I}}return I&&!f.defaultPrevented}function Oo(s,c,l){if(typeof s=="function")l&&(s=A(s,l));else if(s&&typeof s.handleEvent=="function")s=A(s.handleEvent,s);else throw Error("Invalid listener argument");return 2147483647<Number(c)?-1:u.setTimeout(s,c||0)}function Mo(s){s.g=Oo(()=>{s.g=null,s.i&&(s.i=!1,Mo(s))},s.l);const c=s.h;s.h=null,s.m.apply(null,c)}class Ih extends et{constructor(c,l){super(),this.m=c,this.l=l,this.h=null,this.i=!1,this.g=null}j(c){this.h=arguments,this.g?this.i=!0:Mo(this)}N(){super.N(),this.g&&(u.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function gn(s){et.call(this),this.h=s,this.g={}}V(gn,et);var Lo=[];function xo(s){te(s.g,function(c,l){this.g.hasOwnProperty(l)&&Vi(c)},s),s.g={}}gn.prototype.N=function(){gn.aa.N.call(this),xo(this)},gn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Mi=u.JSON.stringify,wh=u.JSON.parse,Ah=class{stringify(s){return u.JSON.stringify(s,void 0)}parse(s){return u.JSON.parse(s,void 0)}};function Li(){}Li.prototype.h=null;function Uo(s){return s.h||(s.h=s.i())}function Fo(){}var _n={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function xi(){fe.call(this,"d")}V(xi,fe);function Ui(){fe.call(this,"c")}V(Ui,fe);var vt={},Bo=null;function fr(){return Bo=Bo||new pe}vt.La="serverreachability";function jo(s){fe.call(this,vt.La,s)}V(jo,fe);function yn(s){const c=fr();Te(c,new jo(c))}vt.STAT_EVENT="statevent";function qo(s,c){fe.call(this,vt.STAT_EVENT,s),this.stat=c}V(qo,fe);function Ie(s){const c=fr();Te(c,new qo(c,s))}vt.Ma="timingevent";function $o(s,c){fe.call(this,vt.Ma,s),this.size=c}V($o,fe);function vn(s,c){if(typeof s!="function")throw Error("Fn must not be null and must be a function");return u.setTimeout(function(){s()},c)}function En(){this.g=!0}En.prototype.xa=function(){this.g=!1};function Rh(s,c,l,f,I,R){s.info(function(){if(s.g)if(R)for(var C="",Q=R.split("&"),ce=0;ce<Q.length;ce++){var z=Q[ce].split("=");if(1<z.length){var me=z[0];z=z[1];var ge=me.split("_");C=2<=ge.length&&ge[1]=="type"?C+(me+"="+z+"&"):C+(me+"=redacted&")}}else C=null;else C=R;return"XMLHTTP REQ ("+f+") [attempt "+I+"]: "+c+`
1561`+l+`
1562`+C})}function bh(s,c,l,f,I,R,C){s.info(function(){return"XMLHTTP RESP ("+f+") [ attempt "+I+"]: "+c+`
1563`+l+`
1564`+R+" "+C})}function Mt(s,c,l,f){s.info(function(){return"XMLHTTP TEXT ("+c+"): "+Ph(s,l)+(f?" "+f:"")})}function Sh(s,c){s.info(function(){return"TIMEOUT: "+c})}En.prototype.info=function(){};function Ph(s,c){if(!s.g)return c;if(!c)return null;try{var l=JSON.parse(c);if(l){for(s=0;s<l.length;s++)if(Array.isArray(l[s])){var f=l[s];if(!(2>f.length)){var I=f[1];if(Array.isArray(I)&&!(1>I.length)){var R=I[0];if(R!="noop"&&R!="stop"&&R!="close")for(var C=1;C<I.length;C++)I[C]=""}}}}return Mi(l)}catch{return c}}var pr={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},zo={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Fi;function mr(){}V(mr,Li),mr.prototype.g=function(){return new XMLHttpRequest},mr.prototype.i=function(){return{}},Fi=new mr;function tt(s,c,l,f){this.j=s,this.i=c,this.l=l,this.R=f||1,this.U=new gn(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 Wo}function Wo(){this.i=null,this.g="",this.h=!1}var Go={},Bi={};function ji(s,c,l){s.L=1,s.v=vr(Be(c)),s.m=l,s.P=!0,Ho(s,null)}function Ho(s,c){s.F=Date.now(),gr(s),s.A=Be(s.v);var l=s.A,f=s.R;Array.isArray(f)||(f=[String(f)]),aa(l.i,"t",f),s.C=0,l=s.j.J,s.h=new Wo,s.g=Ra(s.j,l?c:null,!s.m),0<s.O&&(s.M=new Ih(A(s.Y,s,s.g),s.O)),c=s.U,l=s.g,f=s.ca;var I="readystatechange";Array.isArray(I)||(I&&(Lo[0]=I.toString()),I=Lo);for(var R=0;R<I.length;R++){var C=Co(l,I[R],f||c.handleEvent,!1,c.h||c);if(!C)break;c.g[C.key]=C}c=s.H?m(s.H):{},s.m?(s.u||(s.u="POST"),c["Content-Type"]="application/x-www-form-urlencoded",s.g.ea(s.A,s.u,s.m,c)):(s.u="GET",s.g.ea(s.A,s.u,null,c)),yn(),Rh(s.i,s.u,s.A,s.l,s.R,s.m)}tt.prototype.ca=function(s){s=s.target;const c=this.M;c&&je(s)==3?c.j():this.Y(s)},tt.prototype.Y=function(s){try{if(s==this.g)e:{const ge=je(this.g);var c=this.g.Ba();const Ut=this.g.Z();if(!(3>ge)&&(ge!=3||this.g&&(this.h.h||this.g.oa()||pa(this.g)))){this.J||ge!=4||c==7||(c==8||0>=Ut?yn(3):yn(2)),qi(this);var l=this.g.Z();this.X=l;t:if(Ko(this)){var f=pa(this.g);s="";var I=f.length,R=je(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Et(this),Tn(this);var C="";break t}this.h.i=new u.TextDecoder}for(c=0;c<I;c++)this.h.h=!0,s+=this.h.i.decode(f[c],{stream:!(R&&c==I-1)});f.length=0,this.h.g+=s,this.C=0,C=this.h.g}else C=this.g.oa();if(this.o=l==200,bh(this.i,this.u,this.A,this.l,this.R,ge,l),this.o){if(this.T&&!this.K){t:{if(this.g){var Q,ce=this.g;if((Q=ce.g?ce.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!G(Q)){var z=Q;break t}}z=null}if(l=z)Mt(this.i,this.l,l,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,$i(this,l);else{this.o=!1,this.s=3,Ie(12),Et(this),Tn(this);break e}}if(this.P){l=!0;let Ce;for(;!this.J&&this.C<C.length;)if(Ce=Ch(this,C),Ce==Bi){ge==4&&(this.s=4,Ie(14),l=!1),Mt(this.i,this.l,null,"[Incomplete Response]");break}else if(Ce==Go){this.s=4,Ie(15),Mt(this.i,this.l,C,"[Invalid Chunk]"),l=!1;break}else Mt(this.i,this.l,Ce,null),$i(this,Ce);if(Ko(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),ge!=4||C.length!=0||this.h.h||(this.s=1,Ie(16),l=!1),this.o=this.o&&l,!l)Mt(this.i,this.l,C,"[Invalid Chunked Response]"),Et(this),Tn(this);else if(0<C.length&&!this.W){this.W=!0;var me=this.j;me.g==this&&me.ba&&!me.M&&(me.j.info("Great, no buffering proxy detected. Bytes received: "+C.length),Qi(me),me.M=!0,Ie(11))}}else Mt(this.i,this.l,C,null),$i(this,C);ge==4&&Et(this),this.o&&!this.J&&(ge==4?Ta(this.j,this):(this.o=!1,gr(this)))}else Gh(this.g),l==400&&0<C.indexOf("Unknown SID")?(this.s=3,Ie(12)):(this.s=0,Ie(13)),Et(this),Tn(this)}}}catch{}finally{}};function Ko(s){return s.g?s.u=="GET"&&s.L!=2&&s.j.Ca:!1}function Ch(s,c){var l=s.C,f=c.indexOf(`
1565`,l);return f==-1?Bi:(l=Number(c.substring(l,f)),isNaN(l)?Go:(f+=1,f+l>c.length?Bi:(c=c.slice(f,f+l),s.C=f+l,c)))}tt.prototype.cancel=function(){this.J=!0,Et(this)};function gr(s){s.S=Date.now()+s.I,Qo(s,s.I)}function Qo(s,c){if(s.B!=null)throw Error("WatchDog timer not null");s.B=vn(A(s.ba,s),c)}function qi(s){s.B&&(u.clearTimeout(s.B),s.B=null)}tt.prototype.ba=function(){this.B=null;const s=Date.now();0<=s-this.S?(Sh(this.i,this.A),this.L!=2&&(yn(),Ie(17)),Et(this),this.s=2,Tn(this)):Qo(this,this.S-s)};function Tn(s){s.j.G==0||s.J||Ta(s.j,s)}function Et(s){qi(s);var c=s.M;c&&typeof c.ma=="function"&&c.ma(),s.M=null,xo(s.U),s.g&&(c=s.g,s.g=null,c.abort(),c.ma())}function $i(s,c){try{var l=s.j;if(l.G!=0&&(l.g==s||zi(l.h,s))){if(!s.K&&zi(l.h,s)&&l.G==3){try{var f=l.Da.g.parse(c)}catch{f=null}if(Array.isArray(f)&&f.length==3){var I=f;if(I[0]==0){e:if(!l.u){if(l.g)if(l.g.F+3e3<s.F)Rr(l),wr(l);else break e;Ki(l),Ie(18)}}else l.za=I[1],0<l.za-l.T&&37500>I[2]&&l.F&&l.v==0&&!l.C&&(l.C=vn(A(l.Za,l),6e3));if(1>=Yo(l.h)&&l.ca){try{l.ca()}catch{}l.ca=void 0}}else It(l,11)}else if((s.K||l.g==s)&&Rr(l),!G(c))for(I=l.Da.g.parse(c),c=0;c<I.length;c++){let z=I[c];if(l.T=z[0],z=z[1],l.G==2)if(z[0]=="c"){l.K=z[1],l.ia=z[2];const me=z[3];me!=null&&(l.la=me,l.j.info("VER="+l.la));const ge=z[4];ge!=null&&(l.Aa=ge,l.j.info("SVER="+l.Aa));const Ut=z[5];Ut!=null&&typeof Ut=="number"&&0<Ut&&(f=1.5*Ut,l.L=f,l.j.info("backChannelRequestTimeoutMs_="+f)),f=l;const Ce=s.g;if(Ce){const Sr=Ce.g?Ce.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Sr){var R=f.h;R.g||Sr.indexOf("spdy")==-1&&Sr.indexOf("quic")==-1&&Sr.indexOf("h2")==-1||(R.j=R.l,R.g=new Set,R.h&&(Wi(R,R.h),R.h=null))}if(f.D){const Ji=Ce.g?Ce.g.getResponseHeader("X-HTTP-Session-Id"):null;Ji&&(f.ya=Ji,J(f.I,f.D,Ji))}}l.G=3,l.l&&l.l.ua(),l.ba&&(l.R=Date.now()-s.F,l.j.info("Handshake RTT: "+l.R+"ms")),f=l;var C=s;if(f.qa=Aa(f,f.J?f.ia:null,f.W),C.K){Zo(f.h,C);var Q=C,ce=f.L;ce&&(Q.I=ce),Q.B&&(qi(Q),gr(Q)),f.g=C}else va(f);0<l.i.length&&Ar(l)}else z[0]!="stop"&&z[0]!="close"||It(l,7);else l.G==3&&(z[0]=="stop"||z[0]=="close"?z[0]=="stop"?It(l,7):Hi(l):z[0]!="noop"&&l.l&&l.l.ta(z),l.v=0)}}yn(4)}catch{}}var kh=class{constructor(s,c){this.g=s,this.map=c}};function Jo(s){this.l=s||10,u.PerformanceNavigationTiming?(s=u.performance.getEntriesByType("navigation"),s=0<s.length&&(s[0].nextHopProtocol=="hq"||s[0].nextHopProtocol=="h2")):s=!!(u.chrome&&u.chrome.loadTimes&&u.chrome.loadTimes()&&u.chrome.loadTimes().wasFetchedViaSpdy),this.j=s?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Xo(s){return s.h?!0:s.g?s.g.size>=s.j:!1}function Yo(s){return s.h?1:s.g?s.g.size:0}function zi(s,c){return s.h?s.h==c:s.g?s.g.has(c):!1}function Wi(s,c){s.g?s.g.add(c):s.h=c}function Zo(s,c){s.h&&s.h==c?s.h=null:s.g&&s.g.has(c)&&s.g.delete(c)}Jo.prototype.cancel=function(){if(this.i=ea(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const s of this.g.values())s.cancel();this.g.clear()}};function ea(s){if(s.h!=null)return s.i.concat(s.h.D);if(s.g!=null&&s.g.size!==0){let c=s.i;for(const l of s.g.values())c=c.concat(l.D);return c}return O(s.i)}function Vh(s){if(s.V&&typeof s.V=="function")return s.V();if(typeof Map<"u"&&s instanceof Map||typeof Set<"u"&&s instanceof Set)return Array.from(s.values());if(typeof s=="string")return s.split("");if(h(s)){for(var c=[],l=s.length,f=0;f<l;f++)c.push(s[f]);return c}c=[],l=0;for(f in s)c[l++]=s[f];return c}function Dh(s){if(s.na&&typeof s.na=="function")return s.na();if(!s.V||typeof s.V!="function"){if(typeof Map<"u"&&s instanceof Map)return Array.from(s.keys());if(!(typeof Set<"u"&&s instanceof Set)){if(h(s)||typeof s=="string"){var c=[];s=s.length;for(var l=0;l<s;l++)c.push(l);return c}c=[],l=0;for(const f in s)c[l++]=f;return c}}}function ta(s,c){if(s.forEach&&typeof s.forEach=="function")s.forEach(c,void 0);else if(h(s)||typeof s=="string")Array.prototype.forEach.call(s,c,void 0);else for(var l=Dh(s),f=Vh(s),I=f.length,R=0;R<I;R++)c.call(void 0,f[R],l&&l[R],s)}var na=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Nh(s,c){if(s){s=s.split("&");for(var l=0;l<s.length;l++){var f=s[l].indexOf("="),I=null;if(0<=f){var R=s[l].substring(0,f);I=s[l].substring(f+1)}else R=s[l];c(R,I?decodeURIComponent(I.replace(/\+/g," ")):"")}}}function Tt(s){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,s instanceof Tt){this.h=s.h,_r(this,s.j),this.o=s.o,this.g=s.g,yr(this,s.s),this.l=s.l;var c=s.i,l=new An;l.i=c.i,c.g&&(l.g=new Map(c.g),l.h=c.h),ra(this,l),this.m=s.m}else s&&(c=String(s).match(na))?(this.h=!1,_r(this,c[1]||"",!0),this.o=In(c[2]||""),this.g=In(c[3]||"",!0),yr(this,c[4]),this.l=In(c[5]||"",!0),ra(this,c[6]||"",!0),this.m=In(c[7]||"")):(this.h=!1,this.i=new An(null,this.h))}Tt.prototype.toString=function(){var s=[],c=this.j;c&&s.push(wn(c,ia,!0),":");var l=this.g;return(l||c=="file")&&(s.push("//"),(c=this.o)&&s.push(wn(c,ia,!0),"@"),s.push(encodeURIComponent(String(l)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l=this.s,l!=null&&s.push(":",String(l))),(l=this.l)&&(this.g&&l.charAt(0)!="/"&&s.push("/"),s.push(wn(l,l.charAt(0)=="/"?Lh:Mh,!0))),(l=this.i.toString())&&s.push("?",l),(l=this.m)&&s.push("#",wn(l,Uh)),s.join("")};function Be(s){return new Tt(s)}function _r(s,c,l){s.j=l?In(c,!0):c,s.j&&(s.j=s.j.replace(/:$/,""))}function yr(s,c){if(c){if(c=Number(c),isNaN(c)||0>c)throw Error("Bad port number "+c);s.s=c}else s.s=null}function ra(s,c,l){c instanceof An?(s.i=c,Fh(s.i,s.h)):(l||(c=wn(c,xh)),s.i=new An(c,s.h))}function J(s,c,l){s.i.set(c,l)}function vr(s){return J(s,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),s}function In(s,c){return s?c?decodeURI(s.replace(/%25/g,"%2525")):decodeURIComponent(s):""}function wn(s,c,l){return typeof s=="string"?(s=encodeURI(s).replace(c,Oh),l&&(s=s.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),s):null}function Oh(s){return s=s.charCodeAt(0),"%"+(s>>4&15).toString(16)+(s&15).toString(16)}var ia=/[#\/\?@]/g,Mh=/[#\?:]/g,Lh=/[#\?]/g,xh=/[#\?@]/g,Uh=/#/g;function An(s,c){this.h=this.g=null,this.i=s||null,this.j=!!c}function nt(s){s.g||(s.g=new Map,s.h=0,s.i&&Nh(s.i,function(c,l){s.add(decodeURIComponent(c.replace(/\+/g," ")),l)}))}n=An.prototype,n.add=function(s,c){nt(this),this.i=null,s=Lt(this,s);var l=this.g.get(s);return l||this.g.set(s,l=[]),l.push(c),this.h+=1,this};function sa(s,c){nt(s),c=Lt(s,c),s.g.has(c)&&(s.i=null,s.h-=s.g.get(c).length,s.g.delete(c))}function oa(s,c){return nt(s),c=Lt(s,c),s.g.has(c)}n.forEach=function(s,c){nt(this),this.g.forEach(function(l,f){l.forEach(function(I){s.call(c,I,f,this)},this)},this)},n.na=function(){nt(this);const s=Array.from(this.g.values()),c=Array.from(this.g.keys()),l=[];for(let f=0;f<c.length;f++){const I=s[f];for(let R=0;R<I.length;R++)l.push(c[f])}return l},n.V=function(s){nt(this);let c=[];if(typeof s=="string")oa(this,s)&&(c=c.concat(this.g.get(Lt(this,s))));else{s=Array.from(this.g.values());for(let l=0;l<s.length;l++)c=c.concat(s[l])}return c},n.set=function(s,c){return nt(this),this.i=null,s=Lt(this,s),oa(this,s)&&(this.h-=this.g.get(s).length),this.g.set(s,[c]),this.h+=1,this},n.get=function(s,c){return s?(s=this.V(s),0<s.length?String(s[0]):c):c};function aa(s,c,l){sa(s,c),0<l.length&&(s.i=null,s.g.set(Lt(s,c),O(l)),s.h+=l.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const s=[],c=Array.from(this.g.keys());for(var l=0;l<c.length;l++){var f=c[l];const R=encodeURIComponent(String(f)),C=this.V(f);for(f=0;f<C.length;f++){var I=R;C[f]!==""&&(I+="="+encodeURIComponent(String(C[f]))),s.push(I)}}return this.i=s.join("&")};function Lt(s,c){return c=String(c),s.j&&(c=c.toLowerCase()),c}function Fh(s,c){c&&!s.j&&(nt(s),s.i=null,s.g.forEach(function(l,f){var I=f.toLowerCase();f!=I&&(sa(this,f),aa(this,I,l))},s)),s.j=c}function Bh(s,c){const l=new En;if(u.Image){const f=new Image;f.onload=S(rt,l,"TestLoadImage: loaded",!0,c,f),f.onerror=S(rt,l,"TestLoadImage: error",!1,c,f),f.onabort=S(rt,l,"TestLoadImage: abort",!1,c,f),f.ontimeout=S(rt,l,"TestLoadImage: timeout",!1,c,f),u.setTimeout(function(){f.ontimeout&&f.ontimeout()},1e4),f.src=s}else c(!1)}function jh(s,c){const l=new En,f=new AbortController,I=setTimeout(()=>{f.abort(),rt(l,"TestPingServer: timeout",!1,c)},1e4);fetch(s,{signal:f.signal}).then(R=>{clearTimeout(I),R.ok?rt(l,"TestPingServer: ok",!0,c):rt(l,"TestPingServer: server error",!1,c)}).catch(()=>{clearTimeout(I),rt(l,"TestPingServer: error",!1,c)})}function rt(s,c,l,f,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),f(l)}catch{}}function qh(){this.g=new Ah}function $h(s,c,l){const f=l||"";try{ta(s,function(I,R){let C=I;d(I)&&(C=Mi(I)),c.push(f+R+"="+encodeURIComponent(C))})}catch(I){throw c.push(f+"type="+encodeURIComponent("_badmap")),I}}function Er(s){this.l=s.Ub||null,this.j=s.eb||!1}V(Er,Li),Er.prototype.g=function(){return new Tr(this.l,this.j)},Er.prototype.i=function(s){return function(){return s}}({});function Tr(s,c){pe.call(this),this.D=s,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}V(Tr,pe),n=Tr.prototype,n.open=function(s,c){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=s,this.A=c,this.readyState=1,bn(this)},n.send=function(s){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};s&&(c.body=s),(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,Rn(this)),this.readyState=0},n.Sa=function(s){if(this.g&&(this.l=s,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=s.headers,this.readyState=2,bn(this)),this.g&&(this.readyState=3,bn(this),this.g)))if(this.responseType==="arraybuffer")s.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof u.ReadableStream<"u"&&"body"in s){if(this.j=s.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;ca(this)}else s.text().then(this.Ra.bind(this),this.ga.bind(this))};function ca(s){s.j.read().then(s.Pa.bind(s)).catch(s.ga.bind(s))}n.Pa=function(s){if(this.g){if(this.o&&s.value)this.response.push(s.value);else if(!this.o){var c=s.value?s.value:new Uint8Array(0);(c=this.v.decode(c,{stream:!s.done}))&&(this.response=this.responseText+=c)}s.done?Rn(this):bn(this),this.readyState==3&&ca(this)}},n.Ra=function(s){this.g&&(this.response=this.responseText=s,Rn(this))},n.Qa=function(s){this.g&&(this.response=s,Rn(this))},n.ga=function(){this.g&&Rn(this)};function Rn(s){s.readyState=4,s.l=null,s.j=null,s.v=null,bn(s)}n.setRequestHeader=function(s,c){this.u.append(s,c)},n.getResponseHeader=function(s){return this.h&&this.h.get(s.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const s=[],c=this.h.entries();for(var l=c.next();!l.done;)l=l.value,s.push(l[0]+": "+l[1]),l=c.next();return s.join(`\r
1566`)};function bn(s){s.onreadystatechange&&s.onreadystatechange.call(s)}Object.defineProperty(Tr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(s){this.m=s?"include":"same-origin"}});function ua(s){let c="";return te(s,function(l,f){c+=f,c+=":",c+=l,c+=`\r
1567`}),c}function Gi(s,c,l){e:{for(f in l){var f=!1;break e}f=!0}f||(l=ua(l),typeof s=="string"?l!=null&&encodeURIComponent(String(l)):J(s,c,l))}function Z(s){pe.call(this),this.headers=new Map,this.o=s||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}V(Z,pe);var zh=/^https?$/i,Wh=["POST","PUT"];n=Z.prototype,n.Ha=function(s){this.J=s},n.ea=function(s,c,l,f){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+s);c=c?c.toUpperCase():"GET",this.D=s,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Fi.g(),this.v=this.o?Uo(this.o):Uo(Fi),this.g.onreadystatechange=A(this.Ea,this);try{this.B=!0,this.g.open(c,String(s),!0),this.B=!1}catch(R){la(this,R);return}if(s=l||"",l=new Map(this.headers),f)if(Object.getPrototypeOf(f)===Object.prototype)for(var I in f)l.set(I,f[I]);else if(typeof f.keys=="function"&&typeof f.get=="function")for(const R of f.keys())l.set(R,f.get(R));else throw Error("Unknown input type for opt_headers: "+String(f));f=Array.from(l.keys()).find(R=>R.toLowerCase()=="content-type"),I=u.FormData&&s instanceof u.FormData,!(0<=Array.prototype.indexOf.call(Wh,c,void 0))||f||I||l.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[R,C]of l)this.g.setRequestHeader(R,C);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{fa(this),this.u=!0,this.g.send(s),this.u=!1}catch(R){la(this,R)}};function la(s,c){s.h=!1,s.g&&(s.j=!0,s.g.abort(),s.j=!1),s.l=c,s.m=5,ha(s),Ir(s)}function ha(s){s.A||(s.A=!0,Te(s,"complete"),Te(s,"error"))}n.abort=function(s){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=s||7,Te(this,"complete"),Te(this,"abort"),Ir(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Ir(this,!0)),Z.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?da(this):this.bb())},n.bb=function(){da(this)};function da(s){if(s.h&&typeof a<"u"&&(!s.v[1]||je(s)!=4||s.Z()!=2)){if(s.u&&je(s)==4)Oo(s.Ea,0,s);else if(Te(s,"readystatechange"),je(s)==4){s.h=!1;try{const C=s.Z();e:switch(C){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break e;default:c=!1}var l;if(!(l=c)){var f;if(f=C===0){var I=String(s.D).match(na)[1]||null;!I&&u.self&&u.self.location&&(I=u.self.location.protocol.slice(0,-1)),f=!zh.test(I?I.toLowerCase():"")}l=f}if(l)Te(s,"complete"),Te(s,"success");else{s.m=6;try{var R=2<je(s)?s.g.statusText:""}catch{R=""}s.l=R+" ["+s.Z()+"]",ha(s)}}finally{Ir(s)}}}}function Ir(s,c){if(s.g){fa(s);const l=s.g,f=s.v[0]?()=>{}:null;s.g=null,s.v=null,c||Te(s,"ready");try{l.onreadystatechange=f}catch{}}}function fa(s){s.I&&(u.clearTimeout(s.I),s.I=null)}n.isActive=function(){return!!this.g};function je(s){return s.g?s.g.readyState:0}n.Z=function(){try{return 2<je(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(s){if(this.g){var c=this.g.responseText;return s&&c.indexOf(s)==0&&(c=c.substring(s.length)),wh(c)}};function pa(s){try{if(!s.g)return null;if("response"in s.g)return s.g.response;switch(s.H){case"":case"text":return s.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in s.g)return s.g.mozResponseArrayBuffer}return null}catch{return null}}function Gh(s){const c={};s=(s.g&&2<=je(s)&&s.g.getAllResponseHeaders()||"").split(`\r
1568`);for(let f=0;f<s.length;f++){if(G(s[f]))continue;var l=T(s[f]);const I=l[0];if(l=l[1],typeof l!="string")continue;l=l.trim();const R=c[I]||[];c[I]=R,R.push(l)}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 Sn(s,c,l){return l&&l.internalChannelParams&&l.internalChannelParams[s]||c}function ma(s){this.Aa=0,this.i=[],this.j=new En,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=Sn("failFast",!1,s),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=Sn("baseRetryDelayMs",5e3,s),this.cb=Sn("retryDelaySeedMs",1e4,s),this.Wa=Sn("forwardChannelMaxRetries",2,s),this.wa=Sn("forwardChannelRequestTimeoutMs",2e4,s),this.pa=s&&s.xmlHttpFactory||void 0,this.Xa=s&&s.Tb||void 0,this.Ca=s&&s.useFetchStreams||!1,this.L=void 0,this.J=s&&s.supportsCrossDomainXhr||!1,this.K="",this.h=new Jo(s&&s.concurrentRequestLimit),this.Da=new qh,this.P=s&&s.fastHandshake||!1,this.O=s&&s.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=s&&s.Rb||!1,s&&s.xa&&this.j.xa(),s&&s.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&s&&s.detectBufferingProxy||!1,this.ja=void 0,s&&s.longPollingTimeout&&0<s.longPollingTimeout&&(this.ja=s.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=ma.prototype,n.la=8,n.G=1,n.connect=function(s,c,l,f){Ie(0),this.W=s,this.H=c||{},l&&f!==void 0&&(this.H.OSID=l,this.H.OAID=f),this.F=this.X,this.I=Aa(this,null,this.W),Ar(this)};function Hi(s){if(ga(s),s.G==3){var c=s.U++,l=Be(s.I);if(J(l,"SID",s.K),J(l,"RID",c),J(l,"TYPE","terminate"),Pn(s,l),c=new tt(s,s.j,c),c.L=2,c.v=vr(Be(l)),l=!1,u.navigator&&u.navigator.sendBeacon)try{l=u.navigator.sendBeacon(c.v.toString(),"")}catch{}!l&&u.Image&&(new Image().src=c.v,l=!0),l||(c.g=Ra(c.j,null),c.g.ea(c.v)),c.F=Date.now(),gr(c)}wa(s)}function wr(s){s.g&&(Qi(s),s.g.cancel(),s.g=null)}function ga(s){wr(s),s.u&&(u.clearTimeout(s.u),s.u=null),Rr(s),s.h.cancel(),s.s&&(typeof s.s=="number"&&u.clearTimeout(s.s),s.s=null)}function Ar(s){if(!Xo(s.h)&&!s.s){s.s=!0;var c=s.Ga;dn||Po(),fn||(dn(),fn=!0),bi.add(c,s),s.B=0}}function Hh(s,c){return Yo(s.h)>=s.h.j-(s.s?1:0)?!1:s.s?(s.i=c.D.concat(s.i),!0):s.G==1||s.G==2||s.B>=(s.Va?0:s.Wa)?!1:(s.s=vn(A(s.Ga,s,c),Ia(s,s.B)),s.B++,!0)}n.Ga=function(s){if(this.s)if(this.s=null,this.G==1){if(!s){this.U=Math.floor(1e5*Math.random()),s=this.U++;const I=new tt(this,this.j,s);let R=this.o;if(this.S&&(R?(R=m(R),v(R,this.S)):R=this.S),this.m!==null||this.O||(I.H=R,R=null),this.P)e:{for(var c=0,l=0;l<this.i.length;l++){t:{var f=this.i[l];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=l;break e}if(c===4096||l===this.i.length-1){c=l+1;break e}}c=1e3}else c=1e3;c=ya(this,I,c),l=Be(this.I),J(l,"RID",s),J(l,"CVER",22),this.D&&J(l,"X-HTTP-Session-Id",this.D),Pn(this,l),R&&(this.O?c="headers="+encodeURIComponent(String(ua(R)))+"&"+c:this.m&&Gi(l,this.m,R)),Wi(this.h,I),this.Ua&&J(l,"TYPE","init"),this.P?(J(l,"$req",c),J(l,"SID","null"),I.T=!0,ji(I,l,null)):ji(I,l,c),this.G=2}}else this.G==3&&(s?_a(this,s):this.i.length==0||Xo(this.h)||_a(this))};function _a(s,c){var l;c?l=c.l:l=s.U++;const f=Be(s.I);J(f,"SID",s.K),J(f,"RID",l),J(f,"AID",s.T),Pn(s,f),s.m&&s.o&&Gi(f,s.m,s.o),l=new tt(s,s.j,l,s.B+1),s.m===null&&(l.H=s.o),c&&(s.i=c.D.concat(s.i)),c=ya(s,l,1e3),l.I=Math.round(.5*s.wa)+Math.round(.5*s.wa*Math.random()),Wi(s.h,l),ji(l,f,c)}function Pn(s,c){s.H&&te(s.H,function(l,f){J(c,f,l)}),s.l&&ta({},function(l,f){J(c,f,l)})}function ya(s,c,l){l=Math.min(s.i.length,l);var f=s.l?A(s.l.Na,s.l,s):null;e:{var I=s.i;let R=-1;for(;;){const C=["count="+l];R==-1?0<l?(R=I[0].g,C.push("ofs="+R)):R=0:C.push("ofs="+R);let Q=!0;for(let ce=0;ce<l;ce++){let z=I[ce].g;const me=I[ce].map;if(z-=R,0>z)R=Math.max(0,I[ce].g-100),Q=!1;else try{$h(me,C,"req"+z+"_")}catch{f&&f(me)}}if(Q){f=C.join("&");break e}}}return s=s.i.splice(0,l),c.D=s,f}function va(s){if(!s.g&&!s.u){s.Y=1;var c=s.Fa;dn||Po(),fn||(dn(),fn=!0),bi.add(c,s),s.v=0}}function Ki(s){return s.g||s.u||3<=s.v?!1:(s.Y++,s.u=vn(A(s.Fa,s),Ia(s,s.v)),s.v++,!0)}n.Fa=function(){if(this.u=null,Ea(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var s=2*this.R;this.j.info("BP detection timer enabled: "+s),this.A=vn(A(this.ab,this),s)}},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,Ie(10),wr(this),Ea(this))};function Qi(s){s.A!=null&&(u.clearTimeout(s.A),s.A=null)}function Ea(s){s.g=new tt(s,s.j,"rpc",s.Y),s.m===null&&(s.g.H=s.o),s.g.O=0;var c=Be(s.qa);J(c,"RID","rpc"),J(c,"SID",s.K),J(c,"AID",s.T),J(c,"CI",s.F?"0":"1"),!s.F&&s.ja&&J(c,"TO",s.ja),J(c,"TYPE","xmlhttp"),Pn(s,c),s.m&&s.o&&Gi(c,s.m,s.o),s.L&&(s.g.I=s.L);var l=s.g;s=s.ia,l.L=1,l.v=vr(Be(c)),l.m=null,l.P=!0,Ho(l,s)}n.Za=function(){this.C!=null&&(this.C=null,wr(this),Ki(this),Ie(19))};function Rr(s){s.C!=null&&(u.clearTimeout(s.C),s.C=null)}function Ta(s,c){var l=null;if(s.g==c){Rr(s),Qi(s),s.g=null;var f=2}else if(zi(s.h,c))l=c.D,Zo(s.h,c),f=1;else return;if(s.G!=0){if(c.o)if(f==1){l=c.m?c.m.length:0,c=Date.now()-c.F;var I=s.B;f=fr(),Te(f,new $o(f,l)),Ar(s)}else va(s);else if(I=c.s,I==3||I==0&&0<c.X||!(f==1&&Hh(s,c)||f==2&&Ki(s)))switch(l&&0<l.length&&(c=s.h,c.i=c.i.concat(l)),I){case 1:It(s,5);break;case 4:It(s,10);break;case 3:It(s,6);break;default:It(s,2)}}}function Ia(s,c){let l=s.Ta+Math.floor(Math.random()*s.cb);return s.isActive()||(l*=2),l*c}function It(s,c){if(s.j.info("Error code "+c),c==2){var l=A(s.fb,s),f=s.Xa;const I=!f;f=new Tt(f||"//www.google.com/images/cleardot.gif"),u.location&&u.location.protocol=="http"||_r(f,"https"),vr(f),I?Bh(f.toString(),l):jh(f.toString(),l)}else Ie(2);s.G=0,s.l&&s.l.sa(c),wa(s),ga(s)}n.fb=function(s){s?(this.j.info("Successfully pinged google.com"),Ie(2)):(this.j.info("Failed to ping google.com"),Ie(1))};function wa(s){if(s.G=0,s.ka=[],s.l){const c=ea(s.h);(c.length!=0||s.i.length!=0)&&(k(s.ka,c),k(s.ka,s.i),s.h.i.length=0,O(s.i),s.i.length=0),s.l.ra()}}function Aa(s,c,l){var f=l instanceof Tt?Be(l):new Tt(l);if(f.g!="")c&&(f.g=c+"."+f.g),yr(f,f.s);else{var I=u.location;f=I.protocol,c=c?c+"."+I.hostname:I.hostname,I=+I.port;var R=new Tt(null);f&&_r(R,f),c&&(R.g=c),I&&yr(R,I),l&&(R.l=l),f=R}return l=s.D,c=s.ya,l&&c&&J(f,l,c),J(f,"VER",s.la),Pn(s,f),f}function Ra(s,c,l){if(c&&!s.J)throw Error("Can't create secondary domain capable XhrIo object.");return c=s.Ca&&!s.pa?new Z(new Er({eb:l})):new Z(s.pa),c.Ha(s.J),c}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function ba(){}n=ba.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function br(){}br.prototype.g=function(s,c){return new Ae(s,c)};function Ae(s,c){pe.call(this),this.g=new ma(c),this.l=s,this.h=c&&c.messageUrlParams||null,s=c&&c.messageHeaders||null,c&&c.clientProtocolHeaderRequired&&(s?s["X-Client-Protocol"]="webchannel":s={"X-Client-Protocol":"webchannel"}),this.g.o=s,s=c&&c.initMessageHeaders||null,c&&c.messageContentType&&(s?s["X-WebChannel-Content-Type"]=c.messageContentType:s={"X-WebChannel-Content-Type":c.messageContentType}),c&&c.va&&(s?s["X-WebChannel-Client-Profile"]=c.va:s={"X-WebChannel-Client-Profile":c.va}),this.g.S=s,(s=c&&c.Sb)&&!G(s)&&(this.g.m=s),this.v=c&&c.supportsCrossDomainXhr||!1,this.u=c&&c.sendRawJson||!1,(c=c&&c.httpSessionIdParam)&&!G(c)&&(this.g.D=c,s=this.h,s!==null&&c in s&&(s=this.h,c in s&&delete s[c])),this.j=new xt(this)}V(Ae,pe),Ae.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Ae.prototype.close=function(){Hi(this.g)},Ae.prototype.o=function(s){var c=this.g;if(typeof s=="string"){var l={};l.__data__=s,s=l}else this.u&&(l={},l.__data__=Mi(s),s=l);c.i.push(new kh(c.Ya++,s)),c.G==3&&Ar(c)},Ae.prototype.N=function(){this.g.l=null,delete this.j,Hi(this.g),delete this.g,Ae.aa.N.call(this)};function Sa(s){xi.call(this),s.__headers__&&(this.headers=s.__headers__,this.statusCode=s.__status__,delete s.__headers__,delete s.__status__);var c=s.__sm__;if(c){e:{for(const l in c){s=l;break e}s=void 0}(this.i=s)&&(s=this.i,c=c!==null&&s in c?c[s]:void 0),this.data=c}else this.data=s}V(Sa,xi);function Pa(){Ui.call(this),this.status=1}V(Pa,Ui);function xt(s){this.g=s}V(xt,ba),xt.prototype.ua=function(){Te(this.g,"a")},xt.prototype.ta=function(s){Te(this.g,new Sa(s))},xt.prototype.sa=function(s){Te(this.g,new Pa)},xt.prototype.ra=function(){Te(this.g,"b")},br.prototype.createWebChannel=br.prototype.g,Ae.prototype.send=Ae.prototype.o,Ae.prototype.open=Ae.prototype.m,Ae.prototype.close=Ae.prototype.close,Xu=function(){return new br},Ju=function(){return fr()},Qu=vt,ms={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},pr.NO_ERROR=0,pr.TIMEOUT=8,pr.HTTP_ERROR=6,xr=pr,zo.COMPLETE="complete",Ku=zo,Fo.EventType=_n,_n.OPEN="a",_n.CLOSE="b",_n.ERROR="c",_n.MESSAGE="d",pe.prototype.listen=pe.prototype.K,kn=Fo,Z.prototype.listenOnce=Z.prototype.L,Z.prototype.getLastError=Z.prototype.Ka,Z.prototype.getLastErrorCode=Z.prototype.Ba,Z.prototype.getStatus=Z.prototype.Z,Z.prototype.getResponseJson=Z.prototype.Oa,Z.prototype.getResponseText=Z.prototype.oa,Z.prototype.send=Z.prototype.ea,Z.prototype.setWithCredentials=Z.prototype.Ha,Hu=Z}).apply(typeof Cr<"u"?Cr:typeof self<"u"?self:typeof window<"u"?window:{});const nc="@firebase/firestore";/**
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 */class ye{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}}ye.UNAUTHENTICATED=new ye(null),ye.GOOGLE_CREDENTIALS=new ye("google-credentials-uid"),ye.FIRST_PARTY=new ye("first-party-uid"),ye.MOCK_USER=new ye("mock-user");/**
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 */let on="10.14.0";/**
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 */const Pt=new Ds("@firebase/firestore");function Cn(){return Pt.logLevel}function N(n,...e){if(Pt.logLevel<=B.DEBUG){const t=e.map(qs);Pt.debug(`Firestore (${on}): ${n}`,...t)}}function Xe(n,...e){if(Pt.logLevel<=B.ERROR){const t=e.map(qs);Pt.error(`Firestore (${on}): ${n}`,...t)}}function Jt(n,...e){if(Pt.logLevel<=B.WARN){const t=e.map(qs);Pt.warn(`Firestore (${on}): ${n}`,...t)}}function qs(n){if(typeof n=="string")return n;try{/**
1614* @license
1615* Copyright 2020 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*/return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
1629 * @license
1630 * Copyright 2017 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 x(n="Unexpected state"){const e=`FIRESTORE (${on}) INTERNAL ASSERTION FAILED: `+n;throw Xe(e),new Error(e)}function K(n,e){n||x()}function F(n,e){return n}/**
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, softw
1653are
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 */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 De{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
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 We{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
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 Yu{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Lm{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(ye.UNAUTHENTICATED))}shutdown(){}}class xm{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Um{constructor(e){this.t=e,this.currentUser=ye.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){K(this.o===void 0);let r=this.i;const i=h=>this.i!==r?(r=this.i,t(h)):Promise.resolve();let o=new We;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new We,e.enqueueRetryable(()=>i(this.currentUser))};const a=()=>{const h=o;e.enqueueRetryable(async()=>{await h.promise,await i(this.currentUser)})},u=h=>{N("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=h,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(h=>u(h)),setTimeout(()=>{if(!this.auth){const h=this.t.getImmediate({optional:!0});h?u(h):(N("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new We)}},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?(N("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(K(typeof r.accessToken=="string"),new Yu(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 K(e===null||typeof e=="string"),new ye(e)}}class Fm{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=ye.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 Bm{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new Fm(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(ye.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class jm{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 qm{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){K(this.o===void 0);const r=o=>{o.error!=null&&N("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${o.error.message}`);const a=o.token!==this.R;return this.R=o.token,N("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(o.token):Promise.resolve()};this.o=o=>{e.enqueueRetryable(()=>r(o))};const i=o=>{N("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=o,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(o=>i(o)),setTimeout(()=>{if(!this.appCheck){const o=this.A.getImmediate({optional:!0});o?i(o):N("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(K(typeof t.token=="string"),this.R=t.token,new jm(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1689 * @license
1690 * Copyright 2020 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 */function $m(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}/**
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 Zu{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const i=$m(40);for(let o=0;o<i.length;++o)r.length<20&&i[o]<t&&(r+=e.charAt(i[o]%e.length))}return r}}function W(n,e){return n<e?-1:n>e?1:0}function Xt(n,e,t){return n.length===e.length&&n.every((r,i)=>t(r,e[i]))}/**
1719 * @license
1720 * Copyright 2017 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 */class oe{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 oe.fromMillis(Date.now())}static fromDate(e){return oe.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new oe(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?W(this.nanoseconds,e.nanoseconds):W(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")}}/**
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 */class U{constructor(e){this.timestamp=e}static fromTimestamp(e){return new U(e)}static min(){return new U(new oe(0,0))}static max(){return new U(new oe(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}}/**
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 qn{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 qn.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof qn?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 i=0;i<r;i++){const o=e.get(i),a=t.get(i);if(o<a)return-1;if(o>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class X extends qn{construct(e,t,r){return new X(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(i=>i.length>0))}return new X(t)}static emptyPath(){return new X([])}}const zm=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class le extends qn{construct(e,t,r){return new le(e,t,r)}static isValidIdentifier(e){return zm.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),le.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new le(["__name__"])}static fromServerFormat(e){const t=[];let r="",i=0;const o=()=>{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(;i<e.length;){const u=e[i];if(u==="\\"){if(i+1===e.length)throw new D(b.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const h=e[i+1];if(h!=="\\"&&h!=="."&&h!=="`")throw new D(b.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=h,i+=2}else u==="`"?(a=!a,i++):u!=="."||a?(r+=u,i++):(o(),i++)}if(o(),a)throw new D(b.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new le(t)}static emptyPath(){return new le([])}}/**
1764 * @license
1765 * Copyright 2017 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, software
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 M{constructor(e){this.path=e}static fromPath(e){return new M(X.fromString(e))}static fromName(e){return new M(X.fromString(e).popFirst(5))}static empty(){return new M(X.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&&X.comparator(this.path,e.path)===0}toString(){return this.path.toString()}
1778static comparator(e,t){return X.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new M(new X(e.slice()))}}function Wm(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,i=U.fromTimestamp(r===1e9?new oe(t+1,0):new oe(t,r));return new gt(i,M.empty(),e)}function Gm(n){return new gt(n.readTime,n.key,-1)}class gt{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new gt(U.min(),M.empty(),-1)}static max(){return new gt(U.max(),M.empty(),-1)}}function Hm(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=M.comparator(n.documentKey,e.documentKey),t!==0?t:W(n.largestBatchId,e.largestBatchId))}/**
1779 * @license
1780 * Copyright 2020 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 */const Km="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Qm{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
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 */async function nr(n){if(n.code!==b.FAILED_PRECONDITION||n.message!==Km)throw n;N("LocalStore","Unexpectedly lost primary lease")}/**
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 P{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 P((r,i)=>{this.nextCallback=o=>{this.wrapSuccess(e,o).next(r,i)},this.catchCallback=o=>{this.wrapFailure(t,o).next(r,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof P?t:P.resolve(t)}catch(t){return P.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):P.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):P.reject(t)}static resolve(e){return new P((t,r)=>{t(e)})}static reject(e){return new P((t,r)=>{r(e)})}static waitFor(e){return new P((t,r)=>{let i=0,o=0,a=!1;e.forEach(u=>{++i,u.next(()=>{++o,a&&o===i&&t()},h=>r(h))}),a=!0,o===i&&t()})}static or(e){let t=P.resolve(!1);for(const r of e)t=t.next(i=>i?P.resolve(i):r());return t}static forEach(e,t){const r=[];return e.forEach((i,o)=>{r.push(t.call(this,i,o))}),this.waitFor(r)}static mapArray(e,t){return new P((r,i)=>{const o=e.length,a=new Array(o);let u=0;for(let h=0;h<o;h++){const d=h;t(e[d]).next(p=>{a[d]=p,++u,u===o&&r(a)},p=>i(p))}})}static doWhile(e,t){return new P((r,i)=>{const o=()=>{e()===!0?t().next(()=>{o()},i):r()};o()})}}function Jm(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function rr(n){return n.name==="IndexedDbTransactionError"}/**
1824 * @license
1825 * Copyright 2018 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, software
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 $s{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}}$s.oe=-1;function di(n){return n==null}function Xr(n){return n===0&&1/n==-1/0}function Xm(n){return typeof n=="number"&&Number.isInteger(n)&&!Xr(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
1839 * @license
1840 * Copyright 2017 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 */function rc(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function an(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function el(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1854 * @license
1855 * Copyright 2017 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 Y{constructor(e,t){this.comparator=e,this.root=t||ue.EMPTY}insert(e,t){return new Y(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ue.BLACK,null,null))}remove(e){return new Y(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ue.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 i=this.comparator(e,r.key);if(i===0)return t+r.left.size;i<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 kr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new kr(this.root,e,this.comparator,!1)}getReverseIterator(){return new kr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new kr(this.root,e,this.comparator,!0)}}
1868class kr{constructor(e,t,r,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!e.isEmpty();)if(o=t?r(e.key,t):1,t&&i&&(o*=-1),o<0)e=this.isReverse?e.left:e.right;else{if(o===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 ue{constructor(e,t,r,i,o){this.key=e,this.value=t,this.color=r??ue.RED,this.left=i??ue.EMPTY,this.right=o??ue.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,i,o){return new ue(e??this.key,t??this.value,r??this.color,i??this.left,o??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 i=this;const o=r(e,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(e,t,r),null):o===0?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return ue.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,i=this;if(t(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),t(e,i.key)===0){if(i.right.isEmpty())return ue.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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,ue.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,ue.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)}}ue.EMPTY=null,ue.RED=!0,ue.BLACK=!1;ue.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,i,o){return this}insert(e,t,r){return new ue(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}};/**
1869 * @license
1870 * Copyright 2017 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, softw
1878are
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 */class he{constructor(e){this.comparator=e,this.data=new Y(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 i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.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 ic(this.data.getIterator())}getIteratorFrom(e){return new ic(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 he)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const i=t.getNext().key,o=r.getNext().key;if(this.comparator(i,o)!==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 he(this.comparator);return t.data=e,t}}class ic{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1884 * @license
1885 * Copyright 2020 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 ke{constructor(e){this.fields=e,e.sort(le.comparator)}static empty(){return new ke([])}unionWith(e){let t=new he(le.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new ke(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Xt(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
1899 * @license
1900 * Copyright 2023 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 */class tl extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
1914 * @license
1915 * Copyright 2020 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 de{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new tl("Invalid base64 string: "+o):o}}(e);return new de(t)}static fromUint8Array(e){const t=function(i){let o="";for(let a=0;a<i.length;++a)o+=String.fromCharCode(i[a]);return o}(e);return new de(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)}
1928toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return W(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}de.EMPTY_BYTE_STRING=new de("");const Ym=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function _t(n){if(K(!!n),typeof n=="string"){let e=0;const t=Ym.exec(n);if(K(!!t),t[1]){let i=t[1];i=(i+"000000000").substr(0,9),e=Number(i)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:ne(n.seconds),nanos:ne(n.nanos)}}function ne(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Ct(n){return typeof n=="string"?de.fromBase64String(n):de.fromUint8Array(n)}/**
1929 * @license
1930 * Copyright 2020 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 */function zs(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 Ws(n){const e=n.mapValue.fields.__previous_value__;return zs(e)?Ws(e):e}function $n(n){const e=_t(n.mapValue.fields.__local_write_time__.timestampValue);return new oe(e.seconds,e.nanos)}/**
1944 * @license
1945 * Copyright 2017 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 Zm{constructor(e,t,r,i,o,a,u,h,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=i,this.ssl=o,this.forceLongPolling=a,this.autoDetectLongPolling=u,this.longPollingOptions=h,this.useFetchStreams=d}}class zn{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new zn("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof zn&&e.projectId===this.projectId&&e.database===this.database}}/**
1959 * @license
1960 * Copyright 2020 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, software
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 */const Vr={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function kt(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?zs(n)?4:tg(n)?9007199254740991:eg(n)?10:11:x()}function Ue(n,e){if(n===e)return!0;const t=kt(n);if(t!==kt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return $n(n).isEqual($n(e));case 3:return function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;const a=_t(i.timestampValue),u=_t(o.timestampValue);return a.seconds===u.seconds&&a.nanos===u.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(i,o){return Ct(i.bytesValue).isEqual(Ct(o.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(i,o){return ne(i.geoPointValue.latitude)===ne(o.geoPointValue.latitude)&&ne(i.geoPointValue.longitude)===ne(o.geoPointValue.longitude)}(n,e);case 2:return function(i,o){if("integerValue"in i&&"integerValue"in o)return ne(i.integerValue)===ne(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){const a=ne(i.doubleValue),u=ne(o.doubleValue);return a===u?Xr(a)===Xr(u):isNaN(a)&&isNaN(u)}return!1}(n,e);case 9:return Xt(n.arrayValue.values||[],e.arrayValue.values||[],Ue);case 10:case 11:return function(i,o){const a=i.mapValue.fields||{},u=o.mapValue.fields||{};if(rc(a)!==rc(u))return!1;for(const h in a)if(a.hasOwnProperty(h)&&(u[h]===void 0||!Ue(a[h],u[h])))return!1;return!0}(n,e);default:return x()}}function Wn(n,e){return(n.values||[]).find(t=>Ue(t,e))!==void 0}function Yt(n,e){if(n===e)return 0;const t=kt(n),r=kt(e);if(t!==r)return W(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return W(n.booleanValue,e.booleanValue);case 2:return function(o,a){const u=ne(o.integerValue||o.doubleValue),h=ne(a.integerValue||a.doubleValue);return u<h?-1:u>h?1:u===h?0:isNaN(u)?isNaN(h)?0:-1:1}(n,e);case 3:return sc(n.timestampValue,e.timestampValue);case 4:return sc($n(n),$n(e));case 5:return W(n.stringValue,e.stringValue);case 6:return function(o,a){const u=Ct(o),h=Ct(a);return u.compareTo(h)}(n.bytesValue,e.bytesValue);case 7:return function(o,a){const u=o.split("/"),h=a.split("/");for(let d=0;d<u.length&&d<h.length;d++){const p=W(u[d],h[d]);if(p!==0)return p}return W(u.length,h.length)}(n.referenceValue,e.referenceValue);case 8:return function(o,a){const u=W(ne(o.latitude),ne(a.latitude));return u!==0?u:W(ne(o.longitude),ne(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return oc(n.arrayValue,e.arrayValue);case 10:return function(o,a){var u,h,d,p;const y=o.fields||{},A=a.fields||{},S=(u=y.value)===null||u===void 0?void 0:u.arrayValue,V=(h=A.value)===null||h===void 0?void 0:h.arrayValue,O=W(((d=S==null?void 0:S.values)===null||d===void 0?void 0:d.length)||0,((p=V==null?void 0:V.values)===null||p===void 0?void 0:p.length)||0);return O!==0?O:oc(S,V)}(n.mapValue,e.mapValue);case 11:return function(o,a){if(o===Vr.mapValue&&a===Vr.mapValue)return 0;if(o===Vr.mapValue)return 1;if(a===Vr.mapValue)return-1;const u=o.fields||{},h=Object.keys(u),d=a.fields||{},p=Object.keys(d);h.sort(),p.sort();for(let y=0;y<h.length&&y<p.length;++y){const A=W(h[y],p[y]);if(A!==0)return A;const S=Yt(u[h[y]],d[p[y]]);if(S!==0)return S}return W(h.length,p.length)}(n.mapValue,e.mapValue);default:throw x()}}function sc(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return W(n,e);const t=_t(n),r=_t(e),i=W(t.seconds,r.seconds);return i!==0?i:W(t.nanos,r.nanos)}function oc(n,e){const t=n.values||[],r=e.values||[];for(let i=0;i<t.length&&i<r.length;++i){const o=Yt(t[i],r[i]);if(o)return o}return W(t.length,r.length)}function Zt(n){return gs(n)}function gs(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=_t(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Ct(t).toBase64()}
1973(n.bytesValue):"referenceValue"in n?function(t){return M.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="[",i=!0;for(const o of t.values||[])i?i=!1:r+=",",r+=gs(o);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let i="{",o=!0;for(const a of r)o?o=!1:i+=",",i+=`${a}:${gs(t.fields[a])}`;return i+"}"}(n.mapValue):x()}function ac(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function _s(n){return!!n&&"integerValue"in n}function Gs(n){return!!n&&"arrayValue"in n}function cc(n){return!!n&&"nullValue"in n}function uc(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Ur(n){return!!n&&"mapValue"in n}function eg(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="__vector__"}function Mn(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 an(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=Mn(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=Mn(n.arrayValue.values[t]);return e}return Object.assign({},n)}function tg(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
1974 * @license
1975 * Copyright 2017 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 be{constructor(e){this.value=e}static empty(){return new be({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)],!Ur(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Mn(t)}setAll(e){let t=le.emptyPath(),r={},i=[];e.forEach((a,u)=>{if(!t.isImmediateParentOf(u)){const h=this.getFieldsMap(t);this.applyChanges(h,r,i),r={},i=[],t=u.popLast()}a?r[u.lastSegment()]=Mn(a):i.push(u.lastSegment())});const o=this.getFieldsMap(t);this.applyChanges(o,r,i)}delete(e){const t=this.field(e.popLast());Ur(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ue(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 i=t.mapValue.fields[e.get(r)];Ur(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,r){an(t,(i,o)=>e[i]=o);for(const i of r)delete e[i]}clone(){return new be(Mn(this.value))}}function nl(n){const e=[];return an(n.fields,(t,r)=>{const i=new le([t]);if(Ur(r)){const o=nl(r.mapValue).fields;
1988if(o.length===0)e.push(i);else for(const a of o)e.push(i.child(a))}else e.push(i)}),new ke(e)}/**
1989 * @license
1990 * Copyright 2017 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 ve{constructor(e,t,r,i,o,a,u){this.key=e,this.documentType=t,this.version=r,this.readTime=i,this.createTime=o,this.data=a,this.documentState=u}static newInvalidDocument(e){return new ve(e,0,U.min(),U.min(),U.min(),be.empty(),0)}static newFoundDocument(e,t,r,i){return new ve(e,1,t,U.min(),r,i,0)}static newNoDocument(e,t){return new ve(e,2,t,U.min(),U.min(),be.empty(),0)}static newUnknownDocument(e,t){return new ve(e,3,t,U.min(),U.min(),be.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=be.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=be.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 ve&&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 ve(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}})`}}/**
2004 * @license
2005 * Copyright 2022 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 Yr{constructor(e,t){this.position=e,this.inclusive=t}}function lc(n,e,t){let r=0;for(let i=0;i<n.position.length;i++){const o=e[i],a=n.position[i];if(o.field.isKeyField()?r=M.comparator(M.fromName(a.referenceValue),t.key):r=Yt(a,t.data.field(o.field)),o.dir==="desc"&&(r*=-1),r!==0)break}return r}function hc(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(!Ue(n.position[t],e.position[t]))return!1;return!0}/**
2019 * @license
2020 * Copyright 2022 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, softw
2028are
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 Gn{constructor(e,t="asc"){this.field=e,this.dir=t}}function ng(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
2034 * @license
2035 * Copyright 2022 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 */class rl{}class ie extends rl{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 ig(e,t,r):t==="array-contains"?new ag(e,r):t==="in"?new cg(e,r):t==="not-in"?new ug(e,r):t==="array-contains-any"?new lg(e,r):new ie(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new sg(e,r):new og(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(Yt(t,this.value)):t!==null&&kt(this.value)===kt(t)&&this.matchesComparison(Yt(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 Ve extends rl{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new Ve(e,t)}matches(e){return il(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 il(n){return n.op==="and"}function sl(n){return rg(n)&&il(n)}function rg(n){for(const e of n.filters)if(e instanceof Ve)return!1;return!0}function ys(n){if(n instanceof ie)return n.field.canonicalString()+n.op.toString()+Zt(n.value);if(sl(n))return n.filters.map(e=>ys(e)).join(",");{const e=n.filters.map(t=>ys(t)).join(",");return`${n.op}(${e})`}}function ol(n,e){return n instanceof ie?function(r,i){return i instanceof ie&&r.op===i.op&&r.field.isEqual(i.field)&&Ue(r.value,i.value)}(n,e):n instanceof Ve?function(r,i){return i instanceof Ve&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((o,a,u)=>o&&ol(a,i.filters[u]),!0):!1}(n,e):void x()}function al(n){return n instanceof ie?function(t){return`${t.field.canonicalString()} ${t.op} ${Zt(t.value)}`}(n):n instanceof Ve?function(t){return t.op.toString()+" {"+t.getFilters().map(al).join(" ,")+"}"}(n):"Filter"}class ig extends ie{constructor(e,t,r){super(e,t,r),this.key=M.fromName(r.referenceValue)}matches(e){const t=M.comparator(e.key,this.key);return this.matchesComparison(t)}}class sg extends ie{constructor(e,t){super(e,"in",t),this.keys=cl("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class og extends ie{constructor(e,t){super(e,"not-in",t),this.keys=cl("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function cl(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>M.fromName(r.referenceValue))}class ag extends ie{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Gs(t)&&Wn(t.arrayValue,this.value)}}class cg extends ie{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&Wn(this.value.arrayValue,t)}}class ug extends ie{constructor(e,t){super(e,"not-in",t)}matches(e){if(Wn(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!Wn(this.value.arrayValue,t)}}class lg extends ie{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Gs(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>Wn(this.value.arrayValue,r))}}/**
2049 * @license
2050 * Copyright 2019 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 */class hg{constructor(e,t=null,r=[],i=[],o=null,a=null,u=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=i,this.limit=o,this.startAt=a,this.endAt=u,this.ue=null}}function dc(n,e=null,t=[],r=[],i=null,o=null,a=null){return new hg(n,e,t,r,i,o,a)}function Hs(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=>ys(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(o){return o.field.canonicalString()+o.dir}(r)).join(","),di(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>Zt(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>Zt(r)).join(",")),e.ue=t}return e.ue}function Ks(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!ng(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!ol(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!hc(n.startAt,e.startAt)&&hc(n.endAt,e.endAt)}function vs(n){return M.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2064 * @license
2065 * Copyright 2017 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 cn{constructor(e,t=null,r=[],i=[],o=null,a="F",u=null,h=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=i,this.limit=o,this.limitType=a,this.startAt=u,this.endAt=h,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function dg(n,e,t,r,i,o,a,u){return new cn(n,e,t,r,i,o,a,u)}function fi(n){return new cn(n)}function fc(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 ul(n){return n.collectionGroup!==null}function Ln(n){const e=F(n);if(e.ce===null){e.ce=[];const t=new Set;for(const o of e.explicitOrderBy)e.ce.push(o),t.add(o.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let u=new he(le.comparator);return a.filters.forEach(h=>{h.getFlattenedFilters().forEach(d=>{d.isInequality()&&(u=u.add(d.field))})}),u})(e).forEach(o=>{t.has(o.canonicalString())||o.isKeyField()||e.ce.push(new Gn(o,r))}),t.has(le.keyField().canonicalString())||e.ce.push(new Gn(le.keyField(),r))}return e.ce}function Le(n){const e=F(n);return e.le||(e.le=fg(e,Ln(n))),e.le}function fg(n,e){if(n.limitType==="F")return dc(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(i=>{const o=i.dir==="desc"?"asc":"desc";return new Gn(i.field,o)});const t=n.endAt?new Yr(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Yr(n.startAt.position,n.startAt.inclusive):null;return dc(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function Es(n,e){const t=n.filters.concat([e]);return new cn(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function Zr(n,e,t){return new cn(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function pi(n,e){return Ks(Le(n),Le(e))&&n.limitType===e.limitType}function ll(n){return`${Hs(Le(n))}|lt:${n.limitType}`}function Ft(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(i=>al(i)).join(", ")}]`),di(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(i=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(i)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(i=>Zt(i)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(i=>Zt(i)).join(",")),`Target(${r})`}(Le(n))}; limitType=${n.limitType})`}function mi(n,e){return e.isFoundDocument()&&function(r,i){const o=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(o):M.isDocumentKey(r.path)?r.path.isEqual(o):r.path.isImmediateParentOf(o)}(n,e)&&function(r,i){for(const o of Ln(r))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0}(n,e)&&function(r,i){for(const o of r.filters)if(!o.matches(i))return!1;return!0}(n,e)&&function(r,i){return!(r.startAt&&!function(a,u,h){const d=lc(a,u,h);return a.inclusive?d<=0:d<0}(r.startAt,Ln(r),i)||r.endAt&&!function(a,u,h){const d=lc(a,u,h);return a.inclusive?d>=0:d>0}(r.endAt,Ln(r),i))}(n,e)}function pg(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function hl(n){return(e,t)=>{let r=!1;for(const i of Ln(n)){const o=mg(i,e,t);if(o!==0)return o;r=r||i.field.isKeyField()}return 0}}function mg(n,e,t){const r=n.field.isKeyField()?M.comparator(e.key,t.key):function(o,a,u){const h=a.data.field(o),d=u.data.field(o);return h!==null&&d!==null?Yt(h,d):x()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return x()}}/**
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 un{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[i,o]of r)if(this.equalsFn(i,e))return o}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],e))return void(i[o]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return r.length===1?delete this.inner[t]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(e){an(this.inner,(t,r)=>{for(const[i,o]of r)e(i,o)})}isEmpty(){return el(this.inner)}size(){return this.innerSize}}/**
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 */const gg=new Y(M.comparator);function Ye(){return gg}const dl=new Y(M.comparator);function Vn(...n){let e=dl;for(const t of n)e=e.insert(t.key,t);return e}function fl(n){let e=dl;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function At(){return xn()}function pl(){return xn()}function xn(){return new un(n=>n.toString(),(n,e)=>n.isEqual(e))}const _g=new Y(M.comparator),yg=new he(M.comparator);function j(...n){let e=yg;for(const t of n)e=e.add(t);return e}const vg=new he(W);function Eg(){return vg}/**
2109 * @license
2110 * Copyright 2020 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 */function Qs(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:Xr(e)?"-0":e}}function ml(n){return{integerValue:""+n}}function Tg(n,e){return Xm(e)?ml(e):Qs(n,e)}/**
2124 * @license
2125 * Copyright 2018 Google LLC
2126 *
2127 * Licensed under the Apache License, Version 2.0 (the "License");
2128 * you may not use this file except in compliance with the License.
2129 * You may obtain a copy of the License at
2130 *
2131 *   http://www.apache.org/licenses/LICENSE-2.0
2132 *
2133 * Unless required by applicable law or agreed to in writing, software
2134 * distributed under the License is distributed on an "AS IS" BASIS,
2135 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2136 * See the License for the specific language governing permissions and
2137 * limitations under the License.
2138 */class gi{constructor(){this._=void 0}}function Ig(n,e,t){return n instanceof Hn?function(i,o){const a={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&zs(o)&&(o=Ws(o)),o&&(a.fields.__previous_value__=o),{mapValue:a}}(t,e):n instanceof Kn?_l(n,e):n instanceof Qn?yl(n,e):function(i,o){const a=gl(i,o),u=pc(a)+pc(i.Pe);return _s(a)&&_s(i.Pe)?ml(u):Qs(i.serializer,u)}(n,e)}function wg(n,e,t){return n instanceof Kn?_l(n,e):n instanceof Qn?yl(n,e):t}function gl(n,e){return n instanceof ei?function(r){return _s(r)||function(o){return!!o&&"doubleValue"in o}(r)}(e)?e:{integerValue:0}:null}class Hn extends gi{}class Kn extends gi{constructor(e){super(),this.elements=e}}function _l(n,e){const t=vl(e);for(const r of n.elements)t.some(i=>Ue(i,r))||t.push(r);return{arrayValue:{values:t}}}class Qn extends gi{constructor(e){super(),this.elements=e}}function yl(n,e){let t=vl(e);for(const r of n.elements)t=t.filter(i=>!Ue(i,r));return{arrayValue:{values:t}}}
2138class ei extends gi{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function pc(n){return ne(n.integerValue||n.doubleValue)}function vl(n){return Gs(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}/**
2139 * @license
2140 * Copyright 2017 Google LLC
2141 *
2142 * Licensed under the Apache License, Version 2.0 (the "License");
2143 * you may not use this file except in compliance with the License.
2144 * You may obtain a copy of the License at
2145 *
2146 *   http://www.apache.org/licenses/LICENSE-2.0
2147 *
2148 * Unless required by applicable law or agreed to in writing, software
2149 * distributed under the License is distributed on an "AS IS" BASIS,
2150 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2151 * See the License for the specific language governing permissions and
2152 * limitations under the License.
2153 */class Ag{constructor(e,t){this.field=e,this.transform=t}}function Rg(n,e){return n.field.isEqual(e.field)&&function(r,i){return r instanceof Kn&&i instanceof Kn||r instanceof Qn&&i instanceof Qn?Xt(r.elements,i.elements,Ue):r instanceof ei&&i instanceof ei?Ue(r.Pe,i.Pe):r instanceof Hn&&i instanceof Hn}(n.transform,e.transform)}class bg{constructor(e,t){this.version=e,this.transformResults=t}}class Ge{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Ge}static exists(e){return new Ge(void 0,e)}static updateTime(e){return new Ge(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 Fr(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class _i{}function El(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new Il(n.key,Ge.none()):new ir(n.key,n.data,Ge.none());{const t=n.data,r=be.empty();let i=new he(le.comparator);for(let o of e.fields)if(!i.has(o)){let a=t.field(o);a===null&&o.length>1&&(o=o.popLast(),a=t.field(o)),a===null?r.delete(o):r.set(o,a),i=i.add(o)}return new Nt(n.key,r,new ke(i.toArray()),Ge.none())}}function Sg(n,e,t){n instanceof ir?function(i,o,a){const u=i.value.clone(),h=gc(i.fieldTransforms,o,a.transformResults);u.setAll(h),o.convertToFoundDocument(a.version,u).setHasCommittedMutations()}(n,e,t):n instanceof Nt?function(i,o,a){if(!Fr(i.precondition,o))return void o.convertToUnknownDocument(a.version);const u=gc(i.fieldTransforms,o,a.transformResults),h=o.data;h.setAll(Tl(i)),h.setAll(u),o.convertToFoundDocument(a.version,h).setHasCommittedMutations()}(n,e,t):function(i,o,a){o.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function Un(n,e,t,r){return n instanceof ir?function(o,a,u,h){if(!Fr(o.precondition,a))return u;const d=o.value.clone(),p=_c(o.fieldTransforms,h,a);return d.setAll(p),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof Nt?function(o,a,u,h){if(!Fr(o.precondition,a))return u;const d=_c(o.fieldTransforms,h,a),p=a.data;return p.setAll(Tl(o)),p.setAll(d),a.convertToFoundDocument(a.version,p).setHasLocalMutations(),u===null?null:u.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map(y=>y.field))}(n,e,t,r):function(o,a,u){return Fr(o.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):u}(n,e,t)}function Pg(n,e){let t=null;for(const r of n.fieldTransforms){const i=e.data.field(r.field),o=gl(r.transform,i||null);o!=null&&(t===null&&(t=be.empty()),t.set(r.field,o))}return t||null}function mc(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Xt(r,i,(o,a)=>Rg(o,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 ir extends _i{constructor(e,t,r,i=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Nt extends _i{constructor(e,t,r,i,o=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.prec
2153ondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}}function Tl(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 gc(n,e,t){const r=new Map;K(n.length===t.length);for(let i=0;i<t.length;i++){const o=n[i],a=o.transform,u=e.data.field(o.field);r.set(o.field,wg(a,u,t[i]))}return r}function _c(n,e,t){const r=new Map;for(const i of n){const o=i.transform,a=t.data.field(i.field);r.set(i.field,Ig(o,a,e))}return r}class Il extends _i{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Cg extends _i{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2154 * @license
2155 * Copyright 2017 Google LLC
2156 *
2157 * Licensed under the Apache License, Version 2.0 (the "License");
2158 * you may not use this file except in compliance with the License.
2159 * You may obtain a copy of the License at
2160 *
2161 *   http://www.apache.org/licenses/LICENSE-2.0
2162 *
2163 * Unless required by applicable law or agreed to in writing, software
2164 * distributed under the License is distributed on an "AS IS" BASIS,
2165 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2166 * See the License for the specific language governing permissions and
2167 * limitations under the License.
2168 */class kg{constructor(e,t,r,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let i=0;i<this.mutations.length;i++){const o=this.mutations[i];o.key.isEqual(e.key)&&Sg(o,e,r[i])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=Un(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=Un(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=pl();return this.mutations.forEach(i=>{const o=e.get(i.key),a=o.overlayedDocument;let u=this.applyToLocalView(a,o.mutatedFields);u=t.has(i.key)?null:u;const h=El(a,u);h!==null&&r.set(i.key,h),a.isValidDocument()||a.convertToNoDocument(U.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),j())}isEqual(e){return this.batchId===e.batchId&&Xt(this.mutations,e.mutations,(t,r)=>mc(t,r))&&Xt(this.baseMutations,e.baseMutations,(t,r)=>mc(t,r))}}class Js{constructor(e,t,r,i){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=i}static from(e,t,r){K(e.mutations.length===r.length);let i=function(){return _g}();const o=e.mutations;for(let a=0;a<o.length;a++)i=i.insert(o[a].key,r[a].version);return new Js(e,t,r,i)}}/**
2169 * @license
2170 * Copyright 2022 Google LLC
2171 *
2172 * Licensed under the Apache License, Version 2.0 (the "License");
2173 * you may not use this file except in compliance with the License.
2174 * You may obtain a copy of the License at
2175 *
2176 *   http://www.apache.org/licenses/LICENSE-2.0
2177 *
2178 * Unless required by applicable law or agreed to in writing, software
2179 * distributed under the License is distributed on an "AS IS" BASIS,
2180 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2181 * See the License for the specific language governing permissions and
2182 * limitations under the License.
2183 */class Vg{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{
2184      largestBatchId: ${this.largestBatchId},
2185      mutation: ${this.mutation.toString()}
2186    }`}}/**
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 Dg{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
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 */var re,$;function Ng(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 wl(n){if(n===void 0)return Xe("GRPC error has no .code"),b.UNKNOWN;switch(n){case re.OK:return b.OK;case re.CANCELLED:return b.CANCELLED;case re.UNKNOWN:return b.UNKNOWN;case re.DEADLINE_EXCEEDED:return b.DEADLINE_EXCEEDED;case re.RESOURCE_EXHAUSTED:return b.RESOURCE_EXHAUSTED;case re.INTERNAL:return b.INTERNAL;case re.UNAVAILABLE:return b.UNAVAILABLE;case re.UNAUTHENTICATED:return b.UNAUTHENTICATED;case re.INVALID_ARGUMENT:return b.INVALID_ARGUMENT;case re.NOT_FOUND:return b.NOT_FOUND;case re.ALREADY_EXISTS:return b.ALREADY_EXISTS;case re.PERMISSION_DENIED:return b.PERMISSION_DENIED;case re.FAILED_PRECONDITION:return b.FAILED_PRECONDITION;case re.ABORTED:return b.ABORTED;case re.OUT_OF_RANGE:return b.OUT_OF_RANGE;
2216case re.UNIMPLEMENTED:return b.UNIMPLEMENTED;case re.DATA_LOSS:return b.DATA_LOSS;default:return x()}}($=re||(re={}))[$.OK=0]="OK",$[$.CANCELLED=1]="CANCELLED",$[$.UNKNOWN=2]="UNKNOWN",$[$.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",$[$.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",$[$.NOT_FOUND=5]="NOT_FOUND",$[$.ALREADY_EXISTS=6]="ALREADY_EXISTS",$[$.PERMISSION_DENIED=7]="PERMISSION_DENIED",$[$.UNAUTHENTICATED=16]="UNAUTHENTICATED",$[$.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",$[$.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",$[$.ABORTED=10]="ABORTED",$[$.OUT_OF_RANGE=11]="OUT_OF_RANGE",$[$.UNIMPLEMENTED=12]="UNIMPLEMENTED",$[$.INTERNAL=13]="INTERNAL",$[$.UNAVAILABLE=14]="UNAVAILABLE",$[$.DATA_LOSS=15]="DATA_LOSS";/**
2217 * @license
2218 * Copyright 2023 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 */function Og(){return new TextEncoder}/**
2232 * @license
2233 * Copyright 2022 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 */const Mg=new Rt([4294967295,4294967295],0);function yc(n){const e=Og().encode(n),t=new Gu;return t.update(e),new Uint8Array(t.digest())}function vc(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),i=e.getUint32(8,!0),o=e.getUint32(12,!0);return[new Rt([t,r],0),new Rt([i,o],0)]}class Xs{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new Dn(`Invalid padding: ${t}`);if(r<0)throw new Dn(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Dn(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new Dn(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=Rt.fromNumber(this.Ie)}Ee(e,t,r){let i=e.add(t.multiply(Rt.fromNumber(r)));return i.compare(Mg)===1&&(i=new Rt([i.getBits(0),i.getBits(1)],0)),i.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=yc(e),[r,i]=vc(t);for(let o=0;o<this.hashCount;o++){const a=this.Ee(r,i,o);if(!this.de(a))return!1}return!0}static create(e,t,r){const i=e%8==0?0:8-e%8,o=new Uint8Array(Math.ceil(e/8)),a=new Xs(o,i,t);return r.forEach(u=>a.insert(u)),a}insert(e){if(this.Ie===0)return;const t=yc(e),[r,i]=vc(t);for(let o=0;o<this.hashCount;o++){const a=this.Ee(r,i,o);this.Ae(a)}}Ae(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class Dn extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2247 * @license
2248 * Copyright 2017 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 yi{constructor(e,t,r,i,o){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const i=new Map;return i.set(e,sr.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new yi(U.min(),i,new Y(W),Ye(),j())}}class sr{constructor(e,t,r,i,o){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new sr(r,t,j(),j(),j())}}/**
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 Br{constructor(e,t,r,i){this.Re=e,this.removedTargetIds=t,this.key=r,this.Ve=i}}class Al{constructor(e,t){this.targetId=e,this.me=t}}class Rl{constructor(e,t,r=de.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=i}}class Ec{constructor(){this.fe=0,this.ge=Ic(),this.pe=de.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=j(),t=j(),r=j();return this.ge.forEach((i,o)=>{switch(o){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:r=r.add(i);break;default:x()}}),new sr(this.pe,this.ye,e,t,r)}Ce(){this.we=!1,this.ge=Ic()}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,K(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class Lg{constructor(e){this.Le=e,this.Be=new Map,this.ke=Ye(),this.qe=Tc(),this.Qe=new Y(W)}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,i)=>{this.ze(i)&&t(i)})}He(e){const t=e.targetId,r=e.me.count,i=this.Je(t);if(i){const o=i.target;if(vs(o))if(r===0){const a=new M(o.path);this.Ue(t,a,ve.newNoDocument(a,U.min()))}else K(r===1);else{const a=this.Ye(t);if(a!==r){const u=this.Ze(e),h=u?this.Xe(u,e,a):1;if(h!==0){this.je(t);const d=h===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:i=0},hashCount:o=0}=t;let a,u;try{a=Ct(r).toUint8Array()}catch(h){if(h instanceof tl)return Jt("Decoding the base64 bloom filter in existence filter failed ("+h.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw h}try{u=new Xs(a,i,o)}catch(h){return Jt(h instanceof Dn?"BloomFilter error: ":"Applying bloom filter failed: ",h),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 i=0;return r.forEach(o=>{const a=this.Le.tt(),u=`projects/${a.projectId}/databases/${a.database}/documents/${o.path.canonicalString()}`;e.mightContain(u)||(this.Ue(t,o,null),i++)}),i}rt(e){const t=new Map;this.Be.forEach((o,a)=>{const u=this.Je(a);if(u){if(o.current&&vs(u.target)){const h=new M(u.target.path);this.ke.get(h)!==null||this.it(a,h)||this.Ue(a,h,ve.newNoDocument(h,e))}o.be&&(t.set(a,o.ve()),o.Ce())}});let r=j();this.qe.forEach((o,a)=>{let u=!0;a.forEachWhile(h=>{const d=this.Je(h);return!d||d.purpose==="TargetPurposeLimboResolution"||(u=!1,!1)}),u&&(r=r.add(o))}),this.ke.forEach((o,a)=>a.setReadTime(e));const i=new yi(e,t,this.Qe,this.ke,r);return this.ke=Ye(),this.qe=Tc(),this.Qe=new Y(W),i}$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 i=this.Ge(e);this.it(e,t)?i.Fe(t,1):i.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 Ec,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new he(W),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||N("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 Ec),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function Tc(){return new Y(M.comparator)}function Ic(){return new Y(M.comparator)}const xg=(()=>({asc:"ASCENDING",desc:"DESCENDING"}))(),Ug=(()=>({"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"}))(),Fg=(()=>({and:"AND",or:"OR"}))();class Bg{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ts(n,e){return n.useProto3Json||di(e)?e:{value:e}}function ti(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function bl(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function jg(n,e){return ti(n,e.toTimestamp())}function xe(n){return K(!!n),U.fromTimestamp(function(t){const r=_t(t);return new oe(r.seconds,r.nanos)}(n))}function Ys(n,e){return Is(n,e).canonicalString()}function Is(n,e){const t=function(i){return new X(["projects",i.projectId,"databases",i.database])}(n).child("documents");return e===void 0?t:t.child(e)}function Sl(n){const e=X.fromString(n);return K(Dl(e)),e}function ws(n,e){return Ys(n.databaseId,e.path)}function is(n,e){const t=Sl(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 M(Cl(t))}function Pl(n,e){return Ys(n.databaseId,e)}function qg(n){const e=Sl(n);return e.length===4?X.emptyPath():Cl(e)}function As(n){return new X(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Cl(n){return K(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function wc(n,e,t){return{name:ws(n,e),fields:t.value.mapValue.fields}}function $g(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:x()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=function(d,p){return d.useProto3Json?(K(p===void 0||typeof p=="string"),de.fromBase64String(p||"")):(K(p===void 0||p instanceof Buffer||p instanceof Uint8Array),de.fromUint8Array(p||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,u=a&&function(d){const p=d.code===void 0?b.UNKNOWN:wl(d.code);return new D(p,d.message||"")}(a);t=new Rl(r,i,o,u||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=is(n,r.document.name),o=xe(r.document.updateTime),a=r.document.createTime?xe(r.document.createTime):U.min(),u=new be({mapValue:{fields:r.document.fields}}),h=ve.newFoundDocument(i,o,a,u),d=r.targetIds||[],p=r.removedTargetIds||[];t=new Br(d,p,h.key,h)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=is(n,r.document),o=r.readTime?xe(r.readTime):U.min(),a=ve.newNoDocument(i,o),u=r.removedTargetIds||[];t=new Br([],u,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=is(n,r.document),o=r.removedTargetIds||[];t=new Br([],o,i,null)}else{if(!("filter"in e))return x();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:o}=r,a=new Dg(i,o),u=r.targetId;t=new Al(u,a)}}return t}function zg(n,e){let t;if(e instanceof ir)t={update:wc(n,e.key,e.value)};else if(e instanceof Il)t={delete:ws(n,e.key)};else if(e instanceof Nt)t={update:wc(n,e.key,e.data),updateMask:Zg(e.fieldMask)};else{if(!(e instanceof Cg))return x();t={verify:ws(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(o,a){const u=a.transform;if(u instanceof Hn)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(u instanceof Kn)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:u.elements}};if(u instanceof Qn)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:u.elements}};if(u instanceof ei)return{fieldPath:a.field.canonicalString(),increment:u.Pe};throw x()}(0,r))),e.precondition.isNone||(t.currentDocument=function(i,o){return o.updateTime!==void 0?{updateTime:jg(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:x()}(n,e.precondition)),t}function Wg(n,e){return n&&n.length>0?(K(e!==void 0),n.map(t=>function(i,o){let a=i.updateTime?xe(i.updateTime):xe(o);return a.isEqual(U.min())&&(a=xe(o)),new bg(a,i.transformResults||[])}(t,e))):[]}function Gg(n,e){return{documents:[Pl(n,e.path)]}}function Hg(n,e){const t={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=Pl(n,i);const o=function(d){if(d.length!==0)return Vl(Ve.create(d,"and"))}(e.filters);o&&(t.structuredQuery.where=o);const a=function(d){if(d.length!==0)return d.map(p=>function(A){return{field:Bt(A.field),direction:Jg(A.dir)}}(p))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const u=Ts(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:i}}function Kg(n){let e=qg(n.parent);
2276const t=n.structuredQuery,r=t.from?t.from.length:0;let i=null;if(r>0){K(r===1);const p=t.from[0];p.allDescendants?i=p.collectionId:e=e.child(p.collectionId)}let o=[];t.where&&(o=function(y){const A=kl(y);return A instanceof Ve&&sl(A)?A.getFilters():[A]}(t.where));let a=[];t.orderBy&&(a=function(y){return y.map(A=>function(V){return new Gn(jt(V.field),function(k){switch(k){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(V.direction))}(A))}(t.orderBy));let u=null;t.limit&&(u=function(y){let A;return A=typeof y=="object"?y.value:y,di(A)?null:A}(t.limit));let h=null;t.startAt&&(h=function(y){const A=!!y.before,S=y.values||[];return new Yr(S,A)}(t.startAt));let d=null;return t.endAt&&(d=function(y){const A=!y.before,S=y.values||[];return new Yr(S,A)}(t.endAt)),dg(e,i,a,o,u,"F",h,d)}function Qg(n,e){const t=function(i){switch(i){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 kl(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=jt(t.unaryFilter.field);return ie.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=jt(t.unaryFilter.field);return ie.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const o=jt(t.unaryFilter.field);return ie.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=jt(t.unaryFilter.field);return ie.create(a,"!=",{nullValue:"NULL_VALUE"});default:return x()}}(n):n.fieldFilter!==void 0?function(t){return ie.create(jt(t.fieldFilter.field),function(i){switch(i){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 Ve.create(t.compositeFilter.filters.map(r=>kl(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return x()}}(t.compositeFilter.op))}(n):x()}function Jg(n){return xg[n]}function Xg(n){return Ug[n]}function Yg(n){return Fg[n]}function Bt(n){return{fieldPath:n.canonicalString()}}function jt(n){return le.fromServerFormat(n.fieldPath)}function Vl(n){return n instanceof ie?function(t){if(t.op==="=="){if(uc(t.value))return{unaryFilter:{field:Bt(t.field),op:"IS_NAN"}};if(cc(t.value))return{unaryFilter:{field:Bt(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(uc(t.value))return{unaryFilter:{field:Bt(t.field),op:"IS_NOT_NAN"}};if(cc(t.value))return{unaryFilter:{field:Bt(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Bt(t.field),op:Xg(t.op),value:t.value}}}(n):n instanceof Ve?function(t){const r=t.getFilters().map(i=>Vl(i));return r.length===1?r[0]:{compositeFilter:{op:Yg(t.op),filters:r}}}(n):x()}function Zg(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Dl(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
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 ut{constructor(e,t,r,i,o=U.min(),a=U.min(),u=de.EMPTY_BYTE_STRING,h=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=o,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=u,this.expectedCount=h}withSequenceNumber(e){return new ut(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new ut(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new ut(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new ut(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
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 */class e_{constructor(e){this.ct=e}}function t_(n){const e=Kg({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?Zr(e,e.limit,"L"):e}/**
2307 * @license
2308 * Copyright 2019 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 n_{constructor(){this.un=new r_}addToCollectionParentIndex(e,t){return this.un.add(t),P.resolve()}getCollectionParents(e,t){return P.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return P.resolve()}deleteFieldIndex(e,t){return P.resolve()}deleteAllFieldIndexes(e){return P.resolve()}createTargetIndexes(e,t){return P.resolve()}getDocumentsMatchingTarget(e,t){return P.resolve(null)}getIndexType(e,t){return P.resolve(0)}getFieldIndexes(e,t){return P.resolve([])}getNextCollectionGroupToUpdate(e){return P.resolve(null)}getMinOffset(e,t){return P.resolve(gt.min())}getMinOffsetFromCollectionGroup(e,t){return P.resolve(gt.min())}updateCollectionGroup(e,t,r){return P.resolve()}updateIndexEntries(e,t){return P.resolve()}}class r_{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),i=this.index[t]||new he(X.comparator),o=!i.has(r);return this.index[t]=i.add(r),o}has(e){const t=e.lastSegment(),r=e.popLast(),i=this.index[t];return i&&i.has(r)}getEntries(e){return(this.index[e]||new he(X.comparator)).toArray()}}/**
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 en{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new en(0)}static kn(){return new en(-1)}}/**
2337 * @license
2338 * Copyright 2017 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 i_{constructor(){this.changes=new un(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,ve.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?P.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)}
2351assertNotApplied(){}}/**
2352 * @license
2353 * Copyright 2017 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 *//**
2367 * @license
2368 * Copyright 2022 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 s_{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
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 o_{constructor(e,t,r,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,t))).next(i=>(r!==null&&Un(r.mutation,i,ke.empty(),oe.now()),i))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,j()).next(()=>r))}getLocalViewOfDocuments(e,t,r=j()){const i=At();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,r).next(o=>{let a=Vn();return o.forEach((u,h)=>{a=a.insert(u,h.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=At();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,j()))}populateOverlays(e,t,r){const i=[];return r.forEach(o=>{t.has(o)||i.push(o)}),this.documentOverlayCache.getOverlays(e,i).next(o=>{o.forEach((a,u)=>{t.set(a,u)})})}computeViews(e,t,r,i){let o=Ye();const a=xn(),u=function(){return xn()}();return t.forEach((h,d)=>{const p=r.get(d.key);i.has(d.key)&&(p===void 0||p.mutation instanceof Nt)?o=o.insert(d.key,d):p!==void 0?(a.set(d.key,p.mutation.getFieldMask()),Un(p.mutation,d,p.mutation.getFieldMask(),oe.now())):a.set(d.key,ke.empty())}),this.recalculateAndSaveOverlays(e,o).next(h=>(h.forEach((d,p)=>a.set(d,p)),t.forEach((d,p)=>{var y;return u.set(d,new s_(p,(y=a.get(d))!==null&&y!==void 0?y:null))}),u))}recalculateAndSaveOverlays(e,t){const r=xn();let i=new Y((a,u)=>a-u),o=j();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const u of a)u.keys().forEach(h=>{const d=t.get(h);if(d===null)return;let p=r.get(h)||ke.empty();p=u.applyToLocalView(d,p),r.set(h,p);const y=(i.get(u.batchId)||j()).add(h);i=i.insert(u.batchId,y)})}).next(()=>{const a=[],u=i.getReverseIterator();for(;u.hasNext();){const h=u.getNext(),d=h.key,p=h.value,y=pl();p.forEach(A=>{if(!o.has(A)){const S=El(t.get(A),r.get(A));S!==null&&y.set(A,S),o=o.add(A)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,y))}return P.waitFor(a)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,i){return function(a){return M.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):ul(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,i):this.getDocumentsMatchingCollectionQuery(e,t,r,i)}getNextDocuments(e,t,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,i).next(o=>{const a=i-o.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,i-o.size):P.resolve(At());let u=-1,h=o;return a.next(d=>P.forEach(d,(p,y)=>(u<y.largestBatchId&&(u=y.largestBatchId),o.get(p)?P.resolve():this.remoteDocumentCache.getEntry(e,p).next(A=>{h=h.insert(p,A)}))).next(()=>this.populateOverlays(e,d,o)).next(()=>this.computeViews(e,h,d,j())).next(p=>({batchId:u,changes:fl(p)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new M(t)).next(r=>{let i=Vn();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,t,r,i){const o=t.collectionGroup;let a=Vn();return this.indexManager.getCollectionParents(e,o).next(u=>P.forEach(u,h=>{const d=function(y,A){return new cn(A,null,y.explicitOrderBy.slice(),y.filters.slice(),y.limit,y.limitType,y.startAt,y.endAt)}(t,h.child(o));return this.getDocumentsMatchingCollectionQuery(e,d,r,i).next(p=>{p.forEach((y,A)=>{a=a.insert(y,A)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,i){let o;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(o=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,o,i))).next(a=>{o.forEach((h,d)=>{const p=d.getKey();a.get(p)===null&&(a=a.insert(p,ve.newInvalidDocument(p)))});let u=Vn();return a.forEach((h,d)=>{const p=o.get(h);p!==void 0&&Un(p.mutation,d,ke.empty(),oe.now()),mi(t,d)&&(u=u.insert(h,d))}),u})}}/**
2397 * @license
2398 * Copyright 2020 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 a_{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return P.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,function(i){return{id:i.id,version:i.version,createTime:xe(i.createTime)}}(t)),P.resolve()}getNamedQuery(e,t){return P.resolve(this.Pr.get(t))}saveNamedQuery(e,t){return this.Pr.set(t.name,function(i){return{name:i.name,query:t_(i.bundledQuery),readTime:xe(i.readTime)}}(t)),P.resolve()}}/**
2412 * @license
2413 * Copyright 2022 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 c_{constructor(){this.overlays=new Y(M.comparator),this.Ir=new Map}getOverlay(e,t){return P.resolve(this.overlays.get(t))}getOverlays(e,t){const r=At();return P.forEach(t,i=>this.getOverlay(e,i).next(o=>{o!==null&&r.set(i,o)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((i,o)=>{this.ht(e,t,o)}),P.resolve()}removeOverlaysForBatchId(e,t,r){const i=this.Ir.get(r);return i!==void 0&&(i.forEach(o=>this.overlays=this.overlays.remove(o)),this.Ir.delete(r)),P.resolve()}getOverlaysForCollection(e,t,r){const i=At(),o=t.length+1,a=new M(t.child("")),u=this.overlays.getIteratorFrom(a);for(;u.hasNext();){const h=u.getNext().value,d=h.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===o&&h.largestBatchId>r&&i.set(h.getKey(),h)}return P.resolve(i)}getOverlaysForCollectionGroup(e,t,r,i){let o=new Y((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=o.get(d.largestBatchId);p===null&&(p=At(),o=o.insert(d.largestBatchId,p)),p.set(d.getKey(),d)}}const u=At(),h=o.getIterator();for(;h.hasNext()&&(h.getNext().value.forEach((d,p)=>u.set(d,p)),!(u.size()>=i)););return P.resolve(u)}ht(e,t,r){const i=this.overlays.get(r.key);if(i!==null){const a=this.Ir.get(i.largestBatchId).delete(r.key);this.Ir.set(i.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new Vg(t,r));let o=this.Ir.get(t);o===void 0&&(o=j(),this.Ir.set(t,o)),this.Ir.set(t,o.add(r.key))}}/**
2427 * @license
2428 * Copyright 2024 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 u_{constructor(){this.sessionToken=de.EMPTY_BYTE_STRING}getSessionToken(e){return P.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,P.resolve()}}/**
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, softw
2451are
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 Zs{constructor(){this.Tr=new he(ae.Er),this.dr=new he(ae.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const r=new ae(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 ae(e,t))}mr(e,t){e.forEach(r=>this.removeReference(r,t))}gr(e){const t=new M(new X([])),r=new ae(t,e),i=new ae(t,e+1),o=[];return this.dr.forEachInRange([r,i],a=>{this.Vr(a),o.push(a.key)}),o}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 M(new X([])),r=new ae(t,e),i=new ae(t,e+1);let o=j();return this.dr.forEachInRange([r,i],a=>{o=o.add(a.key)}),o}containsKey(e){const t=new ae(e,0),r=this.Tr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class ae{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return M.comparator(e.key,t.key)||W(e.wr,t.wr)}static Ar(e,t){return W(e.wr,t.wr)||M.comparator(e.key,t.key)}}/**
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 l_{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new he(ae.Er)}checkEmpty(e){return P.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,i){const o=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new kg(o,t,r,i);this.mutationQueue.push(a);for(const u of i)this.br=this.br.add(new ae(u.key,o)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast());return P.resolve(a)}lookupMutationBatch(e,t){return P.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,i=this.vr(r),o=i<0?0:i;return P.resolve(this.mutationQueue.length>o?this.mutationQueue[o]:null)}getHighestUnacknowledgedBatchId(){return P.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return P.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new ae(t,0),i=new ae(t,Number.POSITIVE_INFINITY),o=[];return this.br.forEachInRange([r,i],a=>{const u=this.Dr(a.wr);o.push(u)}),P.resolve(o)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new he(W);return t.forEach(i=>{const o=new ae(i,0),a=new ae(i,Number.POSITIVE_INFINITY);this.br.forEachInRange([o,a],u=>{r=r.add(u.wr)})}),P.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,i=r.length+1;let o=r;M.isDocumentKey(o)||(o=o.child(""));const a=new ae(new M(o),0);let u=new he(W);return this.br.forEachWhile(h=>{const d=h.key.path;return!!r.isPrefixOf(d)&&(d.length===i&&(u=u.add(h.wr)),!0)},a),P.resolve(this.Cr(u))}Cr(e){const t=[];return e.forEach(r=>{const i=this.Dr(r);i!==null&&t.push(i)}),t}removeMutationBatch(e,t){K(this.Fr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return P.forEach(t.mutations,i=>{const o=new ae(i.key,t.batchId);return r=r.delete(o),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,t){const r=new ae(t,0),i=this.br.firstAfterOrEqual(r);return P.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,P.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>
2471=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
2472 * @license
2473 * Copyright 2017 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 h_{constructor(e){this.Mr=e,this.docs=function(){return new Y(M.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,i=this.docs.get(r),o=i?i.size:0,a=this.Mr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-o,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 P.resolve(r?r.document.mutableCopy():ve.newInvalidDocument(t))}getEntries(e,t){let r=Ye();return t.forEach(i=>{const o=this.docs.get(i);r=r.insert(i,o?o.document.mutableCopy():ve.newInvalidDocument(i))}),P.resolve(r)}getDocumentsMatchingQuery(e,t,r,i){let o=Ye();const a=t.path,u=new M(a.child("")),h=this.docs.getIteratorFrom(u);for(;h.hasNext();){const{key:d,value:{document:p}}=h.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||Hm(Gm(p),r)<=0||(i.has(p.key)||mi(t,p))&&(o=o.insert(p.key,p.mutableCopy()))}return P.resolve(o)}getAllFromCollectionGroup(e,t,r,i){x()}Or(e,t){return P.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new d_(this)}getSize(e){return P.resolve(this.size)}}class d_ extends i_{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];
2486return this.changes.forEach((r,i)=>{i.isValidDocument()?t.push(this.cr.addEntry(e,i)):this.cr.removeEntry(r)}),P.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}/**
2487 * @license
2488 * Copyright 2017 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 f_{constructor(e){this.persistence=e,this.Nr=new un(t=>Hs(t),Ks),this.lastRemoteSnapshotVersion=U.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Zs,this.targetCount=0,this.kr=en.Bn()}forEachTarget(e,t){return this.Nr.forEach((r,i)=>t(i)),P.resolve()}getLastRemoteSnapshotVersion(e){return P.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return P.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),P.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.Lr&&(this.Lr=t),P.resolve()}Kn(e){this.Nr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.kr=new en(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,P.resolve()}updateTargetData(e,t){return this.Kn(t),P.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,P.resolve()}removeTargets(e,t,r){let i=0;const o=[];return this.Nr.forEach((a,u)=>{u.sequenceNumber<=t&&r.get(u.targetId)===null&&(this.Nr.delete(a),o.push(this.removeMatchingKeysForTargetId(e,u.targetId)),i++)}),P.waitFor(o).next(()=>i)}getTargetCount(e){return P.resolve(this.targetCount)}getTargetData(e,t){const r=this.Nr.get(t)||null;return P.resolve(r)}addMatchingKeys(e,t,r){return this.Br.Rr(t,r),P.resolve()}removeMatchingKeys(e,t,r){this.Br.mr(t,r);const i=this.persistence.referenceDelegate,o=[];return i&&t.forEach(a=>{o.push(i.markPotentiallyOrphaned(e,a))}),P.waitFor(o)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),P.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Br.yr(t);return P.resolve(r)}containsKey(e,t){return P.resolve(this.Br.containsKey(t))}}/**
2502 * @license
2503 * Copyright 2017 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 p_{constructor(e,t){this.qr={},this.overlays={},this.Qr=new $s(0),this.Kr=!1,this.Kr=!0,this.$r=new u_,this.referenceDelegate=e(this),this.Ur=new f_(this),this.indexManager=new n_,this.remoteDocumentCache=function(i){return new h_(i)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new e_(t),this.Gr=new a_(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 c_,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.qr[e.toKey()];return r||(r=new l_(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){N("MemoryPersistence","Starting transaction:",e);const i=new m_(this.Qr.next());return this.referenceDelegate.zr(),r(i).next(o=>this.referenceDelegate.jr(i).next(()=>o)).toPromise().then(o=>(i.raiseOnCommittedEvent(),o))}
2516Hr(e,t){return P.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,t)))}}class m_ extends Qm{constructor(e){super(),this.currentSequenceNumber=e}}class eo{constructor(e){this.persistence=e,this.Jr=new Zs,this.Yr=null}static Zr(e){return new eo(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()),P.resolve()}removeReference(e,t,r){return this.Jr.removeReference(r,t),this.Xr.add(r.toString()),P.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),P.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(i=>this.Xr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(i=>{i.forEach(o=>this.Xr.add(o.toString()))}).next(()=>r.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return P.forEach(this.Xr,r=>{const i=M.fromPath(r);return this.ei(e,i).next(o=>{o||t.removeEntry(i,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 P.or([()=>P.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}/**
2517 * @license
2518 * Copyright 2017 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 to{constructor(e,t,r,i){this.targetId=e,this.fromCache=t,this.$i=r,this.Ui=i}static Wi(e,t){let r=j(),i=j();for(const o of t.docChanges)switch(o.type){case 0:r=r.add(o.doc.key);break;case 1:i=i.add(o.doc.key)}return new to(e,t.fromCache,r,i)}}/**
2532 * @license
2533 * Copyright 2023 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 g_{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2547 * @license
2548 * Copyright 2019 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 */class __{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return fd()?8:Jm(Ee())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,r,i){const o={result:null};return this.Yi(e,t).next(a=>{o.result=a}).next(()=>{if(!o.result)return this.Zi(e,t,i,r).next(a=>{o.result=a})}).next(()=>{if(o.result)return;const a=new g_;return this.Xi(e,t,a).next(u=>{if(o.result=u,this.zi)return this.es(e,t,a,u.size)})}).next(()=>o.result)}es(e,t,r,i){return r.documentReadCount<this.ji?(Cn()<=B.DEBUG&&N("QueryEngine","SDK will not create cache indexes for query:",Ft(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),P.resolve()):(Cn()<=B.DEBUG&&N("QueryEngine","Query:",Ft(t),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.Hi*i?(Cn()<=B.DEBUG&&N("QueryEngine","The SDK decides to create cache indexes for query:",Ft(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Le(t))):P.resolve())}Yi(e,t){if(fc(t))return P.resolve(null);let r=Le(t);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(t.limit!==null&&i===1&&(t=Zr(t,null,"F"),r=Le(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(o=>{const a=j(...o);return this.Ji.getDocuments(e,a).next(u=>this.indexManager.getMinOffset(e,r).next(h=>{const d=this.ts(t,u);return this.ns(t,d,a,h.readTime)?this.Yi(e,Zr(t,null,"F")):this.rs(e,d,t,h)}))})))}Zi(e,t,r,i){return fc(t)||i.isEqual(U.min())?P.resolve(null):this.Ji.getDocuments(e,r).next(o=>{const a=this.ts(t,o);return this.ns(t,a,r,i)?P.resolve(null):(Cn()<=B.DEBUG&&N("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Ft(t)),this.rs(e,a,t,Wm(i,-1)).next(u=>u))})}ts(e,t){let r=new he(hl(e));return t.forEach((i,o)=>{mi(e,o)&&(r=r.add(o))}),r}ns(e,t,r,i){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const o=e.limitType==="F"?t.last():t.first();return!!o&&(o.hasPendingWrites||o.version.compareTo(i)>0)}Xi(e,t,r){return Cn()<=B.DEBUG&&N("QueryEngine","Using full collection scan to execute query:",Ft(t)),this.Ji.getDocumentsMatchingQuery(e,t,gt.min(),r)}rs(e,t,r,i){return this.Ji.getDocumentsMatchingQuery(e,r,i).next(o=>(t.forEach(a=>{o=o.insert(a.key,a)}),o))}}/**
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 */class y_{constructor(e,t,r,i){this.persistence=e,this.ss=t,this.serializer=i,this.os=new Y(W),this._s=new un(o=>Hs(o),Ks),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 o_(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 v_(n,e,t,r){return new y_(n,e,t,r)}async function Nl(n,e){const t=F(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let i;return t.mutationQueue.getAllMutationBatches(r).next(o=>(i=o,t.ls(e),t.mutationQueue.getAllMutationBatches(r))).next(o=>{const a=[],u=[];let h=j();for(const d of i){a.push(d.batchId);for(const p of d.mutations)h=h.add(p.key)}for(const d of o){u.push(d.batchId);for(const p of d.mutations)h=h.add(p.key)}return t.localDocuments.getDocuments(r,h).next(d=>({hs:d,removedBatchIds:a,addedBatchIds:u}))})})}function E_(n,e){const t=F(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),o=t.cs.newChangeBuffer({trackRemovals:!0});return function(u,h,d,p){const y=d.batch,A=y.keys();let S=P.resolve();return A.forEach(V=>{S=S.next(()=>p.getEntry(h,V)).next(O=>{const k=d.docVersions.get(V);K(k!==null),O.version.compareTo(k)<0&&(y.applyToRemoteDocument(O,d),O.isValidDocument()&&(O.setReadTime(d.commitVersion),p.addEntry(O)))})}),S.next(()=>u.mutationQueue.removeMutationBatch(h,y))}(t,r,e,o).next(()=>o.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(u){let h=j();for(let d=0;d<u.mutationResults.length;++d)u.mutationResults[d].transformResults.length>0&&(h=h.add(u.batch.mutations[d].key));return h}(e))).next(()=>t.localDocuments.getDocuments(r,i))})}function Ol(n){const e=F(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function T_(n,e){const t=F(n),r=e.snapshotVersion;let i=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",o=>{const a=t.cs.newChangeBuffer({trackRemovals:!0});i=t.os;const u=[];
2576e.targetChanges.forEach((p,y)=>{const A=i.get(y);if(!A)return;u.push(t.Ur.removeMatchingKeys(o,p.removedDocuments,y).next(()=>t.Ur.addMatchingKeys(o,p.addedDocuments,y)));let S=A.withSequenceNumber(o.currentSequenceNumber);e.targetMismatches.get(y)!==null?S=S.withResumeToken(de.EMPTY_BYTE_STRING,U.min()).withLastLimboFreeSnapshotVersion(U.min()):p.resumeToken.approximateByteSize()>0&&(S=S.withResumeToken(p.resumeToken,r)),i=i.insert(y,S),function(O,k,q){return O.resumeToken.approximateByteSize()===0||k.snapshotVersion.toMicroseconds()-O.snapshotVersion.toMicroseconds()>=3e8?!0:q.addedDocuments.size+q.modifiedDocuments.size+q.removedDocuments.size>0}(A,S,p)&&u.push(t.Ur.updateTargetData(o,S))});let h=Ye(),d=j();if(e.documentUpdates.forEach(p=>{e.resolvedLimboDocuments.has(p)&&u.push(t.persistence.referenceDelegate.updateLimboDocument(o,p))}),u.push(I_(o,a,e.documentUpdates).next(p=>{h=p.Ps,d=p.Is})),!r.isEqual(U.min())){const p=t.Ur.getLastRemoteSnapshotVersion(o).next(y=>t.Ur.setTargetsMetadata(o,o.currentSequenceNumber,r));u.push(p)}return P.waitFor(u).next(()=>a.apply(o)).next(()=>t.localDocuments.getLocalViewOfDocuments(o,h,d)).next(()=>h)}).then(o=>(t.os=i,o))}function I_(n,e,t){let r=j(),i=j();return t.forEach(o=>r=r.add(o)),e.getEntries(n,r).next(o=>{let a=Ye();return t.forEach((u,h)=>{const d=o.get(u);h.isFoundDocument()!==d.isFoundDocument()&&(i=i.add(u)),h.isNoDocument()&&h.version.isEqual(U.min())?(e.removeEntry(u,h.readTime),a=a.insert(u,h)):!d.isValidDocument()||h.version.compareTo(d.version)>0||h.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(h),a=a.insert(u,h)):N("LocalStore","Ignoring outdated watch update for ",u,". Current version:",d.version," Watch version:",h.version)}),{Ps:a,Is:i}})}function w_(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 A_(n,e){const t=F(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return t.Ur.getTargetData(r,e).next(o=>o?(i=o,P.resolve(i)):t.Ur.allocateTargetId(r).next(a=>(i=new ut(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Ur.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=t.os.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(t.os=t.os.insert(r.targetId,r),t._s.set(e,r.targetId)),r})}async function Rs(n,e,t){const r=F(n),i=r.os.get(e),o=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",o,a=>r.persistence.referenceDelegate.removeTarget(a,i))}catch(a){if(!rr(a))throw a;N("LocalStore",`Failed to update sequence numbers for target ${e}: ${a}`)}r.os=r.os.remove(e),r._s.delete(i.target)}function Ac(n,e,t){const r=F(n);let i=U.min(),o=j();return r.persistence.runTransaction("Execute query","readwrite",a=>function(h,d,p){const y=F(h),A=y._s.get(p);return A!==void 0?P.resolve(y.os.get(A)):y.Ur.getTargetData(d,p)}(r,a,Le(e)).next(u=>{if(u)return i=u.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(a,u.targetId).next(h=>{o=h})}).next(()=>r.ss.getDocumentsMatchingQuery(a,e,t?i:U.min(),t?o:j())).next(u=>(R_(r,pg(e),u),{documents:u,Ts:o})))}function R_(n,e,t){let r=n.us.get(e)||U.min();t.forEach((i,o)=>{o.readTime.compareTo(r)>0&&(r=o.readTime)}),n.us.set(e,r)}class Rc{constructor(){this.activeTargetIds=Eg()}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 b_{constructor(){this.so=new Rc,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 Rc,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2577 * @license
2578 * Copyright 2019 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 S_{_o(e){}shutdown(){}}/**
2592 * @license
2593 * Copyright 2019 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 */class bc{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(){N("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){N("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}}/**
2607 * @license
2608 * Copyright 2023 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 */let Dr=null;function ss(){return Dr===null?Dr=function(){return 268435456+Math.round(2147483648*Math.random())}():Dr++,"0x"+Dr.toString(16)}/**
2622 * @license
2623 * Copyright 2020 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 */const P_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
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, software
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 C_{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)}}/**
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 */const _e="WebChannelConnection";class k_ extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),o=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+t.host,this.vo=`projects/${i}/databases/${o}`,this.Co=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${o}`}get Fo(){return!1}Mo(t,r,i,o,a){const u=ss(),h=this.xo(t,r.toUriEncodedString());N("RestConnection",`Sending RPC '${t}' ${u}:`,h,i);const d={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(d,o,a),this.No(t,h,d,i).then(p=>(N("RestConnection",`Received RPC '${t}' ${u}: `,p),p),p=>{throw Jt("RestConnection",`RPC '${t}' ${u} failed with error: `,p,"url: ",h,"request:",i),p})}Lo(t,r,i,o,a,u){return this.Mo(t,r,i,o,a)}Oo(t,r,i){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+on}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((o,a)=>t[a]=o),i&&i.headers.forEach((o,a)=>t[a]=o)}xo(t,r){const i=P_[t];return`${this.Do}/v1/${r}:${i}`}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,i){const o=ss();return new Promise((a,u)=>{const h=new Hu;h.setWithCredentials(!0),h.listenOnce(Ku.COMPLETE,()=>{try{switch(h.getLastErrorCode()){case xr.NO_ERROR:const p=h.getResponseJson();N(_e,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(p)),a(p);break;case xr.TIMEOUT:N(_e,`RPC '${e}' ${o} timed out`),u(new D(b.DEADLINE_EXCEEDED,"Request time out"));break;case xr.HTTP_ERROR:const y=h.getStatus();if(N(_e,`RPC '${e}' ${o} failed with status:`,y,"response text:",h.getResponseText()),y>0){let A=h.getResponseJson();Array.isArray(A)&&(A=A[0]);const S=A==null?void 0:A.error;if(S&&S.status&&S.message){const V=function(k){const q=k.toLowerCase().replace(/_/g,"-");return Object.values(b).indexOf(q)>=0?q:b.UNKNOWN}(S.status);u(new D(V,S.message))}else u(new D(b.UNKNOWN,"Server responded with status "+h.getStatus()))}else u(new D(b.UNAVAILABLE,"Connection failed."));break;default:x()}}finally{N(_e,`RPC '${e}' ${o} completed.`)}});const d=JSON.stringify(i);N(_e,`RPC '${e}' ${o} sending request:`,i),h.send(t,"POST",d,r,15)})}Bo(e,t,r){const i=ss(),o=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=Xu(),u=Ju(),h={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(h.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(h.useFetchStreams=!0),this.Oo(h.initMessageHeaders,t,r),h.encodeInitMessageHeaders=!0;const p=o.join("");N(_e,`Creating RPC '${e}' stream ${i}: ${p}`,h);const y=a.createWebChannel(p,h);let A=!1,S=!1;const V=new C_({Io:k=>{S?N(_e,`Not sending because RPC '${e}' stream ${i} is closed:`,k):(A||(N(_e,`Opening RPC '${e}' stream ${i} transport.`),y.open(),A=!0),N(_e,`RPC '${e}' stream ${i} sending:`,k),y.send(k))},To:()=>y.close()}),O=(k,q,G)=>{k.listen(q,H=>{try{G(H)}catch(ee){setTimeout(()=>{throw ee},0)}})};return O(y,kn.EventType.OPEN,()=>{S||(N(_e,`RPC '${e}' stream ${i} transport opened.`),V.yo())}),O(y,kn.EventType.CLOSE,()=>{S||(S=!0,N(_e,`RPC '${e}' stream ${i} transport closed`),V.So())}
2666),O(y,kn.EventType.ERROR,k=>{S||(S=!0,Jt(_e,`RPC '${e}' stream ${i} transport errored:`,k),V.So(new D(b.UNAVAILABLE,"The operation could not be completed")))}),O(y,kn.EventType.MESSAGE,k=>{var q;if(!S){const G=k.data[0];K(!!G);const H=G,ee=H.error||((q=H[0])===null||q===void 0?void 0:q.error);if(ee){N(_e,`RPC '${e}' stream ${i} received error:`,ee);const Re=ee.status;let te=function(_){const v=re[_];if(v!==void 0)return wl(v)}(Re),E=ee.message;te===void 0&&(te=b.INTERNAL,E="Unknown error status: "+Re+" with message "+ee.message),S=!0,V.So(new D(te,E)),y.close()}else N(_e,`RPC '${e}' stream ${i} received:`,G),V.bo(G)}}),O(u,Qu.STAT_EVENT,k=>{k.stat===ms.PROXY?N(_e,`RPC '${e}' stream ${i} detected buffering proxy`):k.stat===ms.NOPROXY&&N(_e,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{V.wo()},0),V}}function os(){return typeof document<"u"?document:null}/**
2667 * @license
2668 * Copyright 2020 Google LLC
2669 *
2670 * Licensed under the Apache License, Version 2.0 (the "License");
2671 * you may not use this file except in compliance with the License.
2672 * You may obtain a copy of the License at
2673 *
2674 *   http://www.apache.org/licenses/LICENSE-2.0
2675 *
2676 * Unless required by applicable law or agreed to in writing, software
2677 * distributed under the License is distributed on an "AS IS" BASIS,
2678 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2679 * See the License for the specific language governing permissions and
2680 * limitations under the License.
2681 */function vi(n){return new Bg(n,!0)}/**
2682 * @license
2683 * Copyright 2017 Google LLC
2684 *
2685 * Licensed under the Apache License, Version 2.0 (the "License");
2686 * you may not use this file except in compliance with the License.
2687 * You may obtain a copy of the License at
2688 *
2689 *   http://www.apache.org/licenses/LICENSE-2.0
2690 *
2691 * Unless required by applicable law or agreed to in writing, software
2692 * distributed under the License is distributed on an "AS IS" BASIS,
2693 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2694 * See the License for the specific language governing permissions and
2695 * limitations under the License.
2696 */class Ml{constructor(e,t,r=1e3,i=1.5,o=6e4){this.ui=e,this.timerId=t,this.ko=r,this.qo=i,this.Qo=o,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),i=Math.max(0,t-r);i>0&&N("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,i,()=>(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}}/**
2697 * @license
2698 * Copyright 2017 Google LLC
2699 *
2700 * Licensed under the Apache License, Version 2.0 (the "License");
2701 * you may not use this file except in compliance with the License.
2702 * You may obtain a copy of the License at
2703 *
2704 *   http://www.apache.org/licenses/LICENSE-2.0
2705 *
2706 * Unless required by applicable law or agreed to in writing, software
2707 * distributed under the License is distributed on an "AS IS" BASIS,
2708 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2709 * See the License for the specific language governing permissions and
2710 * limitations under the License.
2711 */class Ll{constructor(e,t,r,i,o,a,u,h){this.ui=e,this.Ho=r,this.Jo=i,this.connection=o,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=u,this.listener=h,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new Ml(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)}
2711c_(){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?(Xe(t.toString()),Xe("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,i])=>{this.Yo===t&&this.P_(r,i)},r=>{e(()=>{const i=new D(b.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(i)})})}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(i=>{r(()=>this.I_(i))}),this.stream.onMessage(i=>{r(()=>++this.e_==1?this.E_(i):this.onNext(i))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return N("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(N("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class V_ extends Ll{constructor(e,t,r,i,o,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,i,a),this.serializer=o}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=$g(this.serializer,e),r=function(o){if(!("targetChange"in o))return U.min();const a=o.targetChange;return a.targetIds&&a.targetIds.length?U.min():a.readTime?xe(a.readTime):U.min()}(e);return this.listener.d_(t,r)}A_(e){const t={};t.database=As(this.serializer),t.addTarget=function(o,a){let u;const h=a.target;if(u=vs(h)?{documents:Gg(o,h)}:{query:Hg(o,h)._t},u.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){u.resumeToken=bl(o,a.resumeToken);const d=Ts(o,a.expectedCount);d!==null&&(u.expectedCount=d)}else if(a.snapshotVersion.compareTo(U.min())>0){u.readTime=ti(o,a.snapshotVersion.toTimestamp());const d=Ts(o,a.expectedCount);d!==null&&(u.expectedCount=d)}return u}(this.serializer,e);const r=Qg(this.serializer,e);r&&(t.labels=r),this.a_(t)}R_(e){const t={};t.database=As(this.serializer),t.removeTarget=e,this.a_(t)}}class D_ extends Ll{constructor(e,t,r,i,o,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,i,a),this.serializer=o}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 K(!!e.streamToken),this.lastStreamToken=e.streamToken,K(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){K(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=Wg(e.writeResults,e.commitTime),r=xe(e.commitTime);return this.listener.g_(r,t)}p_(){const e={};e.database=As(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>zg(this.serializer,r))};this.a_(t)}}/**
2712 * @license
2713 * Copyright 2017 Google LLC
2714 *
2715 * Licensed under the Apache License, Version 2.0 (the "License");
2716 * you may not use this file except in compliance with the License.
2717 * You may obtain a copy of the License at
2718 *
2719 *   http://www.apache.org/licenses/LICENSE-2.0
2720 *
2721 * Unless required by applicable law or agreed to in writing, software
2722 * distributed under the License is distributed on an "AS IS" BASIS,
2723 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2724 * See the License for the specific language governing permissions and
2725 * limitations under the License.
2726 */class N_ extends class{}
2726{constructor(e,t,r,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=i,this.y_=!1}w_(){if(this.y_)throw new D(b.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,r,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Mo(e,Is(t,r),i,o,a)).catch(o=>{throw o.name==="FirebaseError"?(o.code===b.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new D(b.UNKNOWN,o.toString())})}Lo(e,t,r,i,o){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,u])=>this.connection.Lo(e,Is(t,r),i,a,u,o)).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 O_{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}
2727This 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_?(Xe(t),this.D_=!1):N("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
2728 * @license
2729 * Copyright 2017 Google LLC
2730 *
2731 * Licensed under the Apache License, Version 2.0 (the "License");
2732 * you may not use this file except in compliance with the License.
2733 * You may obtain a copy of the License at
2734 *
2735 *   http://www.apache.org/licenses/LICENSE-2.0
2736 *
2737 * Unless required by applicable law or agreed to in writing, software
2738 * distributed under the License is distributed on an "AS IS" BASIS,
2739 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2740 * See the License for the specific language governing permissions and
2741 * limitations under the License.
2742 */class M_{constructor(e,t,r,i,o){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_=o,this.k_._o(a=>{r.enqueueAndForget(async()=>{Ot(this)&&(N("RemoteStore","Restarting streams for network reachability change."),await async function(h){const d=F(h);d.L_.add(4),await or(d),d.q_.set("Unknown"),d.L_.delete(4),await Ei(d)}(this))})}),this.q_=new O_(r,i)}}async function Ei(n){if(Ot(n))for(const e of n.B_)await e(!0)}async function or(n){for(const e of n.B_)await e(!1)}function xl(n,e){const t=F(n);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),so(t)?io(t):ln(t).r_()&&ro(t,e))}function no(n,e){const t=F(n),r=ln(t);t.N_.delete(e),r.r_()&&Ul(t,e),t.N_.size===0&&(r.r_()?r.o_():Ot(t)&&t.q_.set("Unknown"))}function ro(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)}ln(n).A_(e)}function Ul(n,e){n.Q_.xe(e),ln(n).R_(e)}function io(n){n.Q_=new Lg({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>n.N_.get(e)||null,tt:()=>n.datastore.serializer.databaseId}),ln(n).start(),n.q_.v_()}function so(n){return Ot(n)&&!ln(n).n_()&&n.N_.size>0}function Ot(n){return F(n).L_.size===0}function Fl(n){n.Q_=void 0}async function L_(n){n.q_.set("Online")}async function x_(n){n.N_.forEach((e,t)=>{ro(n,e)})}async function U_(n,e){Fl(n),so(n)?(n.q_.M_(e),io(n)):n.q_.set("Unknown")}async function F_(n,e,t){if(n.q_.set("Online"),e instanceof Rl&&e.state===2&&e.cause)try{await async function(i,o){const a=o.cause;for(const u of o.targetIds)i.N_.has(u)&&(await i.remoteSyncer.rejectListen(u,a),i.N_.delete(u),i.Q_.removeTarget(u))}(n,e)}catch(r){N("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await ni(n,r)}else if(e instanceof Br?n.Q_.Ke(e):e instanceof Al?n.Q_.He(e):n.Q_.We(e),!t.isEqual(U.min()))try{const r=await Ol(n.localStore);t.compareTo(r)>=0&&await function(o,a){const u=o.Q_.rt(a);
2742return u.targetChanges.forEach((h,d)=>{if(h.resumeToken.approximateByteSize()>0){const p=o.N_.get(d);p&&o.N_.set(d,p.withResumeToken(h.resumeToken,a))}}),u.targetMismatches.forEach((h,d)=>{const p=o.N_.get(h);if(!p)return;o.N_.set(h,p.withResumeToken(de.EMPTY_BYTE_STRING,p.snapshotVersion)),Ul(o,h);const y=new ut(p.target,h,d,p.sequenceNumber);ro(o,y)}),o.remoteSyncer.applyRemoteEvent(u)}(n,t)}catch(r){N("RemoteStore","Failed to raise snapshot:",r),await ni(n,r)}}async function ni(n,e,t){if(!rr(e))throw e;n.L_.add(1),await or(n),n.q_.set("Offline"),t||(t=()=>Ol(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{N("RemoteStore","Retrying IndexedDB access"),await t(),n.L_.delete(1),await Ei(n)})}function Bl(n,e){return e().catch(t=>ni(n,t,e))}async function Ti(n){const e=F(n),t=yt(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;B_(e);)try{const i=await w_(e.localStore,r);if(i===null){e.O_.length===0&&t.o_();break}r=i.batchId,j_(e,i)}catch(i){await ni(e,i)}jl(e)&&ql(e)}function B_(n){return Ot(n)&&n.O_.length<10}function j_(n,e){n.O_.push(e);const t=yt(n);t.r_()&&t.V_&&t.m_(e.mutations)}function jl(n){return Ot(n)&&!yt(n).n_()&&n.O_.length>0}function ql(n){yt(n).start()}async function q_(n){yt(n).p_()}async function $_(n){const e=yt(n);for(const t of n.O_)e.m_(t.mutations)}async function z_(n,e,t){const r=n.O_.shift(),i=Js.from(r,e,t);await Bl(n,()=>n.remoteSyncer.applySuccessfulWrite(i)),await Ti(n)}async function W_(n,e){e&&yt(n).V_&&await async function(r,i){if(function(a){return Ng(a)&&a!==b.ABORTED}(i.code)){const o=r.O_.shift();yt(r).s_(),await Bl(r,()=>r.remoteSyncer.rejectFailedWrite(o.batchId,i)),await Ti(r)}}(n,e),jl(n)&&ql(n)}async function Sc(n,e){const t=F(n);t.asyncQueue.verifyOperationInProgress(),N("RemoteStore","RemoteStore received new credentials");const r=Ot(t);t.L_.add(3),await or(t),r&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await Ei(t)}async function G_(n,e){const t=F(n);e?(t.L_.delete(2),await Ei(t)):e||(t.L_.add(2),await or(t),t.q_.set("Unknown"))}function ln(n){return n.K_||(n.K_=function(t,r,i){const o=F(t);return o.w_(),new V_(r,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)}(n.datastore,n.asyncQueue,{Eo:L_.bind(null,n),Ro:x_.bind(null,n),mo:U_.bind(null,n),d_:F_.bind(null,n)}),n.B_.push(async e=>{e?(n.K_.s_(),so(n)?io(n):n.q_.set("Unknown")):(await n.K_.stop(),Fl(n))})),n.K_}function yt(n){return n.U_||(n.U_=function(t,r,i){const o=F(t);return o.w_(),new D_(r,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)}(n.datastore,n.asyncQueue,{Eo:()=>Promise.resolve(),Ro:q_.bind(null,n),mo:W_.bind(null,n),f_:$_.bind(null,n),g_:z_.bind(null,n)}),n.B_.push(async e=>{e?(n.U_.s_(),await Ti(n)):(await n.U_.stop(),n.O_.length>0&&(N("RemoteStore",`Stopping write stream with ${n.O_.length} pending writes`),n.O_=[]))})),n.U_}/**
2743 * @license
2744 * Copyright 2017 Google LLC
2745 *
2746 * Licensed under the Apache License, Version 2.0 (the "License");
2747 * you may not use this file except in compliance with the License.
2748 * You may obtain a copy of the License at
2749 *
2750 *   http://www.apache.org/licenses/LICENSE-2.0
2751 *
2752 * Unless required by applicable law or agreed to in writing, software
2753 * distributed under the License is distributed on an "AS IS" BASIS,
2754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2755 * See the License for the specific language governing permissions and
2756 * limitations under the License.
2757 */class oo{constructor(e,t,r,i,o){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=i,this.removalCallback=o,this.deferred=new We,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,i,o){const a=Date.now()+r,u=new oo(e,t,a,i,o);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 ao(n,e){if(Xe("AsyncQueue",`${e}: ${n}`),rr(n))return new D(b.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2758 * @license
2759 * Copyright 2017 Google LLC
2760 *
2761 * Licensed under the Apache License, Version 2.0 (the "License");
2762 * you may not use this file except in compliance with the License.
2763 * You may obtain a copy of the License at
2764 *
2765 *   http://www.apache.org/licenses/LICENSE-2.0
2766 *
2767 * Unless required by applicable law or agreed to in writing, software
2768 * distributed under the License is distributed on an "AS IS" BASIS,
2769 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2770 * See the License for the specific language governing permissions and
2771 * limitations under the License.
2772 */class Gt{constructor(e){this.comparator=e?(t,r)=>e(t,r)||M.comparator(t.key,r.key):(t,r)=>M.comparator(t.key,r.key),this.keyedMap=Vn(),this.sortedSet=new Y(this.comparator)}static emptySet(e){return new Gt(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 Gt)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const i=t.getNext().key,o=r.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
2773  `+e.join(`  
2774`)+`
2775)`}copy(e,t){const r=new Gt;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
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 Pc{constructor(){this.W_=new Y(M.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 tn{constructor(e,t,r,i,o,a,u,h,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=o,this.fromCache=a,this.syncStateChanged=u,this.excludesMetadataChanges=h,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,i,o){const a=[];return t.forEach(u=>{a.push({type:0,doc:u})}),new tn(e,t,Gt.emptySet(t),a,r,i,!0,!1,o)}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)&&pi(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 i=0;i<t.length;i++)if(t[i].type!==r[i].type||!t[i].doc.isEqual(r[i].doc))return!1;return!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, softw
2800are
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 H_{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class K_{constructor(){this.queries=Cc(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,r){const i=F(t),o=i.queries;i.queries=Cc(),o.forEach((a,u)=>{for(const h of u.j_)h.onError(r)})})(this,new D(b.ABORTED,"Firestore shutting down"))}}function Cc(){return new un(n=>ll(n),pi)}async function co(n,e){const t=F(n);let r=3;const i=e.query;let o=t.queries.get(i);o?!o.H_()&&e.J_()&&(r=2):(o=new H_,r=e.J_()?0:1);try{switch(r){case 0:o.z_=await t.onListen(i,!0);break;case 1:o.z_=await t.onListen(i,!1);break;case 2:await t.onFirstRemoteStoreListen(i)}}catch(a){const u=ao(a,`Initialization of query '${Ft(e.query)}' failed`);return void e.onError(u)}t.queries.set(i,o),o.j_.push(e),e.Z_(t.onlineState),o.z_&&e.X_(o.z_)&&lo(t)}async function uo(n,e){const t=F(n),r=e.query;let i=3;const o=t.queries.get(r);if(o){const a=o.j_.indexOf(e);a>=0&&(o.j_.splice(a,1),o.j_.length===0?i=e.J_()?0:1:!o.H_()&&e.J_()&&(i=2))}switch(i){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 Q_(n,e){const t=F(n);let r=!1;for(const i of e){const o=i.query,a=t.queries.get(o);if(a){for(const u of a.j_)u.X_(i)&&(r=!0);a.z_=i}}r&&lo(t)}function J_(n,e,t){const r=F(n),i=r.queries.get(e);if(i)for(const o of i.j_)o.onError(t);r.queries.delete(e)}function lo(n){n.Y_.forEach(e=>{e.next()})}var bs,kc;(kc=bs||(bs={})).ea="default",kc.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 i of e.docChanges)i.type!==3&&r.push(i);e=new tn(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=tn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==bs.Cache}}/**
2806 * @license
2807 * Copyright 2017 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 */class $l{constructor(e){this.key=e}}class zl{constructor(e){this.key=e}}class X_{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=j(),this.mutatedKeys=j(),this.Aa=hl(e),this.Ra=new Gt(this.Aa)}get Va(){return this.Ta}ma(e,t){const r=t?t.fa:new Pc,i=t?t.Ra:this.Ra;let o=t?t.mutatedKeys:this.mutatedKeys,a=i,u=!1;const h=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,d=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((p,y)=>{const A=i.get(p),S=mi(this.query,y)?y:null,V=!!A&&this.mutatedKeys.has(A.key),O=!!S&&(S.hasLocalMutations||this.mutatedKeys.has(S.key)&&S.hasCommittedMutations);let k=!1;A&&S?A.data.isEqual(S.data)?V!==O&&(r.track({type:3,doc:S}),k=!0):this.ga(A,S)||(r.track({type:2,doc:S}),k=!0,(h&&this.Aa(S,h)>0||d&&this.Aa(S,d)<0)&&(u=!0)):!A&&S?(r.track({type:0,doc:S}),k=!0):A&&!S&&(r.track({type:1,doc:A}
2820),k=!0,(h||d)&&(u=!0)),k&&(S?(a=a.add(S),o=O?o.add(p):o.delete(p)):(a=a.delete(p),o=o.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),o=o.delete(p.key),r.track({type:1,doc:p})}return{Ra:a,fa:r,ns:u,mutatedKeys:o}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,i){const o=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const a=e.fa.G_();a.sort((p,y)=>function(S,V){const O=k=>{switch(k){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return x()}};return O(S)-O(V)}(p.type,y.type)||this.Aa(p.doc,y.doc)),this.pa(r),i=i!=null&&i;const u=t&&!i?this.ya():[],h=this.da.size===0&&this.current&&!i?1:0,d=h!==this.Ea;return this.Ea=h,a.length!==0||d?{snapshot:new tn(this.query,e.Ra,o,a,e.mutatedKeys,h===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 Pc,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=j(),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 zl(r))}),this.da.forEach(r=>{e.has(r)||t.push(new $l(r))}),t}ba(e){this.Ta=e.Ts,this.da=j();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return tn.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class Y_{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class Z_{constructor(e){this.key=e,this.va=!1}}class ey{constructor(e,t,r,i,o,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=a,this.Ca={},this.Fa=new un(u=>ll(u),pi),this.Ma=new Map,this.xa=new Set,this.Oa=new Y(M.comparator),this.Na=new Map,this.La=new Zs,this.Ba={},this.ka=new Map,this.qa=en.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function ty(n,e,t=!0){const r=Jl(n);let i;const o=r.Fa.get(e);return o?(r.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.Da()):i=await Wl(r,e,t,!0),i}async function ny(n,e){const t=Jl(n);await Wl(t,e,!0,!1)}async function Wl(n,e,t,r){const i=await A_(n.localStore,Le(e)),o=i.targetId,a=n.sharedClientState.addLocalQueryTarget(o,t);let u;return r&&(u=await ry(n,e,o,a==="current",i.resumeToken)),n.isPrimaryClient&&t&&xl(n.remoteStore,i),u}async function ry(n,e,t,r,i){n.Ka=(y,A,S)=>async function(O,k,q,G){let H=k.view.ma(q);H.ns&&(H=await Ac(O.localStore,k.query,!1).then(({documents:E})=>k.view.ma(E,H)));const ee=G&&G.targetChanges.get(k.targetId),Re=G&&G.targetMismatches.get(k.targetId)!=null,te=k.view.applyChanges(H,O.isPrimaryClient,ee,Re);return Dc(O,k.targetId,te.wa),te.snapshot}(n,y,A,S);const o=await Ac(n.localStore,e,!0),a=new X_(e,o.Ts),u=a.ma(o.documents),h=sr.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",i),d=a.applyChanges(u,n.isPrimaryClient,h);Dc(n,t,d.wa);const p=new Y_(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 iy(n,e,t){const r=F(n),i=r.Fa.get(e),o=r.Ma.get(i.targetId);if(o.length>1)return r.Ma.set(i.targetId,o.filter(a=>!pi(a,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedCl
2820ientState.isActiveQueryTarget(i.targetId)||await Rs(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),t&&no(r.remoteStore,i.targetId),Ss(r,i.targetId)}).catch(nr)):(Ss(r,i.targetId),await Rs(r.localStore,i.targetId,!0))}async function sy(n,e){const t=F(n),r=t.Fa.get(e),i=t.Ma.get(r.targetId);t.isPrimaryClient&&i.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),no(t.remoteStore,r.targetId))}async function oy(n,e,t){const r=fy(n);try{const i=await function(a,u){const h=F(a),d=oe.now(),p=u.reduce((S,V)=>S.add(V.key),j());let y,A;return h.persistence.runTransaction("Locally write mutations","readwrite",S=>{let V=Ye(),O=j();return h.cs.getEntries(S,p).next(k=>{V=k,V.forEach((q,G)=>{G.isValidDocument()||(O=O.add(q))})}).next(()=>h.localDocuments.getOverlayedDocuments(S,V)).next(k=>{y=k;const q=[];for(const G of u){const H=Pg(G,y.get(G.key).overlayedDocument);H!=null&&q.push(new Nt(G.key,H,nl(H.value.mapValue),Ge.exists(!0)))}return h.mutationQueue.addMutationBatch(S,d,q,u)}).next(k=>{A=k;const q=k.applyToLocalDocumentSet(y,O);return h.documentOverlayCache.saveOverlays(S,k.batchId,q)})}).then(()=>({batchId:A.batchId,changes:fl(y)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(a,u,h){let d=a.Ba[a.currentUser.toKey()];d||(d=new Y(W)),d=d.insert(u,h),a.Ba[a.currentUser.toKey()]=d}(r,i.batchId,t),await ar(r,i.changes),await Ti(r.remoteStore)}catch(i){const o=ao(i,"Failed to persist write");t.reject(o)}}async function Gl(n,e){const t=F(n);try{const r=await T_(t.localStore,e);
2820e.targetChanges.forEach((i,o)=>{const a=t.Na.get(o);a&&(K(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?a.va=!0:i.modifiedDocuments.size>0?K(a.va):i.removedDocuments.size>0&&(K(a.va),a.va=!1))}),await ar(t,r,e)}catch(r){await nr(r)}}function Vc(n,e,t){const r=F(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const i=[];r.Fa.forEach((o,a)=>{const u=a.view.Z_(e);u.snapshot&&i.push(u.snapshot)}),function(a,u){const h=F(a);h.onlineState=u;let d=!1;h.queries.forEach((p,y)=>{for(const A of y.j_)A.Z_(u)&&(d=!0)}),d&&lo(h)}(r.eventManager,e),i.length&&r.Ca.d_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function ay(n,e,t){const r=F(n);r.sharedClientState.updateQueryState(e,"rejected",t);const i=r.Na.get(e),o=i&&i.key;if(o){let a=new Y(M.comparator);a=a.insert(o,ve.newNoDocument(o,U.min()));const u=j().add(o),h=new yi(U.min(),new Map,new Y(W),a,u);await Gl(r,h),r.Oa=r.Oa.remove(o),r.Na.delete(e),fo(r)}else await Rs(r.localStore,e,!1).then(()=>Ss(r,e,t)).catch(nr)}async function cy(n,e){const t=F(n),r=e.batch.batchId;try{const i=await E_(t.localStore,e);Kl(t,r,null),Hl(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await ar(t,i)}catch(i){await nr(i)}}async function uy(n,e,t){const r=F(n);try{const i=await function(a,u){const h=F(a);return h.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let p;return h.mutationQueue.lookupMutationBatch(d,u).next(y=>(K(y!==null),p=y.keys(),h.mutationQueue.removeMutationBatch(d,y))).next(()=>h.mutationQueue.performConsistencyCheck(d)).next(()=>h.documentOverlayCache.removeOverlaysForBatchId(d,p,u)).next(()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,p)).next(()=>h.localDocuments.getDocuments(d,p))})}(r.localStore,e);Kl(r,e,t),Hl(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await ar(r,i)}catch(i){await nr(i)}}function Hl(n,e){(n.ka.get(e)||[]).forEach(t=>{t.resolve()}),n.ka.delete(e)}function Kl(n,e,t){const r=F(n);let i=r.Ba[r.currentUser.toKey()];if(i){const o=i.get(e);o&&(t?o.reject(t):o.resolve(),i=i.remove(e)),r.Ba[r.currentUser.toKey()]=i}}function Ss(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)||Ql(n,r)})}function Ql(n,e){n.xa.delete(e.path.canonicalString());const t=n.Oa.get(e);t!==null&&(no(n.remoteStore,t),n.Oa=n.Oa.remove(e),n.Na.delete(t),fo(n))}function Dc(n,e,t){for(const r of t)r instanceof $l?(n.La.addReference(r.key,e),ly(n,r)):r instanceof zl?(N("SyncEngine","Document no longer in limbo: "+r.key),n.La.removeReference(r.key,e),n.La.containsKey(r.key)||Ql(n,r.key)):x()}function ly(n,e){const t=e.key,r=t.path.canonicalString();n.Oa.get(t)||n.xa.has(r)||(N("SyncEngine","New document in limbo: "+t),n.xa.add(r),fo(n))}function fo(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 M(X.fromString(e)),r=n.qa.next();n.Na.set(r,new Z_(t)),n.Oa=n.Oa.insert(t,r),xl(n.remoteStore,new ut(Le(fi(t.path)),r,"TargetPurposeLimboResolution",$s.oe))}}async function ar(n,e,t){const r=F(n),i=[],o=[],a=[];r.Fa.isEmpty()||(r.Fa.forEach((u,h)=>{a.push(r.Ka(h,e,t).then(d=>{var p;if((d||t)&&r.isPrimaryClient){const y=d?!d.fromCache:(p=t==null?void 0:t.targetChanges.get(h.targetId))===null||p===void 0?void 0:p.current;
2820r.sharedClientState.updateQueryState(h.targetId,y?"current":"not-current")}if(d){i.push(d);const y=to.Wi(h.targetId,d);o.push(y)}}))}),await Promise.all(a),r.Ca.d_(i),await async function(h,d){const p=F(h);try{await p.persistence.runTransaction("notifyLocalViewChanges","readwrite",y=>P.forEach(d,A=>P.forEach(A.$i,S=>p.persistence.referenceDelegate.addReference(y,A.targetId,S)).next(()=>P.forEach(A.Ui,S=>p.persistence.referenceDelegate.removeReference(y,A.targetId,S)))))}catch(y){if(!rr(y))throw y;N("LocalStore","Failed to update sequence numbers: "+y)}for(const y of d){const A=y.targetId;if(!y.fromCache){const S=p.os.get(A),V=S.snapshotVersion,O=S.withLastLimboFreeSnapshotVersion(V);p.os=p.os.insert(A,O)}}}(r.localStore,o))}async function hy(n,e){const t=F(n);if(!t.currentUser.isEqual(e)){N("SyncEngine","User change. New user:",e.toKey());const r=await Nl(t.localStore,e);t.currentUser=e,function(o,a){o.ka.forEach(u=>{u.forEach(h=>{h.reject(new D(b.CANCELLED,a))})}),o.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 dy(n,e){const t=F(n),r=t.Na.get(e);if(r&&r.va)return j().add(r.key);{let i=j();const o=t.Ma.get(e);if(!o)return i;for(const a of o){const u=t.Fa.get(a);i=i.unionWith(u.view.Va)}return i}}function Jl(n){const e=F(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Gl.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=dy.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ay.bind(null,e),e.Ca.d_=Q_.bind(null,e.eventManager),e.Ca.$a=J_.bind(null,e.eventManager),e}function fy(n){const e=F(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=cy.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=uy.bind(null,e),e}class ri{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=vi(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 v_(this.persistence,new __,e.initialUser,this.serializer)}Ga(e){return new p_(eo.Zr,this.serializer)}Wa(e){return new b_}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()}}ri.provider={build:()=>new ri};class Ps{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=>Vc(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=hy.bind(null,this.syncEngine),await G_(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new K_}()}createDatastore(e){const t=vi(e.databaseInfo.databaseId),r=function(o){return new k_(o)}(e.databaseInfo);return function(o,a,u,h){return new N_(o,a,u,h)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,i,o,a,u){return new M_(r,i,o,a,u)}(this.localStore,this.datastore,e.asyncQueue,t=>Vc(this.syncEngine,t,0),function(){return bc.D()?new bc:new S_}())}createSyncEngine(e,t){return function(i,o,a,u,h,d,p){const y=new ey(i,o,a,u,h,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(i){const o=F(i);N("RemoteStore","RemoteStore shutting down."),o.L_.add(5),await or(o),o.k_.shutdown(),o.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}Ps.provider={build:()=>new Ps};/**
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 *//**
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 */class po{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):Xe("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,t){setTimeout(()=>{this.muted||e(t)},0)}}/**
2851 * @license
2852 * Copyright 2017 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 py{constructor(e,t,r,i,o){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=i,this.user=ye.UNAUTHENTICATED,this.clientId=Zu.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(r,async a=>{N("FirestoreClient","Received user=",a.uid),await this.authCredentialListener(a),this.user=a}),this.appCheckCredentials.start(r,a=>(N("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 We;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=ao(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function as(n,e){n.asyncQueue.verifyOperationInProgress(),N("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async i=>{r.isEqual(i)||(await Nl(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Nc(n,e){n.asyncQueue.verifyOperationInProgress();const t=await my(n);N("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>Sc(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,i)=>Sc(e.remoteStore,i)),n._onlineComponents=e}async function my(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){N("FirestoreClient","Using user provided OfflineComponentProvider");try{await as(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!function(i){return i.name==="FirebaseError"?i.code===b.FAILED_PRECONDITION||i.code===b.UNIMPLEMENT
2865ED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(t))throw t;Jt("Error using user provided cache. Falling back to memory cache: "+t),await as(n,new ri)}}else N("FirestoreClient","Using default OfflineComponentProvider"),await as(n,new ri);return n._offlineComponents}async function Xl(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(N("FirestoreClient","Using user provided OnlineComponentProvider"),await Nc(n,n._uninitializedComponentsProvider._online)):(N("FirestoreClient","Using default OnlineComponentProvider"),await Nc(n,new Ps))),n._onlineComponents}function gy(n){return Xl(n).then(e=>e.syncEngine)}async function ii(n){const e=await Xl(n),t=e.eventManager;return t.onListen=ty.bind(null,e.syncEngine),t.onUnlisten=iy.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=ny.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=sy.bind(null,e.syncEngine),t}function _y(n,e,t={}){const r=new We;return n.asyncQueue.enqueueAndForget(async()=>function(o,a,u,h,d){const p=new po({next:A=>{p.Za(),a.enqueueAndForget(()=>uo(o,y));const S=A.docs.has(u);!S&&A.fromCache?d.reject(new D(b.UNAVAILABLE,"Failed to get document because the client is offline.")):S&&A.fromCache&&h&&h.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(A)},error:A=>d.reject(A)}),y=new ho(fi(u.path),p,{includeMetadataChanges:!0,_a:!0});return co(o,y)}(await ii(n),n.asyncQueue,e,t,r)),r.promise}function yy(n,e,t={}){const r=new We;return n.asyncQueue.enqueueAndForget(async()=>function(o,a,u,h,d){const p=new po({next:A=>{p.Za(),a.enqueueAndForget(()=>uo(o,y)),A.fromCache&&h.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(A)},error:A=>d.reject(A)}),y=new ho(u,p,{includeMetadataChanges:!0,_a:!0});return co(o,y)}(await ii(n),n.asyncQueue,e,t,r)),r.promise}/**
2866 * @license
2867 * Copyright 2023 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 */function Yl(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
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 */const Oc=new Map;/**
2896 * @license
2897 * Copyright 2017 Google LLC
2898 *
2899 * Licensed under the Apache License, Version 2.0 (the "License");
2900 * you may not use this file except in compliance with the License.
2901 * You may obtain a copy of the License at
2902 *
2903 *   http://www.apache.org/licenses/LICENSE-2.0
2904 *
2905 * Unless required by applicable law or agreed to in writing, software
2906 * distributed under the License is distributed on an "AS IS" BASIS,
2907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2908 * See the License for the specific language governing permissions and
2909 * limitations under the License.
2910 */function Zl(n,e,t){if(!t)throw new D(b.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function vy(n,e,t,r){if(e===!0&&r===!0)throw new D(b.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Mc(n){if(!M.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 Lc(n){if(M.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 Ii(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 He(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=Ii(n);throw new D(b.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function Ey(n,e){if(e<=0)throw new D(b.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
2911 * @license
2912 * Copyright 2020 Google LLC
2913 *
2914 * Licensed under the Apache License, Version 2.0 (the "License");
2915 * you may not use this file except in compliance with the License.
2916 * You may obtain a copy of the License at
2917 *
2918 *   http://www.apache.org/licenses/LICENSE-2.0
2919 *
2920 * Unless required by applicable law or agreed to in writing, software
2921 * distributed under the License is distributed on an "AS IS" BASIS,
2922 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2923 * See the License for the specific language governing permissions and
2924 * limitations under the License.
2925 */class xc{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}vy("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=Yl((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new D(b.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new D(b.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new D(b.INVALID_ARGUMENT,`invalid long polling timeout: ${o.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,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}
2925class wi{constructor(e,t,r,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new xc({}),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 xc(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new Lm;switch(r.type){case"firstParty":return new Bm(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=Oc.get(t);r&&(N("ComponentProvider","Removing Datastore"),Oc.delete(t),r.terminate())}(this),Promise.resolve()}}function Ty(n,e,t,r={}){var i;const o=(n=He(n,wi))._getSettings(),a=`${e}:${t}`;if(o.host!=="firestore.googleapis.com"&&o.host!==a&&Jt("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},o),{host:a,ssl:!1})),r.mockUserToken){let u,h;if(typeof r.mockUserToken=="string")u=r.mockUserToken,h=ye.MOCK_USER;else{u=sd(r.mockUserToken,(i=n._app)===null||i===void 0?void 0:i.options.projectId);const d=r.mockUserToken.sub||r.mockUserToken.user_id;if(!d)throw new D(b.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");
2925h=new ye(d)}n._authCredentials=new xm(new Yu(u,h))}}/**
2926 * @license
2927 * Copyright 2020 Google LLC
2928 *
2929 * Licensed under the Apache License, Version 2.0 (the "License");
2930 * you may not use this file except in compliance with the License.
2931 * You may obtain a copy of the License at
2932 *
2933 *   http://www.apache.org/licenses/LICENSE-2.0
2934 *
2935 * Unless required by applicable law or agreed to in writing, software
2936 * distributed under the License is distributed on an "AS IS" BASIS,
2937 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2938 * See the License for the specific language governing permissions and
2939 * limitations under the License.
2940 */class Ze{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Ze(this.firestore,e,this._query)}}class we{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 dt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new we(this.firestore,e,this._key)}}class dt extends Ze{constructor(e,t,r){super(e,t,fi(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 we(this.firestore,null,new M(e))}withConverter(e){return new dt(this.firestore,e,this._path)}}function Rv(n,e,...t){if(n=se(n),Zl("collection","path",e),n instanceof wi){const r=X.fromString(e,...t);return Lc(r),new dt(n,null,r)}{if(!(n instanceof we||n instanceof dt))throw new D(b.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(X.fromString(e,...t));return Lc(r),new dt(n.firestore,null,r)}}function Iy(n,e,...t){if(n=se(n),arguments.length===1&&(e=Zu.newId()),Zl("doc","path",e),n instanceof wi){const r=X.fromString(e,...t);return Mc(r),new we(n,null,new M(r))}{if(!(n instanceof we||n instanceof dt))throw new D(b.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(X.fromString(e,...t));return Mc(r),new we(n.firestore,n instanceof dt?n.converter:null,new M(r))}}/**
2941 * @license
2942 * Copyright 2020 Google LLC
2943 *
2944 * Licensed under the Apache License, Version 2.0 (the "License");
2945 * you may not use this file except in compliance with the License.
2946 * You may obtain a copy of the License at
2947 *
2948 *   http://www.apache.org/licenses/LICENSE-2.0
2949 *
2950 * Unless required by applicable law or agreed to in writing, software
2951 * distributed under the License is distributed on an "AS IS" BASIS,
2952 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2953 * See the License for the specific language governing permissions and
2954 * limitations under the License.
2955 */class Uc{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 Ml(this,"async_queue_retry"),this.Vu=()=>{const r=os();r&&N("AsyncQueue","Visibility state changed to "+r.visibilityState),this.t_.jo()},this.mu=e;const t=os();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=os();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const t=new We;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(!rr(e))throw e;N("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 i=function(a){let u=a.message||"";return a.stack&&(u=a.stack.includes(a.message)?a.stack:a.message+`
2956`+a.stack),u}(r);throw Xe("INTERNAL UNHANDLED ERROR: ",i),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 i=oo.createAndSchedule(this,e,t,r,o=>this.yu(o));return this.Tu.push(i),i}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 Fc(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const i=t;for(const o of r)if(o in i&&typeof i[o]=="function")return!0;return!1}(n,["next","error","complete"])}
2956class nn extends wi{constructor(e,t,r,i){super(e,t,r,i),this.type="firestore",this._queue=new Uc,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Uc(e),this._firestoreClient=void 0,await e}}}function bv(n,e){const t=typeof n=="object"?n:ci(),r=typeof n=="string"?n:e||"(default)",i=sn(t,"firestore").getImmediate({identifier:r});if(!i._initialized){const o=Yc("firestore");o&&Ty(i,...o)}return i}function Ai(n){if(n._terminated)throw new D(b.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||wy(n),n._firestoreClient}function wy(n){var e,t,r;const i=n._freezeSettings(),o=function(u,h,d,p){return new Zm(u,h,d,p.host,p.ssl,p.experimentalForceLongPolling,p.experimentalAutoDetectLongPolling,Yl(p.experimentalLongPollingOptions),p.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,i);n._componentsProvider||!((t=i.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),n._firestoreClient=new py(n._authCredentials,n._appCheckCredentials,n._queue,o,n._componentsProvider&&function(u){const h=u==null?void 0:u._online.build();return{_offline:u==null?void 0:u._offline.build(h),_online:h}}(n._componentsProvider))}/**
2957 * @license
2958 * Copyright 2020 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 rn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new rn(de.fromBase64String(e))}catch(t){throw new D(b.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new rn(de.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)}}/**
2972 * @license
2973 * Copyright 2020 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 */class mo{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 le(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
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 go{constructor(e){this._methodName=e}}/**
3002 * @license
3003 * Copyright 2017 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 */class _o{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 W(this._lat,e._lat)||W(this._long,e._long)}}/**
3017 * @license
3018 * Copyright 2024 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 */class yo{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let o=0;o<r.length;++o)if(r[o]!==i[o])return!1;return!0}(this._values,e._values)}}/**
3032 * @license
3033 * Copyright 2017 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 */const Ay=/^__.*__$/;class Ry{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Nt(e,this.data,this.fieldMask,t,this.fieldTransforms):new ir(e,this.data,t,this.fieldTransforms)}}function eh(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw x()}}class vo{constructor(e,t,r,i,o,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=i,o===void 0&&this.vu(),this.fieldTransforms=o||[],this.fieldMask=a||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new vo(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),i=this.Fu({path:r,xu:!1});return i.Ou(e),i}Nu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.Fu({path:r,xu:!1});return i.vu(),i}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return si(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(eh(this.Cu)&&Ay.test(e))throw this.Bu('Document fields cannot begin and end with "__"')}}class by{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||vi(e)}Qu(e,t,r,i=!1){return new vo({Cu:e,methodName:t,qu:r,path:le.emptyPath(),xu:!1,ku:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function th(n){const e=n._freezeSettings(),t=vi(n._databaseId);return new by(n._databaseId,!!e.ignoreUndefinedProperties,t)}function Sy(n,e,t,r,i,o={}){const a=n.Qu(o.merge||o.mergeFields?2:0,e,t,i);ih("Data must be an object, but it was:",a,r);const u=nh(r,a);let h,d;if(o.merge)h=new ke(a.fieldMask),d=a.fieldTransforms;else if(o.mergeFields){const p=[];for(const y of o.mergeFields){const A=Cy(e,y,t);if(!a.contains(A))throw new D(b.INVALID_ARGUMENT,`Field '${A}' is specified in your field mask but missing from your input data.`);Vy(p,A)||p.push(A)}h=new ke(p),d=a.fieldTransforms.filter(y=>h.covers(y.field))}else h=null,d=a.fieldTransforms;return new Ry(new be(u),h,d)}class Eo extends go{_toFieldTransform(e){return new Ag(e.path,new Hn)}isEqual(e){return e instanceof Eo}}function Py(n,e,t,r=!1){return To(t,n.Qu(r?4:3,e))}function To(n,e){if(rh(n=se(n)))return ih("Unsupported field value:",e,n),nh(n,e);if(n instanceof go)return function(r,i){if(!eh(i.Cu))throw i.Bu(`${r._methodName}
3046() can only be used with update() and set()`);if(!i.path)throw i.Bu(`${r._methodName}() is not currently supported inside arrays`);const o=r._toFieldTransform(i);o&&i.fieldTransforms.push(o)}(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,i){const o=[];let a=0;for(const u of r){let h=To(u,i.Lu(a));h==null&&(h={nullValue:"NULL_VALUE"}),o.push(h),a++}return{arrayValue:{values:o}}}(n,e)}return function(r,i){if((r=se(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Tg(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const o=oe.fromDate(r);return{timestampValue:ti(i.serializer,o)}}if(r instanceof oe){const o=new oe(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:ti(i.serializer,o)}}if(r instanceof _o)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof rn)return{bytesValue:bl(i.serializer,r._byteString)};if(r instanceof we){const o=i.databaseId,a=r.firestore._databaseId;if(!a.isEqual(o))throw i.Bu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${o.projectId}/${o.database}`);return{referenceValue:Ys(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof yo)return function(a,u){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:a.toArray().map(h=>{if(typeof h!="number")throw u.Bu("VectorValues must only contain numeric values.");return Qs(u.serializer,h)})}}}}}}(r,i);throw i.Bu(`Unsupported field value: ${Ii(r)}`)}(n,e)}function nh(n,e){const t={};return el(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):an(n,(r,i)=>{const o=To(i,e.Mu(r));o!=null&&(t[r]=o)}),{mapValue:{fields:t}}}function rh(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof oe||n instanceof _o||n instanceof rn||n instanceof we||n instanceof go||n instanceof yo)}function ih(n,e,t){if(!rh(t)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(t)){const r=Ii(t);throw r==="an object"?e.Bu(n+" a custom object"):e.Bu(n+" "+r)}}function Cy(n,e,t){if((e=se(e))instanceof mo)return e._internalPath;if(typeof e=="string")return sh(n,e);throw si("Field path arguments must be of type string or ",n,!1,void 0,t)}const ky=new RegExp("[~\\*/\\[\\]]");function sh(n,e,t){if(e.search(ky)>=0)throw si(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new mo(...e.split("."))._internalPath}catch{throw si(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function si(n,e,t,r,i){const o=r&&!r.isEmpty(),a=i!==void 0;let u=`Function ${e}() called with invalid data`;t&&(u+=" (via `toFirestore()`)"),u+=". ";let h="";return(o||a)&&(h+=" (found",o&&(h+=` in field ${r}`),a&&(h+=` in document ${i}`),h+=")"),new D(b.INVALID_ARGUMENT,u+n+h)}function Vy(n,e){return n.some(t=>t.isEqual(e))}/**
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 */class oh{constructor(e,t,r,i,o){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new we(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Dy(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(Ri("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class Dy extends oh{data(){return super.data()}}function Ri(n,e){return typeof e=="string"?sh(n,e):e instanceof mo?e._internalPath:e._delegate._internalPath}/**
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 */function ah(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new D(b.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Io{}class wo extends Io{}function Sv(n,e,...t){let r=[];e instanceof Io&&r.push(e),r=r.concat(t),function(o){const a=o.filter(h=>h instanceof ur).length,u=o.filter(h=>h instanceof cr).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 i of r)n=i._apply(n);return n}class cr extends wo{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new cr(e,t,r)}_apply(e){const t=this._parse(e);return ch(e._query,t),new Ze(e.firestore,e.converter,Es(e._query,t))}_parse(e){const t=th(e.firestore);return function(o,a,u,h,d,p,y){let A;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"){jc(y,p);const S=[];for(const V of y)S.push(Bc(h,o,V));A={arrayValue:{values:S}}}else A=Bc(h,o,y)}else p!=="in"&&p!=="not-in"&&p!=="array-contains-any"||jc(y,p),A=Py(u,a,y,p==="in"||p==="not-in");return ie.create(d,p,A)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function Pv(n,e,t){const r=e,i=Ri("where",n);return cr._create(i,r,t)}class ur extends Io{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ur(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]:Ve.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(i,o){let a=i;const u=o.getFlattenedFilters();for(const h of u)ch(a,h),a=Es(a,h)}(e._query,t),new Ze(e.firestore,e.converter,Es(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Cv(...n){return n.forEach(e=>Ny("or",e)),ur._create("or",n)}class Ao extends wo{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Ao(e,t)}_apply(e){const t=function(i,o,a){if(i.startAt!==null)throw new D(b.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new D(b.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Gn(o,a)}(e._query,this._field,this._direction);return new Ze(e.firestore,e.converter,function(i,o){const a=i.explicitOrderBy.concat([o]);return new cn(i.path,i.collectionGroup,a,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,t))}}function kv(n,e="asc"){const t=e,r=Ri("orderBy",n);return Ao._create(r,t)}class Ro extends wo{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new Ro(e,t,r)}_apply(e){return new Ze(e.firestore,e.converter,Zr(e._query,this._limit,this._limitType))}}function Vv(n){return Ey("limit",n),Ro._create("limit",n,"F")}function Bc(n,e,t){if(typeof(t=se(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(!ul(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(X.fromString(t));if(!M.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 ac(n,new M(r))}if(t instanceof we)return ac(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: ${Ii(t)}.`)}function jc(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 ch(n,e){const t=function(i,o){for(const a of i)for(const u of a.getFlattenedFilters())if(o.indexOf(u.op)>=0)return u.op;return null}(n.filters,function(i){switch(i){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.`)}function Ny(n,e){if(!(e instanceof cr||e instanceof ur))throw new D(b.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class Oy{convertValue(e,t="none"){switch(kt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return ne(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(Ct(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 an(e,(i,o)=>{r[i]=this.convertValue(o,t)}),r}convertVectorValue(e){var t,r,i;const o=(i=(r=(t=e.fields)===null||t===void 0?void 0:t.value.arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.map(a=>ne(a.doubleValue));return new yo(o)}convertGeoPoint(e){return new _o(ne(e.latitude),ne(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Ws(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp($n(e));default:return null}}convertTimestamp(e){const t=_t(e);return new oe(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=X.fromString(e);K(Dl(r));const i=new zn(r.get(1),r.get(3)),o=new M(r.popFirst(5));return i.isEqual(t)||Xe(`Document ${o} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),o}}/**
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 My(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}/**
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 */class Nn{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class uh extends oh{constructor(e,t,r,i,o,a){super(e,t,r,i,a),this._firestore=e,this._firestoreImpl=e,this.metadata=o}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new jr(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(Ri("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class jr extends uh{data(e={}){return super.data(e)}}
3106class lh{constructor(e,t,r,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new Nn(i.hasPendingWrites,i.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 jr(this._firestore,this._userDataWriter,r.key,r,new Nn(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(i,o){if(i._snapshot.oldDocs.isEmpty()){let a=0;return i._snapshot.docChanges.map(u=>{const h=new jr(i._firestore,i._userDataWriter,u.doc.key,u.doc,new Nn(i._snapshot.mutatedKeys.has(u.doc.key),i._snapshot.fromCache),i.query.converter);return u.doc,{type:"added",doc:h,oldIndex:-1,newIndex:a++}})}{let a=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(u=>o||u.type!==3).map(u=>{const h=new jr(i._firestore,i._userDataWriter,u.doc.key,u.doc,new Nn(i._snapshot.mutatedKeys.has(u.doc.key),i._snapshot.fromCache),i.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:Ly(u.type),doc:h,oldIndex:d,newIndex:p}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function Ly(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return x()}}/**
3107 * @license
3108 * Copyright 2020 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 */function Dv(n){n=He(n,we);const e=He(n.firestore,nn);return _y(Ai(e),n._key).then(t=>hh(e,n,t))}class bo extends Oy{constructor(e){super(),this.firestore=e}convertBytes(e){return new rn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new we(this.firestore,null,t)}}function Nv(n){n=He(n,Ze);const e=He(n.firestore,nn),t=Ai(e),r=new bo(e);return ah(n._query),yy(t,n._query).then(i=>new lh(e,r,n,i))}function Ov(n,e){const t=He(n.firestore,nn),r=Iy(n),i=My(n.converter,e);return xy(t,[Sy(th(n.firestore),"addDoc",r._key,i,n.converter!==null,{}).toMutation(r._key,Ge.exists(!1))]).then(()=>r)}function Mv(n,...e){var t,r,i;n=se(n);let o={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||Fc(e[a])||(o=e[a],a++);const u={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(Fc(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]=(i=y.complete)===null||i===void 0?void 0:i.bind(y)}let h,d,p;if(n instanceof we)d=He(n.firestore,nn),p=fi(n._key.path),h={next:y=>{e[a]&&e[a](hh(d,n,y))},error:e[a+1],complete:e[a+2]};else{const y=He(n,Ze);d=He(y.firestore,nn),p=y._query;const A=new bo(d);h={next:S=>{e[a]&&e[a](new lh(d,A,y,S))},error:e[a+1],complete:e[a+2]},ah(n._query)}return function(A,S,V,O){const k=new po(O),q=new ho(S,k,V);return A.asyncQueue.enqueueAndForget(async()=>co(await ii(A),q)),()=>{k.Za(),A.asyncQueue.enqueueAndForget(async()=>uo(await ii(A),q))}}(Ai(d),p,u,h)}function xy(n,e){return function(r,i){const o=new We;return r.asyncQueue.enqueueAndForget(async()=>oy(await gy(r),i,o)),o.promise}(Ai(n),e)}function hh(n,e,t){const r=t.docs.get(e._key),i=new bo(n);return new uh(n,i,e._key,r,new Nn(t.hasPendingWrites,t.fromCache),e.converter)}function Lv(){return new Eo("serverTimestamp")}(function(e,t=!0){(function(i){on=i})(Vt),mt(new ft("firestore",(r,{instanceIdentifier:i,options:o})=>{const a=r.getProvider("app").getImmediate(),u=new nn(new Um(r.getProvider("auth-internal")),new qm(r.getProvider("app-check-internal")),function(d,p){
3121if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new D(b.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new zn(d.options.projectId,p)}(a,i),a);return o=Object.assign({useFetchStreams:t},o),u._setSettings(o),u},"PUBLIC").setMultipleInstances(!0)),Pe(nc,"4.7.3",e),Pe(nc,"4.7.3","esm2017")})();/**
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 */const Uy="type.googleapis.com/google.protobuf.Int64Value",Fy="type.googleapis.com/google.protobuf.UInt64Value";function dh(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function Cs(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>Cs(e));if(typeof n=="function"||typeof n=="object")return dh(n,e=>Cs(e));throw new Error("Data cannot be encoded in JSON: "+n)}function oi(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case Uy:case Fy:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>oi(e)):typeof n=="function"||typeof n=="object"?dh(n,e=>oi(e)):n}/**
3137 * @license
3138 * Copyright 2020 Google LLC
3139 *
3140 * Licensed under the Apache License, Version 2.0 (the "License");
3141 * you may not use this file except in compliance with the License.
3142 * You may obtain a copy of the License at
3143 *
3144 *   http://www.apache.org/licenses/LICENSE-2.0
3145 *
3146 * Unless required by applicable law or agreed to in writing, software
3147 * distributed under the License is distributed on an "AS IS" BASIS,
3148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3149 * See the License for the specific language governing permissions and
3150 * limitations under the License.
3151 */const So="functions";/**
3152 * @license
3153 * Copyright 2017 Google LLC
3154 *
3155 * Licensed under the Apache License, Version 2.0 (the "License");
3156 * you may not use this file except in compliance with the License.
3157 * You may obtain a copy of the License at
3158 *
3159 *   http://www.apache.org/licenses/LICENSE-2.0
3160 *
3161 * Unless required by applicable law or agreed to in writing, software
3162 * distributed under the License is distributed on an "AS IS" BASIS,
3163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3164 * See the License for the specific language governing permissions and
3165 * limitations under the License.
3166 */const qc={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 Ht extends De{constructor(e,t,r){super(`${So}/${e}`,t||""),this.details=r}}function By(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function jy(n,e){let t=By(n),r=t,i;try{const o=e&&e.error;if(o){const a=o.status;
3166if(typeof a=="string"){if(!qc[a])return new Ht("internal","internal");t=qc[a],r=a}const u=o.message;typeof u=="string"&&(r=u),i=o.details,i!==void 0&&(i=oi(i))}}catch{}return t==="ok"?null:new Ht(t,r,i)}/**
3167 * @license
3168 * Copyright 2017 Google LLC
3169 *
3170 * Licensed under the Apache License, Version 2.0 (the "License");
3171 * you may not use this file except in compliance with the License.
3172 * You may obtain a copy of the License at
3173 *
3174 *   http://www.apache.org/licenses/LICENSE-2.0
3175 *
3176 * Unless required by applicable law or agreed to in writing, software
3177 * distributed under the License is distributed on an "AS IS" BASIS,
3178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3179 * See the License for the specific language governing permissions and
3180 * limitations under the License.
3181 */class qy{constructor(e,t,r){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=e.getImmediate({optional:!0}),this.messaging=t.getImmediate({optional:!0}),this.auth||e.get().then(i=>this.auth=i,()=>{}),this.messaging||t.get().then(i=>this.messaging=i,()=>{}),this.appCheck||r.get().then(i=>this.appCheck=i,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),i=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:i}}}/**
3182 * @license
3183 * Copyright 2017 Google LLC
3184 *
3185 * Licensed under the Apache License, Version 2.0 (the "License");
3186 * you may not use this file except in compliance with the License.
3187 * You may obtain a copy of the License at
3188 *
3189 *   http://www.apache.org/licenses/LICENSE-2.0
3190 *
3191 * Unless required by applicable law or agreed to in writing, software
3192 * distributed under the License is distributed on an "AS IS" BASIS,
3193 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3194 * See the License for the specific language governing permissions and
3195 * limitations under the License.
3196 */const ks="us-central1";function $y(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Ht("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class zy{constructor(e,t,r,i,o=ks,a){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new qy(t,r,i),this.cancelAllRequests=new Promise(u=>{this.deleteService=()=>Promise.resolve(u())});try{const u=new URL(o);this.customDomain=u.origin+(u.pathname==="/"?"":u.pathname),this.region=ks}catch{this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function Wy(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function Gy(n,e,t){return r=>Qy(n,e,r,t||{})}function Hy(n,e,t){return r=>fh(n,e,r,t||{})}async function Ky(n,e,t,r){t["Content-Type"]="application/json";let i;try{i=await r(n,{method:"POST",body:JSON.stringify(e),headers:t})}catch{return{status:0,json:null}}let o=null;try{o=await i.json()}catch{}return{status:i.status,json:o}}function Qy(n,e,t,r){const i=n._url(e);return fh(n,i,t,r)}async function fh(n,e,t,r){t=Cs(t);const i={data:t},o={},a=await n.contextProvider.getContext(r.limitedUseAppCheckTokens);a.authToken&&(o.Authorization="Bearer "+a.authToken),a.messagingToken&&(o["Firebase-Instance-ID-Token"]=a.messagingToken),a.appCheckToken!==null&&(o["X-Firebase-AppCheck"]=a.appCheckToken);const u=r.timeout||7e4,h=$y(u),d=await Promise.race([Ky(e,i,o,n.fetchImpl),h.promise,n.cancelAllRequests]);if(h.cancel(),!d)throw new Ht("cancelled","Firebase Functions instance was deleted.");const p=jy(d.status,d.json);if(p)throw p;
3196if(!d.json)throw new Ht("internal","Response is not valid JSON object.");let y=d.json.data;if(typeof y>"u"&&(y=d.json.result),typeof y>"u")throw new Ht("internal","Response is missing data field.");return{data:oi(y)}}const $c="@firebase/functions",zc="0.11.8";/**
3197 * @license
3198 * Copyright 2019 Google LLC
3199 *
3200 * Licensed under the Apache License, Version 2.0 (the "License");
3201 * you may not use this file except in compliance with the License.
3202 * You may obtain a copy of the License at
3203 *
3204 *   http://www.apache.org/licenses/LICENSE-2.0
3205 *
3206 * Unless required by applicable law or agreed to in writing, software
3207 * distributed under the License is distributed on an "AS IS" BASIS,
3208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3209 * See the License for the specific language governing permissions and
3210 * limitations under the License.
3211 */const Jy="auth-internal",Xy="app-check-internal",Yy="messaging-internal";function Zy(n,e){const t=(r,{instanceIdentifier:i})=>{const o=r.getProvider("app").getImmediate(),a=r.getProvider(Jy),u=r.getProvider(Yy),h=r.getProvider(Xy);return new zy(o,a,u,h,i,n)};mt(new ft(So,t,"PUBLIC").setMultipleInstances(!0)),Pe($c,zc,e),Pe($c,zc,"esm2017")}/**
3212 * @license
3213 * Copyright 2020 Google LLC
3214 *
3215 * Licensed under the Apache License, Version 2.0 (the "License");
3216 * you may not use this file except in compliance with the License.
3217 * You may obtain a copy of the License at
3218 *
3219 *   http://www.apache.org/licenses/LICENSE-2.0
3220 *
3221 * Unless required by applicable law or agreed to in writing, software
3222 * distributed under the License is distributed on an "AS IS" BASIS,
3223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3224 * See the License for the specific language governing permissions and
3225 * limitations under the License.
3226 */function xv(n=ci(),e=ks){const r=sn(se(n),So).getImmediate({identifier:e}),i=Yc("functions");return i&&ev(r,...i),r}function ev(n,e,t){Wy(se(n),e,t)}function Uv(n,e,t){return Gy(se(n),e,t)}function Fv(n,e,t){return Hy(se(n),e,t)}Zy(fetch.bind(self));const Wc="v2",tv={"sample-base-test":"sample","users-asset-iteration-add":"addIteration","users-asset-iteration-delete":"deleteIteration","users-asset-iteration-edit":"editIteration","users-asset-iteration-list":"listIterations","users-asset-manage-add":"addAsset","users-asset-manage-delete":"deleteAsset","users-asset-manage-deleteBulk":"deleteAssetBulk","users-asset-manage-edit":"editAsset","users-asset-manage-manuallySelectActiveIteration":"selectActiveIteration","users-asset-url-go":"openBookmark","users-asset-view-lastupdated_team":"lastUpdated","users-asset-view-lastupdated_team_all":"lastUpdatedAll","users-asset-view-recentlyviewed_team":"recentlyViewed","users-asset-view-recentlyviewed_team_all":"recentlyViewedAll","users-asset-view-favorited_team":"favorited","users-asset-view-favorited_team_all":"favoritedAll","users-asset-view-search_team_filter":"searchTeamFilter","users-asset-view-search":"searchTeamFilter","users-collection-manage-add":"addCollection","users-collection-manage-delete":"deleteCollection","users-collection-manage-edit":"editCollection","users-collection-manage-importBatch":"importBatchCollections","users-collection-view-content":"listCollections","users-collection-view-optionsList":"collectionOptions","users-tag-manage-add":"addTag","users-tag-manage-delete":"deleteTag","users-tag-manage-edit":"editTag","users-tag-view-optionsList":"tagOptions","users-map-manage-add":"addMap","users-map-manage-edit":"editMap","users-map-manage-delete":"deleteMap","users-map-manage-clone":"cloneMap","users-map-view-list":"listMaps","users-map-view-content":"loadMap","users-map-node-add":"addMapNode","users-map-node-edit":"editMapNode","users-map-node-delete":"deleteMapNode","users-map-node-bulkUpdate":"bulkUpdateMapNodes","users-map-masthead-upload":"uploadMapMasthead","users-map-masthead-delete":"deleteMapMasthead","users-board-manage-add":"addBoard","users-board-manage-edit":"editBoard","users-board-manage-delete":"deleteBoard","users-board-manage-clone":"cloneBoard","users-board-view-list":"listBoards","users-board-view-content":"loadBoard","users-board-card-add":"addBoardCard","users-board-card-edit":"editBoardCard","users-board-card-delete":"deleteBoardCard","users-board-card-bulkUpdate":"bulkUpdateBoardCards","users-board-card-clone":"cloneBoardCard","users-board-card-reorderBookmarks":"reorderBoardCardBookmarks","users-board-card-toggleBookmarkCheck":"toggleBoardCardBookmarkCheck","users-board-masthead-upload":"uploadBoardMasthead","users-board-masthead-delete":"deleteBoardMasthead","users-share-view-byToken":"loadShareByToken","users-info-teams-list":"listTeams","users-initialization-setup-run":"initializeUser","users-initialization-otp-send":"sendSignupOTP","users-initialization-otp-verify":"verifySignupOTP","users-login-otp-send":"sendLoginOTP","users-login-otp-verify":"verifyLoginOTP","users-auth-otp-send":"sendAuthOTP","users-auth-otp-verify":"verifyAuthOTP","users-auth-handoff-create":"createAuthHandoff","users-auth-handoff-redeem":"redeemAuthHandoff","users-self-manage-edit":"editProfile","users-organization-create-start":"addOrganization","users-organization-create-ensureOwned":"ensureOwnedOrganization","users-organization-manage-standard":"editOrganization","users-organization-view-manage":"organizationSettings","users-organization-subscription-stripeGetAssociatedOrganizationData":"getOrganizationSubscription","users-organization-subscription-retrieveInvoiceList":"retrieveInvoiceList","users-organization-subscription-stripeCheckoutSession":"stripeCheckoutSession","users-organization-subscription-setProcessingFlag":"stripeSetProcessingFlag","users-organization-subscription-stripeChangePlan":"stripeSubscriptionChangePlan","users-organization-subscription-stripeCancel":"stripeSubscriptionCancel","users-organization-subscription-stripeBillingPortalSession":"stripeBillingPortalSession","users-organization-subscription-getPlanPricing":"getPlanPricing","users-organization-subscription-exchangeCheckoutSessionForToken":"exchangeCheckoutSessionForToken","users-team-create-start":"addTeam","users-team-create-startPersonal":"ensurePersonalTeam","users-team-create-seedStarter":"seedStarterContent","users-team-invitations-accept":"acceptInvitation","users-team-invitations-create":"createInvitation","users-team-invitations-updateDefaultOpenInvitation":"updateDefaultOpenInvitation","users-team-invitation-code-generate":"generateShortCode","users-team-invitation-code-accept":"acceptShortCode","users-team-invitation-code-fetch":"fetchShortCode","users-team-manage-changeMemberRole":"changeMemberRole","users-team-manage-standard":"editTeam","users-team-view-manage":"teamSettings","users-team-share-policy-set":"setTeamSharePolicy","users-team-share-policy-listPublic":"listTeamPublicSharedDocs","validate-userContext":"userContext","markfavorite-toggle":"toggleFavorite","internal-platform-checkAccess":"adminCheckAccess","internal-platform-listUsers":"adminListUsers","internal-platform-listDisabledAuthUsers":"adminListDisabledAuthUsers","internal-platform-listSubscribedAuthUsers":"adminListSubscribedAuthUsers","internal-platform-listFeatureOverrideUsers":"adminListFeatureOverrideUsers","internal-platform-listInternalPlatformRoleRoster":"adminListInternalPlatformRoleRoster","internal-platform-getUser":"adminGetUser","internal-platform-getAdminUserProfile":"adminGetAdminUserProfile","internal-platform-listUserCreatedItems":"adminListUserCreatedItems","internal-platform-setInternalUserRole":"adminSetInternalUserRole","internal-platform-disableUser":"adminDisableUser","internal-platform-getUserFeatureOverrides":"adminGetUserFeatureOverrides","internal-platform-setUserFeatureOverride":"adminSetUserFeatureOverride","internal-platform-listAuditLogs":"adminListAuditLogs","internal-platform-getSiteRegistry":"adminGetSiteRegistry","internal-platform-listMailboxMessages":"adminListMailboxMessages","internal-platform-getMailboxMessage":"adminGetMailboxMessage","internal-platform-getMailboxThread":"adminGetMailboxThread","internal-platform-updateMailboxMessage":"adminUpdateMailboxMessage","internal-platform-sendMailboxReply":"adminSendM
3226ailboxReply","internal-platform-sendMailboxForward":"adminSendMailboxForward","users-support-sendMessage":"sendSupportMessage","admin-tools-backfill-site-classification":"backfillSiteClassification","admin-tools-site-registry-ai":"runSiteRegistryAI","admin-tools-backfill-team-id":"backfillTeamId","admin-tools-migration-map-members":"migrateMapMembers","admin-tools-backfill-workspace-privacy":"backfillWorkspacePrivacy","admin-tools-backfill-email-verified":"backfillEmailVerified","users-team-set-privacy-set":"setWorkspacePrivacy","users-team-remove-member-remove":"removeTeamMember","users-team-transfer-ownership-transfer":"transferWorkspaceOwnership","users-team-unban-member-unban":"unbanMember"},nv=n=>{const e=tv[n];return e===void 0?(console.error("[firebase-functions-triggers] Unknown trigger id:",n,"(check list + Cloud Function export name). Callable URL would be invalid."),`${Wc}-undefined`):`${Wc}-${e}`},Bv=Object.freeze(Object.defineProperty({__proto__:null,$FF_trigger:nv},Symbol.toStringTag,{value:"Module"})),Gc={"bookmark.it.com":{name:"Bookmark It",domain:"bookmark.it.com",url:"https://bookmark.it.com",supportEmail:"[email protected]",messagesEmail:"[email protected]",legalEntityName:"Pixels & Form Inc. (doing business as Bookmark It)",copyright:"© {year} Bookmark It",extensionName:"Bookmark It",extensionDescription:"Bookmark It — collaborative bookmark manager",chromeStoreUrl:"https://chromewebstore.google.com/detail/team-bookmarks/nnkccijjkjplbeidbpchalgdahjajeim",pwaInstallText:"Install Bookmark It for quick access from your home screen.",desktopWindowTitle:"Bookmark It",desktopOpenLabel:"Open full Bookmark It window",logoAlt:"Bookmark It",contentScriptRootId:"bookmark-it-root",pageTitle:"Bookmark It",devPortalTitle:"Bookmark It Dev Portal",otpEmailSubject:"Verify your email - Bookmark It",otpEmailHeading:"Welcome to Bookmark It",bridgeSourceExtension:"bookmark-import-ext",bridgeSourceApp:"bookmark-import-app",headerCustomerUid:"X-BookmarkIt-Customer-Uid",headerInternal:"X-BookmarkIt-Internal",dexieDatabaseName:"bookmarkit-asset-loader",corsPatterns:[/bookmark\.it\.com$/,/bookmark-it-com\.web\.app$/,/dev-bookmark-it-com\.web\.app$/,/localhost/,/127\.0\.0\.1/],allowedOrigins:["https://bookmark.it.com","https://dev.bookmark.it.com","https://qa.bookmark.it.com","https://work.bookmark.it.com","https://beta.bookmark.it.com","http://localhost:5002","http://localhost:5173","http://127.0.0.1:5002","http://127.0.0.1:5173"],testUserSignupEmailPrefix:"bookmark.it.com.app"},"iteratingly.com":{name:"Iteratingly",domain:"iteratingly.com",url:"https://iteratingly.com",supportEmail:"[email protected]",messagesEmail:"[email protected]",legalEntityName:"Pixels & Form Inc. (doing business as Iteratingly)",copyright:"© {year} Iteratingly",extensionName:"Team Bookmarks",extensionDescription:"Team Bookmark extension",chromeStoreUrl:"https://chromewebstore.google.com/detail/team-bookmarks/nnkccijjkjplbeidbpchalgdahjajeim",pwaInstallText:"Install Iteratingly for quick access from your home screen.",desktopWindowTitle:"Iteratingly",desktopOpenLabel:"Open full Iteratingly window",logoAlt:"Iteratingly",contentScriptRootId:"Iteratingly Team Bookmarks",pageTitle:"Iteratingly",devPortalTitle:"Iteratingly Dev Portal",otpEmailSubject:"Verify your email - Iteratingly",otpEmailHeading:"Welcome to Iteratingly",bridgeSourceExtension:"bookmark-import-ext",bridgeSourceApp:"bookmark-import-app",headerCustomerUid:"X-Iteratingly-Customer-Uid",headerInternal:"X-Iteratingly-Internal",dexieDatabaseName:"iteratingly-asset-loader",corsPatterns:[/iteratingly\.com$/,/iteratingly\.web\.app$/,/iteratingly-dev\.web\.app$/,/localhost/,/127\.0\.0\.1/],allowedOrigins:["https://iteratingly.com","https://dev.iteratingly.com","https://qa.iteratingly.com","https://beta.iteratingly.com","http://localhost:5002","http://localhost:5173","http://127.0.0.1:5002","http://127.0.0.1:5173"],testUserSignupEmailPrefix:"iteratingly"}},rv="bookmark.it.com",jv=Gc[rv]||Gc["iteratingly.com"];export{nv as $,Ca as A,uv as B,ft as C,pv as D,Qc as E,lv as F,hv as G,Qh as H,fv as I,B as J,sv as K,Ds as L,id as M,cv as N,av as O,vd as P,od as Q,hd as R,dv as S,Xn as T,mv as U,iv as V,Vt as W,Yh as X,xa as Y,De as Z,sn as _,Fv as a,Dv as a0,Iy as a1,Ev as a2,Lv as a3,Ov as a4,_v as a5,yv as a6,Cv as a7,gv as a8,Bv as a9,dp as b,ev as c,bv as d,ci as e,Fp as f,xv as g,Uv as h,uu as i,jv as j,Tv as k,Nv as l,Rv as m,Mv as n,vv as o,Vv as p,Sv as q,kv as r,Kh as s,Yc as t,se as u,sd as v,Pv as w,mt as x,Pe as y,ov 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.