PageSourceSearch

https://dmystapp.com/assets/firebase-BsxLp04Z.js

js dmystapp.com collected 2026-10-09 01:18:07 UTC 555,885 bytes, 4,253 lines download raw bytes

1var Oc={};/**
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 ml=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},sp=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 s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=n[t++],a=n[t++],c=n[t++],l=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const s=n[t++],a=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},_l={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 s=n[i],a=i+1<n.length,c=a?n[i+1]:0,l=i+2<n.length,d=l?n[i+2]:0,f=s>>2,y=(s&3)<<4|c>>4;let w=(c&15)<<2|d>>6,b=d&63;l||(b=64,a||(w=64)),r.push(t[f],t[y],t[w],t[b])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(ml(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):sp(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 s=t[n.charAt(i++)],c=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,s==null||c==null||d==null||y==null)throw new op;const w=s<<2|c>>4;if(r.push(w),d!==64){const b=c<<4&240|d>>2;if(r.push(b),y!==64){const k=d<<6&192|y;r.push(k)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class op extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ap=function(n){const e=ml(n);return _l.encodeByteArray(e,!0)},hi=function(n){return ap(n).replace(/\./g,"")},yl=function(n){try{return _l.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
17 * @license
18 * Copyright 2022 Google LLC
19 *
20 * Licensed under the Apache License, Version 2.0 (the "License");
21 * you may not use this file except in compliance with the License.
22 * You may obtain a copy of the License at
23 *
24 *   http://www.apache.org/licenses/LICENSE-2.0
25 *
26 * Unless required by applicable law or agreed to in writing, software
27 * distributed under the License is distributed on an "AS IS" BASIS,
28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 * See the License for the specific language governing permissions and
30 * limitations under the License.
31 */function cp(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
32 * @license
33 * Copyright 2022 Google LLC
34 *
35 * Licensed under the Apache License, Version 2.0 (the "License");
36 * you may not use this file except in compliance with the License.
37 * You may obtain a copy of the License at
38 *
39 *   http://www.apache.org/licenses/LICENSE-2.0
40 *
41 * Unless required by applicable law or agreed to in writing, software
42 * distributed under the License is distributed on an "AS IS" BASIS,
43 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44 * See the License for the specific language governing permissions and
45 * limitations under the License.
46 */const up=()=>cp().__FIREBASE_DEFAULTS__,lp=()=>{if(typeof process>"u"||typeof Oc>"u")return;const n=Oc.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},hp=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&yl(n[1]);return e&&JSON.parse(e)},ki=()=>{try{return up()||lp()||hp()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},vl=n=>{var e,t;return(t=(e=ki())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},vo=n=>{const e=vl(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]},Tl=()=>{var n;return(n=ki())===null||n===void 0?void 0:n.config},wl=n=>{var e;return(e=ki())===null||e===void 0?void 0:e[`_${n}`]};/**
47 * @license
48 * Copyright 2017 Google LLC
49 *
50 * Licensed under the Apache License, Version 2.0 (the "License");
51 * you may not use this file except in compliance with the License.
52 * You may obtain a copy of the License at
53 *
54 *   http://www.apache.org/licenses/LICENSE-2.0
55 *
56 * Unless required by applicable law or agreed to in writing, software
57 * distributed under the License is distributed on an "AS IS" BASIS,
58 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59 * See the License for the specific language governing permissions and
60 * limitations under the License.
61 */class dp{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
62 * @license
63 * Copyright 2021 Google LLC
64 *
65 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
67 * You may obtain a copy of the License at
68 *
69 *   http://www.apache.org/licenses/LICENSE-2.0
70 *
71 * Unless required by applicable law or agreed to in writing, software
72 * distributed under the License is distributed on an "AS IS" BASIS,
73 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74 * See the License for the specific language governing permissions and
75 * limitations under the License.
76 */function Il(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,s=n.sub||n.user_id;if(!s)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:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},n);return[hi(JSON.stringify(t)),hi(JSON.stringify(a)),""].join(".")}/**
77 * @license
78 * Copyright 2017 Google LLC
79 *
80 * Licensed under the Apache License, Version 2.0 (the "License");
81 * you may not use this file except in compliance with the License.
82 * You may obtain a copy of the License at
83 *
84 *   http://www.apache.org/licenses/LICENSE-2.0
85 *
86 * Unless required by applicable law or agreed to in writing, software
87 * distributed under the License is distributed on an "AS IS" BASIS,
88 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89 * See the License for the specific language governing permissions and
90 * limitations under the License.
91 */function be(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function fp(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(be())}function pp(){var n;const e=(n=ki())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;
91if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function El(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function gp(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function mp(){const n=be();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function _p(){return!pp()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function To(){try{return typeof indexedDB=="object"}catch{return!1}}function wo(){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 s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}function Al(){return!(typeof navigator>"u"||!navigator.cookieEnabled)}/**
92 * @license
93 * Copyright 2017 Google LLC
94 *
95 * Licensed under the Apache License, Version 2.0 (the "License");
96 * you may not use this file except in compliance with the License.
97 * You may obtain a copy of the License at
98 *
99 *   http://www.apache.org/licenses/LICENSE-2.0
100 *
101 * Unless required by applicable law or agreed to in writing, software
102 * distributed under the License is distributed on an "AS IS" BASIS,
103 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104 * See the License for the specific language governing permissions and
105 * limitations under the License.
106 */const yp="FirebaseError";class Be extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=yp,Object.setPrototypeOf(this,Be.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ot.prototype.create)}}class Ot{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?vp(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new Be(i,c,r)}}function vp(n,e){return n.replace(Tp,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const Tp=/\{\$([^}]+)}/g;function wp(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function sr(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 s=n[i],a=e[i];if(Vc(s)&&Vc(a)){if(!sr(s,a))return!1}else if(s!==a)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function Vc(n){return n!==null&&typeof n=="object"}/**
107 * @license
108 * Copyright 2017 Google LLC
109 *
110 * Licensed under the Apache License, Version 2.0 (the "License");
111 * you may not use this file except in compliance with the License.
112 * You may obtain a copy of the License at
113 *
114 *   http://www.apache.org/licenses/LICENSE-2.0
115 *
116 * Unless required by applicable law or agreed to in writing, software
117 * distributed under the License is distributed on an "AS IS" BASIS,
118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119 * See the License for the specific language governing permissions and
120 * limitations under the License.
121 */function _r(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Ip(n,e){const t=new Ep(n,e);return t.subscribe.bind(t)}class Ep{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.");Ap(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=Rs),i.error===void 0&&(i.error=Rs),i.complete===void 0&&(i.complete=Rs);const s=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),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>
121{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Ap(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Rs(){}/**
122 * @license
123 * Copyright 2022 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 */const mA=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})};/**
137 * @license
138 * Copyright 2019 Google LLC
139 *
140 * Licensed under the Apache License, Version 2.0 (the "License");
141 * you may not use this file except in compliance with the License.
142 * You may obtain a copy of the License at
143 *
144 *   http://www.apache.org/licenses/LICENSE-2.0
145 *
146 * Unless required by applicable law or agreed to in writing, software
147 * distributed under the License is distributed on an "AS IS" BASIS,
148 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149 * See the License for the specific language governing permissions and
150 * limitations under the License.
151 */const Rp=1e3,bp=2,Sp=4*60*60*1e3,Pp=.5;function Mc(n,e=Rp,t=bp){const r=e*Math.pow(t,n),i=Math.round(Pp*r*(Math.random()-.5)*2);return Math.min(Sp,r+i)}/**
152 * @license
153 * Copyright 2021 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 W(n){return n&&n._delegate?n._delegate:n}class De{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}}/**
167 * @license
168 * Copyright 2019 Google LLC
169 *
170 * Licensed under the Apache License, Version 2.0 (the "License");
171 * you may not use this file except in compliance with the License.
172 * You may obtain a copy of the License at
173 *
174 *   http://www.apache.org/licenses/LICENSE-2.0
175 *
176 * Unless required by applicable law or agreed to in writing, software
177 * distributed under the License is distributed on an "AS IS" BASIS,
178 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179 * See the License for the specific language governing permissions and
180 * limitations under the License.
181 */const Ft="[DEFAULT]";/**
182 * @license
183 * Copyright 2019 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 */class Cp{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 dp;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(s){if(i)return null;throw s}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(Np(e))try{this.getOrInitializeService({instanceIdentifier:Ft})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Ft){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=Ft){return this.instances.has(e)}getOptions(e=Ft){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[s,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(s);r===c&&a.resolve(i)}return i}onInit(e,t){var r;const i=this.normalizeInstanceIdentifier(t),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const a=this.instances.get(i);return a&&e(a,i),()=>{s.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:kp(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=Ft){return this.component?this.component.multipleInstances?e:Ft:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function kp(n){return n===Ft?void 0:n}function Np(n){return n.instantiationMode==="EAGER"}/**
197 * @license
198 * Copyright 2019 Google LLC
199 *
200 * Licensed under the Apache License, Version 2.0 (the "License");
201 * you may not use this file except in compliance with the License.
202 * You may obtain a copy of the License at
203 *
204 *   http://www.apache.org/licenses/LICENSE-2.0
205 *
206 * Unless required by applicable law or agreed to in writing, software
207 * distributed under the License is distributed on an "AS IS" BASIS,
208 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209 * See the License for the specific language governing permissions and
210 * limitations under the License.
211 */class Dp{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 Cp(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
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 */var H;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(H||(H={}));const Op={debug:H.DEBUG,verbose:H.VERBOSE,info:H.INFO,warn:H.WARN,error:H.ERROR,silent:H.SILENT},Vp=H.INFO,Mp={[H.DEBUG]:"log",[H.VERBOSE]:"log",[H.INFO]:"info",[H.WARN]:"warn",[H.ERROR]:"error"},Lp=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=Mp[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 Ni{constructor(e){this.name=e,this._logLevel=Vp,this._logHandler=Lp,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in H))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Op[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,H.DEBUG,...e),this._logHandler(this,H.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,H.VERBOSE,...e),this._logHandler(this,H.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,H.INFO,...e),this._logHandler(this,H.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,H.WARN,...e),this._logHandler(this,H.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,H.ERROR,...e),this._logHandler(this,H.ERROR,...e)}}const xp=(n,e)=>e.some(t=>n instanceof t);let Lc,xc;function Up(){return Lc||(Lc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Fp(){return xc||(xc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Rl=new WeakMap,Ks=new WeakMap,bl=new WeakMap,bs=new WeakMap,Io=new WeakMap;function Bp(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",a)},s=()=>{t(at(n.result)),i()},a=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&Rl.set(t,n)}).catch(()=>{}),Io.set(e,n),e}function jp(n){if(Ks.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",a),n.removeEventListener("abort",a)},s=()=>{t(),i()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",a),n.addEventListener("abort",a)});Ks.set(n,e)}let Ws={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Ks.get(n);if(e==="objectStoreNames")return n.objectStoreNames||bl.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return at(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 $p(n){Ws=n(Ws)}
226function qp(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Ss(this),e,...t);return bl.set(r,e.sort?e.sort():[e]),at(r)}:Fp().includes(n)?function(...e){return n.apply(Ss(this),e),at(Rl.get(this))}:function(...e){return at(n.apply(Ss(this),e))}}function zp(n){return typeof n=="function"?qp(n):(n instanceof IDBTransaction&&jp(n),xp(n,Up())?new Proxy(n,Ws):n)}function at(n){if(n instanceof IDBRequest)return Bp(n);if(bs.has(n))return bs.get(n);const e=zp(n);return e!==n&&(bs.set(n,e),Io.set(e,n)),e}const Ss=n=>Io.get(n);function Di(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){const a=indexedDB.open(n,e),c=at(a);return r&&a.addEventListener("upgradeneeded",l=>{r(at(a.result),l.oldVersion,l.newVersion,at(a.transaction),l)}),t&&a.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",d=>i(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}function Ps(n,{blocked:e}={}){const t=indexedDB.deleteDatabase(n);return e&&t.addEventListener("blocked",r=>e(r.oldVersion,r)),at(t).then(()=>{})}const Hp=["get","getKey","getAll","getAllKeys","count"],Kp=["put","add","delete","clear"],Cs=new Map;function Uc(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Cs.get(e))return Cs.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=Kp.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Hp.includes(t)))return;const s=async function(a,...c){const l=this.transaction(a,i?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[t](...c),i&&l.done]))[0]};return Cs.set(e,s),s}$p(n=>({...n,get:(e,t,r)=>Uc(e,t)||n.get(e,t,r),has:(e,t)=>!!Uc(e,t)||n.has(e,t)}));/**
227 * @license
228 * Copyright 2019 Google LLC
229 *
230 * Licensed under the Apache License, Version 2.0 (the "License");
231 * you may not use this file except in compliance with the License.
232 * You may obtain a copy of the License at
233 *
234 *   http://www.apache.org/licenses/LICENSE-2.0
235 *
236 * Unless required by applicable law or agreed to in writing, software
237 * distributed under the License is distributed on an "AS IS" BASIS,
238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239 * See the License for the specific language governing permissions and
240 * limitations under the License.
241 */class Wp{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Gp(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Gp(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Gs="@firebase/app",Fc="0.10.10";/**
242 * @license
243 * Copyright 2019 Google LLC
244 *
245 * Licensed under the Apache License, Version 2.0 (the "License");
246 * you may not use this file except in compliance with the License.
247 * You may obtain a copy of the License at
248 *
249 *   http://www.apache.org/licenses/LICENSE-2.0
250 *
251 * Unless required by applicable law or agreed to in writing, software
252 * distributed under the License is distributed on an "AS IS" BASIS,
253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254 * See the License for the specific language governing permissions and
255 * limitations under the License.
256 */const ut=new Ni("@firebase/app"),Qp="@firebase/app-compat",Jp="@firebase/analytics-compat",Xp="@firebase/analytics",Yp="@firebase/app-check-compat",Zp="@firebase/app-check",eg="@firebase/auth",tg="@firebase/auth-compat",ng="@firebase/database",rg="@firebase/database-compat",ig="@firebase/functions",sg="@firebase/functions-compat",og="@firebase/installations",ag="@firebase/installations-compat",cg="@firebase/messaging",ug="@firebase/messaging-compat",lg="@firebase/performance",hg="@firebase/performance-compat",dg="@firebase/remote-config",fg="@firebase/remote-config-compat",pg="@firebase/storage",gg="@firebase/storage-compat",mg="@firebase/firestore",_g="@firebase/vertexai-preview",yg="@firebase/firestore-compat",vg="firebase",Tg="10.13.1";/**
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 Qs="[DEFAULT]",wg={[Gs]:"fire-core",[Qp]:"fire-core-compat",[Xp]:"fire-analytics",[Jp]:"fire-analytics-compat",[Zp]:"fire-app-check",[Yp]:"fire-app-check-compat",[eg]:"fire-auth",[tg]:"fire-auth-compat",[ng]:"fire-rtdb",[rg]:"fire-rtdb-compat",[ig]:"fire-fn",[sg]:"fire-fn-compat",[og]:"fire-iid",[ag]:"fire-iid-compat",[cg]:"fire-fcm",[ug]:"fire-fcm-compat",[lg]:"fire-perf",[hg]:"fire-perf-compat",[dg]:"fire-rc",[fg]:"fire-rc-compat",[pg]:"fire-gcs",[gg]:"fire-gcs-compat",[mg]:"fire-fst",[yg]:"fire-fst-compat",[_g]:"fire-vertex","fire-js":"fire-js",[vg]:"fire-js-all"};/**
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 */const di=new Map,Ig=new Map,Js=new Map;function Bc(n,e){try{n.container.addComponent(e)}catch(t){ut.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Me(n){const e=n.name;if(Js.has(e))return ut.debug(`There were multiple attempts to register component ${e}.`),!1;Js.set(e,n);for(const t of di.values())Bc(t,n);for(const t of Ig.values())Bc(t,n);return!0}function Ze(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function $e(n){return n.settings!==void 0}/**
287 * @license
288 * Copyright 2019 Google LLC
289 *
290 * Licensed under the Apache License, Version 2.0 (the "License");
291 * you may not use this file except in compliance with the License.
292 * You may obtain a copy of the License at
293 *
294 *   http://www.apache.org/licenses/LICENSE-2.0
295 *
296 * Unless required by applicable law or agreed to in writing, software
297 * distributed under the License is distributed on an "AS IS" BASIS,
298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299 * See the License for the specific language governing permissions and
300 * limitations under the License.
301 */const Eg={"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
301d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Pt=new Ot("app","Firebase",Eg);/**
302 * @license
303 * Copyright 2019 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 */class Ag{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 De("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Pt.create("app-deleted",{appName:this._name})}}/**
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 */const Xt=Tg;function Rg(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Qs,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw Pt.create("bad-app-name",{appName:String(i)});if(t||(t=Tl()),!t)throw Pt.create("no-options");const s=di.get(i);if(s){if(sr(t,s.options)&&sr(r,s.config))return s;throw Pt.create("duplicate-app",{appName:i})}const a=new Dp(i);for(const l of Js.values())a.addComponent(l);const c=new Ag(t,r,a);return di.set(i,c),c}function Tn(n=Qs){const e=di.get(n);if(!e&&n===Qs&&Tl())return Rg();if(!e)throw Pt.create("no-app",{appName:n});return e}function le(n,e,t){var r;let i=(r=wg[n])!==null&&r!==void 0?r:n;t&&(i+=`-${t}`);const s=i.match(/\s|\//),a=e.match(/\s|\//);if(s||a){const c=[`Unable to register library "${i}" with version "${e}":`];s&&c.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&a&&c.push("and"),a&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ut.warn(c.join(" "));return}Me(new De(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}/**
332 * @license
333 * Copyright 2021 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, softw
341are
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 bg="firebase-heartbeat-database",Sg=1,or="firebase-heartbeat-store";let ks=null;function Sl(){return ks||(ks=Di(bg,Sg,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(or)}catch(t){console.warn(t)}}}}).catch(n=>{throw Pt.create("idb-open",{originalErrorMessage:n.message})})),ks}async function Pg(n){try{const t=(await Sl()).transaction(or),r=await t.objectStore(or).get(Pl(n));return await t.done,r}catch(e){if(e instanceof Be)ut.warn(e.message);else{const t=Pt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});ut.warn(t.message)}}}async function jc(n,e){try{const r=(await Sl()).transaction(or,"readwrite");await r.objectStore(or).put(e,Pl(n)),await r.done}catch(t){if(t instanceof Be)ut.warn(t.message);else{const r=Pt.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});ut.warn(r.message)}}}function Pl(n){return`${n.name}!${n.options.appId}`}/**
347 * @license
348 * Copyright 2021 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 Cg=1024,kg=30*24*60*60*1e3;class Ng{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Og(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(),s=$c();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===s||this._heartbeatsCache.heartbeats.some(a=>a.date===s)?void 0:(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const c=new Date(a.date).valueOf();return Date.now()-c<=kg}),this._storage.overwrite(this._heartbeatsCache))}catch(r){ut.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=$c(),{heartbeatsToSend:r,unsentEntries:i}=Dg(this._heartbeatsCache.heartbeats),s=hi(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)),s}catch(t){return ut.warn(t),""}}}function $c(){return new Date().toISOString().substring(0,10)}function Dg(n,e=Cg){const t=[];let r=n.slice();for(const i of n){const s=t.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),qc(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),qc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Og{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return To()?wo().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await Pg(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 jc(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 jc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function qc(n){return hi(JSON.stringify({version:2,heartbeats:n})).length}/**
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 */function Vg(n){Me(new De("platform-logger",e=>new Wp(e),"PRIVATE")),Me(new De("heartbeat",e=>new Ng(e),"PRIVATE")),le(Gs,Fc,n),le(Gs,Fc,"esm2017"),le("fire-js","")}Vg("");var Mg="firebase",Lg="10.13.1";/**
377 * @license
378 * Copyright 2020 Google LLC
379 *
380 * Licensed under the Apache License, Version 2.0 (the "License");
381 * you may not use this file except in compliance with the License.
382 * You may obtain a copy of the License at
383 *
384 *   http://www.apache.org/licenses/LICENSE-2.0
385 *
386 * Unless required by applicable law or agreed to in writing, software
387 * distributed under the License is distributed on an "AS IS" BASIS,
388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
389 * See the License for the specific language governing permissions and
390 * limitations under the License.
391 */le(Mg,Lg,"app");/**
392 * @license
393 * Copyright 2017 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 */const xg="type.googleapis.com/google.protobuf.Int64Value",Ug="type.googleapis.com/google.protobuf.UInt64Value";function Cl(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function Xs(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=>Xs(e));if(typeof n=="function"||typeof n=="object")return Cl(n,e=>Xs(e));throw new Error("Data cannot be encoded in JSON: "+n)}function fi(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case xg:case Ug:{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=>fi(e)):typeof n=="function"||typeof n=="object"?Cl(n,e=>fi(e)):n}/**
407 * @license
408 * Copyright 2020 Google LLC
409 *
410 * Licensed under the Apache License, Version 2.0 (the "License");
411 * you may not use this file except in compliance with the License.
412 * You may obtain a copy of the License at
413 *
414 *   http://www.apache.org/licenses/LICENSE-2.0
415 *
416 * Unless required by applicable law or agreed to in writing, software
417 * distributed under the License is distributed on an "AS IS" BASIS,
418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
419 * See the License for the specific language governing permissions and
420 * limitations under the License.
421 */const Eo="functions";/**
422 * @license
423 * Copyright 2017 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 zc={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",UNIMPLEMENT
436ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class an extends Be{constructor(e,t,r){super(`${Eo}/${e}`,t||""),this.details=r}}function Fg(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 Bg(n,e){let t=Fg(n),r=t,i;try{const s=e&&e.error;if(s){const a=s.status;if(typeof a=="string"){if(!zc[a])return new an("internal","internal");t=zc[a],r=a}const c=s.message;typeof c=="string"&&(r=c),i=s.details,i!==void 0&&(i=fi(i))}}catch{}return t==="ok"?null:new an(t,r,i)}/**
437 * @license
438 * Copyright 2017 Google LLC
439 *
440 * Licensed under the Apache License, Version 2.0 (the "License");
441 * you may not use this file except in compliance with the License.
442 * You may obtain a copy of the License at
443 *
444 *   http://www.apache.org/licenses/LICENSE-2.0
445 *
446 * Unless required by applicable law or agreed to in writing, software
447 * distributed under the License is distributed on an "AS IS" BASIS,
448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
449 * See the License for the specific language governing permissions and
450 * limitations under the License.
451 */class jg{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}}}/**
452 * @license
453 * Copyright 2017 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 Ys="us-central1";function $g(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new an("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class qg{constructor(e,t,r,i,s=Ys,a){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new jg(t,r,i),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(s);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=Ys}catch{this.customDomain=null,this.region=s}}_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 zg(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function Hg(n,e,t){return r=>Wg(n,e,r,{})}async function Kg(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 s=null;try{s=await i.json()}catch{}return{status:i.status,json:s}}function Wg(n,e,t,r){const i=n._url(e);return Gg(n,i,t,r)}async function Gg(n,e,t,r){t=Xs(t);const i={data:t},s={},a=await n.contextProvider.getContext(r.limitedUseAppCheckTokens);a.authToken&&(s.Authorization="Bearer "+a.authToken),a.messagingToken&&
466(s["Firebase-Instance-ID-Token"]=a.messagingToken),a.appCheckToken!==null&&(s["X-Firebase-AppCheck"]=a.appCheckToken);const c=r.timeout||7e4,l=$g(c),d=await Promise.race([Kg(e,i,s,n.fetchImpl),l.promise,n.cancelAllRequests]);if(l.cancel(),!d)throw new an("cancelled","Firebase Functions instance was deleted.");const f=Bg(d.status,d.json);if(f)throw f;if(!d.json)throw new an("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 an("internal","Response is missing data field.");return{data:fi(y)}}const Hc="@firebase/functions",Kc="0.11.7";/**
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 */const Qg="auth-internal",Jg="app-check-internal",Xg="messaging-internal";function Yg(n,e){const t=(r,{instanceIdentifier:i})=>{const s=r.getProvider("app").getImmediate(),a=r.getProvider(Qg),c=r.getProvider(Xg),l=r.getProvider(Jg);return new qg(s,a,c,l,i,n)};Me(new De(Eo,t,"PUBLIC").setMultipleInstances(!0)),le(Hc,Kc,e),le(Hc,Kc,"esm2017")}/**
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 */function _A(n=Tn(),e=Ys){const r=Ze(W(n),Eo).getImmediate({identifier:e}),i=vo("functions");return i&&Zg(r,...i),r}function Zg(n,e,t){zg(W(n),e,t)}function yA(n,e,t){return Hg(W(n),e)}Yg(fetch.bind(self));function Ao(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 kl(){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 em=kl,Nl=new Ot("auth","Firebase",kl());/**
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 pi=new Ni("@firebase/auth");function tm(n,...e){pi.logLevel<=H.WARN&&pi.warn(`Auth (${Xt}): ${n}`,...e)}function ti(n,...e){pi.logLevel<=H.ERROR&&pi.error(`Auth (${Xt}): ${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, softw
521are
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 Je(n,...e){throw bo(n,...e)}function qe(n,...e){return bo(n,...e)}function Ro(n,e,t){const r=Object.assign(Object.assign({},em()),{[e]:t});return new Ot("auth","Firebase",r).create(e,{appName:n.name})}function ct(n){return Ro(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function nm(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&Je(n,"argument-error"),Ro(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function bo(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 Nl.create(n,...e)}function L(n,e,...t){if(!n)throw bo(e,...t)}function it(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ti(e),new Error(e)}function lt(n,e){n||it(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 Zs(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function rm(){return Wc()==="http:"||Wc()==="https:"}function Wc(){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 im(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(rm()||El()||"connection"in navigator)?navigator.onLine:!0}
556function sm(){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 yr{constructor(e,t){this.shortDelay=e,this.longDelay=t,lt(t>e,"Short delay should be less than long delay!"),this.isMobile=fp()||gp()}get(){return im()?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 So(n,e){lt(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 Dl{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;it("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;it("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;it("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 om={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVA
616LID_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 am=new yr(3e4,6e4);function vr(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function wn(n,e,t,r,i={}){return Ol(n,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});const c=_r(Object.assign({key:n.config.apiKey},a)).slice(1),l=await n._getAdditionalHeaders();return l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode),Dl.fetch()(Vl(n,n.config.apiHost,t,c),Object.assign({method:e,headers:l,referrerPolicy:"no-referrer"},s))})}async function Ol(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},om),e);try{const i=new cm(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const a=await s.json();if("needConfirmation"in a)throw Gr(n,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{const c=s.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Gr(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw Gr(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw Gr(n,"user-disabled",a);const f=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Ro(n,f,d);Je(n,f)}}catch(i){if(i instanceof Be)throw i;Je(n,"network-request-failed",{message:String(i)})}}async function Po(n,e,t,r,i={}){const s=await wn(n,e,t,r,i);return"mfaPendingCredential"in s&&Je(n,"multi-factor-auth-required",{_serverResponse:s}),s}function Vl(n,e,t,r){const i=`${e}${t}?${r}`;return n.config.emulator?So(n.config,i):`${n.config.apiScheme}://${i}`}
631class cm{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(qe(this.auth,"network-request-failed")),am.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function Gr(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=qe(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 um(n,e){return wn(n,"POST","/v1/accounts:delete",e)}async function Ml(n,e){return wn(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 Zn(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function lm(n,e=!1){const t=W(n),r=await t.getIdToken(e),i=Co(r);L(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,a=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Zn(Ns(i.auth_time)),issuedAtTime:Zn(Ns(i.iat)),expirationTime:Zn(Ns(i.exp)),signInProvider:a||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Ns(n){return Number(n)*1e3}function Co(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ti("JWT malformed, contained fewer than 3 sections"),null;try{const i=yl(t);return i?JSON.parse(i):(ti("Failed to decode base64 JWT payload"),null)}catch(i){return ti("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function Gc(n){const e=Co(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 ar(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof Be&&hm(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function hm({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 dm{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 eo{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Zn(this.lastLoginAt),this.creationTime=Zn(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 gi(n){var e;const t=n.auth,r=await n.getIdToken(),i=await ar(n,Ml(t,{idToken:r}));L(i==null?void 0:i.users.length,t,"internal-error");const s=i.users[0];n._notifyReloadListener(s);const a=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?Ll(s.providerUserInfo):[],c=pm(n.providerData,a),l=n.isAnonymous,d=!(n.email&&s.passwordHash)&&!(c!=null&&c.length),f=l?d:!1,y={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:c,metadata:new eo(s.createdAt,s.lastLoginAt),isAnonymous:f};Object.assign(n,y)}async function fm(n){const e=W(n);await gi(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function pm(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Ll(n){return n.map(e=>{var{providerId:t}=e,r=Ao(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 gm(n,e){const t=await Ol(n,{},async()=>{const r=_r({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,a=Vl(n,i,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",Dl.fetch()(a,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function mm(n,e){return wn(n,"POST","/v2/accounts:revokeToken",vr(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 cn{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):Gc(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){L(e.length!==0,"internal-error");const t=Gc(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:s}=await gm(e,t);this.updateTokensAndExpiration(r,i,Number(s))}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:s}=t,a=new cn;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),s&&(L(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),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 cn,this.toJSON())}_performRefresh(){return it("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 Tt(n,e){L(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class st{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,s=Ao(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new dm(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new eo(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await ar(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 lm(this,e)}reload(){return fm(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 st(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 gi(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if($e(this.auth.app))return Promise.reject(ct(this.auth));const e=await this.getIdToken();return await ar(this,um(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,s,a,c,l,d,f;const y=(r=t.displayName)!==null&&r!==void 0?r:void 0,w=(i=t.email)!==null&&i!==void 0?i:void 0,b=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,k=(a=t.photoURL)!==null&&a!==void 0?a:void 0,O=(c=t.tenantId)!==null&&c!==void 0?c:void 0,C=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,F=(d=t.createdAt)!==null&&d!==void 0?d:void 0,$=(f=t.lastLoginAt)!==null&&f!==void 0?f:void 0,{uid:j,emailVerified:q,isAnonymous:he,providerData:Y,stsTokenManager:T}=t;L(j&&T,e,"internal-error");const g=cn.fromJSON(this.name,T);L(typeof j=="string",e,"internal-error"),Tt(y,e.name),Tt(w,e.name),L(typeof q=="boolean",e,"internal-error"),L(typeof he=="boolean",e,"internal-error"),Tt(b,e.name),Tt(k,e.name),Tt(O,e.name),Tt(C,e.name),Tt(F,e.name),Tt($,e.name);const _=new st({uid:j,auth:e,email:w,emailVerified:q,displayName:y,isAnonymous:he,photoURL:k,phoneNumber:b,tenantId:O,stsTokenManager:g,createdAt:F,lastLoginAt:$});return Y&&Array.isArray(Y)&&(_.providerData=Y.map(v=>Object.assign({},v))),C&&(_._redirectEventId=C),_}static async _fromIdTokenResponse(e,t,r=!1){const i=new cn;i.updateFromServerResponse(t);const s=new st({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await gi(s),s}static async _fromGetAccountInfoResponse(e,t,r){const i=t.users[0];L(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?Ll(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),c=new cn;c.updateFromIdToken(r);const l=new st({uid:i.localId,auth:e,stsTokenManager:c,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:s,metadata:new eo(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(l,d),l}}/**
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 Qc=new Map;function ot(n){lt(n instanceof Function,"Expected a class definition");let e=Qc.get(n);return e?(lt(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Qc.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 xl{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){}}xl.type="NONE";const Jc=xl;/**
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 ni(n,e,t){return`firebase:${n}:${e}:${t}`}class un{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=ni(this.userKey,i.apiKey,s),this.fullPersistenceKey=ni("persistence",i.apiKey,s),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?st._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 un(ot(Jc),e,r);const i=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let s=i[0]||ot(Jc);const a=ni(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const f=await d._get(a);if(f){const y=st._fromJSON(e,f);d!==s&&(c=y),s=d;break}}catch{}const l=i.filter(d=>d._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new un(s,e,r):(s=l[0],c&&await s._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==s)try{await d._remove(a)}catch{}})),new un(s,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 Xc(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(jl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ul(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(ql(e))return"Blackberry";if(zl(e))return"Webos";if(Fl(e))return"Safari";if((e.includes("chrome/")||Bl(e))&&!e.includes("edge/"))return"Chrome";if($l(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 Ul(n=be()){return/firefox\//i.test(n)}function Fl(n=be()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Bl(n=be()){return/crios\//i.test(n)}function jl(n=be()){return/iemobile/i.test(n)}function $l(n=be()){return/android/i.test(n)}function ql(n=be()){return/blackberry/i.test(n)}function zl(n=be()){return/webos/i.test(n)}function ko(n=be()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function _m(n=be()){var e;return ko(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function ym(){return mp()&&document.documentMode===10}function Hl(n=be()){return ko(n)||$l(n)||zl(n)||ql(n)||/windows phone/i.test(n)||jl(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 Kl(n,e=[]){let t;switch(n){case"Browser":t=Xc(be());break;case"Worker":t=`${Xc(be())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Xt}/${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 vm{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=s=>new Promise((a,c)=>{try{const l=e(s);a(l)}catch(l){c(l)}});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 Tm(n,e={}){return wn(n,"GET","/v2/passwordPolicy",vr(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 wm=6;class Im{constructor(e){var t,r,i,s;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:wm,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=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,i,s,a,c;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&
vendor: 2,092 bytes, lines 886-900
886(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(i=l.containsLowercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(s=l.containsUppercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(a=l.containsNumericCharacter)!==null&&a!==void 0?a:!0),l.isValid&&(l.isValid=(c=l.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),l}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,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,s){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=s))}}/**
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 Em{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 Yc(this),this.idTokenSubscription=new Yc(this),this.beforeStateQueue=new vm(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=Nl,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=ot(t)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await un.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 Ml(this,{idToken:e}),r=await st._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($e(this.app)){const a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=i==null?void 0:i._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(i=l.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)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 gi(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=sm()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if($e(this.app))return Promise.reject(ct(this));const t=e?W(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 $e(this.app)?Promise.reject(ct(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return $e(this.app)?Promise.reject(ct(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ot(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 Tm(this),t=new Im(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new Ot("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 mm(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&ot(e)||this._popupRedirectResolver;L(t,this,"argument-error"),this.redirectPersistenceManager=await un.create(this,[ot(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 s=typeof t=="function"?t:t.next.bind(t);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(L(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,i);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return L(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Kl(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&&tm(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function In(n){return W(n)}class Yc{constructor(e){this.auth=e,this.observer=null,this.addObserver=Ip(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 No={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Am(n){No=n}function Rm(n){return No.loadJS(n)}function bm(){return No.gapiScript}function Sm(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 Pm(n,e){const t=Ze(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),s=t.getOptions();if(sr(s,e??{}))return i;Je(i,"already-initialized")}return t.initialize({options:e})}function Cm(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(ot);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function km(n,e,t){const r=In(n);L(r._canInitEmulator,r,"emulator-config-failed"),L(/^https?:\/\//.test(e),r,"invali
931d-emulator-scheme");const i=!1,s=Wl(e),{host:a,port:c}=Nm(e),l=c===null?"":`:${c}`;r.config.emulator={url:`${s}//${a}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),Dm()}function Wl(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function Nm(n){const e=Wl(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 s=i[1];return{host:s,port:Zc(r.substr(s.length+1))}}else{const[s,a]=r.split(":");return{host:s,port:Zc(a)}}}function Zc(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Dm(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
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 Gl{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return it("not implemented")}_getIdTokenResponse(e){return it("not implemented")}_linkToIdToken(e,t){return it("not implemented")}_getReauthenticationResolver(e){return it("not implemented")}}/**
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 ln(n,e){return Po(n,"POST","/v1/accounts:signInWithIdp",vr(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 Om="http://localhost";class ht extends Gl{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new ht(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):Je("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,s=Ao(t,["providerId","signInMethod"]);if(!r||!i)return null;const a=new ht(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return ln(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,ln(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ln(e,t)}buildRequest(){const e={requestUri:Om,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=_r(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 Do{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 En extends Do{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ri extends En{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return L("providerId"in t&&"signInMethod"in t,"argument-error"),ht._fromParams(t)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return L(e.idToken||e.accessToken,"argument-error"),ht._fromParams(Object.assign(Object.assign({}
1006,e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return ri.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return ri.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:c}=e;if(!r&&!i&&!t&&!s||!c)return null;try{return new ri(c)._credential({idToken:t,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}}/**
1007 * @license
1008 * Copyright 2020 Google LLC
1009 *
1010 * Licensed under the Apache License, Version 2.0 (the "License");
1011 * you may not use this file except in compliance with the License.
1012 * You may obtain a copy of the License at
1013 *
1014 *   http://www.apache.org/licenses/LICENSE-2.0
1015 *
1016 * Unless required by applicable law or agreed to in writing, software
1017 * distributed under the License is distributed on an "AS IS" BASIS,
1018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1019 * See the License for the specific language governing permissions and
1020 * limitations under the License.
1021 */class wt extends En{constructor(){super("facebook.com")}static credential(e){return ht._fromParams({providerId:wt.PROVIDER_ID,signInMethod:wt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return wt.credentialFromTaggedObject(e)}static credentialFromError(e){return wt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return wt.credential(e.oauthAccessToken)}catch{return null}}}wt.FACEBOOK_SIGN_IN_METHOD="facebook.com";wt.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, software
1032 * distributed under the License is distributed on an "AS IS" BASIS,
1033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1034 * See the License for the specific language governing permissions and
1035 * limitations under the License.
1036 */class It extends En{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ht._fromParams({providerId:It.PROVIDER_ID,signInMethod:It.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return It.credentialFromTaggedObject(e)}static credentialFromError(e){return It.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return It.credential(t,r)}catch{return null}}}It.GOOGLE_SIGN_IN_METHOD="google.com";It.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 Et extends En{constructor(){super("github.com")}static credential(e){return ht._fromParams({providerId:Et.PROVIDER_ID,signInMethod:Et.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Et.credentialFromTaggedObject(e)}static credentialFromError(e){return Et.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Et.credential(e.oauthAccessToken)}catch{return null}}}Et.GITHUB_SIGN_IN_METHOD="github.com";Et.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 At extends En{constructor(){super("twitter.com")}static credential(e,t){return ht._fromParams({providerId:At.PROVIDER_ID,signInMethod:At.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return At.credentialFromTaggedObject(e)}static credentialFromError(e){return At.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return At.credential(t,r)}catch{return null}}}At.TWITTER_SIGN_IN_METHOD="twitter.com";At.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 */async function Vm(n,e){return Po(n,"POST","/v1/accounts:signUp",vr(n,e))}/**
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 dt{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 s=await st._fromIdTokenResponse(e,r,i),a=eu(r);return new dt({user:s,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=eu(r);return new dt({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function eu(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
1097 * @license
1098 * Copyright 2020 Google LLC
1099 *
1100 * Licensed under the Apache License, Version 2.0 (the "License");
1101 * you may not use this file except in compliance with the License.
1102 * You may obtain a copy of the License at
1103 *
1104 *   http://www.apache.org/licenses/LICENSE-2.0
1105 *
1106 * Unless required by applicable law or agreed to in writing, software
1107 * distributed under the License is distributed on an "AS IS" BASIS,
1108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1109 * See the License for the specific language governing permissions and
1110 * limitations under the License.
1111 */async function vA(n){var e;if($e(n.app))return Promise.reject(ct(n));const t=In(n);if(await t._initializationPromise,!((e=t.currentUser)===null||e===void 0)&&e.isAnonymous)return new dt({user:t.currentUser,providerId:null,operationType:"signIn"});const r=await Vm(t,{returnSecureToken:!0}),i=await dt._fromIdTokenResponse(t,"signIn",r,!0);return await t._updateCurrentUser(i.user),i}/**
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, softw
1121are
1122 * distributed under the License is distributed on an "AS IS" BASIS,
1123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1124 * See the License for the specific language governing permissions and
1125 * limitations under the License.
1126 */class mi extends Be{constructor(e,t,r,i){var s;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,mi.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new mi(e,t,r,i)}}function Ql(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?mi._fromErrorAndOperation(n,s,e,r):s})}async function Mm(n,e,t=!1){const r=await ar(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return dt._forOperation(n,"link",r)}/**
1127 * @license
1128 * Copyright 2019 Google LLC
1129 *
1130 * Licensed under the Apache License, Version 2.0 (the "License");
1131 * you may not use this file except in compliance with the License.
1132 * You may obtain a copy of the License at
1133 *
1134 *   http://www.apache.org/licenses/LICENSE-2.0
1135 *
1136 * Unless required by applicable law or agreed to in writing, software
1137 * distributed under the License is distributed on an "AS IS" BASIS,
1138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1139 * See the License for the specific language governing permissions and
1140 * limitations under the License.
1141 */async function Lm(n,e,t=!1){const{auth:r}=n;if($e(r.app))return Promise.reject(ct(r));const i="reauthenticate";try{const s=await ar(n,Ql(r,i,e,n),t);L(s.idToken,r,"internal-error");const a=Co(s.idToken);L(a,r,"internal-error");const{sub:c}=a;return L(n.uid===c,r,"user-mismatch"),dt._forOperation(n,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&Je(r,"user-mismatch"),s}}/**
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 xm(n,e,t=!1){if($e(n.app))return Promise.reject(ct(n));const r="signIn",i=await Ql(n,r,e),s=await dt._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}/**
1157 * @license
1158 * Copyright 2020 Google LLC
1159 *
1160 * Licensed under the Apache License, Version 2.0 (the "License");
1161 * you may not use this file except in compliance with the License.
1162 * You may obtain a copy of the License at
1163 *
1164 *   http://www.apache.org/licenses/LICENSE-2.0
1165 *
1166 * Unless required by applicable law or agreed to in writing, software
1167 * distributed under the License is distributed on an "AS IS" BASIS,
1168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1169 * See the License for the specific language governing permissions and
1170 * limitations under the License.
1171 */async function Um(n,e){return Po(n,"POST","/v1/accounts:signInWithCustomToken",vr(n,e))}/**
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 */async function TA(n,e){if($e(n.app))return Promise.reject(ct(n));const t=In(n),r=await Um(t,{token:e,returnSecureToken:!0}),i=await dt._fromIdTokenResponse(t,"signIn",r);return await t._updateCurrentUser(i.user),i}/**
1187 * @license
1188 * Copyright 2020 Google LLC
1189 *
1190 * Licensed under the Apache License, Version 2.0 (the "License");
1191 * you may not use this file except in compliance with the License.
1192 * You may obtain a copy of the License at
1193 *
1194 *   http://www.apache.org/licenses/LICENSE-2.0
1195 *
1196 * Unless required by applicable law or agreed to in writing, software
1197 * distributed under the License is distributed on an "AS IS" BASIS,
1198 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1199 * See the License for the specific language governing permissions and
1200 * limitations under the License.
1201 */function wA(n,e){return W(n).setPersistence(e)}function Fm(n,e,t,r){return W(n).onIdTokenChanged(e,t,r)}function Bm(n,e,t){return W(n).beforeAuthStateChanged(e,t)}function IA(n){return W(n).signOut()}const _i="__sak";/**
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 */class Jl{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(_i,"1"),this.storage.removeItem(_i),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()}}/**
1217 * @license
1218 * Copyright 2020 Google LLC
1219 *
1220 * Licensed under the Apache License, Version 2.0 (the "License");
1221 * you may not use this file except in compliance with the License.
1222 * You may obtain a copy of the License at
1223 *
1224 *   http://www.apache.org/licenses/LICENSE-2.0
1225 *
1226 * Unless required by applicable law or agreed to in writing, software
1227 * distributed under the License is distributed on an "AS IS" BASIS,
1228 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229 * See the License for the specific language governing permissions and
1230 * limitations under the License.
1231 */const jm=1e3,$m=10;class Xl extends Jl{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Hl(),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,c,l)=>{this.notifyListeners(a,l)});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)},s=this.storage.getItem(r);ym()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,$m):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)})},jm)}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
1231ject.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]}}Xl.type="LOCAL";const qm=Xl;/**
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 */class Yl extends Jl{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Yl.type="SESSION";const Zl=Yl;/**
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 */function zm(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
1262 * @license
1263 * Copyright 2019 Google LLC
1264 *
1265 * Licensed under the Apache License, Version 2.0 (the "License");
1266 * you may not use this file except in compliance with the License.
1267 * You may obtain a copy of the License at
1268 *
1269 *   http://www.apache.org/licenses/LICENSE-2.0
1270 *
1271 * Unless required by applicable law or agreed to in writing, software
1272 * distributed under the License is distributed on an "AS IS" BASIS,
1273 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1274 * See the License for the specific language governing permissions and
1275 * limitations under the License.
1276 */class Oi{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 Oi(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:s}=t.data,a=this.handlersMap[i];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const c=Array.from(a).map(async d=>d(t.origin,s)),l=await zm(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Oi.receivers=[];/**
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 Oo(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
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 */class Hm{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 s,a;return new Promise((c,l)=>{const d=Oo("",20);i.port1.start();const f=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(y){const w=y;if(w.data.eventId===d)switch(w.data.status){case"ack":clearTimeout(f),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(w.data.response);break;default:clearTimeout(f),clearTimeout(s),l(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)})}}/**
1307 * @license
1308 * Copyright 2020 Google LLC
1309 *
1310 * Licensed under the Apache License, Version 2.0 (the "License");
1311 * you may not use this file except in compliance with the License.
1312 * You may obtain a copy of the License at
1313 *
1314 *   http://www.apache.org/licenses/LICENSE-2.0
1315 *
1316 * Unless required by applicable law or agreed to in writing, 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 Ke(){return window}function Km(n){Ke().location.href=n}/**
1322 * @license
1323 * Copyright 2020 Google LLC.
1324 *
1325 * Licensed under the Apache License, Version 2.0 (the "License");
1326 * you may not use this file except in compliance with the License.
1327 * You may obtain a copy of the License at
1328 *
1329 *   http://www.apache.org/licenses/LICENSE-2.0
1330 *
1331 * Unless required by applicable law or agreed to in writing, software
1332 * distributed under the License is distributed on an "AS IS" BASIS,
1333 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1334 * See the License for the specific language governing permissions and
1335 * limitations under the License.
1336 */function eh(){return typeof Ke().WorkerGlobalScope<"u"&&typeof Ke().importScripts=="function"}async function Wm(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Gm(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Qm(){return eh()?self:null}/**
1337 * @license
1338 * Copyright 2019 Google LLC
1339 *
1340 * Licensed under the Apache License, Version 2.0 (the "License");
1341 * you may not use this file except in compliance with the License.
1342 * You may obtain a copy of the License at
1343 *
1344 *   http://www.apache.org/licenses/LICENSE-2.0
1345 *
1346 * Unless required by applicable law or agreed to in writing, software
1347 * distributed under the License is distributed on an "AS IS" BASIS,
1348 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1349 * See the License for the specific language governing permissions and
1350 * limitations under the License.
1351 */const th="firebaseLocalStorageDb",Jm=1,yi="firebaseLocalStorage",nh="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 Vi(n,e){return n.transaction([yi],e?"readwrite":"readonly").objectStore(yi)}function Xm(){const n=indexedDB.deleteDatabase(th);return new Tr(n).toPromise()}function to(){const n=indexedDB.open(th,Jm);return new Promise((e,t)=>
1351{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(yi,{keyPath:nh})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(yi)?e(r):(r.close(),await Xm(),e(await to()))})})}async function tu(n,e,t){const r=Vi(n,!0).put({[nh]:e,value:t});return new Tr(r).toPromise()}async function Ym(n,e){const t=Vi(n,!1).get(e),r=await new Tr(t).toPromise();return r===void 0?null:r.value}function nu(n,e){const t=Vi(n,!0).delete(e);return new Tr(t).toPromise()}const Zm=800,e_=3;class rh{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 to(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>e_)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return eh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Oi._getInstance(Qm()),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 Wm(),!this.activeServiceWorker)return;this.sender=new Hm(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||Gm()!==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 to();return await tu(e,_i,"1"),await nu(e,_i),!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=>tu(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Ym(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>nu(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Vi(i,!1).getAll();return new Tr(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),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(),Zm)}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
1351ject.keys(this.listeners).length===0&&this.stopPolling()}}rh.type="LOCAL";const t_=rh;new yr(3e4,6e4);/**
1352 * @license
1353 * Copyright 2021 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 */function ih(n,e){return e?ot(e):(L(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
1367 * @license
1368 * Copyright 2019 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 */class Vo extends Gl{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ln(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ln(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ln(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 n_(n){return xm(n.auth,new Vo(n),n.bypassAuthState)}function r_(n){const{auth:e,user:t}=n;return L(t,e,"internal-error"),Lm(t,new Vo(n),n.bypassAuthState)}async function i_(n){const{auth:e,user:t}=n;return L(t,e,"internal-error"),Mm(t,new Vo(n),n.bypassAuthState)}/**
1382 * @license
1383 * Copyright 2020 Google LLC
1384 *
1385 * Licensed under the Apache License, Version 2.0 (the "License");
1386 * you may not use this file except in compliance with the License.
1387 * You may obtain a copy of the License at
1388 *
1389 *   http://www.apache.org/licenses/LICENSE-2.0
1390 *
1391 * Unless required by applicable law or agreed to in writing, software
1392 * distributed under the License is distributed on an "AS IS" BASIS,
1393 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1394 * See the License for the specific language governing permissions and
1395 * limitations under the License.
1396 */class sh{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,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:s,error:a,type:c}=e;if(a){this.reject(a);return}const l={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return n_;case"linkViaPopup":case"linkViaRedirect":return i_;case"reauthViaPopup":case"reauthViaRedirect":return r_;default:Je(this.auth,"internal-error")}}resolve(e){lt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){lt(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()}}/**
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 */const s_=new yr(2e3,1e4);async function EA(n,e,t){if($e(n.app))return Promise.reject(qe(n,"operation-not-supported-in-this-environment"));const r=In(n);nm(n,e,Do);const i=ih(r,t);return new Bt(r,"signInViaPopup",e,i).executeNotNull()}class Bt extends sh{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,Bt.currentPopupAction&&Bt.currentPopupAction.cancel(),Bt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return L(e,this.auth,"internal-error"),e}async onExecution(){lt(this.filter.length===1,"Popup operations only handle one event");const e=Oo();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(qe(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(qe(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Bt.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(qe(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,s_.get())};e()}}Bt.currentPopupAction=null;/**
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 o_="pendingRedirect",ii=new Map;class a_ extends sh{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=ii.get(this.auth._key());if(!e){try{const r=await c_(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}ii.set(this.auth._key(),e)}return this.bypassAuthState||ii.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 c_(n,e){const t=h_(e),r=l_(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function u_(n,e){ii.set(n._key(),e)}function l_(n){return ot(n._redirectPersistence)}function h_(n){return ni(o_,n.config.apiKey,n.name)}async function d_(n,e,t=!1){if($e(n.app))return Promise.reject(ct(n));const r=In(n),i=ih(r,e),a=await new a_(r,i,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
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, software
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 f_=10*60*1e3;class p_{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||!g_(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!oh(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(qe(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>=f_&&this.cachedEventUids.clear(),this.cachedEventUids.has(ru(e))}saveEventToCache(e){this.cachedEventUids.add(ru(e)),this.lastProcessedEventTime=Date.now()}}function ru(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function oh({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function g_(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return oh(n);default:return!1}}/**
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 */async function m_(n,e={}){return wn(n,"GET","/v1/projects",e)}/**
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 __=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,y_=/^https?/;async function v_(n){if(n.config.emulator)return;const{authorizedDomains:e}=await m_(n);for(const t of e)try{if(T_(t))return}catch{}Je(n,"unauthorized-domain")}function T_(n){const e=Zs(),{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(!y_.test(t))return!1;if(__.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
1472 * @license
1473 * Copyright 2020 Google LLC.
1474 *
1475 * Licensed under the Apache License, Version 2.0 (the "License");
1476 * you may not use this file except in compliance with the License.
1477 * You may obtain a copy of the License at
1478 *
1479 *   http://www.apache.org/licenses/LICENSE-2.0
1480 *
1481 * Unless required by applicable law or agreed to in writing, software
1482 * distributed under the License is distributed on an "AS IS" BASIS,
1483 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1484 * See the License for the specific language governing permissions and
1485 * limitations under the License.
1486 */const w_=new yr(3e4,6e4);function iu(){const n=Ke().___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 I_(n){return new Promise((e,t)=>{var r,i,s;function a(){iu(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{iu(),t(qe(n,"network-request-failed"))},timeout:w_.get()})}if(!((i=(r=Ke().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=Ke().gapi)===null||s===void 0)&&s.load)a();else{const c=Sm("iframefcb");return Ke()[c]=()=>{gapi.load?a():t(qe(n,"network-request-failed"))},Rm(`${bm()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw si=null,e})}let si=null;function E_(n){return si=si||I_(n),si}/**
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 A_=new yr(5e3,15e3),R_="__/auth/iframe",b_="emulator/auth/iframe",S_={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},P_=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function C_(n){const e=n.config;L(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?So(e,b_):`https://${n.config.authDomain}/${R_}`,r={apiKey:e.apiKey,appName:n.name,v:Xt},i=P_.get(n.config.apiHost);i&&(r.eid=i);const s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${_r(r).slice(1)}`}async function k_(n){const e=await E_(n),t=Ke().gapi;return L(t,n,"internal-error"),e.open({where:document.body,url:C_(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:S_,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const a=qe(n,"network-request-failed"),c=Ke().setTimeout(()=>{s(a)},A_.get());function l(){Ke().clearTimeout(c),i(r)}r.ping(l).then(l,()=>{s(a)})}))}/**
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 */const N_={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},D_=500,O_=600,V_="_blank",M_="http://localhost";class su{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function L_(n,e,t,r=D_,i=O_){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l=Object.assign(Object.assign({},N_),{width:r.toString(),height:i.toString(),top:s,left:a}),d=be().toLowerCase();t&&(c=Bl(d)?V_:t),Ul(d)&&(e=e||M_,l.scrollbars="yes");const f=Object.entries(l).reduce((w,[b,k])=>`${w}${b}=${k},`,"");if(_m(d)&&c!=="_self")return x_(e||"",c),new su(null);const y=window.open(e||"",c,f);L(y,n,"popup-blocked");try{y.focus()}catch{}return new su(y)}function x_(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");
1516r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
1517 * @license
1518 * Copyright 2021 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 */const U_="__/auth/handler",F_="emulator/auth/handler",B_=encodeURIComponent("fac");async function ou(n,e,t,r,i,s){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:Xt,eventId:i};if(e instanceof Do){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",wp(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,y]of Object.entries({}))a[f]=y}if(e instanceof En){const f=e.getScopes().filter(y=>y!=="");f.length>0&&(a.scopes=f.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const f of Object.keys(c))c[f]===void 0&&delete c[f];const l=await n._getAppCheckToken(),d=l?`#${B_}=${encodeURIComponent(l)}`:"";return`${j_(n)}?${_r(c).slice(1)}${d}`}function j_({config:n}){return n.emulator?So(n,F_):`https://${n.authDomain}/${U_}`}/**
1532 * @license
1533 * Copyright 2020 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 Ds="webStorageSupport";class $_{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Zl,this._completeRedirectFn=d_,this._overrideRedirectResult=u_}async _openPopup(e,t,r,i){var s;lt((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const a=await ou(e,t,r,Zs(),i);return L_(e,a,Oo())}
1546async _openRedirect(e,t,r,i){await this._originValidation(e);const s=await ou(e,t,r,Zs(),i);return Km(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):(lt(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await k_(e),r=new p_(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(Ds,{type:Ds},i=>{var s;const a=(s=i==null?void 0:i[0])===null||s===void 0?void 0:s[Ds];a!==void 0&&t(!!a),Je(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=v_(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Hl()||Fl()||ko()}}const q_=$_;var au="@firebase/auth",cu="1.7.8";/**
1547 * @license
1548 * Copyright 2020 Google LLC
1549 *
1550 * Licensed under the Apache License, Version 2.0 (the "License");
1551 * you may not use this file except in compliance with the License.
1552 * You may obtain a copy of the License at
1553 *
1554 *   http://www.apache.org/licenses/LICENSE-2.0
1555 *
1556 * Unless required by applicable law or agreed to in writing, software
1557 * distributed under the License is distributed on an "AS IS" BASIS,
1558 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1559 * See the License for the specific language governing permissions and
1560 * limitations under the License.
1561 */class z_{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()}}/**
1562 * @license
1563 * Copyright 2020 Google LLC
1564 *
1565 * Licensed under the Apache License, Version 2.0 (the "License");
1566 * you may not use this file except in compliance with the License.
1567 * You may obtain a copy of the License at
1568 *
1569 *   http://www.apache.org/licenses/LICENSE-2.0
1570 *
1571 * Unless required by applicable law or agreed to in writing, software
1572 * distributed under the License is distributed on an "AS IS" BASIS,
1573 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1574 * See the License for the specific language governing permissions and
1575 * limitations under the License.
1576 */function H_(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 K_(n){Me(new De("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;L(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Kl(n)},d=new Em(r,i,s,l);return Cm(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),Me(new De("auth-internal",e=>{const t=In(e.getProvider("auth").getImmediate());return(r=>new z_(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),le(au,cu,H_(n)),le(au,cu,"esm2017")}/**
1577 * @license
1578 * Copyright 2021 Google LLC
1579 *
1580 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 52,437 bytes, lines 1581-1613
1581 * you may not use this file except in compliance with the License.
1582 * You may obtain a copy of the License at
1583 *
1584 *   http://www.apache.org/licenses/LICENSE-2.0
1585 *
1586 * Unless required by applicable law or agreed to in writing, software
1587 * distributed under the License is distributed on an "AS IS" BASIS,
1588 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1589 * See the License for the specific language governing permissions and
1590 * limitations under the License.
1591 */const W_=5*60,G_=wl("authIdTokenMaxAge")||W_;let uu=null;const Q_=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>G_)return;const i=t==null?void 0:t.token;uu!==i&&(uu=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function AA(n=Tn()){const e=Ze(n,"auth");if(e.isInitialized())return e.getImmediate();const t=Pm(n,{popupRedirectResolver:q_,persistence:[t_,qm,Zl]}),r=wl("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const a=Q_(s.toString());Bm(t,a,()=>a(t.currentUser)),Fm(t,c=>a(c))}}const i=vl("auth");return i&&km(t,`http://${i}`),t}function J_(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}Am({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const s=qe("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",J_().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="});K_("Browser");var lu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1592Copyright The Closure Library Authors.
1593SPDX-License-Identifier: Apache-2.0
1594*/var qt,ah;(function(){var n;/** @license
1595
1596 Copyright The Closure Library Authors.
1597 SPDX-License-Identifier: Apache-2.0
1598*/function e(T,g){function _(){}_.prototype=g.prototype,T.D=g.prototype,T.prototype=new _,T.prototype.constructor=T,T.C=function(v,I,A){for(var m=Array(arguments.length-2),et=2;et<arguments.length;et++)m[et-2]=arguments[et];return g.prototype[I].apply(v,m)}}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(T,g,_){_||(_=0);var v=Array(16);if(typeof g=="string")for(var I=0;16>I;++I)v[I]=g.charCodeAt(_++)|g.charCodeAt(_++)<<8|g.charCodeAt(_++)<<16|g.charCodeAt(_++)<<24;else for(I=0;16>I;++I)v[I]=g[_++]|g[_++]<<8|g[_++]<<16|g[_++]<<24;g=T.g[0],_=T.g[1],I=T.g[2];var A=T.g[3],m=g+(A^_&(I^A))+v[0]+3614090360&4294967295;g=_+(m<<7&4294967295|m>>>25),m=A+(I^g&(_^I))+v[1]+3905402710&4294967295,A=g+(m<<12&4294967295|m>>>20),m=I+(_^A&(g^_))+v[2]+606105819&4294967295,I=A+(m<<17&4294967295|m>>>15),m=_+(g^I&(A^g))+v[3]+3250441966&4294967295,_=I+(m<<22&4294967295|m>>>10),m=g+(A^_&(I^A))+v[4]+4118548399&4294967295,g=_+(m<<7&4294967295|m>>>25),m=A+(I^g&(_^I))+v[5]+1200080426&4294967295,A=g+(m<<12&4294967295|m>>>20),m=I+(_^A&(g^_))+v[6]+2821735955&4294967295,I=A+(m<<17&4294967295|m>>>15),m=_+(g^I&(A^g))+v[7]+4249261313&4294967295,_=I+(m<<22&4294967295|m>>>10),m=g+(A^_&(I^A))+v[8]+1770035416&4294967295,g=_+(m<<7&4294967295|m>>>25),m=A+(I^g&(_^I))+v[9]+2336552879&4294967295,A=g+(m<<12&4294967295|m>>>20),m=I+(_^A&(g^_))+v[10]+4294925233&4294967295,I=A+(m<<17&4294967295|m>>>15),m=_+(g^I&(A^g))+v[11]+2304563134&4294967295,_=I+(m<<22&4294967295|m>>>10),m=g+(A^_&(I^A))+v[12]+1804603682&4294967295,g=_+(m<<7&4294967295|m>>>25),m=A+(I^g&(_^I))+v[13]+4254626195&4294967295,A=g+(m<<12&4294967295|m>>>20),m=I+(_^A&(g^_))+v[14]+2792965006&4294967295,I=A+(m<<17&4294967295|m>>>15),m=_+(g^I&(A^g))+v[15]+1236535329&4294967295,_=I+(m<<22&4294967295|m>>>10),m=g+(I^A&(_^I))+v[1]+4129170786&4294967295,g=_+(m<<5&4294967295|m>>>27),m=A+(_^I&(g^_))+v[6]+3225465664&4294967295,A=g+(m<<9&4294967295|m>>>23),m=I+(g^_&(A^g))+v[11]+643717713&4294967295,I=A+(m<<14&4294967295|m>>>18),m=_+(A^g&(I^A))+v[0]+3921069994&4294967295,_=I+(m<<20&4294967295|m>>>12),m=g+(I^A&(_^I))+v[5]+3593408605&4294967295,g=_+(m<<5&4294967295|m>>>27),m=A+(_^I&(g^_))+v[10]+38016083&4294967295,A=g+(m<<9&4294967295|m>>>23),m=I+(g^_&(A^g))+v[15]+3634488961&4294967295,I=A+(m<<14&4294967295|m>>>18),m=_+(A^g&(I^A))+v[4]+3889429448&4294967295,_=I+(m<<20&4294967295|m>>>12),m=g+(I^A&(_^I))+v[9]+568446438&4294967295,g=_+(m<<5&4294967295|m>>>27),m=A+(_^I&(g^_))+v[14]+3275163606&4294967295,A=g+(m<<9&4294967295|m>>>23),m=I+(g^_&(A^g))+v[3]+4107603335&4294967295,I=A+(m<<14&4294967295|m>>>18),m=_+(A^g&(I^A))+v[8]+1163531501&4294967295,_=I+(m<<20&4294967295|m>>>12),m=g+(I^A&(_^I))+v[13]+2850285829&4294967295,g=_+(m<<5&4294967295|m>>>27),m=A+(_^I&(g^_))+v[2]+4243563512&4294967295,A=g+(m<<9&4294967295|m>>>23),m=I+(g^_&(A^g))+v[7]+1735328473&4294967295,I=A+(m<<14&4294967295|m>>>18),m=_+(A^g&(I^A))+v[12]+2368359562&4294967295,_=I+(m<<20&4294967295|m>>>12),m=g+(_^I^A)+v[5]+4294588738&4294967295,g=_+(m<<4&4294967295|m>>>28),m=A+(g^_^I)+v[8]+2272392833&4294967295,A=g+(m<<11&4294967295|m>>>21),m=I+(A^g^_)+v[11]+1839030562&4294967295,I=A+(m<<16&4294967295|m>>>16),m=_+(I^A^g)+v[14]+4259657740&4294967295,_=I+(m<<23&4294967295|m>>>9),m=g+(_^I^A)+v[1]+2763975236&4294967295,g=_+(m<<4&4294967295|m>>>28),m=A+(g^_^I)+v[4]+1272893353&4294967295,A=g+(m<<11&4294967295|m>>>21),m=I+(A^g^_)+v[7]+4139469664&4294967295,I=A+(m<<16&4294967295|m>>>16),m=_+(I^A^g)+v[10]+3200236656&4294967295,_=I+(m<<23&4294967295|m>>>9),m=g+(_^I^A)+v[13]+681279174&4294967295,g=_+(m<<4&4294967295|m>>>28),m=A+(g^_^I)+v[0]+3936430074&4294967295,A=g+(m<<11&4294967295|m>>>21),m=I+(A^g^_)+v[3]+3572445317&4294967295,I=A+(m<<16&4294967295|m>>>16),m=_+(I^A^g)+v[6]+76029189&4294967295,_=I+(m<<23&4294967295|m>>>9),m=g+(_^I^A)+v[9]+3654602809&4294967295,g=_+(m<<4&4294967295|m>>>28),m=A+(g^_^I)+v[12]+3873151461&4294967295,A=g+(m<<11&4294967295|m>>>21),m=I+(A^g^_)+v[15]+530742520&4294967295,I=A+(m<<16&4294967295|m>>>16),m=_+(I^A^g)+v[2]+3299628645&4294967295,_=I+(m<<23&4294967295|m>>>9),m=g+(I^(_|~A))+v[0]+4096336452&4294967295,g=_+(m<<6&4294967295|m>>>26),m=A+(_^(g|~I))+v[7]+1126891415&4294967295,A=g+(m<<10&4294967295|m>>>22),m=I+(g^(A|~_))+v[14]+2878612391&4294967295,I=A+(m<<15&4294967295|m>>>17),m=_+(A^(I|~g))+v[5]+4237533241&4294967295,_=I+(m<<21&4294967295|m>>>11),m=g+(I^(_|~A))+v[12]+1700485571&4294967295,g=_+(m<<6&4294967295|m>>>26),m=A+(_^(g|~I))+v[3]+2399980690&4294967295,A=g+(m<<10&4294967295|m>>>22),m=I+(g^(A|~_))+v[10]+4293915773&4294967295,I=A+(m<<15&4294967295|m>>>17),m=_+(A^(I|~g))+v[1]+2240044497&4294967295,_=I+(m<<21&4294967295|m>>>11),m=g+(I^(_|~A))+v[8]+1873313359&4294967295,g=_+(m<<6&4294967295|m>>>26),m=A+(_^(g|~I))+v[15]+4264355552&4294967295,A=g+(m<<10&4294967295|m>>>22),m=I+(g^(A|~_))+v[6]+2734768916&4294967295,I=A+(m<<15&4294967295|m>>>17),m=_+(A^(I|~g))+v[13]+1309151649&4294967295,_=I+(m<<21&4294967295|m>>>11),m=g+(I^(_|~A))+v[4]+4149444226&4294967295,g=_+(m<<6&4294967295|m>>>26),m=A+(_^(g|~I))+v[11]+3174756917&4294967295,A=g+(m<<10&4294967295|m>>>22),m=I+(g^(A|~_))+v[2]+718787259&4294967295,I=A+(m<<15&4294967295|m>>>17),m=_+(A^(I|~g))+v[9]+3951481745&4294967295,T.g[0]=T.g[0]+g&4294967295,T.g[1]=T.g[1]+(I+(m<<21&4294967295|m>>>11))&4294967295,T.g[2]=T.g[2]+I&4294967295,T.g[3]=T.g[3]+A&4294967295}r.prototype.u=function(T,g){g===void 0&&(g=T.length);for(var _=g-this.blockSize,v=this.B,I=this.h,A=0;A<g;){if(I==0)for(;A<=_;)i(this,T,A),A+=this.blockSize;if(typeof T=="string"){for(;A<g;)if(v[I++]=T.charCodeAt(A++),I==this.blockSize){i(this,v),I=0;break}}else for(;A<g;)if(v[I++]=T[A++],I==this.blockSize){i(this,v),I=0;break}}this.h=I,this.o+=g},r.prototype.v=function(){var T=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);T[0]=128;for(var g=1;g<T.length-8;++g)T[g]=0;var _=8*this.o;for(g=T.length-8;g<T.length;++g)T[g]=_&255,_/=256;for(this.u(T),T=Array(16),g=_=0;4>g;++g)for(var v=0;32>v;v+=8)T[_++]=this.g[g]>>>v&255;return T};function s(T,g){var _=c;return Object.prototype.hasOwnProperty.call(_,T)?_[T]:_[T]=g(T)}function a(T,g){this.h=g;for(var _=[],v=!0,I=T.length-1;0<=I;I--){var A=T[I]|0;v&&A==g||(_[I]=A,v=!1)}this.g=_}var c={};function l(T){return-128<=T&&128>T?s(T,function(g){return new a([g|0],0>g?-1:0)}):new a([T|0],0>T?-1:0)}function d(T){if(isNaN(T)||!isFinite(T))return y;if(0>T)return C(d(-T));for(var g=[],_=1,v=0;T>=_;v++)g[v]=T/_|0,_*=4294967296;return new a(g,0)}function f(T,g){if(T.length==0)throw Error("number format error: empty string");if(g=g||10,2>g||36<g)throw Error("radix out of range: "+g);if(T.charAt(0)=="-")return C(f(T.substring(1),g));if(0<=T.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=d(Math.pow(g,8)),v=y,I=0;I<T.length;I+=8){var A=Math.min(8,T.length-I),m=parseInt(T.substring(I,I+A),g);8>A?(A=d(Math.pow(g,A)),v=v.j(A).add(d(m))):(v=v.j(_),v=v.add(d(m)))}return v}var y=l(0),w=l(1),b=l(16777216);n=a.prototype,n.m=function(){if(O(this))return-C(this).m();for(var T=0,g=1,_=0;_<this.g.length;_++){var v=this.i(_);T+=(0<=v?v:4294967296+v)*g,g*=4294967296}return T},n.toString=function(T){if(T=T||10,2>T||36<T)throw Error("radix out of range: "+T);if(k(this))return"0";if(O(this))return"-"+C(this).toString(T);for(var g=d(Math.pow(T,6)),_=this,v="";;){var I=q(_,g).g;_=F(_,I.j(g));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(T);if(_=I,k(_))return A+v;for(;6>A.length;)A="0"+A;v=A+v}},n.i=function(T){return 0>T?0:T<this.g.length?this.g[T]:this.h};function k(T){if(T.h!=0)return!1;for(var g=0;g<T.g.length;g++)if(T.g[g]!=0)return!1;return!0}function O(T){return T.h==-1}n.l=function(T){return T=F(this,T),O(T)?-1:k(T)?0:1};function C(T){for(var g=T.g.length,_=[],v=0;v<g;v++)_[v]=~T.g[v];return new a(_,~T.h).add(w)}n.abs=function(){return O(this)?C(this):this},n.add=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],v=0,I=0;I<=g;I++){var A=v+(this.i(I)&65535)+(T.i(I)&65535),m=(A>>>16)+(this.i(I)>>>16)+(T.i(I)>>>16);v=m>>>16,A&=65535,m&=65535,_[I]=m<<16|A}return new a(_,_[_.length-1]&-2147483648?-1:0)};function F(T,g){return T.add(C(g))}n.j=function(T){if(k(this)||k(T))return y;if(O(this))return O(T)?C(this).j(C(T)):C(C(this).j(T));if(O(T))return C(this.j(C(T)));if(0>this.l(b)&&0>T.l(b))return d(this.m()*T.m());for(var g=this.g.length+T.g.length,_=[],v=0;v<2*g;v++)_[v]=0;for(v=0;v<this.g.length;v++)for(var I=0;I<T.g.length;I++){var A=this.i(v)>>>16,m=this.i(v)&65535,et=T.i(I)>>>16,Cn=T.i(I)&65535;_[2*v+2*I]+=m*Cn,$(_,2*v+2*I),_[2*v+2*I+1]+=A*Cn,$(_,2*v+2*I+1),_[2*v+2*I+1]+=m*et,$(_,2*v+2*I+1),_[2*v+2*I+2]+=A*et,$(_,2*v+2*I+2)}for(v=0;v<g;v++)_[v]=_[2*v+1]<<16|_[2*v];for(v=g;v<2*g;v++)_[v]=0;return new a(_,0)};function $(T,g){for(;(T[g]&65535)!=T[g];)T[g+1]+=T[g]>>>16,T[g]&=65535,g++}function j(T,g){this.g=T,this.h=g}function q(T,g){if(k(g))throw Error("division by zero");if(k(T))return new j(y,y);if(O(T))return g=q(C(T),g),new j(C(g.g),C(g.h));if(O(g))return g=q(T,C(g)),new j(C(g.g),g.h);if(30<T.g.length){if(O(T)||O(g))throw Error("slowDivide_ only works with positive integers.");for(var _=w,v=g;0>=v.l(T);)_=he(_),v=he(v);var I=Y(_,1),A=Y(v,1);for(v=Y(v,2),_=Y(_,2);!k(v);){var m=A.add(v);0>=m.l(T)&&(I=I.add(_),A=m),v=Y(v,1),_=Y(_,1)}return g=F(T,I.j(g)),new j(I,g)}for(I=y;0<=T.l(g);){for(_=Math.max(1,Math.floor(T.m()/g.m())),v=Math.ceil(Math.log(_)/Math.LN2),v=48>=v?1:Math.pow(2,v-48),A=d(_),m=A.j(g);O(m)||0<m.l(T);)_-=v,A=d(_),m=A.j(g);k(A)&&(A=w),I=I.add(A),T=F(T,m)}return new j(I,T)}n.A=function(T){return q(this,T).h},n.and=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],v=0;v<g;v++)_[v]=this.i(v)&T.i(v);return new a(_,this.h&T.h)},n.or=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],v=0;v<g;v++)_[v]=this.i(v)|T.i(v);return new a(_,this.h|T.h)},n.xor=function(T){for(var g=Math.max(this.g.length,T.g.length),_=[],v=0;v<g;v++)_[v]=this.i(v)^T.i(v);return new a(_,this.h^T.h)};function he(T){for(var g=T.g.length+1,_=[],v=0;v<g;v++)_[v]=T.i(v)<<1|T.i(v-1)>>>31;return new a(_,T.h)}function Y(T,g){var _=g>>5;g%=32;for(var v=T.g.length-_,I=[],A=0;A<v;A++)I[A]=0<g?T.i(A+_)>>>g|T.i(A+_+1)<<32-g:T.i(A+_);return new a(I,T.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,ah=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=f,qt=a}).apply(typeof lu<"u"?lu:typeof self<"u"?self:typeof window<"u"?window:{});var Qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1599Copyright The Closure Library Authors.
1600SPDX-License-Identifier: Apache-2.0
1601*/var ch,uh,Qn,lh,oi,no,hh,dh,fh;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,u,h){return o==Array.prototype||o==Object.prototype||(o[u]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof Qr=="object"&&Qr];for(var u=0;u<o.length;++u){var h=o[u];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function i(o,u){if(u)e:{var h=r;o=o.split(".");for(var p=0;p<o.length-1;p++){var E=o[p];if(!(E in h))break e;h=h[E]}o=o[o.length-1],p=h[o],u=u(p),u!=p&&u!=null&&e(h,o,{configurable:!0,writable:!0,value:u})}}function s(o,u){o instanceof String&&(o+="");var h=0,p=!1,E={next:function(){if(!p&&h<o.length){var R=h++;return{value:u(R,o[R]),done:!1}}return p=!0,{done:!0,value:void 0}}};return E[Symbol.iterator]=function(){return E},E}i("Array.prototype.values",function(o){return o||function(){return s(this,function(u,h){return h})}});/** @license
1602
1603 Copyright The Closure Library Authors.
1604 SPDX-License-Identifier: Apache-2.0
1605*/var a=a||{},c=this||self;function l(o){var u=typeof o;return u=u!="object"?u:o?Array.isArray(o)?"array":u:"null",u=="array"||u=="object"&&typeof o.length=="number"}function d(o){var u=typeof o;return u=="object"&&o!=null||u=="function"}function f(o,u,h){return o.call.apply(o.bind,arguments)}function y(o,u,h){if(!o)throw Error();if(2<arguments.length){var p=Array.prototype.slice.call(arguments,2);return function(){var E=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(E,p),o.apply(u,E)}}return function(){return o.apply(u,arguments)}}function w(o,u,h){return w=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?f:y,w.apply(null,arguments)}function b(o,u){var h=Array.prototype.slice.call(arguments,1);return function(){var p=h.slice();return p.push.apply(p,arguments),o.apply(this,p)}}function k(o,u){function h(){}h.prototype=u.prototype,o.aa=u.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(p,E,R){for(var N=Array(arguments.length-2),X=2;X<arguments.length;X++)N[X-2]=arguments[X];return u.prototype[E].apply(p,N)}}function O(o){const u=o.length;if(0<u){const h=Array(u);for(let p=0;p<u;p++)h[p]=o[p];return h}return[]}function C(o,u){for(let h=1;h<arguments.length;h++){const p=arguments[h];if(l(p)){const E=o.length||0,R=p.length||0;o.length=E+R;for(let N=0;N<R;N++)o[E+N]=p[N]}else o.push(p)}}class F{constructor(u,h){this.i=u,this.j=h,this.h=0,this.g=null}get(){let u;return 0<this.h?(this.h--,u=this.g,this.g=u.next,u.next=null):u=this.i(),u}}function $(o){return/^[\s\xa0]*$/.test(o)}function j(){var o=c.navigator;return o&&(o=o.userAgent)?o:""}function q(o){return q[" "](o),o}q[" "]=function(){};var he=j().indexOf("Gecko")!=-1&&!(j().toLowerCase().indexOf("webkit")!=-1&&j().indexOf("Edge")==-1)&&!(j().indexOf("Trident")!=-1||j().indexOf("MSIE")!=-1)&&j().indexOf("Edge")==-1;function Y(o,u,h){for(const p in o)u.call(h,o[p],p,o)}function T(o,u){for(const h in o)u.call(void 0,o[h],h,o)}function g(o){const u={};for(const h in o)u[h]=o[h];return u}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function v(o,u){let h,p;for(let E=1;E<arguments.length;E++){p=arguments[E];for(h in p)o[h]=p[h];for(let R=0;R<_.length;R++)h=_[R],Object.prototype.hasOwnProperty.call(p,h)&&(o[h]=p[h])}}function I(o){var u=1;o=o.split(":");const h=[];for(;0<u&&o.length;)h.push(o.shift()),u--;return o.length&&h.push(o.join(":")),h}function A(o){c.setTimeout(()=>{throw o},0)}function m(){var o=ts;let u=null;return o.g&&(u=o.g,o.g=o.g.next,o.g||(o.h=null),u.next=null),u}class et{constructor(){this.h=this.g=null}add(u,h){const p=Cn.get();p.set(u,h),this.h?this.h.next=p:this.g=p,this.h=p}}var Cn=new F(()=>new Af,o=>o.reset());class Af{constructor(){this.next=this.g=this.h=null}set(u,h){this.h=u,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let kn,Nn=!1,ts=new et,Oa=()=>{const o=c.Promise.resolve(void 0);kn=()=>{o.then(Rf)}};var Rf=()=>{for(var o;o=m();){try{o.h.call(o.g)}catch(h){A(h)}var u=Cn;u.j(o),100>u.h&&(u.h++,o.next=u.g,u.g=o)}Nn=!1};function mt(){this.s=this.s,this.C=this.C}mt.prototype.s=!1,mt.prototype.ma=function(){this.s||(this.s=!0,this.N())},mt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function _e(o,u){this.type=o,this.g=this.target=u,this.defaultPrevented=!1}_e.prototype.h=function(){this.defaultPrevented=!0};var bf=function(){if(!c.addEventListener||!Object.defineProperty)return!1;var o=!1,u=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};c.addEventListener("test",h,u),c.removeEventListener("test",h,u)}catch{}return o}();function Dn(o,u){if(_e.call(this,o?o.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,o){var h=this.type=o.type,p=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=u,u=o.relatedTarget){if(he){e:{try{q(u.nodeName);var E=!0;break e}catch{}E=!1}E||(u=null)}}else h=="mouseover"?u=o.fromElement:h=="mouseout"&&(u=o.toElement);this.relatedTarget=u,p?(this.clientX=p.clientX!==void 0?p.clientX:p.pageX,this.clientY=p.clientY!==void 0?p.clientY:p.pageY,this.screenX=p.screenX||0,this.screenY=p.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:Sf[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&Dn.aa.h.call(this)}}k(Dn,_e);var Sf={2:"touch",3:"pen",4:"mouse"};Dn.prototype.h=function(){Dn.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var kr="closure_listenable_"+(1e6*Math.random()|0),Pf=0;function Cf(o,u,h,p,E){this.listener=o,this.proxy=null,this.src=u,this.type=h,this.capture=!!p,this.ha=E,this.key=++Pf,this.da=this.fa=!1}function Nr(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function Dr(o){this.src=o,this.g={},this.h=0}Dr.prototype.add=function(o,u,h,p,E){var R=o.toString();o=this.g[R],o||(o=this.g[R]=[],this.h++);var N=rs(o,u,p,E);return-1<N?(u=o[N],h||(u.fa=!1)):(u=new Cf(u,this.src,R,!!p,E),u.fa=h,o.push(u)),u};function ns(o,u){var h=u.type;if(h in o.g){var p=o.g[h],E=Array.prototype.indexOf.call(p,u,void 0),R;(R=0<=E)&&Array.prototype.splice.call(p,E,1),R&&(Nr(u),o.g[h].length==0&&(delete o.g[h],o.h--))}}function rs(o,u,h,p){for(var E=0;E<o.length;++E){var R=o[E];if(!R.da&&R.listener==u&&R.capture==!!h&&R.ha==p)return E}return-1}var is="closure_lm_"+(1e6*Math.random()|0),ss={};function Va(o,u,h,p,E){if(Array.isArray(u)){for(var R=0;R<u.length;R++)Va(o,u[R],h,p,E);return null}return h=xa(h),o&&o[kr]?o.K(u,h,d(p)?!!p.capture:!!p,E):kf(o,u,h,!1,p,E)}function kf(o,u,h,p,E,R){if(!u)throw Error("Invalid event type");var N=d(E)?!!E.capture:!!E,X=as(o);if(X||(o[is]=X=new Dr(o)),h=X.add(u,h,p,N,R),h.proxy)return h;if(p=Nf(),h.proxy=p,p.src=o,p.listener=h,o.addEventListener)bf||(E=N),E===void 0&&(E=!1),o.addEventListener(u.toString(),p,E);else if(o.attachEvent)o.attachEvent(La(u.toString()),p);else if(o.addListener&&o.removeListener)o.addListener(p);else throw Error("addEventListener and attachEvent are unavailable.");return h}function Nf(){function o(h){return u.call(o.src,o.listener,h)}const u=Df;return o}function Ma(o,u,h,p,E){if(Array.isArray(u))for(var R=0;R<u.length;R++)Ma(o,u[R],h,p,E);else p=d(p)?!!p.capture:!!p,h=xa(h),o&&o[kr]?(o=o.i,u=String(u).toString(),u in o.g&&(R=o.g[u],h=rs(R,h,p,E),-1<h&&(Nr(R[h]),Array.prototype.splice.call(R,h,1),R.length==0&&(delete o.g[u],o.h--)))):o&&(o=as(o))&&(u=o.g[u.toString()],o=-1,u&&(o=rs(u,h,p,E)),(h=-1<o?u[o]:null)&&os(h))}function os(o){if(typeof o!="number"&&o&&!o.da){var u=o.src;if(u&&u[kr])ns(u.i,o);else{var h=o.type,p=o.proxy;u.removeEventListener?u.removeEventListener(h,p,o.capture):u.detachEvent?u.detachEvent(La(h),p):u.addListener&&u.removeListener&&u.removeListener(p),(h=as(u))?(ns(h,o),h.h==0&&(h.src=null,u[is]=null)):Nr(o)}}}function La(o){return o in ss?ss[o]:ss[o]="on"+o}function Df(o,u){if(o.da)o=!0;else{u=new Dn(u,this);var h=o.listener,p=o.ha||o.src;o.fa&&os(o),o=h.call(p,u)}return o}function as(o){return o=o[is],o instanceof Dr?o:null}var cs="__closure_events_fn_"+(1e9*Math.random()>>>0);function xa(o){return typeof o=="function"?o:(o[cs]||(o[cs]=function(u){return o.handleEvent(u)}),o[cs])}function ye(){mt.call(this),this.i=new Dr(this),this.M=this,this.F=null}k(ye,mt),ye.prototype[kr]=!0,ye.prototype.removeEventListener=function(o,u,h,p){Ma(this,o,u,h,p)};function Se(o,u){var h,p=o.F;if(p)for(h=[];p;p=p.F)h.push(p);if(o=o.M,p=u.type||u,typeof u=="string")u=new _e(u,o);else if(u instanceof _e)u.target=u.target||o;else{var E=u;u=new _e(p,o),v(u,E)}if(E=!0,h)for(var R=h.length-1;0<=R;R--){var N=u.g=h[R];E=Or(N,p,!0,u)&&E}if(N=u.g=o,E=Or(N,p,!0,u)&&E,E=Or(N,p,!1,u)&&E,h)for(R=0;R<h.length;R++)N=u.g=h[R],E=Or(N,p,!1,u)&&E}ye.prototype.N=function(){if(ye.aa.N.call(this),this.i){var o=this.i,u;for(u in o.g){for(var h=o.g[u],p=0;p<h.length;p++)Nr(h[p]);delete o.g[u],o.h--}}this.F=null},ye.prototype.K=function(o,u,h,p){return this.i.add(String(o),u,!1,h,p)},ye.prototype.L=function(o,u,h,p){return this.i.add(String(o),u,!0,h,p)};function Or(o,u,h,p){if(u=o.i.g[String(u)],!u)return!0;u=u.concat();for(var E=!0,R=0;R<u.length;++R){var N=u[R];if(N&&!N.da&&N.capture==h){var X=N.listener,de=N.ha||N.src;N.fa&&ns(o.i,N),E=X.call(de,p)!==!1&&E}}return E&&!p.defaultPrevented}function Ua(o,u,h){if(typeof o=="function")h&&(o=w(o,h));else if(o&&typeof o.handleEvent=="function")o=w(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(u)?-1:c.setTimeout(o,u||0)}function Fa(o){o.g=Ua(()=>{o.g=null,o.i&&(o.i=!1,Fa(o))},o.l);const u=o.h;o.h=null,o.m.apply(null,u)}class Of extends mt{constructor(u,h){super(),this.m=u,this.l=h,this.h=null,this.i=!1,this.g=null}j(u){this.h=arguments,this.g?this.i=!0:Fa(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function On(o){mt.call(this),this.h=o,this.g={}}k(On,mt);var Ba=[];function ja(o){Y(o.g,function(u,h){this.g.hasOwnProperty(h)&&os(u)},o),o.g={}}On.prototype.N=function(){On.aa.N.call(this),ja(this)},On.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var us=c.JSON.stringify,Vf=c.JSON.parse,Mf=class{stringify(o){return c.JSON.stringify(o,void 0)}parse(o){return c.JSON.parse(o,void 0)}};function ls(){}ls.prototype.h=null;function $a(o){return o.h||(o.h=o.i())}function qa(){}var Vn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function hs(){_e.call(this,"d")}k(hs,_e);function ds(){_e.call(this,"c")}k(ds,_e);var Mt={},za=null;function Vr(){return za=za||new ye}Mt.La="serverreachability";function Ha(o){_e.call(this,Mt.La,o)}k(Ha,_e);function Mn(o){const u=Vr();Se(u,new Ha(u))}Mt.STAT_EVENT="statevent";function Ka(o,u){_e.call(this,Mt.STAT_EVENT,o),this.stat=u}k(Ka,_e);function Pe(o){const u=Vr();Se(u,new Ka(u,o))}Mt.Ma="timingevent";function Wa(o,u){_e.call(this,Mt.Ma,o),this.size=u}k(Wa,_e);function Ln(o,u){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){o()},u)}function xn(){this.g=!0}xn.prototype.xa=function(){this.g=!1};function Lf(o,u,h,p,E,R){o.info(function(){if(o.g)if(R)for(var N="",X=R.split("&"),de=0;de<X.length;de++){var G=X[de].split("=");if(1<G.length){var ve=G[0];G=G[1];var Te=ve.split("_");N=2<=Te.length&&Te[1]=="type"?N+(ve+"="+G+"&"):N+(ve+"=redacted&")}}else N=null;else N=R;return"XMLHTTP REQ ("+p+") [attempt "+E+"]: "+u+`
1606`+h+`
1607`+N})}function xf(o,u,h,p,E,R,N){o.info(function(){return"XMLHTTP RESP ("+p+") [ attempt "+E+"]: "+u+`
1608`+h+`
1609`+R+" "+N})}function en(o,u,h,p){o.info(function(){return"XMLHTTP TEXT ("+u+"): "+Ff(o,h)+(p?" "+p:"")})}function Uf(o,u){o.info(function(){return"TIMEOUT: "+u})}xn.prototype.info=function(){};function Ff(o,u){if(!o.g)return u;if(!u)return null;try{var h=JSON.parse(u);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var p=h[o];if(!(2>p.length)){var E=p[1];if(Array.isArray(E)&&!(1>E.length)){var R=E[0];if(R!="noop"&&R!="stop"&&R!="close")for(var N=1;N<E.length;N++)E[N]=""}}}}return us(h)}catch{return u}}var Mr={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ga={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},fs;function Lr(){}k(Lr,ls),Lr.prototype.g=function(){return new XMLHttpRequest},Lr.prototype.i=function(){return{}},fs=new Lr;function _t(o,u,h,p){this.j=o,this.i=u,this.l=h,this.R=p||1,this.U=new On(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 Qa}function Qa(){this.i=null,this.g="",this.h=!1}var Ja={},ps={};function gs(o,u,h){o.L=1,o.v=Br(tt(u)),o.m=h,o.P=!0,Xa(o,null)}function Xa(o,u){o.F=Date.now(),xr(o),o.A=tt(o.v);var h=o.A,p=o.R;Array.isArray(p)||(p=[String(p)]),hc(h.i,"t",p),o.C=0,h=o.j.J,o.h=new Qa,o.g=Cc(o.j,h?u:null,!o.m),0<o.O&&(o.M=new Of(w(o.Y,o,o.g),o.O)),u=o.U,h=o.g,p=o.ca;var E="readystatechange";Array.isArray(E)||(E&&(Ba[0]=E.toString()),E=Ba);for(var R=0;R<E.length;R++){var N=Va(h,E[R],p||u.handleEvent,!1,u.h||u);if(!N)break;u.g[N.key]=N}u=o.H?g(o.H):{},o.m?(o.u||(o.u="POST"),u["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,u)):(o.u="GET",o.g.ea(o.A,o.u,null,u)),Mn(),Lf(o.i,o.u,o.A,o.l,o.R,o.m)}_t.prototype.ca=function(o){o=o.target;const u=this.M;u&&nt(o)==3?u.j():this.Y(o)},_t.prototype.Y=function(o){try{if(o==this.g)e:{const Te=nt(this.g);var u=this.g.Ba();const rn=this.g.Z();if(!(3>Te)&&(Te!=3||this.g&&(this.h.h||this.g.oa()||yc(this.g)))){this.J||Te!=4||u==7||(u==8||0>=rn?Mn(3):Mn(2)),ms(this);var h=this.g.Z();this.X=h;t:if(Ya(this)){var p=yc(this.g);o="";var E=p.length,R=nt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){Lt(this),Un(this);var N="";break t}this.h.i=new c.TextDecoder}for(u=0;u<E;u++)this.h.h=!0,o+=this.h.i.decode(p[u],{stream:!(R&&u==E-1)});p.length=0,this.h.g+=o,this.C=0,N=this.h.g}else N=this.g.oa();if(this.o=h==200,xf(this.i,this.u,this.A,this.l,this.R,Te,h),this.o){if(this.T&&!this.K){t:{if(this.g){var X,de=this.g;if((X=de.g?de.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!$(X)){var G=X;break t}}G=null}if(h=G)en(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,_s(this,h);else{this.o=!1,this.s=3,Pe(12),Lt(this),Un(this);break e}}if(this.P){h=!0;let je;for(;!this.J&&this.C<N.length;)if(je=Bf(this,N),je==ps){Te==4&&(this.s=4,Pe(14),h=!1),en(this.i,this.l,null,"[Incomplete Response]");break}else if(je==Ja){this.s=4,Pe(15),en(this.i,this.l,N,"[Invalid Chunk]"),h=!1;break}else en(this.i,this.l,je,null),_s(this,je);if(Ya(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Te!=4||N.length!=0||this.h.h||(this.s=1,Pe(16),h=!1),this.o=this.o&&h,!h)en(this.i,this.l,N,"[Invalid Chunked Response]"),Lt(this),Un(this);else if(0<N.length&&!this.W){this.W=!0;var ve=this.j;ve.g==this&&ve.ba&&!ve.M&&(ve.j.info("Great, no buffering proxy detected. Bytes received: "+N.length),Es(ve),ve.M=!0,Pe(11))}}else en(this.i,this.l,N,null),_s(this,N);Te==4&&Lt(this),this.o&&!this.J&&(Te==4?Rc(this.j,this):(this.o=!1,xr(this)))}else rp(this.g),h==400&&0<N.indexOf("Unknown SID")?(this.s=3,Pe(12)):(this.s=0,Pe(13)),Lt(this),Un(this)}}}catch{}finally{}};function Ya(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function Bf(o,u){var h=o.C,p=u.indexOf(`
1610`,h);return p==-1?ps:(h=Number(u.substring(h,p)),isNaN(h)?Ja:(p+=1,p+h>u.length?ps:(u=u.slice(p,p+h),o.C=p+h,u)))}_t.prototype.cancel=function(){this.J=!0,Lt(this)};function xr(o){o.S=Date.now()+o.I,Za(o,o.I)}function Za(o,u){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Ln(w(o.ba,o),u)}function ms(o){o.B&&(c.clearTimeout(o.B),o.B=null)}_t.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(Uf(this.i,this.A),this.L!=2&&(Mn(),Pe(17)),Lt(this),this.s=2,Un(this)):Za(this,this.S-o)};function Un(o){o.j.G==0||o.J||Rc(o.j,o)}function Lt(o){ms(o);var u=o.M;u&&typeof u.ma=="function"&&u.ma(),o.M=null,ja(o.U),o.g&&(u=o.g,o.g=null,u.abort(),u.ma())}function _s(o,u){try{var h=o.j;if(h.G!=0&&(h.g==o||ys(h.h,o))){if(!o.K&&ys(h.h,o)&&h.G==3){try{var p=h.Da.g.parse(u)}catch{p=null}if(Array.isArray(p)&&p.length==3){var E=p;if(E[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)Hr(h),qr(h);else break e;Is(h),Pe(18)}}else h.za=E[1],0<h.za-h.T&&37500>E[2]&&h.F&&h.v==0&&!h.C&&(h.C=Ln(w(h.Za,h),6e3));if(1>=nc(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else Ut(h,11)}else if((o.K||h.g==o)&&Hr(h),!$(u))for(E=h.Da.g.parse(u),u=0;u<E.length;u++){let G=E[u];if(h.T=G[0],G=G[1],h.G==2)if(G[0]=="c"){h.K=G[1],h.ia=G[2];const ve=G[3];ve!=null&&(h.la=ve,h.j.info("VER="+h.la));const Te=G[4];Te!=null&&(h.Aa=Te,h.j.info("SVER="+h.Aa));const rn=G[5];rn!=null&&typeof rn=="number"&&0<rn&&(p=1.5*rn,h.L=p,h.j.info("backChannelRequestTimeoutMs_="+p)),p=h;const je=o.g;if(je){const Wr=je.g?je.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Wr){var R=p.h;R.g||Wr.indexOf("spdy")==-1&&Wr.indexOf("quic")==-1&&Wr.indexOf("h2")==-1||(R.j=R.l,R.g=new Set,R.h&&(vs(R,R.h),R.h=null))}if(p.D){const As=je.g?je.g.getResponseHeader("X-HTTP-Session-Id"):null;As&&(p.ya=As,Z(p.I,p.D,As))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),p=h;var N=o;if(p.qa=Pc(p,p.J?p.ia:null,p.W),N.K){rc(p.h,N);var X=N,de=p.L;de&&(X.I=de),X.B&&(ms(X),xr(X)),p.g=N}else Ec(p);0<h.i.length&&zr(h)}else G[0]!="stop"&&G[0]!="close"||Ut(h,7);else h.G==3&&(G[0]=="stop"||G[0]=="close"?G[0]=="stop"?Ut(h,7):ws(h):G[0]!="noop"&&h.l&&h.l.ta(G),h.v=0)}}Mn(4)}catch{}}var jf=class{constructor(o,u){this.g=o,this.map=u}};function ec(o){this.l=o||10,c.PerformanceNavigationTiming?(o=c.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function tc(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function nc(o){return o.h?1:o.g?o.g.size:0}function ys(o,u){return o.h?o.h==u:o.g?o.g.has(u):!1}function vs(o,u){o.g?o.g.add(u):o.h=u}function rc(o,u){o.h&&o.h==u?o.h=null:o.g&&o.g.has(u)&&o.g.delete(u)}ec.prototype.cancel=function(){if(this.i=ic(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const o of this.g.values())o.cancel();this.g.clear()}};function ic(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let u=o.i;for(const h of o.g.values())u=u.concat(h.D);return u}return O(o.i)}function $f(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map<"u"&&o instanceof Map||typeof Set<"u"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(l(o)){for(var u=[],h=o.length,p=0;p<h;p++)u.push(o[p]);return u}u=[],h=0;for(p in o)u[h++]=o[p];return u}function qf(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map<"u"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set<"u"&&o instanceof Set)){if(l(o)||typeof o=="string"){var u=[];o=o.length;for(var h=0;h<o;h++)u.push(h);return u}u=[],h=0;for(const p in o)u[h++]=p;return u}}}function sc(o,u){if(o.forEach&&typeof o.forEach=="function")o.forEach(u,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,u,void 0);else for(var h=qf(o),p=$f(o),E=p.length,R=0;R<E;R++)u.call(void 0,p[R],h&&h[R],o)}var oc=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function zf(o,u){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var p=o[h].indexOf("="),E=null;if(0<=p){var R=o[h].substring(0,p);E=o[h].substring(p+1)}else R=o[h];u(R,E?decodeURIComponent(E.replace(/\+/g," ")):"")}}}function xt(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof xt){this.h=o.h,Ur(this,o.j),this.o=o.o,this.g=o.g,Fr(this,o.s),this.l=o.l;var u=o.i,h=new jn;h.i=u.i,u.g&&(h.g=new Map(u.g),h.h=u.h),ac(this,h),this.m=o.m}else o&&(u=String(o).match(oc))?(this.h=!1,Ur(this,u[1]||"",!0),this.o=Fn(u[2]||""),this.g=Fn(u[3]||"",!0),Fr(this,u[4]),this.l=Fn(u[5]||"",!0),ac(this,u[6]||"",!0),this.m=Fn(u[7]||"")):(this.h=!1,this.i=new jn(null,this.h))}xt.prototype.toString=function(){var o=[],u=this.j;u&&o.push(Bn(u,cc,!0),":");var h=this.g;return(h||u=="file")&&(o.push("//"),(u=this.o)&&o.push(Bn(u,cc,!0),"@"),o.push(encodeURIComponent(String(h)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h=this.s,h!=null&&o.push(":",String(h))),(h=this.l)&&(this.g&&h.charAt(0)!="/"&&o.push("/"),o.push(Bn(h,h.charAt(0)=="/"?Wf:Kf,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",Bn(h,Qf)),o.join("")};function tt(o){return new xt(o)}function Ur(o,u,h){o.j=h?Fn(u,!0):u,o.j&&(o.j=o.j.replace(/:$/,""))}function Fr(o,u){if(u){if(u=Number(u),isNaN(u)||0>u)throw Error("Bad port number "+u);o.s=u}else o.s=null}function ac(o,u,h){u instanceof jn?(o.i=u,Jf(o.i,o.h)):(h||(u=Bn(u,Gf)),o.i=new jn(u,o.h))}function Z(o,u,h){o.i.set(u,h)}function Br(o){return Z(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Fn(o,u){return o?u?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function Bn(o,u,h){return typeof o=="string"?(o=encodeURI(o).replace(u,Hf),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function Hf(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var cc=/[#\/\?@]/g,Kf=/[#\?:]/g,Wf=/[#\?]/g,Gf=/[#\?@]/g,Qf=/#/g;function jn(o,u){this.h=this.g=null,this.i=o||null,this.j=!!u}function yt(o){o.g||(o.g=new Map,o.h=0,o.i&&zf(o.i,function(u,h){o.add(decodeURIComponent(u.replace(/\+/g," ")),h)}))}n=jn.prototype,n.add=function(o,u){yt(this),this.i=null,o=tn(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(u),this.h+=1,this};function uc(o,u){yt(o),u=tn(o,u),o.g.has(u)&&(o.i=null,o.h-=o.g.get(u).length,o.g.delete(u))}function lc(o,u){return yt(o),u=tn(o,u),o.g.has(u)}n.forEach=function(o,u){yt(this),this.g.forEach(function(h,p){h.forEach(function(E){o.call(u,E,p,this)},this)},this)},n.na=function(){yt(this);const o=Array.from(this.g.values()),u=Array.from(this.g.keys()),h=[];for(let p=0;p<u.length;p++){const E=o[p];for(let R=0;R<E.length;R++)h.push(u[p])}return h},n.V=function(o){yt(this);let u=[];if(typeof o=="string")lc(this,o)&&(u=u.concat(this.g.get(tn(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)u=u.concat(o[h])}return u},n.set=function(o,u){return yt(this),this.i=null,o=tn(this,o),lc(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[u]),this.h+=1,this},n.get=function(o,u){return o?(o=this.V(o),0<o.length?String(o[0]):u):u};function hc(o,u,h){uc(o,u),0<h.length&&(o.i=null,o.g.set(tn(o,u),O(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],u=Array.from(this.g.keys());for(var h=0;h<u.length;h++){var p=u[h];const R=encodeURIComponent(String(p)),N=this.V(p);for(p=0;p<N.length;p++){var E=R;N[p]!==""&&(E+="="+encodeURIComponent(String(N[p]))),o.push(E)}}return this.i=o.join("&")};function tn(o,u){return u=String(u),o.j&&(u=u.toLowerCase()),u}function Jf(o,u){u&&!o.j&&(yt(o),o.i=null,o.g.forEach(function(h,p){var E=p.toLowerCase();p!=E&&(uc(this,p),hc(this,E,h))},o)),o.j=u}function Xf(o,u){const h=new xn;if(c.Image){const p=new Image;p.onload=b(vt,h,"TestLoadImage: loaded",!0,u,p),p.onerror=b(vt,h,"TestLoadImage: error",!1,u,p),p.onabort=b(vt,h,"TestLoadImage: abort",!1,u,p),p.ontimeout=b(vt,h,"TestLoadImage: timeout",!1,u,p),c.setTimeout(function(){p.ontimeout&&p.ontimeout()},1e4),p.src=o}else u(!1)}function Yf(o,u){const h=new xn,p=new AbortController,E=setTimeout(()=>{p.abort(),vt(h,"TestPingServer: timeout",!1,u)},1e4);fetch(o,{signal:p.signal}).then(R=>{clearTimeout(E),R.ok?vt(h,"TestPingServer: ok",!0,u):vt(h,"TestPingServer: server error",!1,u)}).catch(()=>{clearTimeout(E),vt(h,"TestPingServer: error",!1,u)})}function vt(o,u,h,p,E){try{E&&(E.onload=null,E.onerror=null,E.onabort=null,E.ontimeout=null),p(h)}catch{}}function Zf(){this.g=new Mf}function ep(o,u,h){const p=h||"";try{sc(o,function(E,R){let N=E;d(E)&&(N=us(E)),u.push(p+R+"="+encodeURIComponent(N))})}catch(E){throw u.push(p+"type="+encodeURIComponent("_badmap")),E}}function $n(o){this.l=o.Ub||null,this.j=o.eb||!1}k($n,ls),$n.prototype.g=function(){return new jr(this.l,this.j)},$n.prototype.i=function(o){return function(){return o}}({});function jr(o,u){ye.call(this),this.D=o,this.o=u,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}k(jr,ye),n=jr.prototype,n.open=function(o,u){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=u,this.readyState=1,zn(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const u={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(u.body=o),(this.D||c).fetch(new Request(this.A,u)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,qn(this)),this.readyState=0},n.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,zn(this)),this.g&&(this.readyState=3,zn(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in o){if(this.j=o.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;dc(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function dc(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}n.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var u=o.value?o.value:new Uint8Array(0);(u=this.v.decode(u,{stream:!o.done}))&&(this.response=this.responseText+=u)}o.done?qn(this):zn(this),this.readyState==3&&dc(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,qn(this))},n.Qa=function(o){this.g&&(this.response=o,qn(this))},n.ga=function(){this.g&&qn(this)};function qn(o){o.readyState=4,o.l=null,o.j=null,o.v=null,zn(o)}n.setRequestHeader=function(o,u){this.u.append(o,u)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],u=this.h.entries();for(var h=u.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=u.next();return o.join(`\r
1611`)};function zn(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(jr.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function fc(o){let u="";return Y(o,function(h,p){u+=p,u+=":",u+=h,u+=`\r
1612`}),u}function Ts(o,u,h){e:{for(p in h){var p=!1;break e}p=!0}p||(h=fc(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):Z(o,u,h))}function ne(o){ye.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}k(ne,ye);var tp=/^https?$/i,np=["POST","PUT"];n=ne.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,u,h,p){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);u=u?u.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():fs.g(),this.v=this.o?$a(this.o):$a(fs),this.g.onreadystatechange=w(this.Ea,this);try{this.B=!0,this.g.open(u,String(o),!0),this.B=!1}catch(R){pc(this,R);return}if(o=h||"",h=new Map(this.headers),p)if(Object.getPrototypeOf(p)===Object.prototype)for(var E in p)h.set(E,p[E]);else if(typeof p.keys=="function"&&typeof p.get=="function")for(const R of p.keys())h.set(R,p.get(R));else throw Error("Unknown input type for opt_headers: "+String(p));p=Array.from(h.keys()).find(R=>R.toLowerCase()=="content-type"),E=c.FormData&&o instanceof c.FormData,!(0<=Array.prototype.indexOf.call(np,u,void 0))||p||E||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[R,N]of h)this.g.setRequestHeader(R,N);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{_c(this),this.u=!0,this.g.send(o),this.u=!1}catch(R){pc(this,R)}};function pc(o,u){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=u,o.m=5,gc(o),$r(o)}function gc(o){o.A||(o.A=!0,Se(o,"complete"),Se(o,"error"))}n.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,Se(this,"complete"),Se(this,"abort"),$r(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),$r(this,!0)),ne.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?mc(this):this.bb())},n.bb=function(){mc(this)};function mc(o){if(o.h&&typeof a<"u"&&(!o.v[1]||nt(o)!=4||o.Z()!=2)){if(o.u&&nt(o)==4)Ua(o.Ea,0,o);else if(Se(o,"readystatechange"),nt(o)==4){o.h=!1;try{const N=o.Z();e:switch(N){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var u=!0;break e;default:u=!1}var h;if(!(h=u)){var p;if(p=N===0){var E=String(o.D).match(oc)[1]||null;!E&&c.self&&c.self.location&&(E=c.self.location.protocol.slice(0,-1)),p=!tp.test(E?E.toLowerCase():"")}h=p}if(h)Se(o,"complete"),Se(o,"success");else{o.m=6;try{var R=2<nt(o)?o.g.statusText:""}catch{R=""}o.l=R+" ["+o.Z()+"]",gc(o)}}finally{$r(o)}}}}function $r(o,u){if(o.g){_c(o);const h=o.g,p=o.v[0]?()=>{}:null;o.g=null,o.v=null,u||Se(o,"ready");try{h.onreadystatechange=p}catch{}}}function _c(o){o.I&&(c.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function nt(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<nt(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(o){if(this.g){var u=this.g.responseText;return o&&u.indexOf(o)==0&&(u=u.substring(o.length)),Vf(u)}};function yc(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function rp(o){const u={};o=(o.g&&2<=nt(o)&&o.g.getAllResponseHeaders()||"").split(`\r
1613`);for(let p=0;p<o.length;p++){if($(o[p]))continue;var h=I(o[p]);const E=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const R=u[E]||[];u[E]=R,R.push(h)}T(u,function(p){return p.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Hn(o,u,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||u}function vc(o){this.Aa=0,this.i=[],this.j=new xn,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=Hn("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Hn("baseRetryDelayMs",5e3,o),this.cb=Hn("retryDelaySeedMs",1e4,o),this.Wa=Hn("forwardChannelMaxRetries",2,o),this.wa=Hn("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new ec(o&&o.concurrentRequestLimit),this.Da=new Zf,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=vc.prototype,n.la=8,n.G=1,n.connect=function(o,u,h,p){Pe(0),this.W=o,this.H=u||{},h&&p!==void 0&&(this.H.OSID=h,this.H.OAID=p),this.F=this.X,this.I=Pc(this,null,this.W),zr(this)};function ws(o){if(Tc(o),o.G==3){var u=o.U++,h=tt(o.I);if(Z(h,"SID",o.K),Z(h,"RID",u),Z(h,"TYPE","terminate"),Kn(o,h),u=new _t(o,o.j,u),u.L=2,u.v=Br(tt(h)),h=!1,c.navigator&&c.navigator.sendBeacon)try{h=c.navigator.sendBeacon(u.v.toString(),"")}catch{}!h&&c.Image&&(new Image().src=u.v,h=!0),h||(u.g=Cc(u.j,null),u.g.ea(u.v)),u.F=Date.now(),xr(u)}Sc(o)}function qr(o){o.g&&(Es(o),o.g.cancel(),o.g=null)}function Tc(o){qr(o),o.u&&(c.clearTimeout(o.u),o.u=null),Hr(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&c.clearTimeout(o.s),o.s=null)}function zr(o){if(!tc(o.h)&&!o.s){o.s=!0;var u=o.Ga;kn||Oa(),Nn||(kn(),Nn=!0),ts.add(u,o),o.B=0}}function ip(o,u){return nc(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=u.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Ln(w(o.Ga,o,u),bc(o,o.B)),o.B++,!0)}n.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;const E=new _t(this,this.j,o);let R=this.o;if(this.S&&(R?(R=g(R),v(R,this.S)):R=this.S),this.m!==null||this.O||(E.H=R,R=null),this.P)e:{for(var u=0,h=0;h<this.i.length;h++){t:{var p=this.i[h];if("__data__"in p.map&&(p=p.map.__data__,typeof p=="string")){p=p.length;break t}p=void 0}if(p===void 0)break;if(u+=p,4096<u){u=h;break e}if(u===4096||h===this.i.length-1){u=h+1;break e}}u=1e3}else u=1e3;u=Ic(this,E,u),h=tt(this.I),Z(h,"RID",o),Z(h,"CVER",22),this.D&&Z(h,"X-HTTP-Session-Id",this.D),Kn(this,h),R&&(this.O?u="headers="+encodeURIComponent(String(fc(R)))+"&"+u:this.m&&Ts(h,this.m,R)),vs(this.h,E),this.Ua&&Z(h,"TYPE","init"),this.P?(Z(h,"$req",u),Z(h,"SID","null"),E.T=!0,gs(E,h,null)):gs(E,h,u),this.G=2}}else this.G==3&&(o?wc(this,o):this.i.length==0||tc(this.h)||wc(this))};function wc(o,u){var h;u?h=u.l:h=o.U++;const p=tt(o.I);Z(p,"SID",o.K),Z(p,"RID",h),Z(p,"AID",o.T),Kn(o,p),o.m&&o.o&&Ts(p,o.m,o.o),h=new _t(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),u&&(o.i=u.D.concat(o.i)),u=Ic(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),vs(o.h,h),gs(h,p,u)}function Kn(o,u){o.H&&Y(o.H,function(h,p){Z(u,p,h)}),o.l&&sc({},function(h,p){Z(u,p,h)})}function Ic(o,u,h){h=Math.min(o.i.length,h);var p=o.l?w(o.l.Na,o.l,o):null;e:{var E=o.i;let R=-1;for(;;){const N=["count="+h];R==-1?0<h?(R=E[0].g,N.push("ofs="+R)):R=0:N.push("ofs="+R);let X=!0;for(let de=0;de<h;de++){let G=E[de].g;const ve=E[de].map;if(G-=R,0>G)R=Math.max(0,E[de].g-100),X=!1;else try{ep(ve,N,"req"+G+"_")}catch{p&&p(ve)}}if(X){p=N.join("&");break e}}}return o=o.i.splice(0,h),u.D=o,p}function Ec(o){if(!o.g&&!o.u){o.Y=1;var u=o.Fa;kn||Oa(),Nn||(kn(),Nn=!0),ts.add(u,o),o.v=0}}function Is(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Ln(w(o.Fa,o),bc(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,Ac(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=Ln(w(this.ab,this),o)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Pe(10),qr(this),Ac(this))};function Es(o){o.A!=null&&(c.clearTimeout(o.A),o.A=null)}function Ac(o){o.g=new _t(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var u=tt(o.qa);Z(u,"RID","rpc"),Z(u,"SID",o.K),Z(u,"AID",o.T),Z(u,"CI",o.F?"0":"1"),!o.F&&o.ja&&Z(u,"TO",o.ja),Z(u,"TYPE","xmlhttp"),Kn(o,u),o.m&&o.o&&Ts(u,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=Br(tt(u)),h.m=null,h.P=!0,Xa(h,o)}n.Za=function(){this.C!=null&&(this.C=null,qr(this),Is(this),Pe(19))};function Hr(o){o.C!=null&&(c.clearTimeout(o.C),o.C=null)}function Rc(o,u){var h=null;if(o.g==u){Hr(o),Es(o),o.g=null;var p=2}else if(ys(o.h,u))h=u.D,rc(o.h,u),p=1;else return;if(o.G!=0){if(u.o)if(p==1){h=u.m?u.m.length:0,u=Date.now()-u.F;var E=o.B;p=Vr(),Se(p,new Wa(p,h)),zr(o)}else Ec(o);else if(E=u.s,E==3||E==0&&0<u.X||!(p==1&&ip(o,u)||p==2&&Is(o)))switch(h&&0<h.length&&(u=o.h,u.i=u.i.concat(h)),E){case 1:Ut(o,5);break;case 4:Ut(o,10);break;case 3:Ut(o,6);break;default:Ut(o,2)}}}function bc(o,u){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*u}function Ut(o,u){if(o.j.info("Error code "+u),u==2){var h=w(o.fb,o),p=o.Xa;const E=!p;p=new xt(p||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||Ur(p,"https"),Br(p),E?Xf(p.toString(),h):Yf(p.toString(),h)}else Pe(2);o.G=0,o.l&&o.l.sa(u),Sc(o),Tc(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),Pe(2)):(this.j.info("Failed to ping google.com"),Pe(1))};function Sc(o){if(o.G=0,o.ka=[],o.l){const u=ic(o.h);(u.length!=0||o.i.length!=0)&&(C(o.ka,u),C(o.ka,o.i),o.h.i.length=0,O(o.i),o.i.length=0),o.l.ra()}}function Pc(o,u,h){var p=h instanceof xt?tt(h):new xt(h);if(p.g!="")u&&(p.g=u+"."+p.g),Fr(p,p.s);else{var E=c.location;p=E.protocol,u=u?u+"."+E.hostname:E.hostname,E=+E.port;var R=new xt(null);p&&Ur(R,p),u&&(R.g=u),E&&Fr(R,E),h&&(R.l=h),p=R}return h=o.D,u=o.ya,h&&u&&Z(p,h,u),Z(p,"VER",o.la),Kn(o,p),p}function Cc(o,u,h){if(u&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return u=o.Ca&&!o.pa?new ne(new $n({eb:h})):new ne(o.pa),u.Ha(o.J),u}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function kc(){}n=kc.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Kr(){}Kr.prototype.g=function(o,u){return new Le(o,u)};function Le(o,u){ye.call(this),this.g=new vc(u),this.l=o,this.h=u&&u.messageUrlParams||null,o=u&&u.messageHeaders||null,u&&u.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=u&&u.initMessageHeaders||null,u&&u.messageContentType&&(o?o["X-WebChannel-Content-Type"]=u.messageContentType:o={"X-WebChannel-Content-Type":u.messageContentType}),u&&u.va&&(o?o["X-WebChannel-Client-Profile"]=u.va:o={"X-WebChannel-Client-Profile":u.va}),this.g.S=o,(o=u&&u.Sb)&&!$(o)&&(this.g.m=o),this.v=u&&u.supportsCrossDomainXhr||!1,this.u=u&&u.sendRawJson||!1,(u=u&&u.httpSessionIdParam)&&!$(u)&&(this.g.D=u,o=this.h,o!==null&&u in o&&(o=this.h,u in o&&delete o[u])),this.j=new nn(this)}k(Le,ye),Le.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Le.prototype.close=function(){ws(this.g)},Le.prototype.o=function(o){var u=this.g;
1613if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=us(o),o=h);u.i.push(new jf(u.Ya++,o)),u.G==3&&zr(u)},Le.prototype.N=function(){this.g.l=null,delete this.j,ws(this.g),delete this.g,Le.aa.N.call(this)};function Nc(o){hs.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var u=o.__sm__;if(u){e:{for(const h in u){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,u=u!==null&&o in u?u[o]:void 0),this.data=u}else this.data=o}k(Nc,hs);function Dc(){ds.call(this),this.status=1}k(Dc,ds);function nn(o){this.g=o}k(nn,kc),nn.prototype.ua=function(){Se(this.g,"a")},nn.prototype.ta=function(o){Se(this.g,new Nc(o))},nn.prototype.sa=function(o){Se(this.g,new Dc)},nn.prototype.ra=function(){Se(this.g,"b")},Kr.prototype.createWebChannel=Kr.prototype.g,Le.prototype.send=Le.prototype.o,Le.prototype.open=Le.prototype.m,Le.prototype.close=Le.prototype.close,fh=function(){return new Kr},dh=function(){return Vr()},hh=Mt,no={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},Mr.NO_ERROR=0,Mr.TIMEOUT=8,Mr.HTTP_ERROR=6,oi=Mr,Ga.COMPLETE="complete",lh=Ga,qa.EventType=Vn,Vn.OPEN="a",Vn.CLOSE="b",Vn.ERROR="c",Vn.MESSAGE="d",ye.prototype.listen=ye.prototype.K,Qn=qa,uh=$n,ne.prototype.listenOnce=ne.prototype.L,ne.prototype.getLastError=ne.prototype.Ka,ne.prototype.getLastErrorCode=ne.prototype.Ba,ne.prototype.getStatus=ne.prototype.Z,ne.prototype.getResponseJson=ne.prototype.Oa,ne.prototype.getResponseText=ne.prototype.oa,ne.prototype.send=ne.prototype.ea,ne.prototype.setWithCredentials=ne.prototype.Ha,ch=ne}).apply(typeof Qr<"u"?Qr:typeof self<"u"?self:typeof window<"u"?window:{});const hu="@firebase/firestore";/**
1614 * @license
1615 * Copyright 2017 Google LLC
1616 *
1617 * Licensed under the Apache License, Version 2.0 (the "License");
1618 * you may not use this file except in compliance with the License.
1619 * You may obtain a copy of the License at
1620 *
1621 *   http://www.apache.org/licenses/LICENSE-2.0
1622 *
1623 * Unless required by applicable law or agreed to in writing, software
1624 * distributed under the License is distributed on an "AS IS" BASIS,
1625 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1626 * See the License for the specific language governing permissions and
1627 * limitations under the License.
1628 */class Ie{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}}Ie.UNAUTHENTICATED=new Ie(null),Ie.GOOGLE_CREDENTIALS=new Ie("google-credentials-uid"),Ie.FIRST_PARTY=new Ie("first-party-uid"),Ie.MOCK_USER=new Ie("mock-user");/**
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 */let An="10.13.1";/**
1644 * @license
1645 * Copyright 2017 Google LLC
1646 *
1647 * Licensed under the Apache License, Version 2.0 (the "License");
1648 * you may not use this file except in compliance with the License.
1649 * You may obtain a copy of the License at
1650 *
1651 *   http://www.apache.org/licenses/LICENSE-2.0
1652 *
1653 * Unless required by applicable law or agreed to in writing, software
1654 * distributed under the License is distributed on an "AS IS" BASIS,
1655 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1656 * See the License for the specific language governing permissions and
1657 * limitations under the License.
1658 */const Ht=new Ni("@firebase/firestore");function Wn(){return Ht.logLevel}function V(n,...e){if(Ht.logLevel<=H.DEBUG){const t=e.map(Mo);Ht.debug(`Firestore (${An}): ${n}`,...t)}}function ft(n,...e){if(Ht.logLevel<=H.ERROR){const t=e.map(Mo);Ht.error(`Firestore (${An}): ${n}`,...t)}}function fn(n,...e){if(Ht.logLevel<=H.WARN){const t=e.map(Mo);Ht.warn(`Firestore (${An}): ${n}`,...t)}}function Mo(n){if(typeof n=="string")return n;try{/**
1659* @license
1660* Copyright 2020 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*/return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
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 */function x(n="Unexpected state"){const e=`FIRESTORE (${An}) INTERNAL ASSERTION FAILED: `+n;throw ft(e),new Error(e)}function J(n,e){n||x()}function U(n,e){return n}/**
1689 * @license
1690 * Copyright 2017 Google LLC
1691 *
1692 * Licensed under the Apache License, Version 2.0 (the "License");
1693 * you may not use this file except in compliance with the License.
1694 * You may obtain a copy of the License at
1695 *
1696 *   http://www.apache.org/licenses/LICENSE-2.0
1697 *
1698 * Unless required by applicable law or agreed to in writing, software
1699 * distributed under the License is distributed on an "AS IS" BASIS,
1700 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1701 * See the License for the specific language governing permissions and
1702 * limitations under the License.
1703 */const S={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 Be{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
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 We{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
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 ph{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class X_{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Ie.UNAUTHENTICATED))}shutdown(){}}class Y_{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 Z_{constructor(e){this.t=e,this.currentUser=Ie.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let r=this.i;const i=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let s=new We;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new We,e.enqueueRetryable(()=>i(this.currentUser))};const a=()=>{const l=s;e.enqueueRetryable(async()=>{await l.promise,await i(this.currentUser)})},c=l=>{V("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.auth.addAuthTokenListener(this.o),a()};this.t.onInit(l=>c(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(V("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=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?(V("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(J(typeof r.accessToken=="string"),new ph(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return J(e===null||typeof e=="string"),new Ie(e)}}class ey{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=Ie.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 ty{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new ey(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(Ie.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class ny{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 ry{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const r=s=>{s.error!=null&&V("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const a=s.token!==this.R;return this.R=s.token,V("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{V("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):V("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(J(typeof t.token=="string"),this.R=t.token,new ny(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
1734 * @license
1735 * Copyright 2020 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 */function iy(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}/**
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 gh{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const i=iy(40);for(let s=0;s<i.length;++s)r.length<20&&i[s]<t&&(r+=e.charAt(i[s]%e.length))}return r}}function Q(n,e){return n<e?-1:n>e?1:0}function pn(n,e,t){return n.length===e.length&&n.every((r,i)=>t(r,e[i]))}/**
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 ce{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new D(S.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new D(S.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new D(S.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new D(S.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ce.fromMillis(Date.now())}static fromDate(e){return ce.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new ce(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Q(this.nanoseconds,e.nanoseconds):Q(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")}}/**
1779 * @license
1780 * Copyright 2017 Google LLC
1781 *
1782 * Licensed under the Apache License, Version 2.0 (the "License");
1783 * you may not use this file except in compliance with the License.
1784 * You may obtain a copy of the License at
1785 *
1786 *   http://www.apache.org/licenses/LICENSE-2.0
1787 *
1788 * Unless required by applicable law or agreed to in writing, software
1789 * distributed under the License is distributed on an "AS IS" BASIS,
1790 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1791 * See the License for the specific language governing permissions and
1792 * limitations under the License.
1793 */class B{constructor(e){this.timestamp=e}static fromTimestamp(e){return new B(e)}static min(){return new B(new ce(0,0))}static max(){return new B(new ce(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
1794 * @license
1795 * Copyright 2017 Google LLC
1796 *
1797 * Licensed under the Apache License, Version 2.0 (the "License");
1798 * you may not use this file except in compliance with the License.
1799 * You may obtain a copy of the License at
1800 *
1801 *   http://www.apache.org/licenses/LICENSE-2.0
1802 *
1803 * Unless required by applicable law or agreed to in writing, software
1804 * distributed under the License is distributed on an "AS IS" BASIS,
1805 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1806 * See the License for the specific language governing permissions and
1807 * limitations under the License.
1808 */class cr{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 cr.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof cr?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 s=e.get(i),a=t.get(i);if(s<a)return-1;if(s>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ee extends cr{construct(e,t,r){return new ee(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new D(S.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(i=>i.length>0))}return new ee(t)}static emptyPath(){return new ee([])}}const sy=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class pe extends cr{construct(e,t,r){return new pe(e,t,r)}static isValidIdentifier(e){return sy.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),pe.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new pe(["__name__"])}static fromServerFormat(e){const t=[];let r="",i=0;const s=()=>
1808{if(r.length===0)throw new D(S.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 c=e[i];if(c==="\\"){if(i+1===e.length)throw new D(S.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[i+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new D(S.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,i+=2}else c==="`"?(a=!a,i++):c!=="."||a?(r+=c,i++):(s(),i++)}if(s(),a)throw new D(S.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new pe(t)}static emptyPath(){return new pe([])}}/**
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 M{constructor(e){this.path=e}static fromPath(e){return new M(ee.fromString(e))}static fromName(e){return new M(ee.fromString(e).popFirst(5))}static empty(){return new M(ee.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&ee.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ee.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new M(new ee(e.slice()))}}function oy(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,i=B.fromTimestamp(r===1e9?new ce(t+1,0):new ce(t,r));return new kt(i,M.empty(),e)}function ay(n){return new kt(n.readTime,n.key,-1)}class kt{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new kt(B.min(),M.empty(),-1)}static max(){return new kt(B.max(),M.empty(),-1)}}function cy(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=M.comparator(n.documentKey,e.documentKey),t!==0?t:Q(n.largestBatchId,e.largestBatchId))}/**
1824 * @license
1825 * Copyright 2020 Google LLC
1826 *
1827 * Licensed under the Apache License, Version 2.0 (the "License");
1828 * you may not use this file except in compliance with the License.
1829 * You may obtain a copy of the License at
1830 *
1831 *   http://www.apache.org/licenses/LICENSE-2.0
1832 *
1833 * Unless required by applicable law or agreed to in writing, 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 */const uy="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class ly{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
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 */async function wr(n){if(n.code!==S.FAILED_PRECONDITION||n.message!==uy)throw n;V("LocalStore","Unexpectedly lost primary lease")}/**
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 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=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(t,s).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,s=0,a=!1;e.forEach(c=>{++i,c.next(()=>{++s,a&&s===i&&t()},l=>r(l))}),a=!0,s===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,s)=>{r.push(t.call(this,i,s))}),this.waitFor(r)}static mapArray(e,t){return new P((r,i)=>{const s=e.length,a=new Array(s);let c=0;for(let l=0;l<s;l++){const d=l;t(e[d]).next(f=>{a[d]=f,++c,c===s&&r(a)},f=>i(f))}})}static doWhile(e,t){return new P((r,i)=>{const s=()=>{e()===!0?t().next(()=>{s()},i):r()};s()})}}function hy(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function Ir(n){return n.name==="IndexedDbTransactionError"}/**
1869 * @license
1870 * Copyright 2018 Google LLC
1871 *
1872 * Licensed under the Apache License, Version 2.0 (the "License");
1873 * you may not use this file except in compliance with the License.
1874 * You may obtain a copy of the License at
1875 *
1876 *   http://www.apache.org/licenses/LICENSE-2.0
1877 *
1878 * Unless required by applicable law or agreed to in writing, software
1879 * distributed under the License is distributed on an "AS IS" BASIS,
1880 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1881 * See the License for the specific language governing permissions and
1882 * limitations under the License.
1883 */class Lo{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}}Lo.oe=-1;function Mi(n){return n==null}function vi(n){return n===0&&1/n==-1/0}function dy(n){return typeof n=="number"&&Number.isInteger(n)&&!vi(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
1884 * @license
1885 * Copyright 2017 Google LLC
1886 *
1887 * Licensed under the Apache License, Version 2.0 (the "License");
1888 * you may not use this file except in compliance with the License.
1889 * You may obtain a copy of the License at
1890 *
1891 *   http://www.apache.org/licenses/LICENSE-2.0
1892 *
1893 * Unless required by applicable law or agreed to in writing, software
1894 * distributed under the License is distributed on an "AS IS" BASIS,
1895 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1896 * See the License for the specific language governing permissions and
1897 * limitations under the License.
1898 */function du(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function Yt(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function fy(n,e){const t=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.push(e(n[r],r,n));return t}function mh(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
1899 * @license
1900 * Copyright 2017 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 te{constructor(e,t){this.comparator=e,this.root=t||fe.EMPTY}insert(e,t){return new te(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,fe.BLACK,null,null))}remove(e){return new te(this.comparator,this.root.remove(e,this.comparator).copy(null,null,fe.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 Jr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Jr(this.root,e,this.comparator,!1)}getReverseIterator(){return new Jr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Jr(this.root,e,this.comparator,!0)}}
1913class Jr{constructor(e,t,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?r(e.key,t):1,t&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===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 fe{constructor(e,t,r,i,s){this.key=e,this.value=t,this.color=r??fe.RED,this.left=i??fe.EMPTY,this.right=s??fe.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,i,s){return new fe(e??this.key,t??this.value,r??this.color,i??this.left,s??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 s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,t,r),null):s===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 fe.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 fe.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,fe.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,fe.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)}}fe.EMPTY=null,fe.RED=!0,fe.BLACK=!1;fe.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,s){return this}insert(e,t,r){return new fe(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}};/**
1914 * @license
1915 * Copyright 2017 Google LLC
1916 *
1917 * Licensed under the Apache License, Version 2.0 (the "License");
1918 * you may not use this file except in compliance with the License.
1919 * You may obtain a copy of the License at
1920 *
1921 *   http://www.apache.org/licenses/LICENSE-2.0
1922 *
1923 * Unless required by applicable law or agreed to in writing, softw
1923are
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 ge{constructor(e){this.comparator=e,this.data=new te(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const 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 fu(this.data.getIterator())}getIteratorFrom(e){return new fu(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 ge)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const i=t.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==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 ge(this.comparator);return t.data=e,t}}class fu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
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 */class xe{constructor(e){this.fields=e,e.sort(pe.comparator)}static empty(){return new xe([])}unionWith(e){let t=new ge(pe.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new xe(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return pn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
1944 * @license
1945 * Copyright 2023 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 _h extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
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 */class me{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new _h("Invalid base64 string: "+s):s}}(e);return new me(t)}static fromUint8Array(e){const t=function(i){let s="";for(let a=0;a<i.length;++a)s+=String.fromCharCode(i[a]);return s}(e);return new me(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(t){return btoa(t)}(this.binaryString)}
1973toUint8Array(){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 Q(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}me.EMPTY_BYTE_STRING=new me("");const py=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Nt(n){if(J(!!n),typeof n=="string"){let e=0;const t=py.exec(n);if(J(!!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:se(n.seconds),nanos:se(n.nanos)}}function se(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Kt(n){return typeof n=="string"?me.fromBase64String(n):me.fromUint8Array(n)}/**
1974 * @license
1975 * Copyright 2020 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 */function xo(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 Uo(n){const e=n.mapValue.fields.__previous_value__;return xo(e)?Uo(e):e}function ur(n){const e=Nt(n.mapValue.fields.__local_write_time__.timestampValue);return new ce(e.seconds,e.nanos)}/**
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 gy{constructor(e,t,r,i,s,a,c,l,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=i,this.ssl=s,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d}}class lr{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new lr("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof lr&&e.projectId===this.projectId&&e.database===this.database}}/**
2004 * @license
2005 * Copyright 2020 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 */const Xr={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Wt(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?xo(n)?4:_y(n)?9007199254740991:my(n)?10:11:x()}function Xe(n,e){if(n===e)return!0;const t=Wt(n);if(t!==Wt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return ur(n).isEqual(ur(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const a=Nt(i.timestampValue),c=Nt(s.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(i,s){return Kt(i.bytesValue).isEqual(Kt(s.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(i,s){return se(i.geoPointValue.latitude)===se(s.geoPointValue.latitude)&&se(i.geoPointValue.longitude)===se(s.geoPointValue.longitude)}(n,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return se(i.integerValue)===se(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const a=se(i.doubleValue),c=se(s.doubleValue);return a===c?vi(a)===vi(c):isNaN(a)&&isNaN(c)}return!1}(n,e);case 9:return pn(n.arrayValue.values||[],e.arrayValue.values||[],Xe);case 10:case 11:return function(i,s){const a=i.mapValue.fields||{},c=s.mapValue.fields||{};if(du(a)!==du(c))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(c[l]===void 0||!Xe(a[l],c[l])))return!1;return!0}(n,e);default:return x()}}function hr(n,e){return(n.values||[]).find(t=>Xe(t,e))!==void 0}function gn(n,e){if(n===e)return 0;const t=Wt(n),r=Wt(e);if(t!==r)return Q(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return Q(n.booleanValue,e.booleanValue);case 2:return function(s,a){const c=se(s.integerValue||s.doubleValue),l=se(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1}(n,e);case 3:return pu(n.timestampValue,e.timestampValue);case 4:return pu(ur(n),ur(e));case 5:return Q(n.stringValue,e.stringValue);case 6:return function(s,a){const c=Kt(s),l=Kt(a);return c.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(s,a){const c=s.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const f=Q(c[d],l[d]);if(f!==0)return f}return Q(c.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(s,a){const c=Q(se(s.latitude),se(a.latitude));return c!==0?c:Q(se(s.longitude),se(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return gu(n.arrayValue,e.arrayValue);case 10:return function(s,a){var c,l,d,f;const y=s.fields||{},w=a.fields||{},b=(c=y.value)===null||c===void 0?void 0:c.arrayValue,k=(l=w.value)===null||l===void 0?void 0:l.arrayValue,O=Q(((d=b==null?void 0:b.values)===null||d===void 0?void 0:d.length)||0,((f=k==null?void 0:k.values)===null||f===void 0?void 0:f.length)||0);return O!==0?O:gu(b,k)}(n.mapValue,e.mapValue);case 11:return function(s,a){if(s===Xr.mapValue&&a===Xr.mapValue)return 0;if(s===Xr.mapValue)return 1;if(a===Xr.mapValue)return-1;const c=s.fields||{},l=Object.keys(c),d=a.fields||{},f=Object.keys(d);l.sort(),f.sort();for(let y=0;y<l.length&&y<f.length;++y){const w=Q(l[y],f[y]);if(w!==0)return w;const b=gn(c[l[y]],d[f[y]]);if(b!==0)return b}return Q(l.length,f.length)}(n.mapValue,e.mapValue);default:throw x()}}function pu(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return Q(n,e);const t=Nt(n),r=Nt(e),i=Q(t.seconds,r.seconds);return i!==0?i:Q(t.nanos,r.nanos)}function gu(n,e){const t=n.values||[],r=e.values||[];for(let i=0;i<t.length&&i<r.length;++i){const s=gn(t[i],r[i]);if(s)return s}return Q(t.length,r.length)}function mn(n){return ro(n)}function ro(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const r=Nt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Kt(t).toBase64()}
2018(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 s of t.values||[])i?i=!1:r+=",",r+=ro(s);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let i="{",s=!0;for(const a of r)s?s=!1:i+=",",i+=`${a}:${ro(t.fields[a])}`;return i+"}"}(n.mapValue):x()}function mu(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function io(n){return!!n&&"integerValue"in n}function Fo(n){return!!n&&"arrayValue"in n}function _u(n){return!!n&&"nullValue"in n}function yu(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function ai(n){return!!n&&"mapValue"in n}function my(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 er(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 Yt(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=er(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=er(n.arrayValue.values[t]);return e}return Object.assign({},n)}function _y(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
2019 * @license
2020 * Copyright 2017 Google LLC
2021 *
2022 * Licensed under the Apache License, Version 2.0 (the "License");
2023 * you may not use this file except in compliance with the License.
2024 * You may obtain a copy of the License at
2025 *
2026 *   http://www.apache.org/licenses/LICENSE-2.0
2027 *
2028 * Unless required by applicable law or agreed to in writing, software
2029 * distributed under the License is distributed on an "AS IS" BASIS,
2030 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2031 * See the License for the specific language governing permissions and
2032 * limitations under the License.
2033 */class Oe{constructor(e){this.value=e}static empty(){return new Oe({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)],!ai(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=er(t)}setAll(e){let t=pe.emptyPath(),r={},i=[];e.forEach((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,i),r={},i=[],t=c.popLast()}a?r[c.lastSegment()]=er(a):i.push(c.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,r,i)}delete(e){const t=this.field(e.popLast());ai(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Xe(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)];ai(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,r){Yt(t,(i,s)=>e[i]=s);for(const i of r)delete e[i]}clone(){return new Oe(er(this.value))}}function yh(n){const e=[];return Yt(n.fields,(t,r)=>{const i=new pe([t]);if(ai(r)){const s=yh(r.mapValue).fields;
2033if(s.length===0)e.push(i);else for(const a of s)e.push(i.child(a))}else e.push(i)}),new xe(e)}/**
2034 * @license
2035 * Copyright 2017 Google LLC
2036 *
2037 * Licensed under the Apache License, Version 2.0 (the "License");
2038 * you may not use this file except in compliance with the License.
2039 * You may obtain a copy of the License at
2040 *
2041 *   http://www.apache.org/licenses/LICENSE-2.0
2042 *
2043 * Unless required by applicable law or agreed to in writing, software
2044 * distributed under the License is distributed on an "AS IS" BASIS,
2045 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2046 * See the License for the specific language governing permissions and
2047 * limitations under the License.
2048 */class Ee{constructor(e,t,r,i,s,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=i,this.createTime=s,this.data=a,this.documentState=c}static newInvalidDocument(e){return new Ee(e,0,B.min(),B.min(),B.min(),Oe.empty(),0)}static newFoundDocument(e,t,r,i){return new Ee(e,1,t,B.min(),r,i,0)}static newNoDocument(e,t){return new Ee(e,2,t,B.min(),B.min(),Oe.empty(),0)}static newUnknownDocument(e,t){return new Ee(e,3,t,B.min(),B.min(),Oe.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(B.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=Oe.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Oe.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=B.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 Ee&&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 Ee(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}})`}}/**
2049 * @license
2050 * Copyright 2022 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 Ti{constructor(e,t){this.position=e,this.inclusive=t}}function vu(n,e,t){let r=0;for(let i=0;i<n.position.length;i++){const s=e[i],a=n.position[i];if(s.field.isKeyField()?r=M.comparator(M.fromName(a.referenceValue),t.key):r=gn(a,t.data.field(s.field)),s.dir==="desc"&&(r*=-1),r!==0)break}return r}function Tu(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(!Xe(n.position[t],e.position[t]))return!1;return!0}/**
2064 * @license
2065 * Copyright 2022 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, softw
2073are
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 dr{constructor(e,t="asc"){this.field=e,this.dir=t}}function yy(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
2079 * @license
2080 * Copyright 2022 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 vh{}class ae extends vh{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 Ty(e,t,r):t==="array-contains"?new Ey(e,r):t==="in"?new Ay(e,r):t==="not-in"?new Ry(e,r):t==="array-contains-any"?new by(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new wy(e,r):new Iy(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(gn(t,this.value)):t!==null&&Wt(this.value)===Wt(t)&&this.matchesComparison(gn(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 ze extends vh{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new ze(e,t)}matches(e){return Th(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 Th(n){return n.op==="and"}function wh(n){return vy(n)&&Th(n)}function vy(n){for(const e of n.filters)if(e instanceof ze)return!1;return!0}function so(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+mn(n.value);if(wh(n))return n.filters.map(e=>so(e)).join(",");{const e=n.filters.map(t=>so(t)).join(",");return`${n.op}(${e})`}}function Ih(n,e){return n instanceof ae?function(r,i){return i instanceof ae&&r.op===i.op&&r.field.isEqual(i.field)&&Xe(r.value,i.value)}(n,e):n instanceof ze?function(r,i){return i instanceof ze&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,a,c)=>s&&Ih(a,i.filters[c]),!0):!1}(n,e):void x()}function Eh(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${mn(t.value)}`}(n):n instanceof ze?function(t){return t.op.toString()+" {"+t.getFilters().map(Eh).join(" ,")+"}"}(n):"Filter"}class Ty extends ae{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 wy extends ae{constructor(e,t){super(e,"in",t),this.keys=Ah("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Iy extends ae{constructor(e,t){super(e,"not-in",t),this.keys=Ah("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Ah(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>M.fromName(r.referenceValue))}class Ey extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Fo(t)&&hr(t.arrayValue,this.value)}}class Ay extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&hr(this.value.arrayValue,t)}}class Ry extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(hr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!hr(this.value.arrayValue,t)}}class by extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Fo(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>hr(this.value.arrayValue,r))}}/**
2094 * @license
2095 * Copyright 2019 Google LLC
2096 *
2097 * Licensed under the Apache License, Version 2.0 (the "License");
2098 * you may not use this file except in compliance with the License.
2099 * You may obtain a copy of the License at
2100 *
2101 *   http://www.apache.org/licenses/LICENSE-2.0
2102 *
2103 * Unless required by applicable law or agreed to in writing, software
2104 * distributed under the License is distributed on an "AS IS" BASIS,
2105 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2106 * See the License for the specific language governing permissions and
2107 * limitations under the License.
2108 */class Sy{constructor(e,t=null,r=[],i=[],s=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=a,this.endAt=c,this.ue=null}}function wu(n,e=null,t=[],r=[],i=null,s=null,a=null){return new Sy(n,e,t,r,i,s,a)}function Bo(n){const e=U(n);if(e.ue===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>so(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),Mi(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>mn(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>mn(r)).join(",")),e.ue=t}return e.ue}function jo(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(!yy(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(!Ih(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Tu(n.startAt,e.startAt)&&Tu(n.endAt,e.endAt)}function oo(n){return M.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
2109 * @license
2110 * Copyright 2017 Google LLC
2111 *
2112 * Licensed under the Apache License, Version 2.0 (the "License");
2113 * you may not use this file except in compliance with the License.
2114 * You may obtain a copy of the License at
2115 *
2116 *   http://www.apache.org/licenses/LICENSE-2.0
2117 *
2118 * Unless required by applicable law or agreed to in writing, software
2119 * distributed under the License is distributed on an "AS IS" BASIS,
2120 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121 * See the License for the specific language governing permissions and
2122 * limitations under the License.
2123 */class Rn{constructor(e,t=null,r=[],i=[],s=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=a,this.startAt=c,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function Py(n,e,t,r,i,s,a,c){return new Rn(n,e,t,r,i,s,a,c)}function Li(n){return new Rn(n)}function Iu(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 Rh(n){return n.collectionGroup!==null}function tr(n){const e=U(n);if(e.ce===null){e.ce=[];const t=new Set;for(const s of e.explicitOrderBy)e.ce.push(s),t.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new ge(pe.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(c=c.add(d.field))})}),c})(e).forEach(s=>{t.has(s.canonicalString())||s.isKeyField()||e.ce.push(new dr(s,r))}),t.has(pe.keyField().canonicalString())||e.ce.push(new dr(pe.keyField(),r))}return e.ce}function Ge(n){const e=U(n);return e.le||(e.le=bh(e,tr(n))),e.le}function Cy(n){const e=U(n);return e.he||(e.he=bh(e,n.explicitOrderBy)),e.he}function bh(n,e){if(n.limitType==="F")return wu(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new dr(i.field,s)});const t=n.endAt?new Ti(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Ti(n.startAt.position,n.startAt.inclusive):null;return wu(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function ao(n,e){const t=n.filters.concat([e]);return new Rn(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function wi(n,e,t){return new Rn(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function xi(n,e){return jo(Ge(n),Ge(e))&&n.limitType===e.limitType}function Sh(n){return`${Bo(Ge(n))}|lt:${n.limitType}`}function sn(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=>Eh(i)).join(", ")}]`),Mi(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=>mn(i)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(i=>mn(i)).join(",")),`Target(${r})`}(Ge(n))}; limitType=${n.limitType})`}function Ui(n,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):M.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(n,e)&&function(r,i){for(const s of tr(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(n,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(n,e)&&function(r,i){return!(r.startAt&&!function(a,c,l){const d=vu(a,c,l);return a.inclusive?d<=0:d<0}(r.startAt,tr(r),i)||r.endAt&&!function(a,c,l){const d=vu(a,c,l);return a.inclusive?d>=0:d>0}(r.endAt,tr(r),i))}(n,e)}function ky(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function Ph(n){return(e,t)=>{let r=!1;for(const i of tr(n)){const s=Ny(i,e,t);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function Ny(n,e,t){const r=n.field.isKeyField()?M.comparator(e.key,t.key):function(s,a,c){const l=a.data.field(s),d=c.data.field(s);return l!==null&&d!==null?gn(l,d):x()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return x()}}/**
2124 * @license
2125 * Copyright 2017 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 bn{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,s]of r)if(this.equalsFn(i,e))return s}}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 s=0;s<i.length;s++)if(this.equalsFn(i[s][0],e))return void(i[s]=[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){Yt(this.inner,(t,r)=>{for(const[i,s]of r)e(i,s)})}isEmpty(){return mh(this.inner)}size(){return this.innerSize}}/**
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 */const Dy=new te(M.comparator);function pt(){return Dy}const Ch=new te(M.comparator);function Jn(...n){let e=Ch;for(const t of n)e=e.insert(t.key,t);return e}function kh(n){let e=Ch;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function jt(){return nr()}function Nh(){return nr()}function nr(){return new bn(n=>n.toString(),(n,e)=>n.isEqual(e))}const Oy=new te(M.comparator),Vy=new ge(M.comparator);function z(...n){let e=Vy;for(const t of n)e=e.add(t);return e}const My=new ge(Q);function Ly(){return My}/**
2154 * @license
2155 * Copyright 2020 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 */function $o(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:vi(e)?"-0":e}}function Dh(n){return{integerValue:""+n}}function xy(n,e){return dy(e)?Dh(e):$o(n,e)}/**
2169 * @license
2170 * Copyright 2018 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 Fi{constructor(){this._=void 0}}function Uy(n,e,t){return n instanceof Ii?function(i,s){const a={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&xo(s)&&(s=Uo(s)),s&&(a.fields.__previous_value__=s),{mapValue:a}}(t,e):n instanceof fr?Vh(n,e):n instanceof pr?Mh(n,e):function(i,s){const a=Oh(i,s),c=Eu(a)+Eu(i.Pe);return io(a)&&io(i.Pe)?Dh(c):$o(i.serializer,c)}(n,e)}function Fy(n,e,t){return n instanceof fr?Vh(n,e):n instanceof pr?Mh(n,e):t}function Oh(n,e){return n instanceof Ei?function(r){return io(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Ii extends Fi{}class fr extends Fi{constructor(e){super(),this.elements=e}}function Vh(n,e){const t=Lh(e);for(const r of n.elements)t.some(i=>Xe(i,r))||t.push(r);return{arrayValue:{values:t}}}class pr extends Fi{constructor(e){super(),this.elements=e}}function Mh(n,e){let t=Lh(e);for(const r of n.elements)t=t.filter(i=>!Xe(i,r));return{arrayValue:{values:t}}}
2183class Ei extends Fi{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function Eu(n){return se(n.integerValue||n.doubleValue)}function Lh(n){return Fo(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function By(n,e){return n.field.isEqual(e.field)&&function(r,i){return r instanceof fr&&i instanceof fr||r instanceof pr&&i instanceof pr?pn(r.elements,i.elements,Xe):r instanceof Ei&&i instanceof Ei?Xe(r.Pe,i.Pe):r instanceof Ii&&i instanceof Ii}(n.transform,e.transform)}class jy{constructor(e,t){this.version=e,this.transformResults=t}}class Ve{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Ve}static exists(e){return new Ve(void 0,e)}static updateTime(e){return new Ve(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 ci(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class Bi{}function xh(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new ji(n.key,Ve.none()):new Er(n.key,n.data,Ve.none());{const t=n.data,r=Oe.empty();let i=new ge(pe.comparator);for(let s of e.fields)if(!i.has(s)){let a=t.field(s);a===null&&s.length>1&&(s=s.popLast(),a=t.field(s)),a===null?r.delete(s):r.set(s,a),i=i.add(s)}return new Vt(n.key,r,new xe(i.toArray()),Ve.none())}}function $y(n,e,t){n instanceof Er?function(i,s,a){const c=i.value.clone(),l=Ru(i.fieldTransforms,s,a.transformResults);c.setAll(l),s.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(n,e,t):n instanceof Vt?function(i,s,a){if(!ci(i.precondition,s))return void s.convertToUnknownDocument(a.version);const c=Ru(i.fieldTransforms,s,a.transformResults),l=s.data;l.setAll(Uh(i)),l.setAll(c),s.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(i,s,a){s.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function rr(n,e,t,r){return n instanceof Er?function(s,a,c,l){if(!ci(s.precondition,a))return c;const d=s.value.clone(),f=bu(s.fieldTransforms,l,a);return d.setAll(f),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof Vt?function(s,a,c,l){if(!ci(s.precondition,a))return c;const d=bu(s.fieldTransforms,l,a),f=a.data;return f.setAll(Uh(s)),f.setAll(d),a.convertToFoundDocument(a.version,f).setHasLocalMutations(),c===null?null:c.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(y=>y.field))}(n,e,t,r):function(s,a,c){return ci(s.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c}(n,e,t)}function qy(n,e){let t=null;for(const r of n.fieldTransforms){const i=e.data.field(r.field),s=Oh(r.transform,i||null);s!=null&&(t===null&&(t=Oe.empty()),t.set(r.field,s))}return t||null}function Au(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)&&pn(r,i,(s,a)=>By(s,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 Er extends Bi{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 Vt extends Bi{constructor(e,t,r,i,s=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Uh(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 Ru(n,e,t){const r=new Map;J(n.length===t.length);for(let i=0;i<t.length;i++){const s=n[i],a=s.transform,c=e.data.field(s.field);r.set(s.field,Fy(a,c,t[i]))}return r}function bu(n,e,t){const r=new Map;for(const i of n){const s=i.transform,a=t.data.field(i.field);r.set(i.field,Uy(s,a,e))}return r}class ji extends Bi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class zy extends Bi{constructor(e,t){super(),this.key=e,this.prec
2183ondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2184 * @license
2185 * Copyright 2017 Google LLC
2186 *
2187 * Licensed under the Apache License, Version 2.0 (the "License");
2188 * you may not use this file except in compliance with the License.
2189 * You may obtain a copy of the License at
2190 *
2191 *   http://www.apache.org/licenses/LICENSE-2.0
2192 *
2193 * Unless required by applicable law or agreed to in writing, software
2194 * distributed under the License is distributed on an "AS IS" BASIS,
2195 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196 * See the License for the specific language governing permissions and
2197 * limitations under the License.
2198 */class Hy{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 s=this.mutations[i];s.key.isEqual(e.key)&&$y(s,e,r[i])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=rr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=rr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Nh();return this.mutations.forEach(i=>{const s=e.get(i.key),a=s.overlayedDocument;let c=this.applyToLocalView(a,s.mutatedFields);c=t.has(i.key)?null:c;const l=xh(a,c);l!==null&&r.set(i.key,l),a.isValidDocument()||a.convertToNoDocument(B.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),z())}isEqual(e){return this.batchId===e.batchId&&pn(this.mutations,e.mutations,(t,r)=>Au(t,r))&&pn(this.baseMutations,e.baseMutations,(t,r)=>Au(t,r))}}
2198class qo{constructor(e,t,r,i){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=i}static from(e,t,r){J(e.mutations.length===r.length);let i=function(){return Oy}();const s=e.mutations;for(let a=0;a<s.length;a++)i=i.insert(s[a].key,r[a].version);return new qo(e,t,r,i)}}/**
2199 * @license
2200 * Copyright 2022 Google LLC
2201 *
2202 * Licensed under the Apache License, Version 2.0 (the "License");
2203 * you may not use this file except in compliance with the License.
2204 * You may obtain a copy of the License at
2205 *
2206 *   http://www.apache.org/licenses/LICENSE-2.0
2207 *
2208 * Unless required by applicable law or agreed to in writing, software
2209 * distributed under the License is distributed on an "AS IS" BASIS,
2210 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2211 * See the License for the specific language governing permissions and
2212 * limitations under the License.
2213 */class Ky{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{
2214      largestBatchId: ${this.largestBatchId},
2215      mutation: ${this.mutation.toString()}
2216    }`}}/**
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 */class Wy{constructor(e,t,r){this.alias=e,this.aggregateType=t,this.fieldPath=r}}/**
2232 * @license
2233 * Copyright 2017 Google LLC
2234 *
2235 * Licensed under the Apache License, Version 2.0 (the "License");
2236 * you may not use this file except in compliance with the License.
2237 * You may obtain a copy of the License at
2238 *
2239 *   http://www.apache.org/licenses/LICENSE-2.0
2240 *
2241 * Unless required by applicable law or agreed to in writing, software
2242 * distributed under the License is distributed on an "AS IS" BASIS,
2243 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2244 * See the License for the specific language governing permissions and
2245 * limitations under the License.
2246 */class Gy{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
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 */var oe,K;function Qy(n){switch(n){default:return x();case S.CANCELLED:case S.UNKNOWN:case S.DEADLINE_EXCEEDED:case S.RESOURCE_EXHAUSTED:case S.INTERNAL:case S.UNAVAILABLE:case S.UNAUTHENTICATED:return!1;case S.INVALID_ARGUMENT:case S.NOT_FOUND:case S.ALREADY_EXISTS:case S.PERMISSION_DENIED:case S.FAILED_PRECONDITION:case S.ABORTED:case S.OUT_OF_RANGE:case S.UNIMPLEMENTED:case S.DATA_LOSS:return!0}}function Fh(n){if(n===void 0)return ft("GRPC error has no .code"),S.UNKNOWN;switch(n){case oe.OK:return S.OK;case oe.CANCELLED:return S.CANCELLED;case oe.UNKNOWN:return S.UNKNOWN;case oe.DEADLINE_EXCEEDED:return S.DEADLINE_EXCEEDED;case oe.RESOURCE_EXHAUSTED:return S.RESOURCE_EXHAUSTED;case oe.INTERNAL:return S.INTERNAL;case oe.UNAVAILABLE:return S.UNAVAILABLE;case oe.UNAUTHENTICATED:return S.UNAUTHENTICATED;case oe.INVALID_ARGUMENT:return S.INVALID_ARGUMENT;case oe.NOT_FOUND:return S.NOT_FOUND;case oe.ALREADY_EXISTS:return S.ALREADY_EXISTS;case oe.PERMISSION_DENIED:return S.PERMISSION_DENIED;case oe.FAILED_PRECONDITION:return S.FAILED_PRECONDITION;case oe.ABORTED:return S.ABORTED;case oe.OUT_OF_RANGE:return S.OUT_OF_RANGE;
2261case oe.UNIMPLEMENTED:return S.UNIMPLEMENTED;case oe.DATA_LOSS:return S.DATA_LOSS;default:return x()}}(K=oe||(oe={}))[K.OK=0]="OK",K[K.CANCELLED=1]="CANCELLED",K[K.UNKNOWN=2]="UNKNOWN",K[K.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",K[K.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",K[K.NOT_FOUND=5]="NOT_FOUND",K[K.ALREADY_EXISTS=6]="ALREADY_EXISTS",K[K.PERMISSION_DENIED=7]="PERMISSION_DENIED",K[K.UNAUTHENTICATED=16]="UNAUTHENTICATED",K[K.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",K[K.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",K[K.ABORTED=10]="ABORTED",K[K.OUT_OF_RANGE=11]="OUT_OF_RANGE",K[K.UNIMPLEMENTED=12]="UNIMPLEMENTED",K[K.INTERNAL=13]="INTERNAL",K[K.UNAVAILABLE=14]="UNAVAILABLE",K[K.DATA_LOSS=15]="DATA_LOSS";/**
2262 * @license
2263 * Copyright 2023 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 */function Jy(){return new TextEncoder}/**
2277 * @license
2278 * Copyright 2022 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 */const Xy=new qt([4294967295,4294967295],0);function Su(n){const e=Jy().encode(n),t=new ah;return t.update(e),new Uint8Array(t.digest())}function Pu(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),i=e.getUint32(8,!0),s=e.getUint32(12,!0);return[new qt([t,r],0),new qt([i,s],0)]}class zo{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new Xn(`Invalid padding: ${t}`);if(r<0)throw new Xn(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Xn(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new Xn(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=qt.fromNumber(this.Ie)}Ee(e,t,r){let i=e.add(t.multiply(qt.fromNumber(r)));return i.compare(Xy)===1&&(i=new qt([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=Su(e),[r,i]=Pu(t);for(let s=0;s<this.hashCount;s++){const a=this.Ee(r,i,s);if(!this.de(a))return!1}return!0}static create(e,t,r){const i=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),a=new zo(s,i,t);return r.forEach(c=>a.insert(c)),a}insert(e){if(this.Ie===0)return;const t=Su(e),[r,i]=Pu(t);for(let s=0;s<this.hashCount;s++){const a=this.Ee(r,i,s);this.Ae(a)}}Ae(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class Xn extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
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 $i{constructor(e,t,r,i,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const i=new Map;return i.set(e,Ar.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new $i(B.min(),i,new te(Q),pt(),z())}}class Ar{constructor(e,t,r,i,s){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new Ar(r,t,z(),z(),z())}}/**
2307 * @license
2308 * Copyright 2017 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 ui{constructor(e,t,r,i){this.Re=e,this.removedTargetIds=t,this.key=r,this.Ve=i}}class Bh{constructor(e,t){this.targetId=e,this.me=t}}class jh{constructor(e,t,r=me.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=i}}class Cu{constructor(){this.fe=0,this.ge=Nu(),this.pe=me.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=z(),t=z(),r=z();return this.ge.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:r=r.add(i);break;default:x()}}),new Ar(this.pe,this.ye,e,t,r)}Ce(){this.we=!1,this.ge=Nu()}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,J(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class Yy{constructor(e){this.Le=e,this.Be=new Map,this.ke=pt(),this.qe=ku(),this.Qe=new te(Q)}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 s=i.target;if(oo(s))if(r===0){const a=new M(s.path);this.Ue(t,a,Ee.newNoDocument(a,B.min()))}else J(r===1);else{const a=this.Ye(t);if(a!==r){const c=this.Ze(e),l=c?this.Xe(c,e,a):1;if(l!==0){this.je(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,d)}}}}}Ze(e){const t=e.me.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=t;let a,c;try{a=Kt(r).toUint8Array()}catch(l){if(l instanceof _h)return fn("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new zo(a,i,s)}catch(l){return fn(l instanceof Xn?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.Ie===0?null:c}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(s=>{const a=this.Le.tt(),c=`projects/${a.projectId}/databases/${a.database}/documents/${s.path.canonicalString()}`;e.mightContain(c)||(this.Ue(t,s,null),i++)}),i}rt(e){const t=new Map;this.Be.forEach((s,a)=>{const c=this.Je(a);if(c){if(s.current&&oo(c.target)){const l=new M(c.target.path);this.ke.get(l)!==null||this.it(a,l)||this.Ue(a,l,Ee.newNoDocument(l,e))}s.be&&(t.set(a,s.ve()),s.Ce())}});let r=z();this.qe.forEach((s,a)=>{let c=!0;a.forEachWhile(l=>{const d=this.Je(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)}),c&&(r=r.add(s))}),this.ke.forEach((s,a)=>a.setReadTime(e));const i=new $i(e,t,this.Qe,this.ke,r);return this.ke=pt(),this.qe=ku(),this.Qe=new te(Q),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 Cu,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new ge(Q),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||V("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 Cu),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function ku(){return new te(M.comparator)}function Nu(){return new te(M.comparator)}const Zy={asc:"ASCENDING",desc:"DESCENDING"},ev={"<":"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"},tv={and:"AND",or:"OR"};class nv{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function co(n,e){return n.useProto3Json||Mi(e)?e:{value:e}}function Ai(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 $h(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function rv(n,e){return Ai(n,e.toTimestamp())}function Qe(n){return J(!!n),B.fromTimestamp(function(t){const r=Nt(t);return new ce(r.seconds,r.nanos)}(n))}function Ho(n,e){return uo(n,e).canonicalString()}function uo(n,e){const t=function(i){return new ee(["projects",i.projectId,"databases",i.database])}(n).child("documents");return e===void 0?t:t.child(e)}function qh(n){const e=ee.fromString(n);return J(Qh(e)),e}function lo(n,e){return Ho(n.databaseId,e.path)}function Os(n,e){const t=qh(e);if(t.get(1)!==n.databaseId.projectId)throw new D(S.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(S.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new M(Hh(t))}function zh(n,e){return Ho(n.databaseId,e)}function iv(n){const e=qh(n);return e.length===4?ee.emptyPath():Hh(e)}function ho(n){return new ee(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function Hh(n){return J(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function Du(n,e,t){return{name:lo(n,e),fields:t.value.mapValue.fields}}function sv(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||[],s=function(d,f){return d.useProto3Json?(J(f===void 0||typeof f=="string"),me.fromBase64String(f||"")):(J(f===void 0||f instanceof Buffer||f instanceof Uint8Array),me.fromUint8Array(f||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&function(d){const f=d.code===void 0?S.UNKNOWN:Fh(d.code);return new D(f,d.message||"")}(a);t=new jh(r,i,s,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Os(n,r.document.name),s=Qe(r.document.updateTime),a=r.document.createTime?Qe(r.document.createTime):B.min(),c=new Oe({mapValue:{fields:r.document.fields}}),l=Ee.newFoundDocument(i,s,a,c),d=r.targetIds||[],f=r.removedTargetIds||[];t=new ui(d,f,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Os(n,r.document),s=r.readTime?Qe(r.readTime):B.min(),a=Ee.newNoDocument(i,s),c=r.removedTargetIds||[];t=new ui([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Os(n,r.document),s=r.removedTargetIds||[];t=new ui([],s,i,null)}else{if(!("filter"in e))return x();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,a=new Gy(i,s),c=r.targetId;t=new Bh(c,a)}}return t}function ov(n,e){let t;if(e instanceof Er)t={update:Du(n,e.key,e.value)};else if(e instanceof ji)t={delete:lo(n,e.key)};else if(e instanceof Vt)t={update:Du(n,e.key,e.data),updateMask:gv(e.fieldMask)};else{if(!(e instanceof zy))return x();t={verify:lo(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(s,a){const c=a.transform;if(c instanceof Ii)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof fr)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof pr)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof Ei)return{fieldPath:a.field.canonicalString(),increment:c.Pe};throw x()}(0,r))),e.precondition.isNone||(t.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:rv(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:x()}(n,e.precondition)),t}function av(n,e){return n&&n.length>0?(J(e!==void 0),n.map(t=>function(i,s){let a=i.updateTime?Qe(i.updateTime):Qe(s);return a.isEqual(B.min())&&(a=Qe(s)),new jy(a,i.transformResults||[])}(t,e))):[]}function cv(n,e){return{documents:[zh(n,e.path)]}}function Kh(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=zh(n,i);const s=function(d){if(d.length!==0)return Gh(ze.create(d,"and"))}(e.filters);s&&(t.structuredQuery.where=s);const a=function(d){if(d.length!==0)return d.map(f=>function(w){return{field:Rt(w.field),direction:dv(w.dir)}}(f))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=co(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=function(d){return{before:d.inclusive,values:d.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(d){return{before:!d.inclusive,values:d.position}}(e.endAt)),{_t:t,parent:i}}function uv(n,e,t,r){const{_t:i,parent:s}=Kh(n,e),a={},c=[];let l=0;return t.forEach(d=>{const f="aggregate_"+l++;a[f]=d.alias,d.aggregateType==="count"?c.push({alias:f,count:{}}):d.aggregateType==="avg"?c.push({alias:f,avg:{field:Rt(d.fieldPath)}}):d.aggregateType==="sum"&&c.push({alias:f,sum:{field:Rt(d.fieldPath)}})}
2321),{request:{structuredAggregationQuery:{aggregations:c,structuredQuery:i.structuredQuery},parent:i.parent},ut:a,parent:s}}function lv(n){let e=iv(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let i=null;if(r>0){J(r===1);const f=t.from[0];f.allDescendants?i=f.collectionId:e=e.child(f.collectionId)}let s=[];t.where&&(s=function(y){const w=Wh(y);return w instanceof ze&&wh(w)?w.getFilters():[w]}(t.where));let a=[];t.orderBy&&(a=function(y){return y.map(w=>function(k){return new dr(on(k.field),function(C){switch(C){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(k.direction))}(w))}(t.orderBy));let c=null;t.limit&&(c=function(y){let w;return w=typeof y=="object"?y.value:y,Mi(w)?null:w}(t.limit));let l=null;t.startAt&&(l=function(y){const w=!!y.before,b=y.values||[];return new Ti(b,w)}(t.startAt));let d=null;return t.endAt&&(d=function(y){const w=!y.before,b=y.values||[];return new Ti(b,w)}(t.endAt)),Py(e,i,a,s,c,"F",l,d)}function hv(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 Wh(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=on(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=on(t.unaryFilter.field);return ae.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=on(t.unaryFilter.field);return ae.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=on(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});default:return x()}}(n):n.fieldFilter!==void 0?function(t){return ae.create(on(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 ze.create(t.compositeFilter.filters.map(r=>Wh(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return x()}}(t.compositeFilter.op))}(n):x()}function dv(n){return Zy[n]}function fv(n){return ev[n]}function pv(n){return tv[n]}function Rt(n){return{fieldPath:n.canonicalString()}}function on(n){return pe.fromServerFormat(n.fieldPath)}function Gh(n){return n instanceof ae?function(t){if(t.op==="=="){if(yu(t.value))return{unaryFilter:{field:Rt(t.field),op:"IS_NAN"}};if(_u(t.value))return{unaryFilter:{field:Rt(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(yu(t.value))return{unaryFilter:{field:Rt(t.field),op:"IS_NOT_NAN"}};if(_u(t.value))return{unaryFilter:{field:Rt(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Rt(t.field),op:fv(t.op),value:t.value}}}(n):n instanceof ze?function(t){const r=t.getFilters().map(i=>Gh(i));return r.length===1?r[0]:{compositeFilter:{op:pv(t.op),filters:r}}}(n):x()}function gv(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function Qh(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
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 St{constructor(e,t,r,i,s=B.min(),a=B.min(),c=me.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new St(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new St(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new St(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new St(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
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 mv{constructor(e){this.ct=e}}function _v(n){const e=lv({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?wi(e,e.limit,"L"):e}/**
2352 * @license
2353 * Copyright 2019 Google LLC
2354 *
2355 * Licensed under the Apache License, Version 2.0 (the "License");
2356 * you may not use this file except in compliance with the License.
2357 * You may obtain a copy of the License at
2358 *
2359 *   http://www.apache.org/licenses/LICENSE-2.0
2360 *
2361 * Unless required by applicable law or agreed to in writing, software
2362 * distributed under the License is distributed on an "AS IS" BASIS,
2363 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2364 * See the License for the specific language governing permissions and
2365 * limitations under the License.
2366 */class yv{constructor(){this.un=new vv}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(kt.min())}getMinOffsetFromCollectionGroup(e,t){return P.resolve(kt.min())}updateCollectionGroup(e,t,r){return P.resolve()}updateIndexEntries(e,t){return P.resolve()}}class vv{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),i=this.index[t]||new ge(ee.comparator),s=!i.has(r);return this.index[t]=i.add(r),s}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 ge(ee.comparator)).toArray()}}/**
2367 * @license
2368 * Copyright 2017 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 _n{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new _n(0)}static kn(){return new _n(-1)}}/**
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 Tv{constructor(){this.changes=new bn(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,Ee.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)}
2396assertNotApplied(){}}/**
2397 * @license
2398 * Copyright 2017 Google LLC
2399 *
2400 * Licensed under the Apache License, Version 2.0 (the "License");
2401 * you may not use this file except in compliance with the License.
2402 * You may obtain a copy of the License at
2403 *
2404 *   http://www.apache.org/licenses/LICENSE-2.0
2405 *
2406 * Unless required by applicable law or agreed to in writing, software
2407 * distributed under the License is distributed on an "AS IS" BASIS,
2408 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2409 * See the License for the specific language governing permissions and
2410 * limitations under the License.
2411 *//**
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 wv{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
2427 * @license
2428 * Copyright 2017 Google LLC
2429 *
2430 * Licensed under the Apache License, Version 2.0 (the "License");
2431 * you may not use this file except in compliance with the License.
2432 * You may obtain a copy of the License at
2433 *
2434 *   http://www.apache.org/licenses/LICENSE-2.0
2435 *
2436 * Unless required by applicable law or agreed to in writing, software
2437 * distributed under the License is distributed on an "AS IS" BASIS,
2438 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2439 * See the License for the specific language governing permissions and
2440 * limitations under the License.
2441 */class Iv{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&&rr(r.mutation,i,xe.empty(),ce.now()),i))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,z()).next(()=>r))}getLocalViewOfDocuments(e,t,r=z()){const i=jt();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,r).next(s=>{let a=Jn();return s.forEach((c,l)=>{a=a.insert(c,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=jt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,z()))}populateOverlays(e,t,r){const i=[];return r.forEach(s=>{t.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((a,c)=>{t.set(a,c)})})}computeViews(e,t,r,i){let s=pt();const a=nr(),c=function(){return nr()}();return t.forEach((l,d)=>{const f=r.get(d.key);i.has(d.key)&&(f===void 0||f.mutation instanceof Vt)?s=s.insert(d.key,d):f!==void 0?(a.set(d.key,f.mutation.getFieldMask()),rr(f.mutation,d,f.mutation.getFieldMask(),ce.now())):a.set(d.key,xe.empty())}),this.recalculateAndSaveOverlays(e,s).next(l=>(l.forEach((d,f)=>a.set(d,f)),t.forEach((d,f)=>{var y;return c.set(d,new wv(f,(y=a.get(d))!==null&&y!==void 0?y:null))}),c))}recalculateAndSaveOverlays(e,t){const r=nr();let i=new te((a,c)=>a-c),s=z();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const c of a)c.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let f=r.get(l)||xe.empty();f=c.applyToLocalView(d,f),r.set(l,f);const y=(i.get(c.batchId)||z()).add(l);i=i.insert(c.batchId,y)})}).next(()=>{const a=[],c=i.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,f=l.value,y=Nh();f.forEach(w=>{if(!s.has(w)){const b=xh(t.get(w),r.get(w));b!==null&&y.set(w,b),s=s.add(w)}}),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):Rh(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(s=>{const a=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,i-s.size):P.resolve(jt());let c=-1,l=s;return a.next(d=>P.forEach(d,(f,y)=>(c<y.largestBatchId&&(c=y.largestBatchId),s.get(f)?P.resolve():this.remoteDocumentCache.getEntry(e,f).next(w=>{l=l.insert(f,w)}))).next(()=>this.populateOverlays(e,d,s)).next(()=>this.computeViews(e,l,d,z())).next(f=>({batchId:c,changes:kh(f)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new M(t)).next(r=>{let i=Jn();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,t,r,i){const s=t.collectionGroup;let a=Jn();return this.indexManager.getCollectionParents(e,s).next(c=>P.forEach(c,l=>{const d=function(y,w){return new Rn(w,null,y.explicitOrderBy.slice(),y.filters.slice(),y.limit,y.limitType,y.startAt,y.endAt)}(t,l.child(s));return this.getDocumentsMatchingCollectionQuery(e,d,r,i).next(f=>{f.forEach((y,w)=>{a=a.insert(y,w)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(s=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,s,i))).next(a=>{s.forEach((l,d)=>{const f=d.getKey();a.get(f)===null&&(a=a.insert(f,Ee.newInvalidDocument(f)))});let c=Jn();return a.forEach((l,d)=>{const f=s.get(l);f!==void 0&&rr(f.mutation,d,xe.empty(),ce.now()),Ui(t,d)&&(c=c.insert(l,d))}),c})}}/**
2442 * @license
2443 * Copyright 2020 Google LLC
2444 *
2445 * Licensed under the Apache License, Version 2.0 (the "License");
2446 * you may not use this file except in compliance with the License.
2447 * You may obtain a copy of the License at
2448 *
2449 *   http://www.apache.org/licenses/LICENSE-2.0
2450 *
2451 * Unless required by applicable law or agreed to in writing, software
2452 * distributed under the License is distributed on an "AS IS" BASIS,
2453 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2454 * See the License for the specific language governing permissions and
2455 * limitations under the License.
2456 */class Ev{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:Qe(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:_v(i.bundledQuery),readTime:Qe(i.readTime)}}(t)),P.resolve()}}/**
2457 * @license
2458 * Copyright 2022 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 Av{constructor(){this.overlays=new te(M.comparator),this.Ir=new Map}getOverlay(e,t){return P.resolve(this.overlays.get(t))}getOverlays(e,t){const r=jt();return P.forEach(t,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((i,s)=>{this.ht(e,t,s)}),P.resolve()}removeOverlaysForBatchId(e,t,r){const i=this.Ir.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(r)),P.resolve()}getOverlaysForCollection(e,t,r){const i=jt(),s=t.length+1,a=new M(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===s&&l.largestBatchId>r&&i.set(l.getKey(),l)}return P.resolve(i)}getOverlaysForCollectionGroup(e,t,r,i){let s=new te((d,f)=>d-f);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let f=s.get(d.largestBatchId);f===null&&(f=jt(),s=s.insert(d.largestBatchId,f)),f.set(d.getKey(),d)}}const c=jt(),l=s.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,f)=>c.set(d,f)),!(c.size()>=i)););return P.resolve(c)}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 Ky(t,r));let s=this.Ir.get(t);s===void 0&&(s=z(),this.Ir.set(t,s)),this.Ir.set(t,s.add(r.key))}}/**
2472 * @license
2473 * Copyright 2024 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 Rv{constructor(){this.sessionToken=me.EMPTY_BYTE_STRING}getSessionToken(e){return P.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,P.resolve()}}/**
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, softw
2496are
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 Ko{constructor(){this.Tr=new ge(ue.Er),this.dr=new ge(ue.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const r=new ue(e,t);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Vr(new ue(e,t))}mr(e,t){e.forEach(r=>this.removeReference(r,t))}gr(e){const t=new M(new ee([])),r=new ue(t,e),i=new ue(t,e+1),s=[];return this.dr.forEachInRange([r,i],a=>{this.Vr(a),s.push(a.key)}),s}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 ee([])),r=new ue(t,e),i=new ue(t,e+1);let s=z();return this.dr.forEachInRange([r,i],a=>{s=s.add(a.key)}),s}containsKey(e){const t=new ue(e,0),r=this.Tr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class ue{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return M.comparator(e.key,t.key)||Q(e.wr,t.wr)}static Ar(e,t){return Q(e.wr,t.wr)||M.comparator(e.key,t.key)}}/**
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 bv{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new ge(ue.Er)}checkEmpty(e){return P.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,i){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new Hy(s,t,r,i);this.mutationQueue.push(a);for(const c of i)this.br=this.br.add(new ue(c.key,s)),this.indexManager.addToCollectionParentIndex(e,c.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),s=i<0?0:i;return P.resolve(this.mutationQueue.length>s?this.mutationQueue[s]: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 ue(t,0),i=new ue(t,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([r,i],a=>{const c=this.Dr(a.wr);s.push(c)}),P.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new ge(Q);return t.forEach(i=>{const s=new ue(i,0),a=new ue(i,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,a],c=>{r=r.add(c.wr)})}),P.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,i=r.length+1;let s=r;M.isDocumentKey(s)||(s=s.child(""));const a=new ue(new M(s),0);let c=new ge(Q);return this.br.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===i&&(c=c.add(l.wr)),!0)},a),P.resolve(this.Cr(c))}Cr(e){const t=[];return e.forEach(r=>{const i=this.Dr(r);i!==null&&t.push(i)}),t}removeMutationBatch(e,t){J(this.Fr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return P.forEach(t.mutations,i=>{const s=new ue(i.key,t.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,t){const r=new ue(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>
2516=this.mutationQueue.length?null:this.mutationQueue[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 Sv{constructor(e){this.Mr=e,this.docs=function(){return new te(M.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,i=this.docs.get(r),s=i?i.size:0,a=this.Mr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-s,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():Ee.newInvalidDocument(t))}getEntries(e,t){let r=pt();return t.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():Ee.newInvalidDocument(i))}),P.resolve(r)}getDocumentsMatchingQuery(e,t,r,i){let s=pt();const a=t.path,c=new M(a.child("")),l=this.docs.getIteratorFrom(c);for(;l.hasNext();){const{key:d,value:{document:f}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||cy(ay(f),r)<=0||(i.has(f.key)||Ui(t,f))&&(s=s.insert(f.key,f.mutableCopy()))}return P.resolve(s)}getAllFromCollectionGroup(e,t,r,i){x()}Or(e,t){return P.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new Pv(this)}getSize(e){return P.resolve(this.size)}}class Pv extends Tv{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];
2531return 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)}}/**
2532 * @license
2533 * Copyright 2017 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 Cv{constructor(e){this.persistence=e,this.Nr=new bn(t=>Bo(t),jo),this.lastRemoteSnapshotVersion=B.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Ko,this.targetCount=0,this.kr=_n.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 _n(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 s=[];return this.Nr.forEach((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.Nr.delete(a),s.push(this.removeMatchingKeysForTargetId(e,c.targetId)),i++)}),P.waitFor(s).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,s=[];return i&&t.forEach(a=>{s.push(i.markPotentiallyOrphaned(e,a))}),P.waitFor(s)}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))}}/**
2547 * @license
2548 * Copyright 2017 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 kv{constructor(e,t){this.qr={},this.overlays={},this.Qr=new Lo(0),this.Kr=!1,this.Kr=!0,this.$r=new Rv,this.referenceDelegate=e(this),this.Ur=new Cv(this),this.indexManager=new yv,this.remoteDocumentCache=function(i){return new Sv(i)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new mv(t),this.Gr=new Ev(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 Av,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.qr[e.toKey()];return r||(r=new bv(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){V("MemoryPersistence","Starting transaction:",e);const i=new Nv(this.Qr.next());return this.referenceDelegate.zr(),r(i).next(s=>this.referenceDelegate.jr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}
2561Hr(e,t){return P.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,t)))}}class Nv extends ly{constructor(e){super(),this.currentSequenceNumber=e}}class Wo{constructor(e){this.persistence=e,this.Jr=new Ko,this.Yr=null}static Zr(e){return new Wo(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(s=>this.Xr.add(s.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(s=>{s||t.removeEntry(i,B.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)])}}/**
2562 * @license
2563 * Copyright 2017 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 Go{constructor(e,t,r,i){this.targetId=e,this.fromCache=t,this.$i=r,this.Ui=i}static Wi(e,t){let r=z(),i=z();for(const s of t.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Go(e,t.fromCache,r,i)}}/**
2577 * @license
2578 * Copyright 2023 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 Dv{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
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 Ov{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return _p()?8:hy(be())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,r,i){const s={result:null};return this.Yi(e,t).next(a=>{s.result=a}).next(()=>{if(!s.result)return this.Zi(e,t,i,r).next(a=>{s.result=a})}).next(()=>{if(s.result)return;const a=new Dv;return this.Xi(e,t,a).next(c=>{if(s.result=c,this.zi)return this.es(e,t,a,c.size)})}).next(()=>s.result)}es(e,t,r,i){return r.documentReadCount<this.ji?(Wn()<=H.DEBUG&&V("QueryEngine","SDK will not create cache indexes for query:",sn(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),P.resolve()):(Wn()<=H.DEBUG&&V("QueryEngine","Query:",sn(t),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.Hi*i?(Wn()<=H.DEBUG&&V("QueryEngine","The SDK decides to create cache indexes for query:",sn(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Ge(t))):P.resolve())}Yi(e,t){if(Iu(t))return P.resolve(null);let r=Ge(t);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(t.limit!==null&&i===1&&(t=wi(t,null,"F"),r=Ge(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const a=z(...s);return this.Ji.getDocuments(e,a).next(c=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.ts(t,c);return this.ns(t,d,a,l.readTime)?this.Yi(e,wi(t,null,"F")):this.rs(e,d,t,l)}))})))}Zi(e,t,r,i){return Iu(t)||i.isEqual(B.min())?P.resolve(null):this.Ji.getDocuments(e,r).next(s=>{const a=this.ts(t,s);return this.ns(t,a,r,i)?P.resolve(null):(Wn()<=H.DEBUG&&V("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),sn(t)),this.rs(e,a,t,oy(i,-1)).next(c=>c))})}ts(e,t){let r=new ge(Ph(e));return t.forEach((i,s)=>{Ui(e,s)&&(r=r.add(s))}),r}ns(e,t,r,i){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const s=e.limitType==="F"?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Xi(e,t,r){return Wn()<=H.DEBUG&&V("QueryEngine","Using full collection scan to execute query:",sn(t)),this.Ji.getDocumentsMatchingQuery(e,t,kt.min(),r)}rs(e,t,r,i){return this.Ji.getDocumentsMatchingQuery(e,r,i).next(s=>(t.forEach(a=>{s=s.insert(a.key,a)}),s))}}/**
2607 * @license
2608 * Copyright 2020 Google LLC
2609 *
2610 * Licensed under the Apache License, Version 2.0 (the "License");
2611 * you may not use this file except in compliance with the License.
2612 * You may obtain a copy of the License at
2613 *
2614 *   http://www.apache.org/licenses/LICENSE-2.0
2615 *
2616 * Unless required by applicable law or agreed to in writing, software
2617 * distributed under the License is distributed on an "AS IS" BASIS,
2618 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2619 * See the License for the specific language governing permissions and
2620 * limitations under the License.
2621 */class Vv{constructor(e,t,r,i){this.persistence=e,this.ss=t,this.serializer=i,this.os=new te(Q),this._s=new bn(s=>Bo(s),jo),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 Iv(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 Mv(n,e,t,r){return new Vv(n,e,t,r)}async function Jh(n,e){const t=U(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let i;return t.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,t.ls(e),t.mutationQueue.getAllMutationBatches(r))).next(s=>{const a=[],c=[];let l=z();for(const d of i){a.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}for(const d of s){c.push(d.batchId);for(const f of d.mutations)l=l.add(f.key)}return t.localDocuments.getDocuments(r,l).next(d=>({hs:d,removedBatchIds:a,addedBatchIds:c}))})})}function Lv(n,e){const t=U(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=t.cs.newChangeBuffer({trackRemovals:!0});return function(c,l,d,f){const y=d.batch,w=y.keys();let b=P.resolve();return w.forEach(k=>{b=b.next(()=>f.getEntry(l,k)).next(O=>{const C=d.docVersions.get(k);J(C!==null),O.version.compareTo(C)<0&&(y.applyToRemoteDocument(O,d),O.isValidDocument()&&(O.setReadTime(d.commitVersion),f.addEntry(O)))})}),b.next(()=>c.mutationQueue.removeMutationBatch(l,y))}(t,r,e,s).next(()=>s.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(c){let l=z();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,i))})}function Xh(n){const e=U(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function xv(n,e){const t=U(n),r=e.snapshotVersion;let i=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const a=t.cs.newChangeBuffer({trackRemovals:!0});i=t.os;const c=[];
2621e.targetChanges.forEach((f,y)=>{const w=i.get(y);if(!w)return;c.push(t.Ur.removeMatchingKeys(s,f.removedDocuments,y).next(()=>t.Ur.addMatchingKeys(s,f.addedDocuments,y)));let b=w.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(y)!==null?b=b.withResumeToken(me.EMPTY_BYTE_STRING,B.min()).withLastLimboFreeSnapshotVersion(B.min()):f.resumeToken.approximateByteSize()>0&&(b=b.withResumeToken(f.resumeToken,r)),i=i.insert(y,b),function(O,C,F){return O.resumeToken.approximateByteSize()===0||C.snapshotVersion.toMicroseconds()-O.snapshotVersion.toMicroseconds()>=3e8?!0:F.addedDocuments.size+F.modifiedDocuments.size+F.removedDocuments.size>0}(w,b,f)&&c.push(t.Ur.updateTargetData(s,b))});let l=pt(),d=z();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(s,f))}),c.push(Uv(s,a,e.documentUpdates).next(f=>{l=f.Ps,d=f.Is})),!r.isEqual(B.min())){const f=t.Ur.getLastRemoteSnapshotVersion(s).next(y=>t.Ur.setTargetsMetadata(s,s.currentSequenceNumber,r));c.push(f)}return P.waitFor(c).next(()=>a.apply(s)).next(()=>t.localDocuments.getLocalViewOfDocuments(s,l,d)).next(()=>l)}).then(s=>(t.os=i,s))}function Uv(n,e,t){let r=z(),i=z();return t.forEach(s=>r=r.add(s)),e.getEntries(n,r).next(s=>{let a=pt();return t.forEach((c,l)=>{const d=s.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(i=i.add(c)),l.isNoDocument()&&l.version.isEqual(B.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):V("LocalStore","Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)}),{Ps:a,Is:i}})}function Fv(n,e){const t=U(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function Bv(n,e){const t=U(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return t.Ur.getTargetData(r,e).next(s=>s?(i=s,P.resolve(i)):t.Ur.allocateTargetId(r).next(a=>(i=new St(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 fo(n,e,t){const r=U(n),i=r.os.get(e),s=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",s,a=>r.persistence.referenceDelegate.removeTarget(a,i))}catch(a){if(!Ir(a))throw a;V("LocalStore",`Failed to update sequence numbers for target ${e}: ${a}`)}r.os=r.os.remove(e),r._s.delete(i.target)}function Ou(n,e,t){const r=U(n);let i=B.min(),s=z();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,f){const y=U(l),w=y._s.get(f);return w!==void 0?P.resolve(y.os.get(w)):y.Ur.getTargetData(d,f)}(r,a,Ge(e)).next(c=>{if(c)return i=c.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(a,c.targetId).next(l=>{s=l})}).next(()=>r.ss.getDocumentsMatchingQuery(a,e,t?i:B.min(),t?s:z())).next(c=>(jv(r,ky(e),c),{documents:c,Ts:s})))}function jv(n,e,t){let r=n.us.get(e)||B.min();t.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),n.us.set(e,r)}class Vu{constructor(){this.activeTargetIds=Ly()}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 $v{constructor(){this.so=new Vu,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e){return 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 Vu,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2622 * @license
2623 * Copyright 2019 Google LLC
2624 *
2625 * Licensed under the Apache License, Version 2.0 (the "License");
2626 * you may not use this file except in compliance with the License.
2627 * You may obtain a copy of the License at
2628 *
2629 *   http://www.apache.org/licenses/LICENSE-2.0
2630 *
2631 * Unless required by applicable law or agreed to in writing, software
2632 * distributed under the License is distributed on an "AS IS" BASIS,
2633 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2634 * See the License for the specific language governing permissions and
2635 * limitations under the License.
2636 */class qv{_o(e){}shutdown(){}}/**
2637 * @license
2638 * Copyright 2019 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 Mu{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(){V("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){V("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}}/**
2652 * @license
2653 * Copyright 2023 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 */let Yr=null;function Vs(){return Yr===null?Yr=function(){return 268435456+Math.round(2147483648*Math.random())}():Yr++,"0x"+Yr.toString(16)}/**
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 */const zv={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
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 Hv{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)}}/**
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 */const we="WebChannelConnection";class Kv extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+t.host,this.vo=`projects/${i}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get Fo(){return!1}Mo(t,r,i,s,a){const c=Vs(),l=this.xo(t,r.toUriEncodedString());V("RestConnection",`Sending RPC '${t}' ${c}:`,l,i);const d={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(d,s,a),this.No(t,l,d,i).then(f=>(V("RestConnection",`Received RPC '${t}' ${c}: `,f),f),f=>{throw fn("RestConnection",`RPC '${t}' ${c} failed with error: `,f,"url: ",l,"request:",i),f})}Lo(t,r,i,s,a,c){return this.Mo(t,r,i,s,a)}Oo(t,r,i){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+An}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,a)=>t[a]=s),i&&i.headers.forEach((s,a)=>t[a]=s)}xo(t,r){const i=zv[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 s=Vs();return new Promise((a,c)=>{const l=new ch;l.setWithCredentials(!0),l.listenOnce(lh.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case oi.NO_ERROR:const f=l.getResponseJson();V(we,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(f)),a(f);break;case oi.TIMEOUT:V(we,`RPC '${e}' ${s} timed out`),c(new D(S.DEADLINE_EXCEEDED,"Request time out"));break;case oi.HTTP_ERROR:const y=l.getStatus();if(V(we,`RPC '${e}' ${s} failed with status:`,y,"response text:",l.getResponseText()),y>0){let w=l.getResponseJson();Array.isArray(w)&&(w=w[0]);const b=w==null?void 0:w.error;if(b&&b.status&&b.message){const k=function(C){const F=C.toLowerCase().replace(/_/g,"-");return Object.values(S).indexOf(F)>=0?F:S.UNKNOWN}(b.status);c(new D(k,b.message))}else c(new D(S.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new D(S.UNAVAILABLE,"Connection failed."));break;default:x()}}finally{V(we,`RPC '${e}' ${s} completed.`)}});const d=JSON.stringify(i);V(we,`RPC '${e}' ${s} sending request:`,i),l.send(t,"POST",d,r,15)})}Bo(e,t,r){const i=Vs(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=fh(),c=dh(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(l.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(l.xmlHttpFactory=new uh({})),this.Oo(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const f=s.join("");V(we,`Creating RPC '${e}' stream ${i}: ${f}`,l);const y=a.createWebChannel(f,l);let w=!1,b=!1;const k=new Hv({Io:C=>{b?V(we,`Not sending because RPC '${e}' stream ${i} is closed:`,C):(w||(V(we,`Opening RPC '${e}' stream ${i} transport.`),y.open(),w=!0),V(we,`RPC '${e}' stream ${i} sending:`,C),y.send(C))},To:()=>y.close()}),O=(C,F,$)=>{C.listen(F,j=>{try{$(j)}catch(q){setTimeout(()=>{throw q},0)}})};return O(y,Qn.EventType.OPEN,()=>{b||(V(we,`RPC '${e}' stream ${i} transport opened.`),k.yo())}),O(y,Qn.EventType.CLOSE,()=>{b||(b=!0,V(we,`RPC '${e}' stream ${i} transport closed`),k.So())}
2711),O(y,Qn.EventType.ERROR,C=>{b||(b=!0,fn(we,`RPC '${e}' stream ${i} transport errored:`,C),k.So(new D(S.UNAVAILABLE,"The operation could not be completed")))}),O(y,Qn.EventType.MESSAGE,C=>{var F;if(!b){const $=C.data[0];J(!!$);const j=$,q=j.error||((F=j[0])===null||F===void 0?void 0:F.error);if(q){V(we,`RPC '${e}' stream ${i} received error:`,q);const he=q.status;let Y=function(_){const v=oe[_];if(v!==void 0)return Fh(v)}(he),T=q.message;Y===void 0&&(Y=S.INTERNAL,T="Unknown error status: "+he+" with message "+q.message),b=!0,k.So(new D(Y,T)),y.close()}else V(we,`RPC '${e}' stream ${i} received:`,$),k.bo($)}}),O(c,hh.STAT_EVENT,C=>{C.stat===no.PROXY?V(we,`RPC '${e}' stream ${i} detected buffering proxy`):C.stat===no.NOPROXY&&V(we,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{k.wo()},0),k}}function Ms(){return typeof document<"u"?document:null}/**
2712 * @license
2713 * Copyright 2020 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 */function qi(n){return new nv(n,!0)}/**
2727 * @license
2728 * Copyright 2017 Google LLC
2729 *
2730 * Licensed under the Apache License, Version 2.0 (the "License");
2731 * you may not use this file except in compliance with the License.
2732 * You may obtain a copy of the License at
2733 *
2734 *   http://www.apache.org/licenses/LICENSE-2.0
2735 *
2736 * Unless required by applicable law or agreed to in writing, software
2737 * distributed under the License is distributed on an "AS IS" BASIS,
2738 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2739 * See the License for the specific language governing permissions and
2740 * limitations under the License.
2741 */class Yh{constructor(e,t,r=1e3,i=1.5,s=6e4){this.ui=e,this.timerId=t,this.ko=r,this.qo=i,this.Qo=s,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&&V("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}}/**
2742 * @license
2743 * Copyright 2017 Google LLC
2744 *
2745 * Licensed under the Apache License, Version 2.0 (the "License");
2746 * you may not use this file except in compliance with the License.
2747 * You may obtain a copy of the License at
2748 *
2749 *   http://www.apache.org/licenses/LICENSE-2.0
2750 *
2751 * Unless required by applicable law or agreed to in writing, software
2752 * distributed under the License is distributed on an "AS IS" BASIS,
2753 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2754 * See the License for the specific language governing permissions and
2755 * limitations under the License.
2756 */class Zh{constructor(e,t,r,i,s,a,c,l){this.ui=e,this.Ho=r,this.Jo=i,this.connection=s,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new Yh(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)}
2756c_(){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===S.RESOURCE_EXHAUSTED?(ft(t.toString()),ft("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===S.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(S.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 V("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(V("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class Wv extends Zh{constructor(e,t,r,i,s,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,i,a),this.serializer=s}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=sv(this.serializer,e),r=function(s){if(!("targetChange"in s))return B.min();const a=s.targetChange;return a.targetIds&&a.targetIds.length?B.min():a.readTime?Qe(a.readTime):B.min()}(e);return this.listener.d_(t,r)}A_(e){const t={};t.database=ho(this.serializer),t.addTarget=function(s,a){let c;const l=a.target;if(c=oo(l)?{documents:cv(s,l)}:{query:Kh(s,l)._t},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=$h(s,a.resumeToken);const d=co(s,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(B.min())>0){c.readTime=Ai(s,a.snapshotVersion.toTimestamp());const d=co(s,a.expectedCount);d!==null&&(c.expectedCount=d)}return c}(this.serializer,e);const r=hv(this.serializer,e);r&&(t.labels=r),this.a_(t)}R_(e){const t={};t.database=ho(this.serializer),t.removeTarget=e,this.a_(t)}}class Gv extends Zh{constructor(e,t,r,i,s,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,i,a),this.serializer=s}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 J(!!e.streamToken),this.lastStreamToken=e.streamToken,J(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){J(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=av(e.writeResults,e.commitTime),r=Qe(e.commitTime);return this.listener.g_(r,t)}p_(){const e={};e.database=ho(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>ov(this.serializer,r))};this.a_(t)}}/**
2757 * @license
2758 * Copyright 2017 Google LLC
2759 *
2760 * Licensed under the Apache License, Version 2.0 (the "License");
2761 * you may not use this file except in compliance with the License.
2762 * You may obtain a copy of the License at
2763 *
2764 *   http://www.apache.org/licenses/LICENSE-2.0
2765 *
2766 * Unless required by applicable law or agreed to in writing, software
2767 * distributed under the License is distributed on an "AS IS" BASIS,
2768 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2769 * See the License for the specific language governing permissions and
2770 * limitations under the License.
2771 */class Qv extends class{}
2771{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(S.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(([s,a])=>this.connection.Mo(e,uo(t,r),i,s,a)).catch(s=>{throw s.name==="FirebaseError"?(s.code===S.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new D(S.UNKNOWN,s.toString())})}Lo(e,t,r,i,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,c])=>this.connection.Lo(e,uo(t,r),i,a,c,s)).catch(a=>{throw a.name==="FirebaseError"?(a.code===S.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new D(S.UNKNOWN,a.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class Jv{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}
2772This 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_?(ft(t),this.D_=!1):V("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
2773 * @license
2774 * Copyright 2017 Google LLC
2775 *
2776 * Licensed under the Apache License, Version 2.0 (the "License");
2777 * you may not use this file except in compliance with the License.
2778 * You may obtain a copy of the License at
2779 *
2780 *   http://www.apache.org/licenses/LICENSE-2.0
2781 *
2782 * Unless required by applicable law or agreed to in writing, software
2783 * distributed under the License is distributed on an "AS IS" BASIS,
2784 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2785 * See the License for the specific language governing permissions and
2786 * limitations under the License.
2787 */class Xv{constructor(e,t,r,i,s){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_=s,this.k_._o(a=>{r.enqueueAndForget(async()=>{Zt(this)&&(V("RemoteStore","Restarting streams for network reachability change."),await async function(l){const d=U(l);d.L_.add(4),await Rr(d),d.q_.set("Unknown"),d.L_.delete(4),await zi(d)}(this))})}),this.q_=new Jv(r,i)}}async function zi(n){if(Zt(n))for(const e of n.B_)await e(!0)}async function Rr(n){for(const e of n.B_)await e(!1)}function ed(n,e){const t=U(n);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),Yo(t)?Xo(t):Sn(t).r_()&&Jo(t,e))}function Qo(n,e){const t=U(n),r=Sn(t);t.N_.delete(e),r.r_()&&td(t,e),t.N_.size===0&&(r.r_()?r.o_():Zt(t)&&t.q_.set("Unknown"))}function Jo(n,e){if(n.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(B.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}Sn(n).A_(e)}function td(n,e){n.Q_.xe(e),Sn(n).R_(e)}function Xo(n){n.Q_=new Yy({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>n.N_.get(e)||null,tt:()=>n.datastore.serializer.databaseId}),Sn(n).start(),n.q_.v_()}function Yo(n){return Zt(n)&&!Sn(n).n_()&&n.N_.size>0}function Zt(n){return U(n).L_.size===0}function nd(n){n.Q_=void 0}async function Yv(n){n.q_.set("Online")}async function Zv(n){n.N_.forEach((e,t)=>{Jo(n,e)})}async function eT(n,e){nd(n),Yo(n)?(n.q_.M_(e),Xo(n)):n.q_.set("Unknown")}async function tT(n,e,t){if(n.q_.set("Online"),e instanceof jh&&e.state===2&&e.cause)try{await async function(i,s){const a=s.cause;for(const c of s.targetIds)i.N_.has(c)&&(await i.remoteSyncer.rejectListen(c,a),i.N_.delete(c),i.Q_.removeTarget(c))}(n,e)}catch(r){V("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Ri(n,r)}else if(e instanceof ui?n.Q_.Ke(e):e instanceof Bh?n.Q_.He(e):n.Q_.We(e),!t.isEqual(B.min()))try{const r=await Xh(n.localStore);t.compareTo(r)>=0&&await function(s,a){const c=s.Q_.rt(a);
2787return c.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const f=s.N_.get(d);f&&s.N_.set(d,f.withResumeToken(l.resumeToken,a))}}),c.targetMismatches.forEach((l,d)=>{const f=s.N_.get(l);if(!f)return;s.N_.set(l,f.withResumeToken(me.EMPTY_BYTE_STRING,f.snapshotVersion)),td(s,l);const y=new St(f.target,l,d,f.sequenceNumber);Jo(s,y)}),s.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){V("RemoteStore","Failed to raise snapshot:",r),await Ri(n,r)}}async function Ri(n,e,t){if(!Ir(e))throw e;n.L_.add(1),await Rr(n),n.q_.set("Offline"),t||(t=()=>Xh(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{V("RemoteStore","Retrying IndexedDB access"),await t(),n.L_.delete(1),await zi(n)})}function rd(n,e){return e().catch(t=>Ri(n,t,e))}async function Hi(n){const e=U(n),t=Dt(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;nT(e);)try{const i=await Fv(e.localStore,r);if(i===null){e.O_.length===0&&t.o_();break}r=i.batchId,rT(e,i)}catch(i){await Ri(e,i)}id(e)&&sd(e)}function nT(n){return Zt(n)&&n.O_.length<10}function rT(n,e){n.O_.push(e);const t=Dt(n);t.r_()&&t.V_&&t.m_(e.mutations)}function id(n){return Zt(n)&&!Dt(n).n_()&&n.O_.length>0}function sd(n){Dt(n).start()}async function iT(n){Dt(n).p_()}async function sT(n){const e=Dt(n);for(const t of n.O_)e.m_(t.mutations)}async function oT(n,e,t){const r=n.O_.shift(),i=qo.from(r,e,t);await rd(n,()=>n.remoteSyncer.applySuccessfulWrite(i)),await Hi(n)}async function aT(n,e){e&&Dt(n).V_&&await async function(r,i){if(function(a){return Qy(a)&&a!==S.ABORTED}(i.code)){const s=r.O_.shift();Dt(r).s_(),await rd(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Hi(r)}}(n,e),id(n)&&sd(n)}async function Lu(n,e){const t=U(n);t.asyncQueue.verifyOperationInProgress(),V("RemoteStore","RemoteStore received new credentials");const r=Zt(t);t.L_.add(3),await Rr(t),r&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await zi(t)}async function cT(n,e){const t=U(n);e?(t.L_.delete(2),await zi(t)):e||(t.L_.add(2),await Rr(t),t.q_.set("Unknown"))}function Sn(n){return n.K_||(n.K_=function(t,r,i){const s=U(t);return s.w_(),new Wv(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(n.datastore,n.asyncQueue,{Eo:Yv.bind(null,n),Ro:Zv.bind(null,n),mo:eT.bind(null,n),d_:tT.bind(null,n)}),n.B_.push(async e=>{e?(n.K_.s_(),Yo(n)?Xo(n):n.q_.set("Unknown")):(await n.K_.stop(),nd(n))})),n.K_}function Dt(n){return n.U_||(n.U_=function(t,r,i){const s=U(t);return s.w_(),new Gv(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(n.datastore,n.asyncQueue,{Eo:()=>Promise.resolve(),Ro:iT.bind(null,n),mo:aT.bind(null,n),f_:sT.bind(null,n),g_:oT.bind(null,n)}),n.B_.push(async e=>{e?(n.U_.s_(),await Hi(n)):(await n.U_.stop(),n.O_.length>0&&(V("RemoteStore",`Stopping write stream with ${n.O_.length} pending writes`),n.O_=[]))})),n.U_}/**
2788 * @license
2789 * Copyright 2017 Google LLC
2790 *
2791 * Licensed under the Apache License, Version 2.0 (the "License");
2792 * you may not use this file except in compliance with the License.
2793 * You may obtain a copy of the License at
2794 *
2795 *   http://www.apache.org/licenses/LICENSE-2.0
2796 *
2797 * Unless required by applicable law or agreed to in writing, software
2798 * distributed under the License is distributed on an "AS IS" BASIS,
2799 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2800 * See the License for the specific language governing permissions and
2801 * limitations under the License.
2802 */class Zo{constructor(e,t,r,i,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=i,this.removalCallback=s,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,s){const a=Date.now()+r,c=new Zo(e,t,a,i,s);return c.start(r),c}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new D(S.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 ea(n,e){if(ft("AsyncQueue",`${e}: ${n}`),Ir(n))return new D(S.UNAVAILABLE,`${e}: ${n}`);throw n}/**
2803 * @license
2804 * Copyright 2017 Google LLC
2805 *
2806 * Licensed under the Apache License, Version 2.0 (the "License");
2807 * you may not use this file except in compliance with the License.
2808 * You may obtain a copy of the License at
2809 *
2810 *   http://www.apache.org/licenses/LICENSE-2.0
2811 *
2812 * Unless required by applicable law or agreed to in writing, software
2813 * distributed under the License is distributed on an "AS IS" BASIS,
2814 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2815 * See the License for the specific language governing permissions and
2816 * limitations under the License.
2817 */class hn{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=Jn(),this.sortedSet=new te(this.comparator)}static emptySet(e){return new hn(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 hn)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const i=t.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
2818  `+e.join(`  
2819`)+`
2820)`}copy(e,t){const r=new hn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
2821 * @license
2822 * Copyright 2017 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 */class xu{constructor(){this.W_=new te(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 yn{constructor(e,t,r,i,s,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,i,s){const a=[];return t.forEach(c=>{a.push({type:0,doc:c})}),new yn(e,t,hn.emptySet(t),a,r,i,!0,!1,s)}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)&&xi(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}}/**
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, softw
2845are
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 uT{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class lT{constructor(){this.queries=Uu(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,r){const i=U(t),s=i.queries;i.queries=Uu(),s.forEach((a,c)=>{for(const l of c.j_)l.onError(r)})})(this,new D(S.ABORTED,"Firestore shutting down"))}}function Uu(){return new bn(n=>Sh(n),xi)}async function ta(n,e){const t=U(n);let r=3;const i=e.query;let s=t.queries.get(i);s?!s.H_()&&e.J_()&&(r=2):(s=new uT,r=e.J_()?0:1);try{switch(r){case 0:s.z_=await t.onListen(i,!0);break;case 1:s.z_=await t.onListen(i,!1);break;case 2:await t.onFirstRemoteStoreListen(i)}}catch(a){const c=ea(a,`Initialization of query '${sn(e.query)}' failed`);return void e.onError(c)}t.queries.set(i,s),s.j_.push(e),e.Z_(t.onlineState),s.z_&&e.X_(s.z_)&&ra(t)}async function na(n,e){const t=U(n),r=e.query;let i=3;const s=t.queries.get(r);if(s){const a=s.j_.indexOf(e);a>=0&&(s.j_.splice(a,1),s.j_.length===0?i=e.J_()?0:1:!s.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 hT(n,e){const t=U(n);let r=!1;for(const i of e){const s=i.query,a=t.queries.get(s);if(a){for(const c of a.j_)c.X_(i)&&(r=!0);a.z_=i}}r&&ra(t)}function dT(n,e,t){const r=U(n),i=r.queries.get(e);if(i)for(const s of i.j_)s.onError(t);r.queries.delete(e)}function ra(n){n.Y_.forEach(e=>{e.next()})}var po,Fu;(Fu=po||(po={})).ea="default",Fu.Cache="cache";class ia{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 yn(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=yn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==po.Cache}}/**
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 od{constructor(e){this.key=e}}class ad{constructor(e){this.key=e}}class fT{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=z(),this.mutatedKeys=z(),this.Aa=Ph(e),this.Ra=new hn(this.Aa)}get Va(){return this.Ta}ma(e,t){const r=t?t.fa:new xu,i=t?t.Ra:this.Ra;let s=t?t.mutatedKeys:this.mutatedKeys,a=i,c=!1;const l=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((f,y)=>{const w=i.get(f),b=Ui(this.query,y)?y:null,k=!!w&&this.mutatedKeys.has(w.key),O=!!b&&(b.hasLocalMutations||this.mutatedKeys.has(b.key)&&b.hasCommittedMutations);let C=!1;w&&b?w.data.isEqual(b.data)?k!==O&&(r.track({type:3,doc:b}),C=!0):this.ga(w,b)||(r.track({type:2,doc:b}),C=!0,(l&&this.Aa(b,l)>0||d&&this.Aa(b,d)<0)&&(c=!0)):!w&&b?(r.track({type:0,doc:b}),C=!0):w&&!b&&(r.track({type:1,doc:w}),C=!0,(l||d)&&(c=!0)),C&&(b?(a=a.add(b),s=O?s.add(f):s.delete(f)):(a=a.delete(f),s=s.delete(f)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const f=this.query.limitType==="F"?a.last():a.first();a=a.delete(f.key),s=s.delete(f.key),r.track({type:1,doc:f})}return{Ra:a,fa:r,ns:c,mutatedKeys:s}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}
2865applyChanges(e,t,r,i){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const a=e.fa.G_();a.sort((f,y)=>function(b,k){const O=C=>{switch(C){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return x()}};return O(b)-O(k)}(f.type,y.type)||this.Aa(f.doc,y.doc)),this.pa(r),i=i!=null&&i;const c=t&&!i?this.ya():[],l=this.da.size===0&&this.current&&!i?1:0,d=l!==this.Ea;return this.Ea=l,a.length!==0||d?{snapshot:new yn(this.query,e.Ra,s,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:c}:{wa:c}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new xu,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(t=>this.Ta=this.Ta.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ta=this.Ta.delete(t)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=z(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const t=[];return e.forEach(r=>{this.da.has(r)||t.push(new ad(r))}),this.da.forEach(r=>{e.has(r)||t.push(new od(r))}),t}ba(e){this.Ta=e.Ts,this.da=z();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return yn.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class pT{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class gT{constructor(e){this.key=e,this.va=!1}}class mT{constructor(e,t,r,i,s,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=a,this.Ca={},this.Fa=new bn(c=>Sh(c),xi),this.Ma=new Map,this.xa=new Set,this.Oa=new te(M.comparator),this.Na=new Map,this.La=new Ko,this.Ba={},this.ka=new Map,this.qa=_n.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function _T(n,e,t=!0){const r=fd(n);let i;const s=r.Fa.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.Da()):i=await cd(r,e,t,!0),i}async function yT(n,e){const t=fd(n);await cd(t,e,!0,!1)}async function cd(n,e,t,r){const i=await Bv(n.localStore,Ge(e)),s=i.targetId,a=t?n.sharedClientState.addLocalQueryTarget(s):"not-current";let c;return r&&(c=await vT(n,e,s,a==="current",i.resumeToken)),n.isPrimaryClient&&t&&ed(n.remoteStore,i),c}async function vT(n,e,t,r,i){n.Ka=(y,w,b)=>async function(O,C,F,$){let j=C.view.ma(F);j.ns&&(j=await Ou(O.localStore,C.query,!1).then(({documents:T})=>C.view.ma(T,j)));const q=$&&$.targetChanges.get(C.targetId),he=$&&$.targetMismatches.get(C.targetId)!=null,Y=C.view.applyChanges(j,O.isPrimaryClient,q,he);return ju(O,C.targetId,Y.wa),Y.snapshot}(n,y,w,b);const s=await Ou(n.localStore,e,!0),a=new fT(e,s.Ts),c=a.ma(s.documents),l=Ar.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",i),d=a.applyChanges(c,n.isPrimaryClient,l);ju(n,t,d.wa);const f=new pT(e,t,a);return n.Fa.set(e,f),n.Ma.has(t)?n.Ma.get(t).push(e):n.Ma.set(t,[e]),d.snapshot}async function TT(n,e,t){const r=U(n),i=r.Fa.get(e),s=r.Ma.get(i.targetId);if(s.length>1)return r.Ma.set(i.targetId,s.filter(a=>!xi(a,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedCl
2865ientState.isActiveQueryTarget(i.targetId)||await fo(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),t&&Qo(r.remoteStore,i.targetId),go(r,i.targetId)}).catch(wr)):(go(r,i.targetId),await fo(r.localStore,i.targetId,!0))}async function wT(n,e){const t=U(n),r=t.Fa.get(e),i=t.Ma.get(r.targetId);t.isPrimaryClient&&i.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),Qo(t.remoteStore,r.targetId))}async function IT(n,e,t){const r=CT(n);try{const i=await function(a,c){const l=U(a),d=ce.now(),f=c.reduce((b,k)=>b.add(k.key),z());let y,w;return l.persistence.runTransaction("Locally write mutations","readwrite",b=>{let k=pt(),O=z();return l.cs.getEntries(b,f).next(C=>{k=C,k.forEach((F,$)=>{$.isValidDocument()||(O=O.add(F))})}).next(()=>l.localDocuments.getOverlayedDocuments(b,k)).next(C=>{y=C;const F=[];for(const $ of c){const j=qy($,y.get($.key).overlayedDocument);j!=null&&F.push(new Vt($.key,j,yh(j.value.mapValue),Ve.exists(!0)))}return l.mutationQueue.addMutationBatch(b,d,F,c)}).next(C=>{w=C;const F=C.applyToLocalDocumentSet(y,O);return l.documentOverlayCache.saveOverlays(b,C.batchId,F)})}).then(()=>({batchId:w.batchId,changes:kh(y)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(a,c,l){let d=a.Ba[a.currentUser.toKey()];d||(d=new te(Q)),d=d.insert(c,l),a.Ba[a.currentUser.toKey()]=d}(r,i.batchId,t),await br(r,i.changes),await Hi(r.remoteStore)}catch(i){const s=ea(i,"Failed to persist write");t.reject(s)}}async function ud(n,e){const t=U(n);try{const r=await xv(t.localStore,e);
2865e.targetChanges.forEach((i,s)=>{const a=t.Na.get(s);a&&(J(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?a.va=!0:i.modifiedDocuments.size>0?J(a.va):i.removedDocuments.size>0&&(J(a.va),a.va=!1))}),await br(t,r,e)}catch(r){await wr(r)}}function Bu(n,e,t){const r=U(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const i=[];r.Fa.forEach((s,a)=>{const c=a.view.Z_(e);c.snapshot&&i.push(c.snapshot)}),function(a,c){const l=U(a);l.onlineState=c;let d=!1;l.queries.forEach((f,y)=>{for(const w of y.j_)w.Z_(c)&&(d=!0)}),d&&ra(l)}(r.eventManager,e),i.length&&r.Ca.d_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function ET(n,e,t){const r=U(n);r.sharedClientState.updateQueryState(e,"rejected",t);const i=r.Na.get(e),s=i&&i.key;if(s){let a=new te(M.comparator);a=a.insert(s,Ee.newNoDocument(s,B.min()));const c=z().add(s),l=new $i(B.min(),new Map,new te(Q),a,c);await ud(r,l),r.Oa=r.Oa.remove(s),r.Na.delete(e),sa(r)}else await fo(r.localStore,e,!1).then(()=>go(r,e,t)).catch(wr)}async function AT(n,e){const t=U(n),r=e.batch.batchId;try{const i=await Lv(t.localStore,e);hd(t,r,null),ld(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await br(t,i)}catch(i){await wr(i)}}async function RT(n,e,t){const r=U(n);try{const i=await function(a,c){const l=U(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let f;return l.mutationQueue.lookupMutationBatch(d,c).next(y=>(J(y!==null),f=y.keys(),l.mutationQueue.removeMutationBatch(d,y))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,f,c)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,f)).next(()=>l.localDocuments.getDocuments(d,f))})}(r.localStore,e);hd(r,e,t),ld(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await br(r,i)}catch(i){await wr(i)}}function ld(n,e){(n.ka.get(e)||[]).forEach(t=>{t.resolve()}),n.ka.delete(e)}function hd(n,e,t){const r=U(n);let i=r.Ba[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(t?s.reject(t):s.resolve(),i=i.remove(e)),r.Ba[r.currentUser.toKey()]=i}}function go(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)||dd(n,r)})}function dd(n,e){n.xa.delete(e.path.canonicalString());const t=n.Oa.get(e);t!==null&&(Qo(n.remoteStore,t),n.Oa=n.Oa.remove(e),n.Na.delete(t),sa(n))}function ju(n,e,t){for(const r of t)r instanceof od?(n.La.addReference(r.key,e),bT(n,r)):r instanceof ad?(V("SyncEngine","Document no longer in limbo: "+r.key),n.La.removeReference(r.key,e),n.La.containsKey(r.key)||dd(n,r.key)):x()}function bT(n,e){const t=e.key,r=t.path.canonicalString();n.Oa.get(t)||n.xa.has(r)||(V("SyncEngine","New document in limbo: "+t),n.xa.add(r),sa(n))}function sa(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(ee.fromString(e)),r=n.qa.next();n.Na.set(r,new gT(t)),n.Oa=n.Oa.insert(t,r),ed(n.remoteStore,new St(Ge(Li(t.path)),r,"TargetPurposeLimboResolution",Lo.oe))}}async function br(n,e,t){const r=U(n),i=[],s=[],a=[];r.Fa.isEmpty()||(r.Fa.forEach((c,l)=>{a.push(r.Ka(l,e,t).then(d=>{var f;if((d||t)&&r.isPrimaryClient){const y=d?!d.fromCache:(f=t==null?void 0:t.targetChanges.get(l.targetId))===null||f===void 0?void 0:f.current;
2865r.sharedClientState.updateQueryState(l.targetId,y?"current":"not-current")}if(d){i.push(d);const y=Go.Wi(l.targetId,d);s.push(y)}}))}),await Promise.all(a),r.Ca.d_(i),await async function(l,d){const f=U(l);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",y=>P.forEach(d,w=>P.forEach(w.$i,b=>f.persistence.referenceDelegate.addReference(y,w.targetId,b)).next(()=>P.forEach(w.Ui,b=>f.persistence.referenceDelegate.removeReference(y,w.targetId,b)))))}catch(y){if(!Ir(y))throw y;V("LocalStore","Failed to update sequence numbers: "+y)}for(const y of d){const w=y.targetId;if(!y.fromCache){const b=f.os.get(w),k=b.snapshotVersion,O=b.withLastLimboFreeSnapshotVersion(k);f.os=f.os.insert(w,O)}}}(r.localStore,s))}async function ST(n,e){const t=U(n);if(!t.currentUser.isEqual(e)){V("SyncEngine","User change. New user:",e.toKey());const r=await Jh(t.localStore,e);t.currentUser=e,function(s,a){s.ka.forEach(c=>{c.forEach(l=>{l.reject(new D(S.CANCELLED,a))})}),s.ka.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await br(t,r.hs)}}function PT(n,e){const t=U(n),r=t.Na.get(e);if(r&&r.va)return z().add(r.key);{let i=z();const s=t.Ma.get(e);if(!s)return i;for(const a of s){const c=t.Fa.get(a);i=i.unionWith(c.view.Va)}return i}}function fd(n){const e=U(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=ud.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=PT.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ET.bind(null,e),e.Ca.d_=hT.bind(null,e.eventManager),e.Ca.$a=dT.bind(null,e.eventManager),e}function CT(n){const e=U(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=AT.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=RT.bind(null,e),e}class $u{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=qi(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return Mv(this.persistence,new Ov,e.initialUser,this.serializer)}createPersistence(e){return new kv(Wo.Zr,this.serializer)}createSharedClientState(e){return new $v}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class kT{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=>Bu(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=ST.bind(null,this.syncEngine),await cT(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new lT}()}createDatastore(e){const t=qi(e.databaseInfo.databaseId),r=function(s){return new Kv(s)}(e.databaseInfo);return function(s,a,c,l){return new Qv(s,a,c,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,i,s,a,c){return new Xv(r,i,s,a,c)}(this.localStore,this.datastore,e.asyncQueue,t=>Bu(this.syncEngine,t,0),function(){return Mu.D()?new Mu:new qv}())}createSyncEngine(e,t){return function(i,s,a,c,l,d,f){const y=new mT(i,s,a,c,l,d);return f&&(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 s=U(i);V("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await Rr(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}/**
2866 * @license
2867 * Copyright 2020 Google LLC
2868 *
2869 * Licensed under the Apache License, Version 2.0 (the "License");
2870 * you may not use this file except in compliance with the License.
2871 * You may obtain a copy of the License at
2872 *
2873 *   http://www.apache.org/licenses/LICENSE-2.0
2874 *
2875 * Unless required by applicable law or agreed to in writing, software
2876 * distributed under the License is distributed on an "AS IS" BASIS,
2877 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2878 * See the License for the specific language governing permissions and
2879 * limitations under the License.
2880 *//**
2881 * @license
2882 * Copyright 2017 Google LLC
2883 *
2884 * Licensed under the Apache License, Version 2.0 (the "License");
2885 * you may not use this file except in compliance with the License.
2886 * You may obtain a copy of the License at
2887 *
2888 *   http://www.apache.org/licenses/LICENSE-2.0
2889 *
2890 * Unless required by applicable law or agreed to in writing, software
2891 * distributed under the License is distributed on an "AS IS" BASIS,
2892 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2893 * See the License for the specific language governing permissions and
2894 * limitations under the License.
2895 */class oa{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ga(this.observer.next,e)}error(e){this.observer.error?this.Ga(this.observer.error,e):ft("Uncaught Error in snapshot listener:",e.toString())}za(){this.muted=!0}Ga(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}}/**
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 */class NT{constructor(e,t,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=i,this.user=Ie.UNAUTHENTICATED,this.clientId=gh.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async s=>{V("FirestoreClient","Received user=",s.uid),await this.authCredentialListener(s),this.user=s}),this.appCheckCredentials.start(r,s=>(V("FirestoreClient","Received new app check token=",s),this.appCheckCredentialListener(s,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}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new D(S.FAILED_PRECONDITION,"The client has already been terminated.")}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=ea(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Ls(n,e){n.asyncQueue.verifyOperationInProgress(),V("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async i=>{r.isEqual(i)||(await Jh(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function qu(n,e){n.asyncQueue.verifyOperationInProgress();const t=await OT(n);V("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>Lu(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,i)=>Lu(e.remoteStore,i)),n._onlineComponents=e}function DT(n){return n.name==="FirebaseError"?n.code===S.FAILED_PRECONDITION||n.code===S.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11}async function OT(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){V("FirestoreClient","Using user provided OfflineComponentProvider");try{await Ls(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!DT(t))throw t;fn("Error using user provided cache. Falling back to memory cache: "+t),await Ls(n,new $u)}}else V("FirestoreClient","Using default OfflineComponentProvider"),await Ls(n,new $u);return n._offlineComponents}async function aa(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(V("FirestoreClient","Using user provided OnlineComponentProvider"),await qu(n,n._uninitializedComponentsProvider._online)):(V("FirestoreClient","Using default OnlineComponentProvider"),await qu(n,new kT))),n._onlineComponents}function VT(n){return aa(n).then(e=>e.syncEngine)}function MT(n){return aa(n).then(e=>e.datastore)}async function bi(n){const e=await aa(n),t=e.eventManager;return t.onListen=_T.bind(null,e.syncEngine),t.onUnlisten=TT.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=yT.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=wT.bind(null,e.syncEngine),t}function LT(n,e,t={}){const r=new We;return n.asyncQueue.enqueueAndForget(async()=>function(s,a,c,l,d){const f=new oa({next:w=>{a.enqueueAndForget(()=>na(s,y));const b=w.docs.has(c);!b&&w.fromCache?d.reject(new D(S.UNAVAILABLE,"Failed to get document because the client is offline.")):b&&w.fromCache&&l&&l.source==="server"?d.reject(new D(S.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(w)},error:w=>d.reject(w)}),y=new ia(Li(c.path),f,{includeMetadataChanges:!0,_a:!0});return ta(s,y)}(await bi(n),n.asyncQueue,e,t,r)),r.promise}function xT(n,e,t={}){const r=new We;return n.asyncQueue.enqueueAndForget(async()=>function(s,a,c,l,d){const f=new oa({next:w=>{a.enqueueAndForget(()=>na(s,y)),w.fromCache&&l.source==="server"?d.reject(new D(S.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(w)},error:w=>d.reject(w)}),y=new ia(c,f,{includeMetadataChanges:!0,_a:!0});return ta(s,y)}(await bi(n),n.asyncQueue,e,t,r)),r.promise}function UT(n,e,t){const r=new We;return n.asyncQueue.enqueueAndForget(async()=>{try{const i=await MT(n);r.resolve(async function(a,c,l){var d;const f=U(a),{request:y,ut:w,parent:b}=uv(f.serializer,Cy(c),l);f.connection.Fo||delete y.parent;
2910const k=(await f.Lo("RunAggregationQuery",f.serializer.databaseId,b,y,1)).filter(C=>!!C.result);J(k.length===1);const O=(d=k[0].result)===null||d===void 0?void 0:d.aggregateFields;return Object.keys(O).reduce((C,F)=>(C[w[F]]=O[F],C),{})}(i,e,t))}catch(i){r.reject(i)}}),r.promise}/**
2911 * @license
2912 * Copyright 2023 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 */function pd(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
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 */const zu=new Map;/**
2941 * @license
2942 * Copyright 2017 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 */function gd(n,e,t){if(!t)throw new D(S.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function FT(n,e,t,r){if(e===!0&&r===!0)throw new D(S.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Hu(n){if(!M.isDocumentKey(n))throw new D(S.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Ku(n){if(M.isDocumentKey(n))throw new D(S.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function Ki(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 ke(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new D(S.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=Ki(n);throw new D(S.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function BT(n,e){if(e<=0)throw new D(S.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
2956 * @license
2957 * Copyright 2020 Google LLC
2958 *
2959 * Licensed under the Apache License, Version 2.0 (the "License");
2960 * you may not use this file except in compliance with the License.
2961 * You may obtain a copy of the License at
2962 *
2963 *   http://www.apache.org/licenses/LICENSE-2.0
2964 *
2965 * Unless required by applicable law or agreed to in writing, software
2966 * distributed under the License is distributed on an "AS IS" BASIS,
2967 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2968 * See the License for the specific language governing permissions and
2969 * limitations under the License.
2970 */class Wu{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new D(S.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;
2970else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new D(S.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}FT("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=pd((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new D(S.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new D(S.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new D(S.INVALID_ARGUMENT,`invalid long polling timeout: ${s.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}}
2970class 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 Wu({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new D(S.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!==void 0}_setSettings(e){if(this._settingsFrozen)throw new D(S.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 Wu(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new X_;switch(r.type){case"firstParty":return new ty(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new D(S.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||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const r=zu.get(t);r&&(V("ComponentProvider","Removing Datastore"),zu.delete(t),r.terminate())}(this),Promise.resolve()}}function jT(n,e,t,r={}){var i;const s=(n=ke(n,Wi))._getSettings(),a=`${e}:${t}`;if(s.host!=="firestore.googleapis.com"&&s.host!==a&&fn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},s),{host:a,ssl:!1})),r.mockUserToken){let c,l;if(typeof r.mockUserToken=="string")c=r.mockUserToken,l=Ie.MOCK_USER;else{c=Il(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(S.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new Ie(d)}n._authCredentials=new Y_(new ph(c,l))}}/**
2971 * @license
2972 * Copyright 2020 Google LLC
2973 *
2974 * Licensed under the Apache License, Version 2.0 (the "License");
2975 * you may not use this file except in compliance with the License.
2976 * You may obtain a copy of the License at
2977 *
2978 *   http://www.apache.org/licenses/LICENSE-2.0
2979 *
2980 * Unless required by applicable law or agreed to in writing, software
2981 * distributed under the License is distributed on an "AS IS" BASIS,
2982 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2983 * See the License for the specific language governing permissions and
2984 * limitations under the License.
2985 */class gt{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new gt(this.firestore,e,this._query)}}class Ae{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 Ct(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ae(this.firestore,e,this._key)}}class Ct extends gt{constructor(e,t,r){super(e,t,Li(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 Ae(this.firestore,null,new M(e))}withConverter(e){return new Ct(this.firestore,e,this._path)}}function PA(n,e,...t){if(n=W(n),gd("collection","path",e),n instanceof Wi){const r=ee.fromString(e,...t);return Ku(r),new Ct(n,null,r)}{if(!(n instanceof Ae||n instanceof Ct))throw new D(S.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return Ku(r),new Ct(n.firestore,null,r)}}function CA(n,e,...t){if(n=W(n),arguments.length===1&&(e=gh.newId()),gd("doc","path",e),n instanceof Wi){const r=ee.fromString(e,...t);
2985return Hu(r),new Ae(n,null,new M(r))}{if(!(n instanceof Ae||n instanceof Ct))throw new D(S.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return Hu(r),new Ae(n.firestore,n instanceof Ct?n.converter:null,new M(r))}}/**
2986 * @license
2987 * Copyright 2020 Google LLC
2988 *
2989 * Licensed under the Apache License, Version 2.0 (the "License");
2990 * you may not use this file except in compliance with the License.
2991 * You may obtain a copy of the License at
2992 *
2993 *   http://www.apache.org/licenses/LICENSE-2.0
2994 *
2995 * Unless required by applicable law or agreed to in writing, software
2996 * distributed under the License is distributed on an "AS IS" BASIS,
2997 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2998 * See the License for the specific language governing permissions and
2999 * limitations under the License.
3000 */class $T{constructor(){this.au=Promise.resolve(),this.uu=[],this.cu=!1,this.lu=[],this.hu=null,this.Pu=!1,this.Iu=!1,this.Tu=[],this.t_=new Yh(this,"async_queue_retry"),this.Eu=()=>{const t=Ms();t&&V("AsyncQueue","Visibility state changed to "+t.visibilityState),this.t_.jo()};const e=Ms();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.Eu)}get isShuttingDown(){return this.cu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.du(),this.Au(e)}enterRestrictedMode(e){if(!this.cu){this.cu=!0,this.Iu=e||!1;const t=Ms();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Eu)}}enqueue(e){if(this.du(),this.cu)return new Promise(()=>{});const t=new We;return this.Au(()=>this.cu&&this.Iu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.uu.push(e),this.Ru()))}async Ru(){if(this.uu.length!==0){try{await this.uu[0](),this.uu.shift(),this.t_.reset()}catch(e){if(!Ir(e))throw e;V("AsyncQueue","Operation failed with retryable error: "+e)}this.uu.length>0&&this.t_.Go(()=>this.Ru())}}Au(e){const t=this.au.then(()=>(this.Pu=!0,e().catch(r=>{this.hu=r,this.Pu=!1;const i=function(a){let c=a.message||"";return a.stack&&(c=a.stack.includes(a.message)?a.stack:a.message+`
3001`+a.stack),c}(r);throw ft("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.Pu=!1,r))));return this.au=t,t}enqueueAfterDelay(e,t,r){this.du(),this.Tu.indexOf(e)>-1&&(t=0);const i=Zo.createAndSchedule(this,e,t,r,s=>this.Vu(s));return this.lu.push(i),i}du(){this.hu&&x()}verifyOperationInProgress(){}async mu(){let e;do e=this.au,await e;while(e!==this.au)}fu(e){for(const t of this.lu)if(t.timerId===e)return!0;return!1}gu(e){return this.mu().then(()=>{this.lu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.lu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.mu()})}pu(e){this.Tu.push(e)}Vu(e){const t=this.lu.indexOf(e);this.lu.splice(t,1)}}function Gu(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const i=t;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(n,["next","error","complete"])}
3001class Ye extends Wi{constructor(e,t,r,i){super(e,t,r,i),this.type="firestore",this._queue=function(){return new $T}(),this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||md(this),this._firestoreClient.terminate()}}function kA(n,e){const t=typeof n=="object"?n:Tn(),r=typeof n=="string"?n:"(default)",i=Ze(t,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=vo("firestore");s&&jT(i,...s)}return i}function Pn(n){return n._firestoreClient||md(n),n._firestoreClient.verifyNotTerminated(),n._firestoreClient}function md(n){var e,t,r;const i=n._freezeSettings(),s=function(c,l,d,f){return new gy(c,l,d,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,pd(f.experimentalLongPollingOptions),f.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,i);n._firestoreClient=new NT(n._authCredentials,n._appCheckCredentials,n._queue,s),!((t=i.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._firestoreClient._uninitializedComponentsProvider={_offlineKind:i.localCache.kind,_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider})}/**
3002 * @license
3003 * Copyright 2020 Google LLC
3004 *
3005 * Licensed under the Apache License, Version 2.0 (the "License");
3006 * you may not use this file except in compliance with the License.
3007 * You may obtain a copy of the License at
3008 *
3009 *   http://www.apache.org/licenses/LICENSE-2.0
3010 *
3011 * Unless required by applicable law or agreed to in writing, software
3012 * distributed under the License is distributed on an "AS IS" BASIS,
3013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3014 * See the License for the specific language governing permissions and
3015 * limitations under the License.
3016 *//**
3017 * @license
3018 * Copyright 2022 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 qT{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class zT{constructor(e,t,r){this._userDataWriter=t,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
3032 * @license
3033 * Copyright 2020 Google LLC
3034 *
3035 * Licensed under the Apache License, Version 2.0 (the "License");
3036 * you may not use this file except in compliance with the License.
3037 * You may obtain a copy of the License at
3038 *
3039 *   http://www.apache.org/licenses/LICENSE-2.0
3040 *
3041 * Unless required by applicable law or agreed to in writing, software
3042 * distributed under the License is distributed on an "AS IS" BASIS,
3043 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3044 * See the License for the specific language governing permissions and
3045 * limitations under the License.
3046 */class vn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new vn(me.fromBase64String(e))}catch(t){throw new D(S.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new vn(me.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
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, softw
3056are
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 Sr{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new D(S.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new pe(e)}isEqual(e){return this._internalPath.isEqual(e._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 */class ca{constructor(e){this._methodName=e}}/**
3077 * @license
3078 * Copyright 2017 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 */class ua{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new D(S.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new D(S.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 Q(this._lat,e._lat)||Q(this._long,e._long)}}/**
3092 * @license
3093 * Copyright 2024 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 la{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 s=0;s<r.length;++s)if(r[s]!==i[s])return!1;return!0}(this._values,e._values)}}/**
3107 * @license
3108 * Copyright 2017 Google LLC
3109 *
3110 * Licensed under the Apache License, Version 2.0 (the "License");
3111 * you may not use this file except in compliance with the License.
3112 * You may obtain a copy of the License at
3113 *
3114 *   http://www.apache.org/licenses/LICENSE-2.0
3115 *
3116 * Unless required by applicable law or agreed to in writing, software
3117 * distributed under the License is distributed on an "AS IS" BASIS,
3118 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3119 * See the License for the specific language governing permissions and
3120 * limitations under the License.
3121 */const HT=/^__.*__$/;class KT{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Vt(e,this.data,this.fieldMask,t,this.fieldTransforms):new Er(e,this.data,t,this.fieldTransforms)}}class _d{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new Vt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function yd(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw x()}}class ha{constructor(e,t,r,i,s,a){this.settings=e,this.databaseId=t,this.serializer
3121=r,this.ignoreUndefinedProperties=i,s===void 0&&this.yu(),this.fieldTransforms=s||[],this.fieldMask=a||[]}get path(){return this.settings.path}get wu(){return this.settings.wu}Su(e){return new ha(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}bu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.Su({path:r,Du:!1});return i.vu(e),i}Cu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),i=this.Su({path:r,Du:!1});return i.yu(),i}Fu(e){return this.Su({path:void 0,Du:!0})}Mu(e){return Si(e,this.settings.methodName,this.settings.xu||!1,this.path,this.settings.Ou)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}yu(){if(this.path)for(let e=0;e<this.path.length;e++)this.vu(this.path.get(e))}vu(e){if(e.length===0)throw this.Mu("Document fields must not be empty");if(yd(this.wu)&&HT.test(e))throw this.Mu('Document fields cannot begin and end with "__"')}}class WT{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||qi(e)}Nu(e,t,r,i=!1){return new ha({wu:e,methodName:t,Ou:r,path:pe.emptyPath(),Du:!1,xu:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function Gi(n){const e=n._freezeSettings(),t=qi(n._databaseId);return new WT(n._databaseId,!!e.ignoreUndefinedProperties,t)}function vd(n,e,t,r,i,s={}){const a=n.Nu(s.merge||s.mergeFields?2:0,e,t,i);da("Data must be an object, but it was:",a,r);const c=Id(r,a);let l,d;if(s.merge)l=new xe(a.fieldMask),d=a.fieldTransforms;else if(s.mergeFields){const f=[];for(const y of s.mergeFields){const w=mo(e,y,t);if(!a.contains(w))throw new D(S.INVALID_ARGUMENT,`Field '${w}' is specified in your field mask but missing from your input data.`);Ad(f,w)||f.push(w)}l=new xe(f),d=a.fieldTransforms.filter(y=>l.covers(y.field))}else l=null,d=a.fieldTransforms;return new KT(new Oe(c),l,d)}class Pr extends ca{_toFieldTransform(e){if(e.wu!==2)throw e.wu===1?e.Mu(`${this._methodName}() can only appear at the top level of your update data`):e.Mu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Pr}}function Td(n,e,t,r){const i=n.Nu(1,e,t);da("Data must be an object, but it was:",i,r);const s=[],a=Oe.empty();Yt(r,(l,d)=>{const f=fa(e,l,t);d=W(d);const y=i.Cu(f);if(d instanceof Pr)s.push(f);else{const w=Cr(d,y);w!=null&&(s.push(f),a.set(f,w))}});const c=new xe(s);return new _d(a,c,i.fieldTransforms)}function wd(n,e,t,r,i,s){const a=n.Nu(1,e,t),c=[mo(e,r,t)],l=[i];if(s.length%2!=0)throw new D(S.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let w=0;w<s.length;w+=2)c.push(mo(e,s[w])),l.push(s[w+1]);const d=[],f=Oe.empty();for(let w=c.length-1;w>=0;--w)if(!Ad(d,c[w])){const b=c[w];let k=l[w];k=W(k);const O=a.Cu(b);if(k instanceof Pr)d.push(b);else{const C=Cr(k,O);C!=null&&(d.push(b),f.set(b,C))}}const y=new xe(d);return new _d(f,y,a.fieldTransforms)}function GT(n,e,t,r=!1){return Cr(t,n.Nu(r?4:3,e))}function Cr(n,e){if(Ed(n=W(n)))return da("Unsupported field value:",e,n),Id(n,e);if(n instanceof ca)return function(r,i){if(!yd(i.wu))throw i.Mu(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Mu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(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.Du&&e.wu!==4)throw e.Mu("Nested arrays are not supported");return function(r,i){const s=[];let a=0;for(const c of r){let l=Cr(c,i.Fu(a));l==null&&(l={nullValue:"NULL_VALUE"}),s.push(l),a++}return{arrayValue:{values:s}}}(n,e)}return function(r,i){if((r=W(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return xy(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=ce.fromDate(r);return{timestampValue:Ai(i.serializer,s)}}if(r instanceof ce){const s=new ce(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Ai(i.serializer,s)}}if(r instanceof ua)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof vn)return{bytesValue:$h(i.serializer,r._byteString)};if(r instanceof Ae){const s=i.databaseId,a=r.firestore._databaseId;if(!a.isEqual(s))throw i.Mu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Ho(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof la)return function(a,c){return{mapValue:{fields:{__type__:{stringValue:"__vector__"}
3121,value:{arrayValue:{values:a.toArray().map(l=>{if(typeof l!="number")throw c.Mu("VectorValues must only contain numeric values.");return $o(c.serializer,l)})}}}}}}(r,i);throw i.Mu(`Unsupported field value: ${Ki(r)}`)}(n,e)}function Id(n,e){const t={};return mh(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Yt(n,(r,i)=>{const s=Cr(i,e.bu(r));s!=null&&(t[r]=s)}),{mapValue:{fields:t}}}function Ed(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ce||n instanceof ua||n instanceof vn||n instanceof Ae||n instanceof ca||n instanceof la)}function da(n,e,t){if(!Ed(t)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(t)){const r=Ki(t);throw r==="an object"?e.Mu(n+" a custom object"):e.Mu(n+" "+r)}}function mo(n,e,t){if((e=W(e))instanceof Sr)return e._internalPath;if(typeof e=="string")return fa(n,e);throw Si("Field path arguments must be of type string or ",n,!1,void 0,t)}const QT=new RegExp("[~\\*/\\[\\]]");function fa(n,e,t){if(e.search(QT)>=0)throw Si(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Sr(...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 s=r&&!r.isEmpty(),a=i!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(s||a)&&(l+=" (found",s&&(l+=` in field ${r}`),a&&(l+=` in document ${i}`),l+=")"),new D(S.INVALID_ARGUMENT,c+n+l)}function Ad(n,e){return n.some(t=>t.isEqual(e))}/**
3122 * @license
3123 * Copyright 2020 Google LLC
3124 *
3125 * Licensed under the Apache License, Version 2.0 (the "License");
3126 * you may not use this file except in compliance with the License.
3127 * You may obtain a copy of the License at
3128 *
3129 *   http://www.apache.org/licenses/LICENSE-2.0
3130 *
3131 * Unless required by applicable law or agreed to in writing, software
3132 * distributed under the License is distributed on an "AS IS" BASIS,
3133 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3134 * See the License for the specific language governing permissions and
3135 * limitations under the License.
3136 */class Rd{constructor(e,t,r,i,s){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Ae(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new JT(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(Qi("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class JT extends Rd{data(){return super.data()}}function Qi(n,e){return typeof e=="string"?fa(n,e):e instanceof Sr?e._internalPath:e._delegate._internalPath}/**
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 */function bd(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new D(S.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class pa{}class ga extends pa{}function NA(n,e,...t){let r=[];e instanceof pa&&r.push(e),r=r.concat(t),function(s){const a=s.filter(l=>l instanceof ma).length,c=s.filter(l=>l instanceof Ji).length;if(a>1||a>0&&c>0)throw new D(S.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 Ji extends ga{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new Ji(e,t,r)}_apply(e){const t=this._parse(e);return Sd(e._query,t),new gt(e.firestore,e.converter,ao(e._query,t))}_parse(e){const t=Gi(e.firestore);return function(s,a,c,l,d,f,y){let w;
3151if(d.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new D(S.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){Ju(y,f);const b=[];for(const k of y)b.push(Qu(l,s,k));w={arrayValue:{values:b}}}else w=Qu(l,s,y)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||Ju(y,f),w=GT(c,a,y,f==="in"||f==="not-in");return ae.create(d,f,w)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function DA(n,e,t){const r=e,i=Qi("where",n);return Ji._create(i,r,t)}class ma extends pa{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new ma(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]:ze.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(i,s){let a=i;const c=s.getFlattenedFilters();for(const l of c)Sd(a,l),a=ao(a,l)}(e._query,t),new gt(e.firestore,e.converter,ao(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class _a extends ga{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new _a(e,t)}_apply(e){const t=function(i,s,a){if(i.startAt!==null)throw new D(S.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new D(S.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new dr(s,a)}(e._query,this._field,this._direction);return new gt(e.firestore,e.converter,function(i,s){const a=i.explicitOrderBy.concat([s]);return new Rn(i.path,i.collectionGroup,a,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,t))}}function OA(n,e="asc"){const t=e,r=Qi("orderBy",n);return _a._create(r,t)}class ya extends ga{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new ya(e,t,r)}_apply(e){return new gt(e.firestore,e.converter,wi(e._query,this._limit,this._limitType))}}function VA(n){return BT("limit",n),ya._create("limit",n,"F")}function Qu(n,e,t){if(typeof(t=W(t))=="string"){if(t==="")throw new D(S.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Rh(e)&&t.indexOf("/")!==-1)throw new D(S.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(ee.fromString(t));if(!M.isDocumentKey(r))throw new D(S.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 mu(n,new M(r))}if(t instanceof Ae)return mu(n,t._key);throw new D(S.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ki(t)}.`)}function Ju(n,e){if(!Array.isArray(n)||n.length===0)throw new D(S.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Sd(n,e){const t=function(i,s){for(const a of i)for(const c of a.getFlattenedFilters())if(s.indexOf(c.op)>=0)return c.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(S.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new D(S.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}class XT{convertValue(e,t="none"){switch(Wt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return se(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(Kt(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 Yt(e,(i,s)=>{r[i]=this.convertValue(s,t)}),r}convertVectorValue(e){var t,r,i;const s=(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=>se(a.doubleValue));return new la(s)}convertGeoPoint(e){return new ua(se(e.latitude),se(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=Uo(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(ur(e));default:return null}}convertTimestamp(e){const t=Nt(e);
3151return new ce(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=ee.fromString(e);J(Qh(r));const i=new lr(r.get(1),r.get(3)),s=new M(r.popFirst(5));return i.isEqual(t)||ft(`Document ${s} 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.`),s}}/**
3152 * @license
3153 * Copyright 2020 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 */function Pd(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}function YT(){return new qT("count")}/**
3167 * @license
3168 * Copyright 2020 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 Yn{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Cd extends Rd{constructor(e,t,r,i,s,a){super(e,t,r,i,a),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new li(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(Qi("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class li extends Cd{data(e={}){return super.data(e)}}
3181class kd{constructor(e,t,r,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new Yn(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 li(this._firestore,this._userDataWriter,r.key,r,new Yn(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new D(S.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,s){if(i._snapshot.oldDocs.isEmpty()){let a=0;return i._snapshot.docChanges.map(c=>{const l=new li(i._firestore,i._userDataWriter,c.doc.key,c.doc,new Yn(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(c=>s||c.type!==3).map(c=>{const l=new li(i._firestore,i._userDataWriter,c.doc.key,c.doc,new Yn(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);let d=-1,f=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),f=a.indexOf(c.doc.key)),{type:ZT(c.type),doc:l,oldIndex:d,newIndex:f}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function ZT(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return x()}}/**
3182 * @license
3183 * Copyright 2020 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 */function MA(n){n=ke(n,Ae);const e=ke(n.firestore,Ye);return LT(Pn(e),n._key).then(t=>Nd(e,n,t))}class Xi extends XT{constructor(e){super(),this.firestore=e}convertBytes(e){return new vn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new Ae(this.firestore,null,t)}}function LA(n){n=ke(n,gt);const e=ke(n.firestore,Ye),t=Pn(e),r=new Xi(e);return bd(n._query),xT(t,n._query).then(i=>new kd(e,r,n,i))}function xA(n,e,t){n=ke(n,Ae);const r=ke(n.firestore,Ye),i=Pd(n.converter,e,t);return Yi(r,[vd(Gi(r),"setDoc",n._key,i,n.converter!==null,t).toMutation(n._key,Ve.none())])}function UA(n,e,t,...r){n=ke(n,Ae);const i=ke(n.firestore,Ye),s=Gi(i);let a;return a=typeof(e=W(e))=="string"||e instanceof Sr?wd(s,"updateDoc",n._key,e,t,r):Td(s,"updateDoc",n._key,e),Yi(i,[a.toMutation(n._key,Ve.exists(!0))])}function FA(n){return Yi(ke(n.firestore,Ye),[new ji(n._key,Ve.none())])}function BA(n,...e){var t,r,i;n=W(n);let s={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||Gu(e[a])||(s=e[a],a++);const c={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(Gu(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 l,d,f;if(n instanceof Ae)d=ke(n.firestore,Ye),f=Li(n._key.path),l={next:y=>{e[a]&&e[a](Nd(d,n,y))},error:e[a+1],complete:e[a+2]};else{const y=ke(n,gt);d=ke(y.firestore,Ye),f=y._query;const w=new Xi(d);l={next:b=>{e[a]&&e[a](new kd(d,w,y,b))},error:e[a+1],complete:e[a+2]},bd(n._query)}return function(w,b,k,O){const C=new oa(O),F=new ia(b,C,k);return w.asyncQueue.enqueueAndForget(async()=>ta(await bi(w),F)),()=>{C.za(),w.asyncQueue.enqueueAndForget(async()=>na(await bi(w),F))}}(Pn(d),f,c,l)}function Yi(n,e){return function(r,i){const s=new We;return r.asyncQueue.enqueueAndForget(async()=>IT(await VT(r),i,s)),s.promise}(Pn(n),e)}function Nd(n,e,t){const r=t.docs.get(e._key),i=new Xi(n);return new Cd(n,i,e._key,r,new Yn(t.hasPendingWrites,t.fromCache),e.converter)}/**
3197 * @license
3198 * Copyright 2022 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 */function jA(n){return ew(n,{count:YT()})}function ew(n,e){const t=ke(n.firestore,Ye),r=Pn(t),i=fy(e,(s,a)=>new Wy(a,s.aggregateType,s._internalFieldPath));return UT(r,n._query,i).then(s=>function(c,l,d){const f=new Xi(c);return new zT(l,f,d)}(t,n,s))}/**
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 */class tw{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=Gi(e)}set(e,t,r){this._verifyNotCommitted();const i=xs(e,this._firestore),s=Pd(i.converter,t,r),a=vd(this._dataReader,"WriteBatch.set",i._key,s,i.converter!==null,r);return this._mutations.push(a.toMutation(i._key,Ve.none())),this}update(e,t,r,...i){this._verifyNotCommitted();const s=xs(e,this._firestore);let a;return a=typeof(t=W(t))=="string"||t instanceof Sr?wd(this._dataReader,"WriteBatch.update",s._key,t,r,i):Td(this._dataReader,"WriteBatch.update",s._key,t),this._mutations.push(a.toMutation(s._key,Ve.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=xs(e,this._firestore);return this._mutations=this._mutations.concat(new ji(t._key,Ve.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new D(S.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function xs(n,e){if((n=W(n)).firestore!==e)throw new D(S.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
3227 * @license
3228 * Copyright 2020 Google LLC
3229 *
3230 * Licensed under the Apache License, Version 2.0 (the "License");
3231 * you may not use this file except in compliance with the License.
3232 * You may obtain a copy of the License at
3233 *
3234 *   http://www.apache.org/licenses/LICENSE-2.0
3235 *
3236 * Unless required by applicable law or agreed to in writing, software
3237 * distributed under the License is distributed on an "AS IS" BASIS,
3238 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3239 * See the License for the specific language governing permissions and
3240 * limitations under the License.
3241 */function $A(){return new Pr("deleteField")}/**
3242 * @license
3243 * Copyright 2020 Google LLC
3244 *
3245 * Licensed under the Apache License, Version 2.0 (the "License");
3246 * you may not use this file except in compliance with the License.
3247 * You may obtain a copy of the License at
3248 *
3249 *   http://www.apache.org/licenses/LICENSE-2.0
3250 *
3251 * Unless required by applicable law or agreed to in writing, software
3252 * distributed under the License is distributed on an "AS IS" BASIS,
3253 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3254 * See the License for the specific language governing permissions and
3255 * limitations under the License.
3256 */function qA(n){return Pn(n=ke(n,Ye)),new tw(n,e=>Yi(n,e))}(function(e,t=!0){(function(i){An=i})(Xt),Me(new De("firestore",(r,{instanceIdentifier:i,options:s})=>{const a=r.getProvider("app").getImmediate(),c=new Ye(new Z_(r.getProvider("auth-internal")),new ry(r.getProvider("app-check-internal")),function(d,f){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new D(S.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new lr(d.options.projectId,f)}(a,i),a);return s=Object.assign({useFetchStreams:t},s),c._setSettings(s),c},"PUBLIC").setMultipleInstances(!0)),le(hu,"4.7.1",e),le(hu,"4.7.1","esm2017")})();
3256const Dd="@firebase/installations",va="0.6.8";/**
3257 * @license
3258 * Copyright 2019 Google LLC
3259 *
3260 * Licensed under the Apache License, Version 2.0 (the "License");
3261 * you may not use this file except in compliance with the License.
3262 * You may obtain a copy of the License at
3263 *
3264 *   http://www.apache.org/licenses/LICENSE-2.0
3265 *
3266 * Unless required by applicable law or agreed to in writing, software
3267 * distributed under the License is distributed on an "AS IS" BASIS,
3268 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3269 * See the License for the specific language governing permissions and
3270 * limitations under the License.
3271 */const Od=1e4,Vd=`w:${va}`,Md="FIS_v2",nw="https://firebaseinstallations.googleapis.com/v1",rw=60*60*1e3,iw="installations",sw="Installations";/**
3272 * @license
3273 * Copyright 2019 Google LLC
3274 *
3275 * Licensed under the Apache License, Version 2.0 (the "License");
3276 * you may not use this file except in compliance with the License.
3277 * You may obtain a copy of the License at
3278 *
3279 *   http://www.apache.org/licenses/LICENSE-2.0
3280 *
3281 * Unless required by applicable law or agreed to in writing, software
3282 * distributed under the License is distributed on an "AS IS" BASIS,
3283 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3284 * See the License for the specific language governing permissions and
3285 * limitations under the License.
3286 */const ow={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},Gt=new Ot(iw,sw,ow);function Ld(n){return n instanceof Be&&n.code.includes("request-failed")}/**
3287 * @license
3288 * Copyright 2019 Google LLC
3289 *
3290 * Licensed under the Apache License, Version 2.0 (the "License");
3291 * you may not use this file except in compliance with the License.
3292 * You may obtain a copy of the License at
3293 *
3294 *   http://www.apache.org/licenses/LICENSE-2.0
3295 *
3296 * Unless required by applicable law or agreed to in writing, software
3297 * distributed under the License is distributed on an "AS IS" BASIS,
3298 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3299 * See the License for the specific language governing permissions and
3300 * limitations under the License.
3301 */function xd({projectId:n}){return`${nw}/projects/${n}/installations`}function Ud(n){return{token:n.token,requestStatus:2,expiresIn:cw(n.expiresIn),creationTime:Date.now()}}async function Fd(n,e){const r=(await e.json()).error;return Gt.create("request-failed",{requestName:n,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function Bd({apiKey:n}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n})}function aw(n,{refreshToken:e}){const t=Bd(n);return t.append("Authorization",uw(e)),t}async function jd(n){const e=await n();return e.status>=500&&e.status<600?n():e}function cw(n){return Number(n.replace("s","000"))}function uw(n){return`${Md} ${n}`}/**
3302 * @license
3303 * Copyright 2019 Google LLC
3304 *
3305 * Licensed under the Apache License, Version 2.0 (the "License");
3306 * you may not use this file except in compliance with the License.
3307 * You may obtain a copy of the License at
3308 *
3309 *   http://www.apache.org/licenses/LICENSE-2.0
3310 *
3311 * Unless required by applicable law or agreed to in writing, software
3312 * distributed under the License is distributed on an "AS IS" BASIS,
3313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3314 * See the License for the specific language governing permissions and
3315 * limitations under the License.
3316 */async function lw({appConfig:n,heartbeatServiceProvider:e},{fid:t}){const r=xd(n),i=Bd(n),s=e.getImmediate({optional:!0});if(s){const d=await s.getHeartbeatsHeader();d&&i.append("x-firebase-client",d)}const a={fid:t,authVersion:Md,appId:n.appId,sdkVersion:Vd},c={method:"POST",headers:i,body:JSON.stringify(a)},l=await jd(()=>fetch(r,c));if(l.ok){const d=await l.json();return{fid:d.fid||t,registrationStatus:2,refreshToken:d.refreshToken,authToken:Ud(d.authToken)}}else throw await Fd("Create Installation",l)}/**
3317 * @license
3318 * Copyright 2019 Google LLC
3319 *
3320 * Licensed under the Apache License, Version 2.0 (the "License");
3321 * you may not use this file except in compliance with the License.
3322 * You may obtain a copy of the License at
3323 *
3324 *   http://www.apache.org/licenses/LICENSE-2.0
3325 *
3326 * Unless required by applicable law or agreed to in writing, software
3327 * distributed under the License is distributed on an "AS IS" BASIS,
3328 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3329 * See the License for the specific language governing permissions and
3330 * limitations under the License.
3331 */function $d(n){return new Promise(e=>{setTimeout(e,n)})}/**
3332 * @license
3333 * Copyright 2019 Google LLC
3334 *
3335 * Licensed under the Apache License, Version 2.0 (the "License");
3336 * you may not use this file except in compliance with the License.
3337 * You may obtain a copy of the License at
3338 *
3339 *   http://www.apache.org/licenses/LICENSE-2.0
3340 *
3341 * Unless required by applicable law or agreed to in writing, software
3342 * distributed under the License is distributed on an "AS IS" BASIS,
3343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3344 * See the License for the specific language governing permissions and
3345 * limitations under the License.
3346 */function hw(n){return btoa(String.fromCharCode(...n)).replace(/\+/g,"-").replace(/\//g,"_")}/**
3347 * @license
3348 * Copyright 2019 Google LLC
3349 *
3350 * Licensed under the Apache License, Version 2.0 (the "License");
3351 * you may not use this file except in compliance with the License.
3352 * You may obtain a copy of the License at
3353 *
3354 *   http://www.apache.org/licenses/LICENSE-2.0
3355 *
3356 * Unless required by applicable law or agreed to in writing, software
3357 * distributed under the License is distributed on an "AS IS" BASIS,
3358 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3359 * See the License for the specific language governing permissions and
3360 * limitations under the License.
3361 */const dw=/^[cdef][\w-]{21}$/,_o="";function fw(){try{const n=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(n),n[0]=112+n[0]%16;const t=pw(n);return dw.test(t)?t:_o}catch{return _o}}function pw(n){return hw(n).substr(0,22)}/**
3362 * @license
3363 * Copyright 2019 Google LLC
3364 *
3365 * Licensed under the Apache License, Version 2.0 (the "License");
3366 * you may not use this file except in compliance with the License.
3367 * You may obtain a copy of the License at
3368 *
3369 *   http://www.apache.org/licenses/LICENSE-2.0
3370 *
3371 * Unless required by applicable law or agreed to in writing, software
3372 * distributed under the License is distributed on an "AS IS" BASIS,
3373 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3374 * See the License for the specific language governing permissions and
3375 * limitations under the License.
3376 */function Zi(n){return`${n.appName}!${n.appId}`}/**
3377 * @license
3378 * Copyright 2019 Google LLC
3379 *
3380 * Licensed under the Apache License, Version 2.0 (the "License");
3381 * you may not use this file except in compliance with the License.
3382 * You may obtain a copy of the License at
3383 *
3384 *   http://www.apache.org/licenses/LICENSE-2.0
3385 *
3386 * Unless required by applicable law or agreed to in writing, software
3387 * distributed under the License is distributed on an "AS IS" BASIS,
3388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3389 * See the License for the specific language governing permissions and
3390 * limitations under the License.
3391 */const qd=new Map;function zd(n,e){const t=Zi(n);Hd(t,e),gw(t,e)}function Hd(n,e){const t=qd.get(n);if(t)for(const r of t)r(e)}function gw(n,e){const t=mw();t&&t.postMessage({key:n,fid:e}),_w()}let $t=null;function mw(){return!$t&&"BroadcastChannel"in self&&($t=new BroadcastChannel("[Firebase] FID Change"),$t.onmessage=n=>{Hd(n.data.key,n.data.fid)}),$t}function _w(){qd.size===0&&$t&&($t.close(),$t=null)}/**
3392 * @license
3393 * Copyright 2019 Google LLC
3394 *
3395 * Licensed under the Apache License, Version 2.0 (the "License");
3396 * you may not use this file except in compliance with the License.
3397 * You may obtain a copy of the License at
3398 *
3399 *   http://www.apache.org/licenses/LICENSE-2.0
3400 *
3401 * Unless required by applicable law or agreed to in writing, software
3402 * distributed under the License is distributed on an "AS IS" BASIS,
3403 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3404 * See the License for the specific language governing permissions and
3405 * limitations under the License.
3406 */const yw="firebase-installations-database",vw=1,Qt="firebase-installations-store";let Us=null;function Ta(){return Us||(Us=Di(yw,vw,{upgrade:(n,e)=>
3406{switch(e){case 0:n.createObjectStore(Qt)}}})),Us}async function Pi(n,e){const t=Zi(n),i=(await Ta()).transaction(Qt,"readwrite"),s=i.objectStore(Qt),a=await s.get(t);return await s.put(e,t),await i.done,(!a||a.fid!==e.fid)&&zd(n,e.fid),e}async function Kd(n){const e=Zi(n),r=(await Ta()).transaction(Qt,"readwrite");await r.objectStore(Qt).delete(e),await r.done}async function es(n,e){const t=Zi(n),i=(await Ta()).transaction(Qt,"readwrite"),s=i.objectStore(Qt),a=await s.get(t),c=e(a);return c===void 0?await s.delete(t):await s.put(c,t),await i.done,c&&(!a||a.fid!==c.fid)&&zd(n,c.fid),c}/**
3407 * @license
3408 * Copyright 2019 Google LLC
3409 *
3410 * Licensed under the Apache License, Version 2.0 (the "License");
3411 * you may not use this file except in compliance with the License.
3412 * You may obtain a copy of the License at
3413 *
3414 *   http://www.apache.org/licenses/LICENSE-2.0
3415 *
3416 * Unless required by applicable law or agreed to in writing, software
3417 * distributed under the License is distributed on an "AS IS" BASIS,
3418 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3419 * See the License for the specific language governing permissions and
3420 * limitations under the License.
3421 */async function wa(n){let e;const t=await es(n.appConfig,r=>{const i=Tw(r),s=ww(n,i);return e=s.registrationPromise,s.installationEntry});return t.fid===_o?{installationEntry:await e}:{installationEntry:t,registrationPromise:e}}function Tw(n){const e=n||{fid:fw(),registrationStatus:0};return Wd(e)}function ww(n,e){if(e.registrationStatus===0){if(!navigator.onLine){const i=Promise.reject(Gt.create("app-offline"));return{installationEntry:e,registrationPromise:i}}const t={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=Iw(n,t);return{installationEntry:t,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:Ew(n)}:{installationEntry:e}}async function Iw(n,e){try{const t=await lw(n,e);return Pi(n.appConfig,t)}catch(t){throw Ld(t)&&t.customData.serverCode===409?await Kd(n.appConfig):await Pi(n.appConfig,{fid:e.fid,registrationStatus:0}),t}}async function Ew(n){let e=await Xu(n.appConfig);for(;e.registrationStatus===1;)await $d(100),e=await Xu(n.appConfig);if(e.registrationStatus===0){const{installationEntry:t,registrationPromise:r}=await wa(n);return r||t}return e}function Xu(n){return es(n,e=>{if(!e)throw Gt.create("installation-not-found");return Wd(e)})}function Wd(n){return Aw(n)?{fid:n.fid,registrationStatus:0}:n}function Aw(n){return n.registrationStatus===1&&n.registrationTime+Od<Date.now()}/**
3422 * @license
3423 * Copyright 2019 Google LLC
3424 *
3425 * Licensed under the Apache License, Version 2.0 (the "License");
3426 * you may not use this file except in compliance with the License.
3427 * You may obtain a copy of the License at
3428 *
3429 *   http://www.apache.org/licenses/LICENSE-2.0
3430 *
3431 * Unless required by applicable law or agreed to in writing, software
3432 * distributed under the License is distributed on an "AS IS" BASIS,
3433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3434 * See the License for the specific language governing permissions and
3435 * limitations under the License.
3436 */async function Rw({appConfig:n,heartbeatServiceProvider:e},t){const r=bw(n,t),i=aw(n,t),s=e.getImmediate({optional:!0});if(s){const d=await s.getHeartbeatsHeader();d&&i.append("x-firebase-client",d)}const a={installation:{sdkVersion:Vd,appId:n.appId}},c={method:"POST",headers:i,body:JSON.stringify(a)},l=await jd(()=>fetch(r,c));if(l.ok){const d=await l.json();return Ud(d)}else throw await Fd("Generate Auth Token",l)}function bw(n,{fid:e}){return`${xd(n)}/${e}/authTokens:generate`}/**
3437 * @license
3438 * Copyright 2019 Google LLC
3439 *
3440 * Licensed under the Apache License, Version 2.0 (the "License");
3441 * you may not use this file except in compliance with the License.
3442 * You may obtain a copy of the License at
3443 *
3444 *   http://www.apache.org/licenses/LICENSE-2.0
3445 *
3446 * Unless required by applicable law or agreed to in writing, software
3447 * distributed under the License is distributed on an "AS IS" BASIS,
3448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3449 * See the License for the specific language governing permissions and
3450 * limitations under the License.
3451 */async function Ia(n,e=!1){let t;const r=await es(n.appConfig,s=>{if(!Gd(s))throw Gt.create("not-registered");const a=s.authToken;if(!e&&Cw(a))return s;if(a.requestStatus===1)return t=Sw(n,e),s;{if(!navigator.onLine)throw Gt.create("app-offline");const c=Nw(s);return t=Pw(n,c),c}});return t?await t:r.authToken}async function Sw(n,e){let t=await Yu(n.appConfig);for(;t.authToken.requestStatus===1;)await $d(100),t=await Yu(n.appConfig);const r=t.authToken;return r.requestStatus===0?Ia(n,e):r}function Yu(n){return es(n,e=>{if(!Gd(e))throw Gt.create("not-registered");const t=e.authToken;return Dw(t)?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}async function Pw(n,e){try{const t=await Rw(n,e),r=Object.assign(Object.assign({},e),{authToken:t});return await Pi(n.appConfig,r),t}catch(t){if(Ld(t)&&(t.customData.serverCode===401||t.customData.serverCode===404))await Kd(n.appConfig);else{const r=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await Pi(n.appConfig,r)}throw t}}function Gd(n){return n!==void 0&&n.registrationStatus===2}function Cw(n){return n.requestStatus===2&&!kw(n)}function kw(n){const e=Date.now();return e<n.creationTime||n.creationTime+n.expiresIn<e+rw}function Nw(n){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},n),{authToken:e})}function Dw(n){return n.requestStatus===1&&n.requestTime+Od<Date.now()}/**
3452 * @license
3453 * Copyright 2019 Google LLC
3454 *
3455 * Licensed under the Apache License, Version 2.0 (the "License");
3456 * you may not use this file except in compliance with the License.
3457 * You may obtain a copy of the License at
3458 *
3459 *   http://www.apache.org/licenses/LICENSE-2.0
3460 *
3461 * Unless required by applicable law or agreed to in writing, software
3462 * distributed under the License is distributed on an "AS IS" BASIS,
3463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3464 * See the License for the specific language governing permissions and
3465 * limitations under the License.
3466 */async function Ow(n){const e=n,{installationEntry:t,registrationPromise:r}=await wa(e);return r?r.catch(console.error):Ia(e).catch(console.error),t.fid}/**
3467 * @license
3468 * Copyright 2019 Google LLC
3469 *
3470 * Licensed under the Apache License, Version 2.0 (the "License");
3471 * you may not use this file except in compliance with the License.
3472 * You may obtain a copy of the License at
3473 *
3474 *   http://www.apache.org/licenses/LICENSE-2.0
3475 *
3476 * Unless required by applicable law or agreed to in writing, software
3477 * distributed under the License is distributed on an "AS IS" BASIS,
3478 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3479 * See the License for the specific language governing permissions and
3480 * limitations under the License.
3481 */async function Vw(n,e=!1){const t=n;return await Mw(t),(await Ia(t,e)).token}async function Mw(n){const{registrationPromise:e}=await wa(n);e&&await e}/**
3482 * @license
3483 * Copyright 2019 Google LLC
3484 *
3485 * Licensed under the Apache License, Version 2.0 (the "License");
3486 * you may not use this file except in compliance with the License.
3487 * You may obtain a copy of the License at
3488 *
3489 *   http://www.apache.org/licenses/LICENSE-2.0
3490 *
3491 * Unless required by applicable law or agreed to in writing, software
3492 * distributed under the License is distributed on an "AS IS" BASIS,
3493 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3494 * See the License for the specific language governing permissions and
3495 * limitations under the License.
3496 */function Lw(n){if(!n||!n.options)throw Fs("App Configuration");if(!n.name)throw Fs("App Name");const e=["projectId","apiKey","appId"];for(const t of e)if(!n.options[t])throw Fs(t);return{appName:n.name,projectId:n.options.projectId,apiKey:n.options.apiKey,appId:n.options.appId}}function Fs(n){return Gt.create("missing-app-config-values",{valueName:n})}/**
3497 * @license
3498 * Copyright 2020 Google LLC
3499 *
3500 * Licensed under the Apache License, Version 2.0 (the "License");
3501 * you may not use this file except in compliance with the License.
3502 * You may obtain a copy of the License at
3503 *
3504 *   http://www.apache.org/licenses/LICENSE-2.0
3505 *
3506 * Unless required by applicable law or agreed to in writing, software
3507 * distributed under the License is distributed on an "AS IS" BASIS,
3508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3509 * See the License for the specific language governing permissions and
3510 * limitations under the License.
3511 */const Qd="installations",xw="installations-internal",Uw=n=>{const e=n.getProvider("app").getImmediate(),t=Lw(e),r=Ze(e,"heartbeat");return{app:e,appConfig:t,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},Fw=n=>{const e=n.getProvider("app").getImmediate(),t=Ze(e,Qd).getImmediate();return{getId:()=>Ow(t),getToken:i=>Vw(t,i)}};function Bw(){Me(new De(Qd,Uw,"PUBLIC")),Me(new De(xw,Fw,"PRIVATE"))}Bw();le(Dd,va);le(Dd,va,"esm2017");/**
3512 * @license
3513 * Copyright 2019 Google LLC
3514 *
3515 * Licensed under the Apache License, Version 2.0 (the "License");
3516 * you may not use this file except in compliance with the License.
3517 * You may obtain a copy of the License at
3518 *
3519 *   http://www.apache.org/licenses/LICENSE-2.0
3520 *
3521 * Unless required by applicable law or agreed to in writing, software
3522 * distributed under the License is distributed on an "AS IS" BASIS,
3523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3524 * See the License for the specific language governing permissions and
3525 * limitations under the License.
3526 */const jw="/firebase-messaging-sw.js",$w="/firebase-cloud-messaging-push-scope",Jd="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",qw="https://fcmregistrations.googleapis.com/v1",Xd="google.c.a.c_id",zw="google.c.a.c_l",Hw="google.c.a.ts",Kw="google.c.a.e";var Zu;(function(n){n[n.DATA_MESSAGE=1]="DATA_MESSAGE",n[n.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(Zu||(Zu={}));/**
3527 * @license
3528 * Copyright 2018 Google LLC
3529 *
3530 * Licensed under the Apache License, Version 2.0 (the "License");
3530 you may not use this file except
3531 * in compliance with the License. You may obtain a copy of the License at
3532 *
3533 * http://www.apache.org/licenses/LICENSE-2.0
3534 *
3535 * Unless required by applicable law or agreed to in writing, software distributed under the License
3536 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
3537 * or implied. See the License for the specific language governing permissions and limitations under
3538 * the License.
3539 */var gr;(function(n){n.PUSH_RECEIVED="push-received",n.NOTIFICATION_CLICKED="notification-clicked"})(gr||(gr={}));/**
3540 * @license
3541 * Copyright 2017 Google LLC
3542 *
3543 * Licensed under the Apache License, Version 2.0 (the "License");
3544 * you may not use this file except in compliance with the License.
3545 * You may obtain a copy of the License at
3546 *
3547 *   http://www.apache.org/licenses/LICENSE-2.0
3548 *
3549 * Unless required by applicable law or agreed to in writing, software
3550 * distributed under the License is distributed on an "AS IS" BASIS,
3551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3552 * See the License for the specific language governing permissions and
3553 * limitations under the License.
3554 */function rt(n){const e=new Uint8Array(n);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Ww(n){const e="=".repeat((4-n.length%4)%4),t=(n+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(t),i=new Uint8Array(r.length);for(let s=0;s<r.length;++s)i[s]=r.charCodeAt(s);return i}/**
3555 * @license
3556 * Copyright 2019 Google LLC
3557 *
3558 * Licensed under the Apache License, Version 2.0 (the "License");
3559 * you may not use this file except in compliance with the License.
3560 * You may obtain a copy of the License at
3561 *
3562 *   http://www.apache.org/licenses/LICENSE-2.0
3563 *
3564 * Unless required by applicable law or agreed to in writing, software
3565 * distributed under the License is distributed on an "AS IS" BASIS,
3566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3567 * See the License for the specific language governing permissions and
3568 * limitations under the License.
3569 */const Bs="fcm_token_details_db",Gw=5,el="fcm_token_object_Store";async function Qw(n){if("databases"in indexedDB&&!(await indexedDB.databases()).map(s=>s.name).includes(Bs))return null;let e=null;return(await Di(Bs,Gw,{upgrade:async(r,i,s,a)=>{var c;if(i<2||!r.objectStoreNames.contains(el))return;const l=a.objectStore(el),d=await l.index("fcmSenderId").get(n);if(await l.clear(),!!d){if(i===2){const f=d;if(!f.auth||!f.p256dh||!f.endpoint)return;e={token:f.fcmToken,createTime:(c=f.createTime)!==null&&c!==void 0?c:Date.now(),subscriptionOptions:{auth:f.auth,p256dh:f.p256dh,endpoint:f.endpoint,swScope:f.swScope,vapidKey:typeof f.vapidKey=="string"?f.vapidKey:rt(f.vapidKey)}}}else if(i===3){const f=d;e={token:f.fcmToken,createTime:f.createTime,subscriptionOptions:{auth:rt(f.auth),p256dh:rt(f.p256dh),endpoint:f.endpoint,swScope:f.swScope,vapidKey:rt(f.vapidKey)}}}else if(i===4){const f=d;e={token:f.fcmToken,createTime:f.createTime,subscriptionOptions:{auth:rt(f.auth),p256dh:rt(f.p256dh),endpoint:f.endpoint,swScope:f.swScope,vapidKey:rt(f.vapidKey)}}}}}})).close(),await Ps(Bs),await Ps("fcm_vapid_details_db"),await Ps("undefined"),Jw(e)?e:null}function Jw(n){if(!n||!n.subscriptionOptions)return!1;const{subscriptionOptions:e}=n;return typeof n.createTime=="number"&&n.createTime>0&&typeof n.token=="string"&&n.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}/**
3570 * @license
3571 * Copyright 2019 Google LLC
3572 *
3573 * Licensed under the Apache License, Version 2.0 (the "License");
3574 * you may not use this file except in compliance with the License.
3575 * You may obtain a copy of the License at
3576 *
3577 *   http://www.apache.org/licenses/LICENSE-2.0
3578 *
3579 * Unless required by applicable law or agreed to in writing, software
3580 * distributed under the License is distributed on an "AS IS" BASIS,
3581 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3582 * See the License for the specific language governing permissions and
3583 * limitations under the License.
3584 */const Xw="firebase-messaging-database",Yw=1,mr="firebase-messaging-store";let js=null;function Yd(){return js||(js=Di(Xw,Yw,{upgrade:(n,e)=>
3584{switch(e){case 0:n.createObjectStore(mr)}}})),js}async function Zw(n){const e=Zd(n),r=await(await Yd()).transaction(mr).objectStore(mr).get(e);if(r)return r;{const i=await Qw(n.appConfig.senderId);if(i)return await Ea(n,i),i}}async function Ea(n,e){const t=Zd(n),i=(await Yd()).transaction(mr,"readwrite");return await i.objectStore(mr).put(e,t),await i.done,e}function Zd({appConfig:n}){return n.appId}/**
3585 * @license
3586 * Copyright 2017 Google LLC
3587 *
3588 * Licensed under the Apache License, Version 2.0 (the "License");
3589 * you may not use this file except in compliance with the License.
3590 * You may obtain a copy of the License at
3591 *
3592 *   http://www.apache.org/licenses/LICENSE-2.0
3593 *
3594 * Unless required by applicable law or agreed to in writing, software
3595 * distributed under the License is distributed on an "AS IS" BASIS,
3596 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3597 * See the License for the specific language governing permissions and
3598 * limitations under the License.
3599 */const eI={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},Re=new Ot("messaging","Messaging",eI);/**
3600 * @license
3601 * Copyright 2019 Google LLC
3602 *
3603 * Licensed under the Apache License, Version 2.0 (the "License");
3604 * you may not use this file except in compliance with the License.
3605 * You may obtain a copy of the License at
3606 *
3607 *   http://www.apache.org/licenses/LICENSE-2.0
3608 *
3609 * Unless required by applicable law or agreed to in writing, software
3610 * distributed under the License is distributed on an "AS IS" BASIS,
3611 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3612 * See the License for the specific language governing permissions and
3613 * limitations under the License.
3614 */async function tI(n,e){const t=await Ra(n),r=ef(e),i={method:"POST",headers:t,body:JSON.stringify(r)};let s;try{s=await(await fetch(Aa(n.appConfig),i)).json()}catch(a){throw Re.create("token-subscribe-failed",{errorInfo:a==null?void 0:a.toString()})}if(s.error){const a=s.error.message;throw Re.create("token-subscribe-failed",{errorInfo:a})}if(!s.token)throw Re.create("token-subscribe-no-token");return s.token}async function nI(n,e){const t=await Ra(n),r=ef(e.subscriptionOptions),i={method:"PATCH",headers:t,body:JSON.stringify(r)};let s;try{s=await(await fetch(`${Aa(n.appConfig)}/${e.token}`,i)).json()}catch(a){throw Re.create("token-update-failed",{errorInfo:a==null?void 0:a.toString()})}if(s.error){const a=s.error.message;throw Re.create("token-update-failed",{errorInfo:a})}if(!s.token)throw Re.create("token-update-no-token");return s.token}async function rI(n,e){const r={method:"DELETE",headers:await Ra(n)};try{const s=await(await fetch(`${Aa(n.appConfig)}
3614/${e}`,r)).json();if(s.error){const a=s.error.message;throw Re.create("token-unsubscribe-failed",{errorInfo:a})}}catch(i){throw Re.create("token-unsubscribe-failed",{errorInfo:i==null?void 0:i.toString()})}}function Aa({projectId:n}){return`${qw}/projects/${n}/registrations`}async function Ra({appConfig:n,installations:e}){const t=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":n.apiKey,"x-goog-firebase-installations-auth":`FIS ${t}`})}function ef({p256dh:n,auth:e,endpoint:t,vapidKey:r}){const i={web:{endpoint:t,auth:e,p256dh:n}};return r!==Jd&&(i.web.applicationPubKey=r),i}/**
3615 * @license
3616 * Copyright 2019 Google LLC
3617 *
3618 * Licensed under the Apache License, Version 2.0 (the "License");
3619 * you may not use this file except in compliance with the License.
3620 * You may obtain a copy of the License at
3621 *
3622 *   http://www.apache.org/licenses/LICENSE-2.0
3623 *
3624 * Unless required by applicable law or agreed to in writing, software
3625 * distributed under the License is distributed on an "AS IS" BASIS,
3626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3627 * See the License for the specific language governing permissions and
3628 * limitations under the License.
3629 */const iI=7*24*60*60*1e3;async function sI(n){const e=await aI(n.swRegistration,n.vapidKey),t={vapidKey:n.vapidKey,swScope:n.swRegistration.scope,endpoint:e.endpoint,auth:rt(e.getKey("auth")),p256dh:rt(e.getKey("p256dh"))},r=await Zw(n.firebaseDependencies);if(r){if(cI(r.subscriptionOptions,t))return Date.now()>=r.createTime+iI?oI(n,{token:r.token,createTime:Date.now(),subscriptionOptions:t}):r.token;try{await rI(n.firebaseDependencies,r.token)}catch(i){console.warn(i)}return tl(n.firebaseDependencies,t)}else return tl(n.firebaseDependencies,t)}async function oI(n,e){try{const t=await nI(n.firebaseDependencies,e),r=Object.assign(Object.assign({},e),{token:t,createTime:Date.now()});return await Ea(n.firebaseDependencies,r),t}catch(t){throw t}}async function tl(n,e){const r={token:await tI(n,e),createTime:Date.now(),subscriptionOptions:e};return await Ea(n,r),r.token}async function aI(n,e){const t=await n.pushManager.getSubscription();return t||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ww(e)})}function cI(n,e){const t=e.vapidKey===n.vapidKey,r=e.endpoint===n.endpoint,i=e.auth===n.auth,s=e.p256dh===n.p256dh;return t&&r&&i&&s}/**
3630 * @license
3631 * Copyright 2020 Google LLC
3632 *
3633 * Licensed under the Apache License, Version 2.0 (the "License");
3634 * you may not use this file except in compliance with the License.
3635 * You may obtain a copy of the License at
3636 *
3637 *   http://www.apache.org/licenses/LICENSE-2.0
3638 *
3639 * Unless required by applicable law or agreed to in writing, software
3640 * distributed under the License is distributed on an "AS IS" BASIS,
3641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3642 * See the License for the specific language governing permissions and
3643 * limitations under the License.
3644 */function nl(n){const e={from:n.from,collapseKey:n.collapse_key,messageId:n.fcmMessageId};return uI(e,n),lI(e,n),hI(e,n),e}function uI(n,e){if(!e.notification)return;n.notification={};const t=e.notification.title;t&&(n.notification.title=t);const r=e.notification.body;r&&(n.notification.body=r);const i=e.notification.image;i&&(n.notification.image=i);const s=e.notification.icon;s&&(n.notification.icon=s)}function lI(n,e){e.data&&(n.data=e.data)}function hI(n,e){var t,r,i,s,a;if(!e.fcmOptions&&!(!((t=e.notification)===null||t===void 0)&&t.click_action))return;n.fcmOptions={};const c=(i=(r=e.fcmOptions)===null||r===void 0?void 0:r.link)!==null&&i!==void 0?i:(s=e.notification)===null||s===void 0?void 0:s.click_action;c&&(n.fcmOptions.link=c);const l=(a=e.fcmOptions)===null||a===void 0?void 0:a.analytics_label;l&&(n.fcmOptions.analyticsLabel=l)}/**
3645 * @license
3646 * Copyright 2019 Google LLC
3647 *
3648 * Licensed under the Apache License, Version 2.0 (the "License");
3649 * you may not use this file except in compliance with the License.
3650 * You may obtain a copy of the License at
3651 *
3652 *   http://www.apache.org/licenses/LICENSE-2.0
3653 *
3654 * Unless required by applicable law or agreed to in writing, softw
3654are
3655 * distributed under the License is distributed on an "AS IS" BASIS,
3656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3657 * See the License for the specific language governing permissions and
3658 * limitations under the License.
3659 */function dI(n){return typeof n=="object"&&!!n&&Xd in n}/**
3660 * @license
3661 * Copyright 2019 Google LLC
3662 *
3663 * Licensed under the Apache License, Version 2.0 (the "License");
3664 * you may not use this file except in compliance with the License.
3665 * You may obtain a copy of the License at
3666 *
3667 *   http://www.apache.org/licenses/LICENSE-2.0
3668 *
3669 * Unless required by applicable law or agreed to in writing, software
3670 * distributed under the License is distributed on an "AS IS" BASIS,
3671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3672 * See the License for the specific language governing permissions and
3673 * limitations under the License.
3674 */tf("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o");tf("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");function tf(n,e){const t=[];for(let r=0;r<n.length;r++)t.push(n.charAt(r)),r<e.length&&t.push(e.charAt(r));return t.join("")}/**
3675 * @license
3676 * Copyright 2019 Google LLC
3677 *
3678 * Licensed under the Apache License, Version 2.0 (the "License");
3679 * you may not use this file except in compliance with the License.
3680 * You may obtain a copy of the License at
3681 *
3682 *   http://www.apache.org/licenses/LICENSE-2.0
3683 *
3684 * Unless required by applicable law or agreed to in writing, software
3685 * distributed under the License is distributed on an "AS IS" BASIS,
3686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3687 * See the License for the specific language governing permissions and
3688 * limitations under the License.
3689 */function fI(n){if(!n||!n.options)throw $s("App Configuration Object");if(!n.name)throw $s("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:t}=n;for(const r of e)if(!t[r])throw $s(r);return{appName:n.name,projectId:t.projectId,apiKey:t.apiKey,appId:t.appId,senderId:t.messagingSenderId}}function $s(n){return Re.create("missing-app-config-values",{valueName:n})}/**
3690 * @license
3691 * Copyright 2020 Google LLC
3692 *
3693 * Licensed under the Apache License, Version 2.0 (the "License");
3694 * you may not use this file except in compliance with the License.
3695 * You may obtain a copy of the License at
3696 *
3697 *   http://www.apache.org/licenses/LICENSE-2.0
3698 *
3699 * Unless required by applicable law or agreed to in writing, software
3700 * distributed under the License is distributed on an "AS IS" BASIS,
3701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3702 * See the License for the specific language governing permissions and
3703 * limitations under the License.
3704 */class pI{constructor(e,t,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=fI(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:r}}_delete(){return Promise.resolve()}}/**
3705 * @license
3706 * Copyright 2020 Google LLC
3707 *
3708 * Licensed under the Apache License, Version 2.0 (the "License");
3709 * you may not use this file except in compliance with the License.
3710 * You may obtain a copy of the License at
3711 *
3712 *   http://www.apache.org/licenses/LICENSE-2.0
3713 *
3714 * Unless required by applicable law or agreed to in writing, software
3715 * distributed under the License is distributed on an "AS IS" BASIS,
3716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3717 * See the License for the specific language governing permissions and
3718 * limitations under the License.
3719 */async function gI(n){try{n.swRegistration=await navigator.serviceWorker.register(jw,{scope:$w}),n.swRegistration.update().catch(()=>{})}catch(e){throw Re.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}/**
3720 * @license
3721 * Copyright 2020 Google LLC
3722 *
3723 * Licensed under the Apache License, Version 2.0 (the "License");
3724 * you may not use this file except in compliance with the License.
3725 * You may obtain a copy of the License at
3726 *
3727 *   http://www.apache.org/licenses/LICENSE-2.0
3728 *
3729 * Unless required by applicable law or agreed to in writing, softw
3729are
3730 * distributed under the License is distributed on an "AS IS" BASIS,
3731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3732 * See the License for the specific language governing permissions and
3733 * limitations under the License.
3734 */async function mI(n,e){if(!e&&!n.swRegistration&&await gI(n),!(!e&&n.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw Re.create("invalid-sw-registration");n.swRegistration=e}}/**
3735 * @license
3736 * Copyright 2020 Google LLC
3737 *
3738 * Licensed under the Apache License, Version 2.0 (the "License");
3739 * you may not use this file except in compliance with the License.
3740 * You may obtain a copy of the License at
3741 *
3742 *   http://www.apache.org/licenses/LICENSE-2.0
3743 *
3744 * Unless required by applicable law or agreed to in writing, software
3745 * distributed under the License is distributed on an "AS IS" BASIS,
3746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3747 * See the License for the specific language governing permissions and
3748 * limitations under the License.
3749 */async function _I(n,e){e?n.vapidKey=e:n.vapidKey||(n.vapidKey=Jd)}/**
3750 * @license
3751 * Copyright 2020 Google LLC
3752 *
3753 * Licensed under the Apache License, Version 2.0 (the "License");
3754 * you may not use this file except in compliance with the License.
3755 * You may obtain a copy of the License at
3756 *
3757 *   http://www.apache.org/licenses/LICENSE-2.0
3758 *
3759 * Unless required by applicable law or agreed to in writing, software
3760 * distributed under the License is distributed on an "AS IS" BASIS,
3761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3762 * See the License for the specific language governing permissions and
3763 * limitations under the License.
3764 */async function nf(n,e){if(!navigator)throw Re.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw Re.create("permission-blocked");return await _I(n,e==null?void 0:e.vapidKey),await mI(n,e==null?void 0:e.serviceWorkerRegistration),sI(n)}/**
3765 * @license
3766 * Copyright 2019 Google LLC
3767 *
3768 * Licensed under the Apache License, Version 2.0 (the "License");
3769 * you may not use this file except in compliance with the License.
3770 * You may obtain a copy of the License at
3771 *
3772 *   http://www.apache.org/licenses/LICENSE-2.0
3773 *
3774 * Unless required by applicable law or agreed to in writing, software
3775 * distributed under the License is distributed on an "AS IS" BASIS,
3776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3777 * See the License for the specific language governing permissions and
3778 * limitations under the License.
3779 */async function yI(n,e,t){const r=vI(e);(await n.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:t[Xd],message_name:t[zw],message_time:t[Hw],message_device_time:Math.floor(Date.now()/1e3)})}function vI(n){switch(n){case gr.NOTIFICATION_CLICKED:return"notification_open";case gr.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
3780 * @license
3781 * Copyright 2017 Google LLC
3782 *
3783 * Licensed under the Apache License, Version 2.0 (the "License");
3784 * you may not use this file except in compliance with the License.
3785 * You may obtain a copy of the License at
3786 *
3787 *   http://www.apache.org/licenses/LICENSE-2.0
3788 *
3789 * Unless required by applicable law or agreed to in writing, software
3790 * distributed under the License is distributed on an "AS IS" BASIS,
3791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3792 * See the License for the specific language governing permissions and
3793 * limitations under the License.
3794 */async function TI(n,e){const t=e.data;if(!t.isFirebaseMessaging)return;n.onMessageHandler&&t.messageType===gr.PUSH_RECEIVED&&(typeof n.onMessageHandler=="function"?n.onMessageHandler(nl(t)):n.onMessageHandler.next(nl(t)));const r=t.data;dI(r)&&r[Kw]==="1"&&await yI(n,t.messageType,r)}const rl="@firebase/messaging",il="0.12.10";/**
3795 * @license
3796 * Copyright 2020 Google LLC
3797 *
3798 * Licensed under the Apache License, Version 2.0 (the "License");
3799 * you may not use this file except in compliance with the License.
3800 * You may obtain a copy of the License at
3801 *
3802 *   http://www.apache.org/licenses/LICENSE-2.0
3803 *
3804 * Unless required by applicable law or agreed to in writing, software
3805 * distributed under the License is distributed on an "AS IS" BASIS,
3806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3807 * See the License for the specific language governing permissions and
3808 * limitations under the License.
3809 */const wI=n=>{const e=new pI(n.getProvider("app").getImmediate(),n.getProvider("installations-internal").getImmediate(),n.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",t=>TI(e,t)),e},II=n=>{const e=n.getProvider("messaging").getImmediate();return{getToken:r=>nf(e,r)}};function EI(){Me(new De("messaging",wI,"PUBLIC")),Me(new De("messaging-internal",II,"PRIVATE")),le(rl,il),le(rl,il,"esm2017")}/**
3810 * @license
3811 * Copyright 2020 Google LLC
3812 *
3813 * Licensed under the Apache License, Version 2.0 (the "License");
3814 * you may not use this file except in compliance with the License.
3815 * You may obtain a copy of the License at
3816 *
3817 *   http://www.apache.org/licenses/LICENSE-2.0
3818 *
3819 * Unless required by applicable law or agreed to in writing, software
3820 * distributed under the License is distributed on an "AS IS" BASIS,
3821 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3822 * See the License for the specific language governing permissions and
3823 * limitations under the License.
3824 */async function AI(){try{await wo()}catch{return!1}return typeof window<"u"&&To()&&Al()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
3825 * @license
3826 * Copyright 2020 Google LLC
3827 *
3828 * Licensed under the Apache License, Version 2.0 (the "License");
3829 * you may not use this file except in compliance with the License.
3830 * You may obtain a copy of the License at
3831 *
3832 *   http://www.apache.org/licenses/LICENSE-2.0
3833 *
3834 * Unless required by applicable law or agreed to in writing, software
3835 * distributed under the License is distributed on an "AS IS" BASIS,
3836 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3837 * See the License for the specific language governing permissions and
3838 * limitations under the License.
3839 */function RI(n,e){if(!navigator)throw Re.create("only-available-in-window");return n.onMessageHandler=e,()=>{n.onMessageHandler=null}}/**
3840 * @license
3841 * Copyright 2017 Google LLC
3842 *
3843 * Licensed under the Apache License, Version 2.0 (the "License");
3844 * you may not use this file except in compliance with the License.
3845 * You may obtain a copy of the License at
3846 *
3847 *   http://www.apache.org/licenses/LICENSE-2.0
3848 *
3849 * Unless required by applicable law or agreed to in writing, software
3850 * distributed under the License is distributed on an "AS IS" BASIS,
3851 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3852 * See the License for the specific language governing permissions and
3853 * limitations under the License.
3854 */function zA(n=Tn()){return AI().then(e=>{if(!e)throw Re.create("unsupported-browser")},e=>{throw Re.create("indexed-db-unsupported")}),Ze(W(n),"messaging").getImmediate()}async function HA(n,e){return n=W(n),nf(n,e)}function KA(n,e){return n=W(n),RI(n,e)}EI();/**
3855 * @license
3856 * Copyright 2017 Google LLC
3857 *
3858 * Licensed under the Apache License, Version 2.0 (the "License");
3859 * you may not use this file except in compliance with the License.
3860 * You may obtain a copy of the License at
3861 *
3862 *   http://www.apache.org/licenses/LICENSE-2.0
3863 *
3864 * Unless required by applicable law or agreed to in writing, software
3865 * distributed under the License is distributed on an "AS IS" BASIS,
3866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3867 * See the License for the specific language governing permissions and
3868 * limitations under the License.
3869 */const rf="firebasestorage.googleapis.com",sf="storageBucket",bI=2*60*1e3,SI=10*60*1e3;/**
3870 * @license
3871 * Copyright 2017 Google LLC
3872 *
3873 * Licensed under the Apache License, Version 2.0 (the "License");
3874 * you may not use this file except in compliance with the License.
3875 * You may obtain a copy of the License at
3876 *
3877 *   http://www.apache.org/licenses/LICENSE-2.0
3878 *
3879 * Unless required by applicable law or agreed to in writing, software
3880 * distributed under the License is distributed on an "AS IS" BASIS,
3881 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3882 * See the License for the specific language governing permissions and
3883 * limitations under the License.
3884 */class ie extends Be{constructor(e,t,r=0){super(qs(e),`Firebase Storage: ${t} (${qs(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,ie.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return qs(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3885${this.customData.serverResponse}`:this.message=this._baseMessage}}var re;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(re||(re={}));function qs(n){return"storage/"+n}function ba(){const n="An unknown error occurred, please check the error payload for server response.";return new ie(re.UNKNOWN,n)}function PI(n){return new ie(re.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function CI(n){return new ie(re.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function kI(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new ie(re.UNAUTHENTICATED,n)}function NI(){return new ie(re.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function DI(n){return new ie(re.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function OI(){return new ie(re.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function VI(){return new ie(re.CANCELED,"User canceled the upload/download.")}function MI(n){return new ie(re.INVALID_URL,"Invalid URL '"+n+"'.")}function LI(n){return new ie(re.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function xI(){return new ie(re.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+sf+"' property when initializing the app?")}function UI(){return new ie(re.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function FI(){return new ie(re.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function BI(n){return new ie(re.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function yo(n){return new ie(re.INVALID_ARGUMENT,n)}function of(){return new ie(re.APP_DELETED,"The Firebase app was deleted.")}function jI(n){return new ie(re.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function ir(n,e){return new ie(re.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function Gn(n){throw new ie(re.INTERNAL_ERROR,"Internal error: "+n)}/**
3886 * @license
3887 * Copyright 2017 Google LLC
3888 *
3889 * Licensed under the Apache License, Version 2.0 (the "License");
3890 * you may not use this file except in compliance with the License.
3891 * You may obtain a copy of the License at
3892 *
3893 *   http://www.apache.org/licenses/LICENSE-2.0
3894 *
3895 * Unless required by applicable law or agreed to in writing, software
3896 * distributed under the License is distributed on an "AS IS" BASIS,
3897 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3898 * See the License for the specific language governing permissions and
3899 * limitations under the License.
3900 */class Ue{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=Ue.makeFromUrl(e,t)}catch{return new Ue(e,"")}if(r.path==="")return r;throw LI(e)}static makeFromUrl(e,t){let r=null;const i="([A-Za-z0-9.\\-_]+)";function s(q){q.path.charAt(q.path.length-1)==="/"&&(q.path_=q.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+i+a,"i"),l={bucket:1,path:3};function d(q){q.path_=decodeURIComponent(q.path)}const f="v[A-Za-z0-9_]+",y=t.replace(/[.]/g,"\\."),w="(/([^?#]*).*)?$",b=new RegExp(`^https?://${y}/${f}/b/${i}/o${w}`,"i"),k={bucket:1,path:3},O=t===rf?"(?:storage.googleapis.com|storage.cloud.google.com)":t,C="([^?#]*)",F=new RegExp(`^https?://${O}/${i}/${C}`,"i"),j=[{regex:c,indices:l,postModify:s},{regex:b,indices:k,postModify:d},{regex:F,indices:{bucket:1,path:2},postModify:d}];for(let q=0;q<j.length;q++){const he=j[q],Y=he.regex.exec(e);if(Y){const T=Y[he.indices.bucket];let g=Y[he.indices.path];g||(g=""),r=new Ue(T,g),he.postModify(r);break}}if(r==null)throw MI(e);return r}}class $I{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3901 * @license
3902 * Copyright 2017 Google LLC
3903 *
3904 * Licensed under the Apache License, Version 2.0 (the "License");
3905 * you may not use this file except in compliance with the License.
3906 * You may obtain a copy of the License at
3907 *
3908 *   http://www.apache.org/licenses/LICENSE-2.0
3909 *
3910 * Unless required by applicable law or agreed to in writing, software
3911 * distributed under the License is distributed on an "AS IS" BASIS,
3912 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3913 * See the License for the specific language governing permissions and
3914 * limitations under the License.
3915 */function qI(n,e,t){let r=1,i=null,s=null,a=!1,c=0;function l(){return c===2}let d=!1;function f(...C){d||(d=!0,e.apply(null,C))}function y(C){i=setTimeout(()=>{i=null,n(b,l())},C)}function w(){s&&clearTimeout(s)}function b(C,...F){if(d){w();return}if(C){w(),f.call(null,C,...F);return}if(l()||a){w(),f.call(null,C,...F);return}r<64&&(r*=2);let j;c===1?(c=2,j=0):j=(r+Math.random())*1e3,y(j)}let k=!1;function O(C){k||(k=!0,w(),!d&&(i!==null?(C||(c=2),clearTimeout(i),y(0)):C||(c=1)))}return y(0),s=setTimeout(()=>{a=!0,O(!0)},t),O}function zI(n){n(!1)}/**
3916 * @license
3917 * Copyright 2017 Google LLC
3918 *
3919 * Licensed under the Apache License, Version 2.0 (the "License");
3920 * you may not use this file except in compliance with the License.
3921 * You may obtain a copy of the License at
3922 *
3923 *   http://www.apache.org/licenses/LICENSE-2.0
3924 *
3925 * Unless required by applicable law or agreed to in writing, software
3926 * distributed under the License is distributed on an "AS IS" BASIS,
3927 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3928 * See the License for the specific language governing permissions and
3929 * limitations under the License.
3930 */function HI(n){return n!==void 0}function KI(n){return typeof n=="object"&&!Array.isArray(n)}function Sa(n){return typeof n=="string"||n instanceof String}function sl(n){return Pa()&&n instanceof Blob}function Pa(){return typeof Blob<"u"}function ol(n,e,t,r){if(r<e)throw yo(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw yo(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3931 * @license
3932 * Copyright 2017 Google LLC
3933 *
3934 * Licensed under the Apache License, Version 2.0 (the "License");
3935 * you may not use this file except in compliance with the License.
3936 * You may obtain a copy of the License at
3937 *
3938 *   http://www.apache.org/licenses/LICENSE-2.0
3939 *
3940 * Unless required by applicable law or agreed to in writing, software
3941 * distributed under the License is distributed on an "AS IS" BASIS,
3942 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3943 * See the License for the specific language governing permissions and
3944 * limitations under the License.
3945 */function Ca(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function af(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const i=e(r)+"="+e(n[r]);t=t+i+"&"}return t=t.slice(0,-1),t}var zt;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(zt||(zt={}));/**
3946 * @license
3947 * Copyright 2022 Google LLC
3948 *
3949 * Licensed under the Apache License, Version 2.0 (the "License");
3950 * you may not use this file except in compliance with the License.
3951 * You may obtain a copy of the License at
3952 *
3953 *   http://www.apache.org/licenses/LICENSE-2.0
3954 *
3955 * Unless required by applicable law or agreed to in writing, software
3956 * distributed under the License is distributed on an "AS IS" BASIS,
3957 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3958 * See the License for the specific language governing permissions and
3959 * limitations under the License.
3960 */function WI(n,e){const t=n>=500&&n<600,i=[408,429].indexOf(n)!==-1,s=e.indexOf(n)!==-1;return t||i||s}/**
3961 * @license
3962 * Copyright 2017 Google LLC
3963 *
3964 * Licensed under the Apache License, Version 2.0 (the "License");
3965 * you may not use this file except in compliance with the License.
3966 * You may obtain a copy of the License at
3967 *
3968 *   http://www.apache.org/licenses/LICENSE-2.0
3969 *
3970 * Unless required by applicable law or agreed to in writing, software
3971 * distributed under the License is distributed on an "AS IS" BASIS,
3972 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3973 * See the License for the specific language governing permissions and
3974 * limitations under the License.
3975 */class GI{constructor(e,t,r,i,s,a,c,l,d,f,y,w=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=f,this.connectionFactory_=y,this.retry=w,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((b,k)=>{this.resolve_=b,this.reject_=k,this.start_()})}start_(){const e=(r,i)=>{if(i){r(!1,new Zr(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const a=c=>{const l=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,d)};this.progressCallback_!==null&&s.addUploadProgressListener(a),s.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(a),this.pendingConnection_=null;const c=s.getErrorCode()===zt.NO_ERROR,l=s.getStatus();if(!c||WI(l,this.additionalRetryCodes_)&&this.retry){const f=s.getErrorCode()===zt.ABORT;r(!1,new Zr(!1,null,f));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new Zr(d,s))})},t=(r,i)=>{const s=this.resolve_,a=this.reject_,c=i.connection;if(i.wasSuccessCode)try{const l=this.callback_(c,c.getResponse());HI(l)?s(l):s()}catch(l){a(l)}else if(c!==null){const l=ba();l.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,l)):a(l)}else if(i.canceled){const l=this.appDelete_?of():VI();a(l)}else{const l=OI();a(l)}};this.canceled_?t(!1,new Zr(!1,null,!0)):this.backoffId_=qI(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&zI(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class Zr{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function QI(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function JI(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function XI(n,e){e&&(n["X-Firebase-GMPID"]=e)}function YI(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}
3975function ZI(n,e,t,r,i,s,a=!0){const c=af(n.urlParams),l=n.url+c,d=Object.assign({},n.headers);return XI(d,e),QI(d,t),JI(d,s),YI(d,r),new GI(l,n.method,d,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,i,a)}/**
3976 * @license
3977 * Copyright 2017 Google LLC
3978 *
3979 * Licensed under the Apache License, Version 2.0 (the "License");
3980 * you may not use this file except in compliance with the License.
3981 * You may obtain a copy of the License at
3982 *
3983 *   http://www.apache.org/licenses/LICENSE-2.0
3984 *
3985 * Unless required by applicable law or agreed to in writing, software
3986 * distributed under the License is distributed on an "AS IS" BASIS,
3987 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3988 * See the License for the specific language governing permissions and
3989 * limitations under the License.
3990 */function eE(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function tE(...n){const e=eE();if(e!==void 0){const t=new e;for(let r=0;r<n.length;r++)t.append(n[r]);return t.getBlob()}else{if(Pa())return new Blob(n);throw new ie(re.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function nE(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3991 * @license
3992 * Copyright 2021 Google LLC
3993 *
3994 * Licensed under the Apache License, Version 2.0 (the "License");
3995 * you may not use this file except in compliance with the License.
3996 * You may obtain a copy of the License at
3997 *
3998 *   http://www.apache.org/licenses/LICENSE-2.0
3999 *
4000 * Unless required by applicable law or agreed to in writing, software
4001 * distributed under the License is distributed on an "AS IS" BASIS,
4002 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4003 * See the License for the specific language governing permissions and
4004 * limitations under the License.
4005 */function rE(n){if(typeof atob>"u")throw BI("base-64");return atob(n)}/**
4006 * @license
4007 * Copyright 2017 Google LLC
4008 *
4009 * Licensed under the Apache License, Version 2.0 (the "License");
4010 * you may not use this file except in compliance with the License.
4011 * You may obtain a copy of the License at
4012 *
4013 *   http://www.apache.org/licenses/LICENSE-2.0
4014 *
4015 * Unless required by applicable law or agreed to in writing, software
4016 * distributed under the License is distributed on an "AS IS" BASIS,
4017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4018 * See the License for the specific language governing permissions and
4019 * limitations under the License.
4020 */const He={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class zs{constructor(e,t){this.data=e,this.contentType=t||null}}function iE(n,e){switch(n){case He.RAW:return new zs(cf(e));case He.BASE64:case He.BASE64URL:return new zs(uf(n,e));case He.DATA_URL:return new zs(oE(e),aE(e))}throw ba()}function cf(n){const e=[];for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<n.length-1&&(n.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const s=r,a=n.charCodeAt(++t);r=65536|(s&1023)<<10|a&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function sE(n){let e;try{e=decodeURIComponent(n)}catch{throw ir(He.DATA_URL,"Malformed data URL.")}return cf(e)}function uf(n,e){switch(n){case He.BASE64:{const i=e.indexOf("-")!==-1,s=e.indexOf("_")!==-1;if(i||s)throw ir(n,"Invalid character '"+(i?"-":"_")+"' found: is it base64url encoded?");break}case He.BASE64URL:{const i=e.indexOf("+")!==-1,s=e.indexOf("/")!==-1;if(i||s)throw ir(n,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=rE(e)}catch(i){throw i.message.includes("polyfill")?i:ir(n,"Invalid character found")}const r=new Uint8Array(t.length);for(let i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return r}class lf{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw ir(He.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=cE(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function oE(n){const e=new lf(n);return e.base64?uf(He.BASE64,e.rest):sE(e.rest)}function aE(n){return new lf(n).contentType}function cE(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
4021 * @license
4022 * Copyright 2017 Google LLC
4023 *
4024 * Licensed under the Apache License, Version 2.0 (the "License");
4025 * you may not use this file except in compliance with the License.
4026 * You may obtain a copy of the License at
4027 *
4028 *   http://www.apache.org/licenses/LICENSE-2.0
4029 *
4030 * Unless required by applicable law or agreed to in writing, software
4031 * distributed under the License is distributed on an "AS IS" BASIS,
4032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4033 * See the License for the specific language governing permissions and
4034 * limitations under the License.
4035 */class bt{constructor(e,t){let r=0,i="";sl(e)?(this.data_=e,r=e.size,i=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=i}size(){return this.size_}type(){return this.type_}slice(e,t){if(sl(this.data_)){const r=this.data_,i=nE(r,e,t);return i===null?null:new bt(i)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new bt(r,!0)}}static getBlob(...e){if(Pa()){const t=e.map(r=>r instanceof bt?r.data_:r);return new bt(tE.apply(null,t))}else{const t=e.map(a=>Sa(a)?iE(He.RAW,a).data:a.data_);let r=0;t.forEach(a=>{r+=a.byteLength});const i=new Uint8Array(r);let s=0;return t.forEach(a=>{for(let c=0;c<a.length;c++)i[s++]=a[c]}),new bt(i,!0)}}uploadData(){return this.data_}}/**
4036 * @license
4037 * Copyright 2017 Google LLC
4038 *
4039 * Licensed under the Apache License, Version 2.0 (the "License");
4040 * you may not use this file except in compliance with the License.
4041 * You may obtain a copy of the License at
4042 *
4043 *   http://www.apache.org/licenses/LICENSE-2.0
4044 *
4045 * Unless required by applicable law or agreed to in writing, software
4046 * distributed under the License is distributed on an "AS IS" BASIS,
4047 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4048 * See the License for the specific language governing permissions and
4049 * limitations under the License.
4050 */function hf(n){let e;try{e=JSON.parse(n)}catch{return null}return KI(e)?e:null}/**
4051 * @license
4052 * Copyright 2017 Google LLC
4053 *
4054 * Licensed under the Apache License, Version 2.0 (the "License");
4055 * you may not use this file except in compliance with the License.
4056 * You may obtain a copy of the License at
4057 *
4058 *   http://www.apache.org/licenses/LICENSE-2.0
4059 *
4060 * Unless required by applicable law or agreed to in writing, software
4061 * distributed under the License is distributed on an "AS IS" BASIS,
4062 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4063 * See the License for the specific language governing permissions and
4064 * limitations under the License.
4065 */function uE(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function lE(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function df(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
4066 * @license
4067 * Copyright 2017 Google LLC
4068 *
4069 * Licensed under the Apache License, Version 2.0 (the "License");
4070 * you may not use this file except in compliance with the License.
4071 * You may obtain a copy of the License at
4072 *
4073 *   http://www.apache.org/licenses/LICENSE-2.0
4074 *
4075 * Unless required by applicable law or agreed to in writing, software
4076 * distributed under the License is distributed on an "AS IS" BASIS,
4077 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4078 * See the License for the specific language governing permissions and
4079 * limitations under the License.
4080 */function hE(n,e){return e}
4080class Ce{constructor(e,t,r,i){this.server=e,this.local=t||e,this.writable=!!r,this.xform=i||hE}}let ei=null;function dE(n){return!Sa(n)||n.length<2?n:df(n)}function ff(){if(ei)return ei;const n=[];n.push(new Ce("bucket")),n.push(new Ce("generation")),n.push(new Ce("metageneration")),n.push(new Ce("name","fullPath",!0));function e(s,a){return dE(a)}const t=new Ce("name");t.xform=e,n.push(t);function r(s,a){return a!==void 0?Number(a):a}const i=new Ce("size");return i.xform=r,n.push(i),n.push(new Ce("timeCreated")),n.push(new Ce("updated")),n.push(new Ce("md5Hash",null,!0)),n.push(new Ce("cacheControl",null,!0)),n.push(new Ce("contentDisposition",null,!0)),n.push(new Ce("contentEncoding",null,!0)),n.push(new Ce("contentLanguage",null,!0)),n.push(new Ce("contentType",null,!0)),n.push(new Ce("metadata","customMetadata",!0)),ei=n,ei}function fE(n,e){function t(){const r=n.bucket,i=n.fullPath,s=new Ue(r,i);return e._makeStorageReference(s)}Object.defineProperty(n,"ref",{get:t})}function pE(n,e,t){const r={};r.type="file";const i=t.length;for(let s=0;s<i;s++){const a=t[s];r[a.local]=a.xform(r,e[a.server])}return fE(r,n),r}function pf(n,e,t){const r=hf(e);return r===null?null:pE(n,r,t)}function gE(n,e,t,r){const i=hf(e);
4080if(i===null||!Sa(i.downloadTokens))return null;const s=i.downloadTokens;if(s.length===0)return null;const a=encodeURIComponent;return s.split(",").map(d=>{const f=n.bucket,y=n.fullPath,w="/b/"+a(f)+"/o/"+a(y),b=Ca(w,t,r),k=af({alt:"media",token:d});return b+k})[0]}function mE(n,e){const t={},r=e.length;for(let i=0;i<r;i++){const s=e[i];s.writable&&(t[s.server]=n[s.local])}return JSON.stringify(t)}class gf{constructor(e,t,r,i){this.url=e,this.method=t,this.handler=r,this.timeout=i,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
4081 * @license
4082 * Copyright 2017 Google LLC
4083 *
4084 * Licensed under the Apache License, Version 2.0 (the "License");
4085 * you may not use this file except in compliance with the License.
4086 * You may obtain a copy of the License at
4087 *
4088 *   http://www.apache.org/licenses/LICENSE-2.0
4089 *
4090 * Unless required by applicable law or agreed to in writing, software
4091 * distributed under the License is distributed on an "AS IS" BASIS,
4092 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4093 * See the License for the specific language governing permissions and
4094 * limitations under the License.
4095 */function mf(n){if(!n)throw ba()}function _E(n,e){function t(r,i){const s=pf(n,i,e);return mf(s!==null),s}return t}function yE(n,e){function t(r,i){const s=pf(n,i,e);return mf(s!==null),gE(s,i,n.host,n._protocol)}return t}function _f(n){function e(t,r){let i;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?i=NI():i=kI():t.getStatus()===402?i=CI(n.bucket):t.getStatus()===403?i=D
4095I(n.path):i=r,i.status=t.getStatus(),i.serverResponse=r.serverResponse,i}return e}function vE(n){const e=_f(n);function t(r,i){let s=e(r,i);return r.getStatus()===404&&(s=PI(n.path)),s.serverResponse=i.serverResponse,s}return t}function TE(n,e,t){const r=e.fullServerUrl(),i=Ca(r,n.host,n._protocol),s="GET",a=n.maxOperationRetryTime,c=new gf(i,s,yE(n,t),a);return c.errorHandler=vE(e),c}function wE(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function IE(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=wE(null,e)),r}function EE(n,e,t,r,i){const s=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let j="";for(let q=0;q<2;q++)j=j+Math.random().toString().slice(2);return j}const l=c();a["Content-Type"]="multipart/related; boundary="+l;const d=IE(e,r,i),f=mE(d,t),y="--"+l+`\r
4096Content-Type: application/json; charset=utf-8\r
4097\r
4098`+f+`\r
4099--`+l+`\r
4100Content-Type: `+d.contentType+`\r
4101\r
4102`,w=`\r
4103--`+l+"--",b=bt.getBlob(y,r,w);if(b===null)throw UI();const k={name:d.fullPath},O=Ca(s,n.host,n._protocol),C="POST",F=n.maxUploadRetryTime,$=new gf(O,C,_E(n,t),F);return $.urlParams=k,$.headers=a,$.body=b.uploadData(),$.errorHandler=_f(e),$}class AE{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=zt.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=zt.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=zt.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,i){if(this.sent_)throw Gn("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),i!==void 0)for(const s in i)i.hasOwnProperty(s)&&this.xhr_.setRequestHeader(s,i[s].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Gn("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Gn("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Gn("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Gn("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class RE extends AE{initXhr(){this.xhr_.responseType="text"}}function yf(){return new RE}/**
4104 * @license
4105 * Copyright 2019 Google LLC
4106 *
4107 * Licensed under the Apache License, Version 2.0 (the "License");
4108 * you may not use this file except in compliance with the License.
4109 * You may obtain a copy of the License at
4110 *
4111 *   http://www.apache.org/licenses/LICENSE-2.0
4112 *
4113 * Unless required by applicable law or agreed to in writing, software
4114 * distributed under the License is distributed on an "AS IS" BASIS,
4115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4116 * See the License for the specific language governing permissions and
4117 * limitations under the License.
4118 */class Jt{constructor(e,t){this._service=e,t instanceof Ue?this._location=t:this._location=Ue.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new Jt(e,t)}get root(){const e=new Ue(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return df(this._location.path)}get storage(){return this._service}get parent(){const e=uE(this._location.path);if(e===null)return null;const t=new Ue(this._location.bucket,e);return new Jt(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw jI(e)}}function bE(n,e,t){n._throwIfRoot("uploadBytes");const r=EE(n.storage,n._location,ff(),new bt(e,!0),t);return n.storage.makeRequestWithTokens(r,yf).then(i=>({metadata:i,ref:n}))}function SE(n){n._throwIfRoot("getDownloadURL");const e=TE(n.storage,n._location,ff());return n.storage.makeRequestWithTokens(e,yf).then(t=>{if(t===null)throw FI();return t})}function PE(n,e){const t=lE(n._location.path,e),r=new Ue(n._location.bucket,t);return new Jt(n.storage,r)}/**
4119 * @license
4120 * Copyright 2017 Google LLC
4121 *
4122 * Licensed under the Apache License, Version 2.0 (the "License");
4123 * you may not use this file except in compliance with the License.
4124 * You may obtain a copy of the License at
4125 *
4126 *   http://www.apache.org/licenses/LICENSE-2.0
4127 *
4128 * Unless required by applicable law or agreed to in writing, software
4129 * distributed under the License is distributed on an "AS IS" BASIS,
4130 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4131 * See the License for the specific language governing permissions and
4132 * limitations under the License.
4133 */function CE(n){return/^[A-Za-z]+:\/\//.test(n)}function kE(n,e){return new Jt(n,e)}function vf(n,e){if(n instanceof ka){const t=n;if(t._bucket==null)throw xI();const r=new Jt(t,t._bucket);return e!=null?vf(r,e):r}else return e!==void 0?PE(n,e):n}function NE(n,e){if(e&&CE(e)){if(n instanceof ka)return kE(n,e);throw yo("To use ref(service, url), the first argument must be a Storage instance.")}else return vf(n,e)}function al(n,e){const t=e==null?void 0:e[sf];return t==null?null:Ue.makeFromBucketSpec(t,n)}function DE(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:i}=r;i&&(n._overrideAuthToken=typeof i=="string"?i:Il(i,n.app.options.projectId))}class ka{constructor(e,t,r,i,s){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=i,this._firebaseVersion=s,this._bucket=null,this._host=rf,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=bI,this._maxUploadRetryTime=SI,this._requests=new Set,i!=null?this._bucket=Ue.makeFromBucketSpec(i,this._host):this._bucket=al(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Ue.makeFromBucketSpec(this._url,e):this._bucket=al(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ol("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ol("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Jt(this,e)}_makeRequest(e,t,r,i,s=!0){if(this._deleted)return new $I(of());{const a=ZI(e,this._appId,r,i,t,this._firebaseVersion,s);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,i).getPromise()}}const cl="@firebase/storage",ul="0.13.1";/**
4134 * @license
4135 * Copyright 2020 Google LLC
4136 *
4137 * Licensed under the Apache License, Version 2.0 (the "License");
4138 * you may not use this file except in compliance with the License.
4139 * You may obtain a copy of the License at
4140 *
4141 *   http://www.apache.org/licenses/LICENSE-2.0
4142 *
4143 * Unless required by applicable law or agreed to in writing, software
4144 * distributed under the License is distributed on an "AS IS" BASIS,
4145 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4146 * See the License for the specific language governing permissions and
4147 * limitations under the License.
4148 */const Tf="storage";function WA(n,e,t){return n=W(n),bE(n,e,t)}function GA(n){return n=W(n),SE(n)}function QA(n,e){return n=W(n),NE(n,e)}function JA(n=Tn(),e){n=W(n);const r=Ze(n,Tf).getImmediate({identifier:e}),i=vo("storage");return i&&OE(r,...i),r}function OE(n,e,t,r={}){DE(n,e,t,r)}function VE(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),i=n.getProvider("app-check-internal");return new ka(t,r,i,e,Xt)}function ME(){Me(new De(Tf,VE,"PUBLIC").setMultipleInstances(!0)),le(cl,ul,""),le(cl,ul,"esm2017")}ME();/**
4149 * @license
4150 * Copyright 2019 Google LLC
4151 *
4152 * Licensed under the Apache License, Version 2.0 (the "License");
4153 * you may not use this file except in compliance with the License.
4154 * You may obtain a copy of the License at
4155 *
4156 *   http://www.apache.org/licenses/LICENSE-2.0
4157 *
4158 * Unless required by applicable law or agreed to in writing, software
4159 * distributed under the License is distributed on an "AS IS" BASIS,
4160 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4161 * See the License for the specific language governing permissions and
4162 * limitations under the License.
4163 */const Ci="analytics",LE="firebase_id",xE="origin",UE=60*1e3,FE="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",Na="https://www.googletagmanager.com/gtag/js";/**
4164 * @license
4165 * Copyright 2019 Google LLC
4166 *
4167 * Licensed under the Apache License, Version 2.0 (the "License");
4168 * you may not use this file except in compliance with the License.
4169 * You may obtain a copy of the License at
4170 *
4171 *   http://www.apache.org/licenses/LICENSE-2.0
4172 *
4173 * Unless required by applicable law or agreed to in writing, software
4174 * distributed under the License is distributed on an "AS IS" BASIS,
4175 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4176 * See the License for the specific language governing permissions and
4177 * limitations under the License.
4178 */const Ne=new Ni("@firebase/analytics");/**
4179 * @license
4180 * Copyright 2019 Google LLC
4181 *
4182 * Licensed under the Apache License, Version 2.0 (the "License");
4183 * you may not use this file except in compliance with the License.
4184 * You may obtain a copy of the License at
4185 *
4186 *   http://www.apache.org/licenses/LICENSE-2.0
4187 *
4188 * Unless required by applicable law or agreed to in writing, software
4189 * distributed under the License is distributed on an "AS IS" BASIS,
4190 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4191 * See the License for the specific language governing permissions and
4192 * limitations under the License.
4193 */const BE={"already-exists":"A Firebase Analytics instance with the appId {$id}  already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."},Fe=new Ot("analytics","Analytics",BE);/**
4194 * @license
4195 * Copyright 2019 Google LLC
4196 *
4197 * Licensed under the Apache License, Version 2.0 (the "License");
4198 * you may not use this file except in compliance with the License.
4199 * You may obtain a copy of the License at
4200 *
4201 *   http://www.apache.org/licenses/LICENSE-2.0
4202 *
4203 * Unless required by applicable law or agreed to in writing, softw
4203are
4204 * distributed under the License is distributed on an "AS IS" BASIS,
4205 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4206 * See the License for the specific language governing permissions and
4207 * limitations under the License.
4208 */function jE(n){if(!n.startsWith(Na)){const e=Fe.create("invalid-gtag-resource",{gtagURL:n});return Ne.warn(e.message),""}return n}function wf(n){return Promise.all(n.map(e=>e.catch(t=>t)))}function $E(n,e){let t;return window.trustedTypes&&(t=window.trustedTypes.createPolicy(n,e)),t}function qE(n,e){const t=$E("firebase-js-sdk-policy",{createScriptURL:jE}),r=document.createElement("script"),i=`${Na}?l=${n}&id=${e}`;r.src=t?t==null?void 0:t.createScriptURL(i):i,r.async=!0,document.head.appendChild(r)}function zE(n){let e=[];return Array.isArray(window[n])?e=window[n]:window[n]=e,e}async function HE(n,e,t,r,i,s){const a=r[i];try{if(a)await e[a];else{const l=(await wf(t)).find(d=>d.measurementId===i);l&&await e[l.appId]}}catch(c){Ne.error(c)}n("config",i,s)}async function KE(n,e,t,r,i){try{let s=[];if(i&&i.send_to){let a=i.send_to;Array.isArray(a)||(a=[a]);const c=await wf(t);for(const l of a){const d=c.find(y=>y.measurementId===l),f=d&&e[d.appId];if(f)s.push(f);else{s=[];break}}}s.length===0&&(s=Object.values(e)),await Promise.all(s),n("event",r,i||{})}catch(s){Ne.error(s)}}function WE(n,e,t,r){async function i(s,...a){try{if(s==="event"){const[c,l]=a;await KE(n,e,t,c,l)}else if(s==="config"){const[c,l]=a;await HE(n,e,t,r,c,l)}else if(s==="consent"){const[c,l]=a;n("consent",c,l)}else if(s==="get"){const[c,l,d]=a;n("get",c,l,d)}else if(s==="set"){const[c]=a;n("set",c)}else n(s,...a)}catch(c){Ne.error(c)}}return i}function GE(n,e,t,r,i){let s=function(...a){window[r].push(arguments)};return window[i]&&typeof window[i]=="function"&&(s=window[i]),window[i]=WE(s,n,e,t),{gtagCore:s,wrappedGtag:window[i]}}function QE(n){const e=window.document.getElementsByTagName("script");for(const t of Object.values(e))if(t.src&&t.src.includes(Na)&&t.src.includes(n))return t;return null}/**
4209 * @license
4210 * Copyright 2020 Google LLC
4211 *
4212 * Licensed under the Apache License, Version 2.0 (the "License");
4213 * you may not use this file except in compliance with the License.
4214 * You may obtain a copy of the License at
4215 *
4216 *   http://www.apache.org/licenses/LICENSE-2.0
4217 *
4218 * Unless required by applicable law or agreed to in writing, software
4219 * distributed under the License is distributed on an "AS IS" BASIS,
4220 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4221 * See the License for the specific language governing permissions and
4222 * limitations under the License.
4223 */const JE=30,XE=1e3;class YE{constructor(e={},t=XE){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}}const If=new YE;function ZE(n){return new Headers({Accept:"application/json","x-goog-api-key":n})}async function eA(n){var e;const{appId:t,apiKey:r}=n,i={method:"GET",headers:ZE(r)},s=FE.replace("{app-id}",t),a=await fetch(s,i);if(a.status!==200&&a.status!==304){let c="";try{const l=await a.json();!((e=l.error)===null||e===void 0)&&e.message&&(c=l.error.message)}catch{}throw Fe.create("config-fetch-failed",{httpStatus:a.status,responseMessage:c})}return a.json()}async function tA(n,e=If,t){const{appId:r,apiKey:i,measurementId:s}=n.options;if(!r)throw Fe.create("no-app-id");if(!i){if(s)return{measurementId:s,appId:r};throw Fe.create("no-api-key")}const a=e.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()},c=new iA;return setTimeout(async()=>{c.abort()},UE),Ef({appId:r,apiKey:i,measurementId:s},a,c,e)}async function Ef(n,{throttleEndTimeMillis:e,backoffCount:t},r,i=If){var s;const{appId:a,measurementId:c}=n;try{await nA(r,e)}catch(l){if(c)return Ne.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${c} provided in the "measurementId" field in the local Firebase config. [${l==null?void 0:l.message}
4223]`),{appId:a,measurementId:c};throw l}try{const l=await eA(n);return i.deleteThrottleMetadata(a),l}catch(l){const d=l;if(!rA(d)){if(i.deleteThrottleMetadata(a),c)return Ne.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${c} provided in the "measurementId" field in the local Firebase config. [${d==null?void 0:d.message}]`),{appId:a,measurementId:c};throw l}const f=Number((s=d==null?void 0:d.customData)===null||s===void 0?void 0:s.httpStatus)===503?Mc(t,i.intervalMillis,JE):Mc(t,i.intervalMillis),y={throttleEndTimeMillis:Date.now()+f,backoffCount:t+1};return i.setThrottleMetadata(a,y),Ne.debug(`Calling attemptFetch again in ${f} millis`),Ef(n,y,r,i)}}function nA(n,e){return new Promise((t,r)=>{const i=Math.max(e-Date.now(),0),s=setTimeout(t,i);n.addEventListener(()=>{clearTimeout(s),r(Fe.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}function rA(n){if(!(n instanceof Be)||!n.customData)return!1;const e=Number(n.customData.httpStatus);return e===429||e===500||e===503||e===504}class iA{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function sA(n,e,t,r,i){if(i&&i.global){n("event",t,r);return}else{const s=await e,a=Object.assign(Object.assign({},r),{send_to:s});n("event",t,a)}}async function oA(n,e,t,r){{const i=await e;n("config",i,{update:!0,user_properties:t})}}/**
4224 * @license
4225 * Copyright 2020 Google LLC
4226 *
4227 * Licensed under the Apache License, Version 2.0 (the "License");
4228 * you may not use this file except in compliance with the License.
4229 * You may obtain a copy of the License at
4230 *
4231 *   http://www.apache.org/licenses/LICENSE-2.0
4232 *
4233 * Unless required by applicable law or agreed to in writing, software
4234 * distributed under the License is distributed on an "AS IS" BASIS,
4235 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4236 * See the License for the specific language governing permissions and
4237 * limitations under the License.
4238 */async function aA(){if(To())try{await wo()}catch(n){return Ne.warn(Fe.create("indexeddb-unavailable",{errorInfo:n==null?void 0:n.toString()}).message),!1}else return Ne.warn(Fe.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;return!0}async function cA(n,e,t,r,i,s,a){var c;const l=tA(n);l.then(b=>{t[b.measurementId]=b.appId,n.options.measurementId&&b.measurementId!==n.options.measurementId&&Ne.warn(`The measurement ID in the local Firebase config (${n.options.measurementId}) does not match the measurement ID fetched from the server (${b.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(b=>Ne.error(b)),e.push(l);const d=aA().then(b=>{if(b)return r.getId()}),[f,y]=await Promise.all([l,d]);QE(s)||qE(s,f.measurementId),i("js",new Date);const w=(c=a==null?void 0:a.config)!==null&&c!==void 0?c:{};return w[xE]="firebase",w.update=!0,y!=null&&(w[LE]=y),i("config",f.measurementId,w),f.measurementId}/**
4239 * @license
4240 * Copyright 2019 Google LLC
4241 *
4242 * Licensed under the Apache License, Version 2.0 (the "License");
4243 * you may not use this file except in compliance with the License.
4244 * You may obtain a copy of the License at
4245 *
4246 *   http://www.apache.org/licenses/LICENSE-2.0
4247 *
4248 * Unless required by applicable law or agreed to in writing, software
4249 * distributed under the License is distributed on an "AS IS" BASIS,
4250 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4251 * See the License for the specific language governing permissions and
4252 * limitations under the License.
4253 */class uA{constructor(e){this.app=e}_delete(){return delete dn[this.app.options.appId],Promise.resolve()}}let dn={},ll=[];const hl={};let Hs="dataLayer",lA="gtag",dl,Da,fl=!1;function hA(){const n=[];if(El()&&n.push("This is a browser extension environment."),Al()||n.push("Cookies are not available."),n.length>0){const e=n.map((r,i)=>`(${i+1}) ${r}`).join(" "),t=Fe.create("invalid-analytics-context",{errorInfo:e});Ne.warn(t.message)}}function dA(n,e,t){hA();const r=n.options.appId;if(!r)throw Fe.create("no-app-id");if(!n.options.apiKey)if(n.options.measurementId)Ne.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${n.options.measurementId} provided in the "measurementId" field in the local Firebase config.`);else throw Fe.create("no-api-key");if(dn[r]!=null)throw Fe.create("already-exists",{id:r});if(!fl){zE(Hs);const{wrappedGtag:s,gtagCore:a}=GE(dn,ll,hl,Hs,lA);Da=s,dl=a,fl=!0}return dn[r]=cA(n,ll,hl,e,dl,Hs,t),new uA(n)}function XA(n=Tn()){n=W(n);const e=Ze(n,Ci);return e.isInitialized()?e.getImmediate():fA(n)}function fA(n,e={}){const t=Ze(n,Ci);if(t.isInitialized()){const i=t.getImmediate();if(sr(e,t.getOptions()))return i;throw Fe.create("already-initialized")}return t.initialize({options:e})}function YA(n,e,t){n=W(n),oA(Da,dn[n.app.options.appId],e).catch(r=>Ne.error(r))}function pA(n,e,t,r){n=W(n),sA(Da,dn[n.app.options.appId],e,t,r).catch(i=>Ne.error(i))}const pl="@firebase/analytics",gl="0.10.7";function gA(){Me(new De(Ci,(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("installations-internal").getImmediate();return dA(r,i,t)},"PUBLIC")),Me(new De("analytics-internal",n,"PRIVATE")),le(pl,gl),le(pl,gl,"esm2017");function n(e){try{const t=e.getProvider(Ci).getImmediate();return{logEvent:(r,i,s)=>pA(t,r,i,s)}}catch(t){throw Fe.create("interop-component-reg-failed",{reason:t})}}}gA();export{OA as A,CA as B,De as C,dp as D,Ot as E,MA as F,It as G,xA as H,LA as I,FA as J,qA as K,Ni as L,UA as M,AI as N,ri as O,zA as P,HA as Q,KA as R,$A as S,JA as T,GA as U,QA as V,WA as W,XA as X,pA as Y,YA as Z,Me as _,Ze as a,Tn as b,cp as c,_l as d,Mc as e,Rg as f,W as g,_A as h,To as i,yA as j,AA as k,EA as l,vA as m,IA as n,TA as o,qm as p,kA as q,le as r,wA as s,PA as t,mA as u,NA as v,DA as w,jA as x,VA as y,BA 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.