1import{r as A,h as N,C as D,e as $,E as Y,q as mt,F as B,l as wt,t as h,u as W,v as Tt,L as b,w as St,S as _t,x as It}from"./index.esm2017-CF2IW8hE.js";const X="@firebase/installations",q="0.6.9";/** 2 * @license 3 * Copyright 2019 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 Q=1e4,Z=`w:${q}`,tt="FIS_v2",Ct="https://firebaseinstallations.googleapis.com/v1",bt=60*60*1e3,Et="installations",At="Installations";/** 17 * @license 18 * Copyright 2019 Google LLC 19 * 20 * Licensed under the Apache License, Version 2.0 (the "License"); 21 * you may not use this file except in compliance with the License. 22 * You may obtain a copy of the License at 23 * 24 * http://www.apache.org/licenses/LICENSE-2.0 25 * 26 * Unless required by applicable law or agreed to in writing, software 27 * distributed under the License is distributed on an "AS IS" BASIS, 28 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 * See the License for the specific language governing permissions and 30 * limitations under the License. 31 */const yt={"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."},S=new Y(Et,At,yt);function et(e){return e instanceof B&&e.code.includes("request-failed")}/** 32 * @license 33 * Copyright 2019 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 */function st({projectId:e}){return`${Ct}/projects/${e}/installations`}function nt(e){return{token:e.token,requestStatus:2,expiresIn:Ft(e.expiresIn),creationTime:Date.now()}}async function it(e,t){const n=(await t.json()).error;return S.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function at({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function vt(e,{refreshToken:t}){const s=at(e);return s.append("Authorization",Mt(t)),s}async function rt(e){const t=await e();return t.status>=500&&t.status<600?e():t}function Ft(e){return Number(e.replace("s","000"))}function Mt(e){return`${tt} ${e}`}/** 47 * @license 48 * Copyright 2019 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 */async function Rt({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const n=st(e),i=at(e),a=t.getImmediate({optional:!0});if(a){const o=await a.getHeartbeatsHeader();o&&i.append("x-firebase-client",o)}const c={fid:s,authVersion:tt,appId:e.appId,sdkVersion:Z},u={method:"POST",headers:i,body:JSON.stringify(c)},r=await rt(()=>fetch(n,u));if(r.ok){const o=await r.json();return{fid:o.fid||s,registrationStatus:2,refreshToken:o.refreshToken,authToken:nt(o.authToken)}}else throw await it("Create Installation",r)}/** 62 * @license 63 * Copyright 2019 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 ot(e){return new Promise(t=>{setTimeout(t,e)})}/** 77 * @license 78 * Copyright 2019 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 Pt(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")}/** 92 * @license 93 * Copyright 2019 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 kt=/^[cdef][\w-]{21}$/,j="";function Ot(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const s=Lt(e);return kt.test(s)?s:j}catch{return j}}function Lt(e){return Pt(e).substr(0,22)}/** 107 * @license 108 * Copyright 2019 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 v(e){return`${e.appName}!${e.appId}`}/** 122 * @license 123 * Copyright 2019 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 ct=new Map;function ut(e,t){const s=v(e);lt(s,t),Nt(s,t)}function lt(e,t){const s=ct.get(e);if(s)for(const n of s)n(t)}function Nt(e,t){const s=Dt();s&&s.postMessage({key:e,fid:t}),jt()}let T=null;function Dt(){return!T&&"BroadcastChannel"in self&&(T=new BroadcastChannel("[Firebase] FID Change"),T.onmessage=e=>{lt(e.data.key,e.data.fid)}),T}function jt(){ct.size===0&&T&&(T.close(),T=null)}/** 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 $t="firebase-installations-database",Bt=1,_="firebase-installations-store";let P=null;function U(){return P||(P=mt($t,Bt,{upgrade:(e,t)=>{switch(t){case 0:e.createObjectStore(_)}}})),P}async function y(e,t){const s=v(e),i=(await U()).transaction(_,"readwrite"),a=i.objectStore(_),c=await a.get(s);return await a.put(t,s),await i.done,(!c||c.fid!==t.fid)&&ut(e,t.fid),t}async function gt(e){const t=v(e),n=(await U()).transaction(_,"readwrite");await n.objectStore(_).delete(t),await n.done}async function F(e,t){const s=v(e),i=(await U()).transaction(_,"readwrite"),a=i.objectStore(_),c=await a.get(s),u=t(c);return u===void 0?await a.delete(s):await a.put(u,s),await i.done,u&&(!c||c.fid!==u.f
151id)&&ut(e,u.fid),u}/** 152 * @license 153 * Copyright 2019 Google LLC 154 * 155 * Licensed under the Apache License, Version 2.0 (the "License"); 156 * you may not use this file except in compliance with the License. 157 * You may obtain a copy of the License at 158 * 159 * http://www.apache.org/licenses/LICENSE-2.0 160 * 161 * Unless required by applicable law or agreed to in writing, software 162 * distributed under the License is distributed on an "AS IS" BASIS, 163 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 164 * See the License for the specific language governing permissions and 165 * limitations under the License. 166 */async function V(e){let t;const s=await F(e.appConfig,n=>{const i=qt(n),a=Ut(e,i);return t=a.registrationPromise,a.installationEntry});return s.fid===j?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}function qt(e){const t=e||{fid:Ot(),registrationStatus:0};return ft(t)}function Ut(e,t){if(t.registrationStatus===0){if(!navigator.onLine){const i=Promise.reject(S.create("app-offline"));return{installationEntry:t,registrationPromise:i}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=Vt(e,s);return{installationEntry:s,registrationPromise:n}}else return t.registrationStatus===1?{installationEntry:t,registrationPromise:xt(e)}:{installationEntry:t}}async function Vt(e,t){try{const s=await Rt(e,t);return y(e.appConfig,s)}catch(s){throw et(s)&&s.customData.serverCode===409?await gt(e.appConfig):await y(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}async function xt(e){let t=await H(e.appConfig);for(;t.registrationStatus===1;)await ot(100),t=await H(e.appConfig);if(t.registrationStatus===0){const{installationEntry:s,registrationPromise:n}=await V(e);return n||s}return t}function H(e){return F(e,t=>{if(!t)throw S.create("installation-not-found");return ft(t)})}function ft(e){return Kt(e)?{fid:e.fid,registrationStatus:0}:e}function Kt(e){return e.registrationStatus===1&&e.registrationTime+Q<Date.now()}/** 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 */async function Ht({appConfig:e,heartbeatServiceProvider:t},s){const n=zt(e,s),i=vt(e,s),a=t.getImmediate({optional:!0});if(a){const o=await a.getHeartbeatsHeader();o&&i.append("x-firebase-client",o)}const c={installation:{sdkVersion:Z,appId:e.appId}},u={method:"POST",headers:i,body:JSON.stringify(c)},r=await rt(()=>fetch(n,u));if(r.ok){const o=await r.json();return nt(o)}else throw await it("Generate Auth Token",r)}function zt(e,{fid:t}){return`${st(e)}/${t}/authTokens:generate`}/** 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 */async function x(e,t=!1){let s;const n=await F(e.appConfig,a=>{if(!ht(a))throw S.create("not-registered");const c=a.authToken;if(!t&&Yt(c))return a;if(c.requestStatus===1)return s=Gt(e,t),a;{if(!navigator.onLine)throw S.create("app-offline");const u=Xt(a);return s=Jt(e,u),u}});return s?await s:n.authToken}async function Gt(e,t){let s=await z(e.appConfig);for(;s.authToken.requestStatus===1;)await ot(100),s=await z(e.appConfig);const n=s.authToken;return n.requestStatus===0?x(e,t):n}function z(e){return F(e,t=>{if(!ht(t))throw S.create("not-registered");const s=t.authToken;return Qt(s)?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t})}async function Jt(e,t){try{const s=await Ht(e,t),n=Object.assign(Object.assign({},t),{authToken:s});return await y(e.appConfig,n),s}catch(s){if(et(s)&&(s.customData.serverCode===401||s.customData.serverCode===404))await gt(e.appConfig);else{const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await y(e.appConfig,n)}throw s}}function ht(e){return e!==void 0&&e.registrationStatus===2}function Yt(e){return e.requestStatus===2&&!Wt(e)}function Wt(e){const t=Date.now();
196return t<e.creationTime||e.creationTime+e.expiresIn<t+bt}function Xt(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}function Qt(e){return e.requestStatus===1&&e.requestTime+Q<Date.now()}/** 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 */async function Zt(e){const t=e,{installationEntry:s,registrationPromise:n}=await V(t);return n?n.catch(console.error):x(t).catch(console.error),s.fid}/** 212 * @license 213 * Copyright 2019 Google LLC 214 * 215 * Licensed under the Apache License, Version 2.0 (the "License"); 216 * you may not use this file except in compliance with the License. 217 * You may obtain a copy of the License at 218 * 219 * http://www.apache.org/licenses/LICENSE-2.0 220 * 221 * Unless required by applicable law or agreed to in writing, software 222 * distributed under the License is distributed on an "AS IS" BASIS, 223 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 224 * See the License for the specific language governing permissions and 225 * limitations under the License. 226 */async function te(e,t=!1){const s=e;return await ee(s),(await x(s,t)).token}async function ee(e){const{registrationPromise:t}=await V(e);t&&await 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 */function se(e){if(!e||!e.options)throw k("App Configuration");if(!e.name)throw k("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw k(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}function k(e){return S.create("missing-app-config-values",{valueName:e})}/** 242 * @license 243 * Copyright 2020 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 dt="installations",ne="installations-internal",ie=e=>{const t=e.getProvider("app").getImmediate(),s=se(t),n=$(t,"heartbeat");return{app:t,appConfig:s,heartbeatServiceProvider:n,_delete:()=>Promise.resolve()}},ae=e=>{const t=e.getProvider("app").getImmediate(),s=$(t,dt).getImmediate();return{getId:()=>Zt(s),getToken:i=>te(s,i)}};function re(){N(new D(dt,ie,"PUBLIC")),N(new D(ne,ae,"PRIVATE"))}re();A(X,q);A(X,q,"esm2017");const O="@firebase/remote-config",G="0.4.9";/** 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, softw
266are 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 */class oe{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach(t=>t())}}/** 272 * @license 273 * Copyright 2020 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 pt="remote-config";/** 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 ce={"registration-window":"Undefined window object. This SDK only supports usage in a browser environment.","registration-project-id":"Undefined project identifier. Check Firebase app initialization.","registration-api-key":"Undefined API key. Check Firebase app initialization.","registration-app-id":"Undefined app identifier. Check Firebase app initialization.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}.","fetch-client-network":"Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-timeout":'The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',"fetch-throttle":'The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',"fetch-client-parse":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","indexed-db-unavailable":"Indexed DB is not supported by current browser"},l=new Y("remoteconfig","Remote Config",ce);function ue(e,t){return e instanceof B&&e.code.indexOf(t)!==-1}/** 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 */const le=!1,ge="",J=0,fe=["1","true","t","yes","y","on"];class L{constructor(t,s=ge){this._source=t,this._value=s}asString(){return this._value}asBoolean(){return this._source==="static"?le:fe.indexOf(this._value.toLowerCase())>=0}asNumber(){if(this._source==="static")return J;let t=Number(this._value);return isNaN(t)&&(t=J),t}getSource(){return this._source}}/** 317 * @license 318 * Copyright 2020 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 */function Oe(e=wt()){return e=h(e),$(e,pt).getImmediate()}async function he(e){const t=h(e),[s,n]=await Promise.all([t._storage.getLastSuccessfulFetchResponse(),t._storage.getActiveConfigEtag()]);return!s||!s.config||!s.eTag||s.eTag===n?!1:(await Promise.all([t._storageCache.setActiveConfig(s.config),t._storage.setActiveConfigEtag(s.eTag)]),!0)}function de(e){const t=h(e);return t._initializePromise||(t._initializePromise=t._storageCache.loadFromStorage().then(()=>{t._isInitializationComplete=!0})),t._initializePromise}async function pe(e){const t=h(e),s=new oe;setTimeout(async()=>{s.abort()},t.settings.fetchTimeoutMillis);try{await t._client.fetch({cacheMaxAgeMillis:t.settings.minimumFetchIntervalMillis,signal:s}),await t._storageCache.setLastFetchStatus("success")}catch(n){const i=ue(n,"fetch-throttle")?"throttle":"failure";throw await t._storageCache.setLastFetchStatus(i),n}}function Le(e){const t=h(e);return me(t._storageCache.getActiveConfig(),t.defaultConfig).reduce((s,n)=>(s[n]=M(e,n),s),{})}function Ne(e,t){return M(h(e),t).asBoolean()}function De(e,t){return M(h(e),t).asNumber()}function je(e,t){return M(h(e),t).asString()}function M(e,t){const s=h(e);s._isInitializationComplete||s._logger.debug(`A value was requested for key "${t}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);const n=s._storageCache.getActiveConfig();return n&&n[t]!==void 0?new L("remote",n[t]):s.defaultConfig&&s.defaultConfig[t]!==void 0?new L("default",String(s.defaultConfig[t])):(s._logger.debug(`Returning static value for key "${t}". Define a default or remote value if this is unintentional.`),new L("static"))}function $e(e,t){const s=h(e);switch(t){case"debug":s._logger.logLevel=b.DEBUG;break;case"silent":s._logger.logLevel=b.SILENT;break;default:s._logger.logLevel=b.ERROR}}function me(e={},t={}){return Object.keys(Object.assign(Object.assign({},e),t))}/** 332 * @license 333 * Copyright 2019 Google LLC 334 * 335 * Licensed under the Apache License, Version 2.0 (the "License"); 336 * you may not use this file except in compliance with the License. 337 * You may obtain a copy of the License at 338 * 339 * http://www.apache.org/licenses/LICENSE-2.0 340 * 341 * Unless required by applicable law or agreed to in writing, software 342 * distributed under the License is distributed on an "AS IS" BASIS, 343 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 344 * See the License for the specific language governing permissions and 345 * limitations under the License. 346 */class we{constructor(t,s,n,i){this.client=t,this.storage=s,this.storageCache=n,this.logger=i}isCachedDataFresh(t,s){if(!s)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;const n=Date.now()-s,i=n<=t;return this.logger.debug(`Config fetch cache check. Cache age millis: ${n}. Cache max age millis (minimumFetchIntervalMillis setting): ${t}. Is cache hit: ${i}.`),i}async fetch(t){const[s,n]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(n&&this.isCachedDataFresh(t.cacheMaxAgeMillis,s))return n;t.eTag=n&&n.eTag;const i=await this.client.fetch(t),a=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return i.status===200&&a.push(this.storage.setLastSuccessfulFetchResponse(i)),await Promise.all(a),i}}/** 347 * @license 348 * Copyright 2019 Google LLC 349 * 350 * Licensed under the Apache License, Version 2.0 (the "License"); 351 * you may not use this file except in compliance with the License. 352 * You may obtain a copy of the License at 353 * 354 * http://www.apache.org/licenses/LICENSE-2.0 355 * 356 * Unless required by applicable law or agreed to in writing, softw
356are 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 */function Te(e=navigator){return e.languages&&e.languages[0]||e.language}/** 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 */class Se{constructor(t,s,n,i,a,c){this.firebaseInstallations=t,this.sdkVersion=s,this.namespace=n,this.projectId=i,this.apiKey=a,this.appId=c}async fetch(t){const[s,n]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),a=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,c={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":t.eTag||"*"},u={sdk_version:this.sdkVersion,app_instance_id:s,app_instance_id_token:n,app_id:this.appId,language_code:Te()},r={method:"POST",headers:c,body:JSON.stringify(u)},o=fetch(a,r),g=new Promise((f,p)=>{t.signal.addEventListener(()=>{const K=new Error("The operation was aborted.");K.name="AbortError",p(K)})});let m;try{await Promise.race([o,g]),m=await o}catch(f){let p="fetch-client-network";throw(f==null?void 0:f.name)==="AbortError"&&(p="fetch-timeout"),l.create(p,{originalErrorMessage:f==null?void 0:f.message})}let d=m.status;const R=m.headers.get("ETag")||void 0;let I,C;if(m.status===200){let f;try{f=await m.json()}catch(p){throw l.create("fetch-client-parse",{originalErrorMessage:p==null?void 0:p.message})}I=f.entries,C=f.state}if(C==="INSTANCE_STATE_UNSPECIFIED"?d=500:C==="NO_CHANGE"?d=304:(C==="NO_TEMPLATE"||C==="EMPTY_CONFIG")&&(I={}),d!==304&&d!==200)throw l.create("fetch-status",{httpStatus:d});return{status:d,eTag:R,config:I}}}/** 377 * @license 378 * Copyright 2019 Google LLC 379 * 380 * Licensed under the Apache License, Version 2.0 (the "License"); 381 * you may not use this file except in compliance with the License. 382 * You may obtain a copy of the License at 383 * 384 * http://www.apache.org/licenses/LICENSE-2.0 385 * 386 * Unless required by applicable law or agreed to in writing, software 387 * distributed under the License is distributed on an "AS IS" BASIS, 388 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 389 * See the License for the specific language governing permissions and 390 * limitations under the License. 391 */function _e(e,t){return new Promise((s,n)=>{const i=Math.max(t-Date.now(),0),a=setTimeout(s,i);e.addEventListener(()=>{clearTimeout(a),n(l.create("fetch-throttle",{throttleEndTimeMillis:t}))})})}function Ie(e){if(!(e instanceof B)||!e.customData)return!1;const t=Number(e.customData.httpStatus);return t===429||t===500||t===503||t===504}class Ce{constructor(t,s){this.client=t,this.storage=s}async fetch(t){const s=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(t,s)}async attemptFetch(t,{throttleEndTimeMillis:s,backoffCount:n}){await _e(t.signal,s);try{const i=await this.client.fetch(t);return await this.storage.deleteThrottleMetadata(),i}catch(i){if(!Ie(i))throw i;const a={throttleEndTimeMillis:Date.now()+It(n),backoffCount:n+1};return await this.storage.setThrottleMetadata(a),this.attemptFetch(t,a)}}}/** 392 * @license 393 * Copyright 2019 Google LLC 394 * 395 * Licensed under the Apache License, Version 2.0 (the "License"); 396 * you may not use this file except in compliance with the License. 397 * You may obtain a copy of the License at 398 * 399 * http://www.apache.org/licenses/LICENSE-2.0 400 * 401 * Unless required by applicable law or agreed to in writing, softw
401are 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 be=60*1e3,Ee=12*60*60*1e3;class Ae{constructor(t,s,n,i,a){this.app=t,this._client=s,this._storageCache=n,this._storage=i,this._logger=a,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:be,minimumFetchIntervalMillis:Ee},this.defaultConfig={}}get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}}/** 407 * @license 408 * Copyright 2019 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 */function E(e,t){const s=e.target.error||void 0;return l.create(t,{originalErrorMessage:s&&(s==null?void 0:s.message)})}const w="app_namespace_store",ye="firebase_remote_config",ve=1;function Fe(){return new Promise((e,t)=>{try{const s=indexedDB.open(ye,ve);s.onerror=n=>{t(E(n,"storage-open"))},s.onsuccess=n=>{e(n.target.result)},s.onupgradeneeded=n=>{const i=n.target.result;switch(n.oldVersion){case 0:i.createObjectStore(w,{keyPath:"compositeKey"})}}}catch(s){t(l.create("storage-open",{originalErrorMessage:s==null?void 0:s.message}))}})}class Me{constructor(t,s,n,i=Fe()){this.appId=t,this.appName=s,this.namespace=n,this.openDbPromise=i}getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(t){return this.set("last_fetch_status",t)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(t){return this.set("last_successful_fetch_timestamp_millis",t)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(t){return this.set("last_successful_fetch_response",t)}getActiveConfig(){return this.get("active_config")}setActiveConfig(t){return this.set("active_config",t)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(t){return this.set("active_config_etag",t)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(t){return this.set("throttle_metadata",t)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}async get(t){const s=await this.openDbPromise;return new Promise((n,i)=>{const c=s.transaction([w],"readonly").objectStore(w),u=this.createCompositeKey(t);try{const r=c.get(u);r.onerror=o=>{i(E(o,"storage-get"))},r.onsuccess=o=>{const g=o.target.result;n(g?g.value:void 0)}}catch(r){i(l.create("storage-get",{originalErrorMessage:r==null?void 0:r.message}))}})}async set(t,s){const n=await this.openDbPromise;return new Promise((i,a)=>{const u=n.transaction([w],"readwrite").objectStore(w),r=this.createCompositeKey(t);try{const o=u.put({compositeKey:r,value:s});o.onerror=g=>{a(E(g,"storage-set"))},o.onsuccess=()=>{i()}}catch(o){a(l.create("storage-set",{originalErrorMessage:o==null?void 0:o.message}))}})}async delete(t){const s=await this.openDbPromise;return new Promise((n,i)=>{const c=s.transaction([w],"readwrite").objectStore(w),u=this.createCompositeKey(t);try{const r=c.delete(u);r.onerror=o=>{i(E(o,"storage-delete"))},r.onsuccess=()=>{n()}}catch(r){i(l.create("storage-delete",{originalErrorMessage:r==null?void 0:r.message}))}})}createCompositeKey(t){return[this.appId,this.appName,this.namespace,t].join()}}/** 422 * @license 423 * Copyright 2019 Google LLC 424 * 425 * Licensed under the Apache License, Version 2.0 (the "License");
426 * you may not use this file except in compliance with the License. 427 * You may obtain a copy of the License at 428 * 429 * http://www.apache.org/licenses/LICENSE-2.0 430 * 431 * Unless required by applicable law or agreed to in writing, software 432 * distributed under the License is distributed on an "AS IS" BASIS, 433 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 434 * See the License for the specific language governing permissions and 435 * limitations under the License. 436 */class Re{constructor(t){this.storage=t}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}async loadFromStorage(){const t=this.storage.getLastFetchStatus(),s=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),i=await t;i&&(this.lastFetchStatus=i);const a=await s;a&&(this.lastSuccessfulFetchTimestampMillis=a);const c=await n;c&&(this.activeConfig=c)}setLastFetchStatus(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)}setLastSuccessfulFetchTimestampMillis(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)}setActiveConfig(t){return this.activeConfig=t,this.storage.setActiveConfig(t)}}/** 437 * @license 438 * Copyright 2020 Google LLC 439 * 440 * Licensed under the Apache License, Version 2.0 (the "License"); 441 * you may not use this file except in compliance with the License. 442 * You may obtain a copy of the License at 443 * 444 * http://www.apache.org/licenses/LICENSE-2.0 445 * 446 * Unless required by applicable law or agreed to in writing, software 447 * distributed under the License is distributed on an "AS IS" BASIS, 448 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 449 * See the License for the specific language governing permissions and 450 * limitations under the License. 451 */function Pe(){N(new D(pt,e,"PUBLIC").setMultipleInstances(!0)),A(O,G),A(O,G,"esm2017");function e(t,{instanceIdentifier:s}){const n=t.getProvider("app").getImmediate(),i=t.getProvider("installations-internal").getImmediate();if(typeof window>"u")throw l.create("registration-window");if(!W())throw l.create("indexed-db-unavailable");const{projectId:a,apiKey:c,appId:u}=n.options;if(!a)throw l.create("registration-project-id");if(!c)throw l.create("registration-api-key");if(!u)throw l.create("registration-app-id");s=s||"firebase";const r=new Me(u,n.name,s),o=new Re(r),g=new St(O);g.logLevel=b.ERROR;const m=new Se(i,_t,s,a,c,u),d=new Ce(m,r),R=new we(d,r,o,g),I=new Ae(n,R,o,r,g);return de(I),I}}/** 452 * @license 453 * Copyright 2020 Google LLC 454 * 455 * Licensed under the Apache License, Version 2.0 (the "License"); 456 * you may not use this file except in compliance with the License. 457 * You may obtain a copy of the License at 458 * 459 * http://www.apache.org/licenses/LICENSE-2.0 460 * 461 * Unless required by applicable law or agreed to in writing, software 462 * distributed under the License is distributed on an "AS IS" BASIS, 463 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 464 * See the License for the specific language governing permissions and 465 * limitations under the License. 466 */async function Be(e){return e=h(e),await pe(e),he(e)}async function qe(){if(!W())return!1;try{return await Tt()}catch{return!1}}Pe();export{he as activate,de as ensureInitialized,Be as fetchAndActivate,pe as fetchConfig,Le as getAll,Ne as getBoolean,De as getNumber,Oe as getRemoteConfig,je as getString,M as getValue,qe as isSupported,$e as setLogLevel}; 467//# sourceMappingURL=index.esm-B6wXcInU.js.map
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.