!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(Ct,Ot){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,n=e(Ct);(_t=t=t||{})[_t.DEBUG=0]="DEBUG",_t[_t.VERBOSE=1]="VERBOSE",_t[_t.INFO=2]="INFO",_t[_t.WARN=3]="WARN",_t[_t.ERROR=4]="ERROR",_t[_t.SILENT=5]="SILENT";const a={debug:t.DEBUG,verbose:t.VERBOSE,info:t.INFO,warn:t.WARN,error:t.ERROR,silent:t.SILENT},i=t.INFO,o={[t.DEBUG]:"log",[t.VERBOSE]:"log",[t.INFO]:"info",[t.WARN]:"warn",[t.ERROR]:"error"},s=(e,t,...n)=>{if(!(t<e.logLevel)){var r=(new Date).toISOString(),a=o[t];if(!a)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[a](`[${r}]  ${e.name}:`,...n)}};const c={};function l(e,t){if(n=e,!Array.isArray(n)||!Array.isArray(n.raw)||(n.length!==n.raw.length||!p&&n===n.raw||!(p&&!f||u(n)))||t+1!==e.length)throw new TypeError(`
    ############################## ERROR ##############################

    It looks like you are trying to call a template tag function (fn\`...\`)
    using the normal function syntax (fn(...)), which is not supported.

    The functions in the safevalues library are not designed to be called
    like normal functions, and doing so invalidates the security guarantees
    that safevalues provides.

    If you are stuck and not sure how to proceed, please reach out to us
    instead through:
     - https://github.com/google/safevalues/issues

    ############################## ERROR ##############################`);var n}function u(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function d(e){return-1===e.toString().indexOf("`")}const p=d(e=>e``)||d(e=>e`\0`)||d(e=>e`\n`)||d(e=>e`\u0000`),f=u``&&u`\0`&&u`\n`&&u`\u0000`;let h="google#safe";function g(){var e;return h,null!==(e=function(){if("undefined"!=typeof window)return window.trustedTypes}())&&void 0!==e?e:null}let m;class w{constructor(e,t){!function(e){if("production"!==process.env.NODE_ENV&&e!==c)throw new Error("Bad secret")}(t),this.privateDoNotAccessOrElseWrappedResourceUrl=e}toString(){return this.privateDoNotAccessOrElseWrappedResourceUrl.toString()}}function v(e){var t=e,n=null===(n=function(){var e,t;if(void 0===m)try{m=null!==(t=null===(e=g())||void 0===e?void 0:e.createPolicy(h,{createHTML:e=>e,createScript:e=>e,createScriptURL:e=>e}))&&void 0!==t?t:null}catch(e){m=null}return m}())||void 0===n?void 0:n.createScriptURL(t);return null!=n?n:new w(t,c)}function y(e,...t){if("production"!==process.env.NODE_ENV&&l(e,t.length),0===t.length)return v(e[0]);var n,r=e[0].toLowerCase();if("production"!==process.env.NODE_ENV){if(/^data:/.test(r))throw new Error("Data URLs cannot have expressions in the template literal input.");if(!(function(e){if(/^https:\/\//.test(e)||/^\/\//.test(e)){var t=e.indexOf("//")+2,n=e.indexOf("/",t);if(n<=t)throw new Error("Can't interpolate data in a url's origin, Please make sure to fully specify the origin, terminated with '/'.");n=e.substring(t,n);if(!/^[0-9a-z.:-]+$/i.test(n))throw new Error("The origin contains unsupported characters.");if(!/^[^:]*(:[0-9]+)?$/i.test(n))throw new Error("Invalid port number.");if(!/(^|\.)[a-z][^.]*$/i.test(n))throw new Error("The top-level domain must start with a letter.");return 1}}(r)||function(e){if(/^\//.test(e)){if("/"===e||1<e.length&&"/"!==e[1]&&"\\"!==e[1])return 1;throw new Error("The path start in the url is invalid.")}}(r)||(n=r,new RegExp("^[^:\\s\\\\/]+/").test(n))||function(e){if(/^about:blank/.test(e)){if("about:blank"!==e&&!/^about:blank#/.test(e))throw new Error("The about url is invalid.");return 1}}(r)))throw new Error("Trying to interpolate expressions in an unsupported url format.")}let a=e[0];for(let i=0;i<t.length;i++)a+=encodeURIComponent(t[i])+e[i+1];return v(a)}function I(e){return function(e,t){var n;const r=t.document,a=null===(n=r.querySelector)||void 0===n?void 0:n.call(r,`${e}[nonce]`);if(a)return a.nonce||a.getAttribute("nonce")||"";return""}("script",e)}function b(e,t,n){var r;e.src=function(e){var t;if(null!==(t=g())&&void 0!==t&&t.isScriptURL(e))return e;if(e instanceof w)return e.privateDoNotAccessOrElseWrappedResourceUrl;{let e="";throw"production"!==process.env.NODE_ENV&&(e="Unexpected type when unwrapping TrustedResourceUrl"),new Error(e)}}(t),null!=n&&n.omitNonce||(r=I((e=e).ownerDocument&&e.ownerDocument.defaultView||window))&&e.setAttribute("nonce",r)}function E(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function _(){try{return"object"==typeof indexedDB}catch(e){return}}function T(){return new Promise((t,n)=>{try{let e=!0;const r="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(r);a.onsuccess=()=>{a.result.close(),e||self.indexedDB.deleteDatabase(r),t(!0)},a.onupgradeneeded=()=>{e=!1},a.onerror=()=>{var e;n((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){n(e)}})}function S(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class D extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,D.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,C.prototype.create)}}class C{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var r,n=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],i=i?(r=n,i.replace(O,(e,t)=>{var n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${a}).`;return new D(a,i,n)}}const O=/\{\$([^}]+)}/g,N=1e3,L=2,A=144e5,R=.5;function P(e,t=N,n=L){var r=t*Math.pow(n,e),a=Math.round(R*r*(Math.random()-.5)*2);return Math.min(A,r+a)}function k(e){return e&&e._delegate?e._delegate:e}class j{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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}}const M=(t,e)=>e.some(e=>t instanceof e);let $,x;const B=new WeakMap,F=new WeakMap,H=new WeakMap,V=new WeakMap,U=new WeakMap;let q={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return F.get(e);if("objectStoreNames"===t)return e.objectStoreNames||H.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return z(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function W(r){return r!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x=x||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(r)?function(...e){return r.apply(K(this),e),z(B.get(this))}:function(...e){return z(r.apply(K(this),e))}:function(e,...t){var n=r.call(K(this),e,...t);return H.set(n,e.sort?e.sort():[e]),z(n)}}function G(e){return"function"==typeof e?W(e):(e instanceof IDBTransaction&&(i=e,F.has(i)||(t=new Promise((e,t)=>{const n=()=>{i.removeEventListener("complete",r),i.removeEventListener("error",a),i.removeEventListener("abort",a)},r=()=>{e(),n()},a=()=>{t(i.error||new DOMException("AbortError","AbortError")),n()};i.addEventListener("complete",r),i.addEventListener("error",a),i.addEventListener("abort",a)}),F.set(i,t))),M(e,$=$||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,q):e);var i,t}function z(e){if(e instanceof IDBRequest)return function(i){const e=new Promise((e,t)=>{const n=()=>{i.removeEventListener("success",r),i.removeEventListener("error",a)},r=()=>{e(z(i.result)),n()},a=()=>{t(i.error),n()};i.addEventListener("success",r),i.addEventListener("error",a)});return e.then(e=>{e instanceof IDBCursor&&B.set(e,i)}).catch(()=>{}),U.set(e,i),e}(e);if(V.has(e))return V.get(e);var t=G(e);return t!==e&&(V.set(e,t),U.set(t,e)),t}const K=e=>U.get(e);const J=["get","getKey","getAll","getAllKeys","count"],Y=["put","add","delete","clear"],X=new Map;function Z(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(X.get(t))return X.get(t);const a=t.replace(/FromIndex$/,""),i=t!==a,o=Y.includes(a);if(a in(i?IDBIndex:IDBObjectStore).prototype&&(o||J.includes(a))){var n=async function(e,...t){var n=this.transaction(e,o?"readwrite":"readonly");let r=n.store;return i&&(r=r.index(t.shift())),(await Promise.all([r[a](...t),o&&n.done]))[0]};return X.set(t,n),n}}}q={...r=q,get:(e,t,n)=>Z(e,t)||r.get(e,t,n),has:(e,t)=>!!Z(e,t)||r.has(e,t)};var Q="@firebase/installations",ee="0.6.8-canary.fd8bd4b02";const te=1e4,ne=`w:${ee}`,re="FIS_v2",ae="https://firebaseinstallations.googleapis.com/v1",ie=36e5;const oe=new C("installations","Installations",{"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."});function se(e){return e instanceof D&&e.code.includes("request-failed")}function ce({projectId:e}){return`${ae}/projects/${e}/installations`}function le(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function ue(e,t){var n=(await t.json()).error;return oe.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function de({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function pe(e,{refreshToken:t}){const n=de(e);return n.append("Authorization",(t=t,`${re} ${t}`)),n}async function fe(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function he(t){return new Promise(e=>{setTimeout(e,t)})}const ge=/^[cdef][\w-]{21}$/,me="";function we(){try{const t=new Uint8Array(17),n=self.crypto||self.msCrypto;n.getRandomValues(t),t[0]=112+t[0]%16;var e=function(e){const t=function(e){const t=btoa(String.fromCharCode(...e));return t.replace(/\+/g,"-").replace(/\//g,"_")}(e);return t.substr(0,22)}(t);return ge.test(e)?e:me}catch(e){return me}}function ve(e){return`${e.appName}!${e.appId}`}const ye=new Map;function Ie(e,t){var n=ve(e);be(n,t),function(e,t){const n=function(){!Ee&&"BroadcastChannel"in self&&(Ee=new BroadcastChannel("[Firebase] FID Change"),Ee.onmessage=e=>{be(e.data.key,e.data.fid)});return Ee}();n&&n.postMessage({key:e,fid:t});0===ye.size&&Ee&&(Ee.close(),Ee=null)}(n,t)}function be(e,t){var n=ye.get(e);if(n)for(const r of n)r(t)}let Ee=null;const _e="firebase-installations-store";let Te=null;function Se(){return Te=Te||function(e,t,{blocked:n,upgrade:r,blocking:a,terminated:i}){const o=indexedDB.open(e,t),s=z(o);return r&&o.addEventListener("upgradeneeded",e=>{r(z(o.result),e.oldVersion,e.newVersion,z(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{i&&e.addEventListener("close",()=>i()),a&&e.addEventListener("versionchange",e=>a(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(_e)}}),Te}async function De(e,t){var n=ve(e);const r=await Se(),a=r.transaction(_e,"readwrite"),i=a.objectStore(_e);var o=await i.get(n);return await i.put(t,n),await a.done,o&&o.fid===t.fid||Ie(e,t.fid),t}async function Ce(e){var t=ve(e);const n=await Se(),r=n.transaction(_e,"readwrite");await r.objectStore(_e).delete(t),await r.done}async function Oe(e,t){var n=ve(e);const r=await Se(),a=r.transaction(_e,"readwrite"),i=a.objectStore(_e);var o=await i.get(n),s=t(o);return void 0===s?await i.delete(n):await i.put(s,n),await a.done,!s||o&&o.fid===s.fid||Ie(e,s.fid),s}async function Ne(n){let r;var e=await Oe(n.appConfig,e=>{var t=Ae(e||{fid:we(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await Le(e.appConfig);for(;1===t.registrationStatus;)await he(100),t=await Le(e.appConfig);if(0!==t.registrationStatus)return t;{var{installationEntry:n,registrationPromise:r}=await Ne(e);return r||n}}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(oe.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(t,n){try{var e=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=ce(e),a=de(e),i=t.getImmediate({optional:!0});!i||(o=await i.getHeartbeatsHeader())&&a.append("x-firebase-client",o);var o={fid:n,authVersion:re,appId:e.appId,sdkVersion:ne};const s={method:"POST",headers:a,body:JSON.stringify(o)},c=await fe(()=>fetch(r,s));if(c.ok){o=await c.json();return{fid:o.fid||n,registrationStatus:2,refreshToken:o.refreshToken,authToken:le(o.authToken)}}throw await ue("Create Installation",c)}(t,n);return De(t.appConfig,e)}catch(e){throw se(e)&&409===e.customData.serverCode?await Ce(t.appConfig):await De(t.appConfig,{fid:n.fid,registrationStatus:0}),e}}(e,r);return{installationEntry:r,registrationPromise:n}}}(n,t);return r=t.registrationPromise,t.installationEntry});return e.fid===me?{installationEntry:await r}:{installationEntry:e,registrationPromise:r}}function Le(e){return Oe(e,e=>{if(!e)throw oe.create("installation-not-found");return Ae(e)})}function Ae(e){return 1===(t=e).registrationStatus&&t.registrationTime+te<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function Re({appConfig:e,heartbeatServiceProvider:t},n){const r=([a,i]=[e,n["fid"]],`${ce(a)}/${i}/authTokens:generate`);var a,i;const o=pe(e,n),s=t.getImmediate({optional:!0});!s||(c=await s.getHeartbeatsHeader())&&o.append("x-firebase-client",c);var c={installation:{sdkVersion:ne,appId:e.appId}};const l={method:"POST",headers:o,body:JSON.stringify(c)},u=await fe(()=>fetch(r,l));if(u.ok)return le(await u.json());throw await ue("Generate Auth Token",u)}async function Pe(r,a=!1){let i;var e=await Oe(r.appConfig,e=>{if(!je(e))throw oe.create("not-registered");var t,n=e.authToken;if(a||2!==(t=n).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+ie}(t)){if(1===n.requestStatus)return i=async function(e,t){let n=await ke(e.appConfig);for(;1===n.authToken.requestStatus;)await he(100),n=await ke(e.appConfig);var r=n.authToken;return 0===r.requestStatus?Pe(e,t):r}(r,a),e;if(!navigator.onLine)throw oe.create("app-offline");n=(t=e,n={requestStatus:1,requestTime:Date.now()},Object.assign(Object.assign({},t),{authToken:n}));return i=async function(t,n){try{var r=await Re(t,n),e=Object.assign(Object.assign({},n),{authToken:r});return await De(t.appConfig,e),r}catch(e){throw!se(e)||401!==e.customData.serverCode&&404!==e.customData.serverCode?(r=Object.assign(Object.assign({},n),{authToken:{requestStatus:0}}),await De(t.appConfig,r)):await Ce(t.appConfig),e}}(r,n),n}return e});return i?await i:e.authToken}function ke(e){return Oe(e,e=>{if(!je(e))throw oe.create("not-registered");var t,n=e.authToken;return 1===(t=n).requestStatus&&t.requestTime+te<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}function je(e){return void 0!==e&&2===e.registrationStatus}async function Me(e,t=!1){var n,r=e;return await((n=(await Ne(r)).registrationPromise)&&await n),(await Pe(r,t)).token}function $e(e){return oe.create("missing-app-config-values",{valueName:e})}const xe="installations",Be=e=>{var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){if(!e||!e.options)throw $e("App Configuration");if(!e.name)throw $e("App Name");for(const t of["projectId","apiKey","appId"])if(!e.options[t])throw $e(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Ot._getProvider(t,"heartbeat"),_delete:()=>Promise.resolve()}},Fe=e=>{var t=e.getProvider("app").getImmediate();const n=Ot._getProvider(t,xe).getImmediate();return{getId:()=>async function(e){var t=e;const{installationEntry:n,registrationPromise:r}=await Ne(t);return(r||Pe(t)).catch(console.error),n.fid}(n),getToken:e=>Me(n,e)}};Ot._registerComponent(new j(xe,Be,"PUBLIC")),Ot._registerComponent(new j("installations-internal",Fe,"PRIVATE")),Ot.registerVersion(Q,ee),Ot.registerVersion(Q,ee,"esm2017");const He="analytics",Ve="firebase_id",Ue="origin",qe="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",We=new class{constructor(e){this.name=e,this._logLevel=i,this._logHandler=s,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?a[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)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,t.DEBUG,...e),this._logHandler(this,t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,t.VERBOSE,...e),this._logHandler(this,t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,t.INFO,...e),this._logHandler(this,t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,t.WARN,...e),this._logHandler(this,t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,t.ERROR,...e),this._logHandler(this,t.ERROR,...e)}}("@firebase/analytics");function Ge(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function ze(p,f,h,g){return async function(e,...t){try{var n,r,a,i,o,s,c,l,u,d;"event"===e?([n,r]=t,await async function(e,n,r,a,i){try{let t=[];if(i&&i.send_to){let e=i.send_to;Array.isArray(e)||(e=[e]);const c=await Ge(r);for(const l of e){var o=c.find(e=>e.measurementId===l),s=o&&n[o.appId];if(!s){t=[];break}t.push(s)}}0===t.length&&(t=Object.values(n)),await Promise.all(t),e("event",a,i||{})}catch(e){We.error(e)}}(p,f,h,n,r)):"config"===e?([a,i]=t,await async function(e,t,n,r,a,i){var o=r[a];try{if(o)await t[o];else{const c=await Ge(n);var s=c.find(e=>e.measurementId===a);s&&await t[s.appId]}}catch(e){We.error(e)}e("config",a,i)}(p,f,h,g,a,i)):"consent"===e?([o,s]=t,p("consent",o,s)):"get"===e?([c,l,u]=t,p("get",c,l,u)):"set"===e?([d]=t,p("set",d)):p(e,...t)}catch(e){We.error(e)}}}const Ke=new C("analytics","Analytics",{"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-intialized 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}."}),Je=30;const Ye=new class{constructor(e={},t=1e3){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]}};async function Xe(e){var t,{appId:n,apiKey:r}=e,r={method:"GET",headers:new Headers({Accept:"application/json","x-goog-api-key":r})},n=qe.replace("{app-id}",n);const a=await fetch(n,r);if(200===a.status||304===a.status)return a.json();{let e="";try{var i=await a.json();null!==(t=i.error)&&void 0!==t&&t.message&&(e=i.error.message)}catch(e){}throw Ke.create("config-fetch-failed",{httpStatus:a.status,responseMessage:e})}}async function Ze(e,t=Ye,n){var{appId:r,apiKey:a,measurementId:i}=e.options;if(!r)throw Ke.create("no-app-id");if(!a){if(i)return{measurementId:i,appId:r};throw Ke.create("no-api-key")}var o=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()};const s=new tt;return setTimeout(async()=>{s.abort()},void 0!==n?n:6e4),async function t(n,{throttleEndTimeMillis:e,backoffCount:r},a,i=Ye){var o;const{appId:s,measurementId:c}=n;try{await Qe(a,e)}catch(e){if(c)return We.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. [${null==e?void 0:e.message}]`),{appId:s,measurementId:c};throw e}try{const l=await Xe(n);return i.deleteThrottleMetadata(s),l}catch(e){const u=e;if(!et(u)){if(i.deleteThrottleMetadata(s),c)return We.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. [${null===u||void 0===u?void 0:u.message}]`),{appId:s,measurementId:c};throw e}const d=503===Number(null===(o=null===u||void 0===u?void 0:u.customData)||void 0===o?void 0:o.httpStatus)?P(r,i.intervalMillis,Je):P(r,i.intervalMillis),p={throttleEndTimeMillis:Date.now()+d,backoffCount:r+1};return i.setThrottleMetadata(s,p),We.debug(`Calling attemptFetch again in ${d} millis`),t(n,p,a,i)}}({appId:r,apiKey:a,measurementId:i},o,s,t)}function Qe(a,i){return new Promise((e,t)=>{var n=Math.max(i-Date.now(),0);const r=setTimeout(e,n);a.addEventListener(()=>{clearTimeout(r),t(Ke.create("fetch-throttle",{throttleEndTimeMillis:i}))})})}function et(e){if(!(e instanceof D&&e.customData))return!1;var t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}class tt{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function nt(t,e,n,r,a,i,o){const s=Ze(t);s.then(e=>{n[e.measurementId]=e.appId,t.options.measurementId&&e.measurementId!==t.options.measurementId&&We.warn(`The measurement ID in the local Firebase config (${t.options.measurementId})`+` does not match the measurement ID fetched from the server (${e.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(e=>We.error(e)),e.push(s);var c=async function(){if(!_())return We.warn(Ke.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await T()}catch(e){return We.warn(Ke.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then(e=>{if(e)return r.getId()}),[l,u]=await Promise.all([s,c]);!function(e){var t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes("https://www.googletagmanager.com/gtag/js")&&n.src.includes(e))return n}(i)&&function(e,t){const n=document.createElement("script");var r=y`https://www.googletagmanager.com/gtag/js?l=${e}&id=${t}`;b(n,r),n.async=!0,document.head.appendChild(n)}(i,l.measurementId),a("js",new Date);const d=null!==(c=null==o?void 0:o.config)&&void 0!==c?c:{};return d[Ue]="firebase",d.update=!0,null!=u&&(d[Ve]=u),a("config",l.measurementId,d),l.measurementId}class rt{constructor(e){this.app=e}_delete(){return delete at[this.app.options.appId],Promise.resolve()}}let at={},it=[];const ot={};let st="dataLayer",ct="gtag",lt,ut,dt=!1;function pt(e){if(dt)throw Ke.create("already-initialized");e.dataLayerName&&(st=e.dataLayerName),e.gtagName&&(ct=e.gtagName)}function ft(e,t,n){!function(){const e=[];var t;E()&&e.push("This is a browser extension environment."),S()||e.push("Cookies are not available."),0<e.length&&(t=e.map((e,t)=>`(${t+1}) ${e}`).join(" "),t=Ke.create("invalid-analytics-context",{errorInfo:t}),We.warn(t.message))}();var r,a,i=e.options.appId;if(!i)throw Ke.create("no-app-id");if(!e.options.apiKey){if(!e.options.measurementId)throw Ke.create("no-api-key");We.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 ${e.options.measurementId}`+' provided in the "measurementId" field in the local Firebase config.')}if(null!=at[i])throw Ke.create("already-exists",{id:i});return dt||(function(e){let t=[];Array.isArray(window[e])?t=window[e]:window[e]=t,t}(st),{wrappedGtag:r,gtagCore:a}=function(e,t,n,r,a){let i=function(){window[r].push(arguments)};return window[a]&&"function"==typeof window[a]&&(i=window[a]),window[a]=ze(i,e,t,n),{gtagCore:i,wrappedGtag:window[a]}}(at,it,ot,st,ct),ut=r,lt=a,dt=!0),at[i]=nt(e,it,ot,t,lt,st,n),new rt(e)}async function ht(){if(E())return!1;if(!S())return!1;if(!_())return!1;try{return await T()}catch(e){return!1}}function gt(e,t,n){e=k(e),async function(e,t,n,r){if(r&&r.global)return e("set",{screen_name:n}),Promise.resolve();e("config",await t,{update:!0,screen_name:n})}(ut,at[e.app.options.appId],t,n).catch(e=>We.error(e))}function mt(e,t,n){e=k(e),async function(e,t,n,r){if(r&&r.global)return e("set",{user_id:n}),Promise.resolve();e("config",await t,{update:!0,user_id:n})}(ut,at[e.app.options.appId],t,n).catch(e=>We.error(e))}function wt(e,t,n){e=k(e),async function(e,t,n,r){if(r&&r.global){const a={};for(const i of Object.keys(n))a[`user_properties.${i}`]=n[i];return e("set",a),Promise.resolve()}e("config",await t,{update:!0,user_properties:n})}(ut,at[e.app.options.appId],t,n).catch(e=>We.error(e))}function vt(e,t){e=k(e),async function(e,t){var n=await e;window[`ga-disable-${n}`]=!t}(at[e.app.options.appId],t).catch(e=>We.error(e))}function yt(e,t,n,r){e=k(e),async function(e,t,n,r,a){var i;a&&a.global?e("event",n,r):(i=await t,e("event",n,Object.assign(Object.assign({},r),{send_to:i})))}(ut,at[e.app.options.appId],t,n,r).catch(e=>We.error(e))}const It="@firebase/analytics",bt="0.10.5-canary.fd8bd4b02";Ot._registerComponent(new j(He,(e,{options:t})=>{return ft(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),t)},"PUBLIC")),Ot._registerComponent(new j("analytics-internal",function(e){try{const r=e.getProvider(He).getImmediate();return{logEvent:(e,t,n)=>yt(r,e,t,n)}}catch(e){throw Ke.create("interop-component-reg-failed",{reason:e})}},"PRIVATE")),Ot.registerVersion(It,bt),Ot.registerVersion(It,bt,"esm2017");var Et,_t,Tt;class St{constructor(e,t){this.app=e,this._delegate=t}logEvent(e,t,n){yt(this._delegate,e,t,n)}setCurrentScreen(e,t){gt(this._delegate,e,t)}setUserId(e,t){mt(this._delegate,e,t)}setUserProperties(e,t){wt(this._delegate,e,t)}setAnalyticsCollectionEnabled(e){vt(this._delegate,e)}}(_t=Et=Et||{}).ADD_SHIPPING_INFO="add_shipping_info",_t.ADD_PAYMENT_INFO="add_payment_info",_t.ADD_TO_CART="add_to_cart",_t.ADD_TO_WISHLIST="add_to_wishlist",_t.BEGIN_CHECKOUT="begin_checkout",_t.CHECKOUT_PROGRESS="checkout_progress",_t.EXCEPTION="exception",_t.GENERATE_LEAD="generate_lead",_t.LOGIN="login",_t.PAGE_VIEW="page_view",_t.PURCHASE="purchase",_t.REFUND="refund",_t.REMOVE_FROM_CART="remove_from_cart",_t.SCREEN_VIEW="screen_view",_t.SEARCH="search",_t.SELECT_CONTENT="select_content",_t.SELECT_ITEM="select_item",_t.SELECT_PROMOTION="select_promotion",_t.SET_CHECKOUT_OPTION="set_checkout_option",_t.SHARE="share",_t.SIGN_UP="sign_up",_t.TIMING_COMPLETE="timing_complete",_t.VIEW_CART="view_cart",_t.VIEW_ITEM="view_item",_t.VIEW_ITEM_LIST="view_item_list",_t.VIEW_PROMOTION="view_promotion",_t.VIEW_SEARCH_RESULTS="view_search_results";const Dt=e=>{var t=e.getProvider("app-compat").getImmediate(),n=e.getProvider("analytics").getImmediate();return new St(t,n)};Tt={Analytics:St,settings:pt,isSupported:ht,EventName:Et},n.default.INTERNAL.registerComponent(new j("analytics-compat",Dt,"PUBLIC").setServiceProps(Tt).setMultipleInstances(!0)),n.default.registerVersion("@firebase/analytics-compat","0.2.11-canary.fd8bd4b02")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-analytics-compat.js - be sure to load firebase-app.js first.")}});
//# sourceMappingURL=firebase-analytics-compat.js.map
