firebase 9.12.1 → 9.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/app/dist/index.cjs.js +1 -1
  3. package/app/dist/index.esm.js +1 -1
  4. package/app/dist/index.mjs +1 -1
  5. package/compat/app/dist/index.cjs.js +1 -1
  6. package/compat/app/dist/index.esm.js +1 -1
  7. package/compat/app/dist/index.mjs +1 -1
  8. package/compat/dist/index.esm.js +2 -2
  9. package/compat/dist/index.node.cjs +2 -2
  10. package/compat/dist/index.rn.cjs.js +2 -2
  11. package/firebase-analytics-compat.js +1 -1
  12. package/firebase-analytics.js +1 -1
  13. package/firebase-app-check-compat.js +1 -1
  14. package/firebase-app-check.js +1 -1
  15. package/firebase-app-compat.js +2 -2
  16. package/firebase-app.js +5 -5
  17. package/firebase-auth-compat.js +1 -1
  18. package/firebase-auth-cordova.js +1 -1
  19. package/firebase-auth-react-native.js +1 -1
  20. package/firebase-auth.js +1 -1
  21. package/firebase-compat.js +3 -3
  22. package/firebase-compat.js.map +1 -1
  23. package/firebase-database-compat.js +1 -1
  24. package/firebase-database-compat.js.map +1 -1
  25. package/firebase-database.js +1 -1
  26. package/firebase-database.js.map +1 -1
  27. package/firebase-firestore-compat.js +1 -1
  28. package/firebase-firestore-compat.js.map +1 -1
  29. package/firebase-firestore-lite.js +1 -1
  30. package/firebase-firestore-lite.js.map +1 -1
  31. package/firebase-firestore.js +1 -1
  32. package/firebase-firestore.js.map +1 -1
  33. package/firebase-functions-compat.js +1 -1
  34. package/firebase-functions.js +1 -1
  35. package/firebase-installations-compat.js +1 -1
  36. package/firebase-installations.js +1 -1
  37. package/firebase-messaging-compat.js +1 -1
  38. package/firebase-messaging-compat.js.map +1 -1
  39. package/firebase-messaging-sw.js +1 -1
  40. package/firebase-messaging-sw.js.map +1 -1
  41. package/firebase-messaging.js +1 -1
  42. package/firebase-messaging.js.map +1 -1
  43. package/firebase-performance-compat.js +1 -1
  44. package/firebase-performance-standalone-compat.es2017.js +7 -7
  45. package/firebase-performance-standalone-compat.js +1 -1
  46. package/firebase-performance.js +1 -1
  47. package/firebase-remote-config-compat.js +1 -1
  48. package/firebase-remote-config.js +1 -1
  49. package/firebase-storage-compat.js +1 -1
  50. package/firebase-storage-compat.js.map +1 -1
  51. package/firebase-storage.js +1 -1
  52. package/firebase-storage.js.map +1 -1
  53. package/package.json +28 -28
@@ -1,2 +1,2 @@
1
- !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(Ve,Ke){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u,t,a,r=e(Ve);function g(){return"object"==typeof indexedDB}class c extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,i.prototype.create)}}class i{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var a,r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],s=s?(a=r,s.replace(n,(e,t)=>{var r=a[t];return null!=r?String(r):`<${t}?>`})):"Error",s=`${this.serviceName}: ${s} (${i}).`;return new c(i,s,r)}}const n=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class o{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}}(t=u=u||{})[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 l={debug:u.DEBUG,verbose:u.VERBOSE,info:u.INFO,warn:u.WARN,error:u.ERROR,silent:u.SILENT},h=u.INFO,d={[u.DEBUG]:"log",[u.VERBOSE]:"log",[u.INFO]:"info",[u.WARN]:"warn",[u.ERROR]:"error"},f=(e,t,...r)=>{if(!(t<e.logLevel)){var a=(new Date).toISOString(),i=d[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${a}] ${e.name}:`,...r)}};class p{constructor(e){this.name=e,this._logLevel=h,this._logHandler=f,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in u))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?l[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,u.DEBUG,...e),this._logHandler(this,u.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,u.VERBOSE,...e),this._logHandler(this,u.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,u.INFO,...e),this._logHandler(this,u.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,u.WARN,...e),this._logHandler(this,u.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,u.ERROR,...e),this._logHandler(this,u.ERROR,...e)}}const m=(t,e)=>e.some(e=>t instanceof e);let v,w;const _=new WeakMap,y=new WeakMap,b=new WeakMap,S=new WeakMap,E=new WeakMap;let C={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return y.get(e);if("objectStoreNames"===t)return e.objectStoreNames||b.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return L(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function I(a){return a!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(w=w||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(a)?function(...e){return a.apply(M(this),e),L(_.get(this))}:function(...e){return L(a.apply(M(this),e))}:function(e,...t){var r=a.call(M(this),e,...t);return b.set(r,e.sort?e.sort():[e]),L(r)}}function T(e){return"function"==typeof e?I(e):(e instanceof IDBTransaction&&(s=e,y.has(s)||(t=new Promise((e,t)=>{const r=()=>{s.removeEventListener("complete",a),s.removeEventListener("error",i),s.removeEventListener("abort",i)},a=()=>{e(),r()},i=()=>{t(s.error||new DOMException("AbortError","AbortError")),r()};s.addEventListener("complete",a),s.addEventListener("error",i),s.addEventListener("abort",i)}),y.set(s,t))),m(e,v=v||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,C):e);var s,t}function L(e){if(e instanceof IDBRequest)return function(s){const e=new Promise((e,t)=>{const r=()=>{s.removeEventListener("success",a),s.removeEventListener("error",i)},a=()=>{e(L(s.result)),r()},i=()=>{t(s.error),r()};s.addEventListener("success",a),s.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&_.set(e,s)}).catch(()=>{}),E.set(e,s),e}(e);if(S.has(e))return S.get(e);var t=T(e);return t!==e&&(S.set(e,t),E.set(t,e)),t}const M=e=>E.get(e);const D=["get","getKey","getAll","getAllKeys","count"],F=["put","add","delete","clear"],P=new Map;function k(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(P.get(t))return P.get(t);const i=t.replace(/FromIndex$/,""),s=t!==i,n=F.includes(i);if(i in(s?IDBIndex:IDBObjectStore).prototype&&(n||D.includes(i))){var r=async function(e,...t){var r=this.transaction(e,n?"readwrite":"readonly");let a=r.store;return s&&(a=a.index(t.shift())),(await Promise.all([a[i](...t),n&&r.done]))[0]};return P.set(t,r),r}}}C={...a=C,get:(e,t,r)=>k(e,t)||a.get(e,t,r),has:(e,t)=>!!k(e,t)||a.has(e,t)};var O="@firebase/installations",N="0.5.15";const j=1e4,A=`w:${N}`,R="FIS_v2",B="https://firebaseinstallations.googleapis.com/v1",$=36e5;var H;const x=new i("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 q(e){return e instanceof c&&e.code.includes("request-failed")}function V({projectId:e}){return`${B}/projects/${e}/installations`}function K(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function U(e,t){var r=(await t.json()).error;return x.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function z({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function G(e,{refreshToken:t}){const r=z(e);return r.append("Authorization",(t=t,`${R} ${t}`)),r}async function W(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function J(t){return new Promise(e=>{setTimeout(e,t)})}const Y=/^[cdef][\w-]{21}$/,Z="";function Q(){try{const t=new Uint8Array(17),r=self.crypto||self.msCrypto;r.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 Y.test(e)?e:Z}catch(e){return Z}}function X(e){return`${e.appName}!${e.appId}`}const ee=new Map;function te(e,t){var r=X(e);re(r,t),function(e,t){const r=function(){!ae&&"BroadcastChannel"in self&&(ae=new BroadcastChannel("[Firebase] FID Change"),ae.onmessage=e=>{re(e.data.key,e.data.fid)});return ae}();r&&r.postMessage({key:e,fid:t});0===ee.size&&ae&&(ae.close(),ae=null)}(r,t)}function re(e,t){var r=ee.get(e);if(r)for(const a of r)a(t)}let ae=null;const ie="firebase-installations-store";let se=null;function ne(){return se=se||function(e,t,{blocked:r,upgrade:a,blocking:i,terminated:s}){const n=indexedDB.open(e,t),o=L(n);return a&&n.addEventListener("upgradeneeded",e=>{a(L(n.result),e.oldVersion,e.newVersion,L(n.transaction))}),r&&n.addEventListener("blocked",()=>r()),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),o}("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(ie)}}),se}async function oe(e,t){var r=X(e);const a=await ne(),i=a.transaction(ie,"readwrite"),s=i.objectStore(ie);var n=await s.get(r);return await s.put(t,r),await i.done,n&&n.fid===t.fid||te(e,t.fid),t}async function ce(e){var t=X(e);const r=await ne(),a=r.transaction(ie,"readwrite");await a.objectStore(ie).delete(t),await a.done}async function le(e,t){var r=X(e);const a=await ne(),i=a.transaction(ie,"readwrite"),s=i.objectStore(ie);var n=await s.get(r),o=t(n);return void 0===o?await s.delete(r):await s.put(o,r),await i.done,!o||n&&n.fid===o.fid||te(e,o.fid),o}async function ue(r){let a;var e=await le(r.appConfig,e=>{var t=he(e||{fid:Q(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await ge(e.appConfig);for(;1===t.registrationStatus;)await J(100),t=await ge(e.appConfig);if(0!==t.registrationStatus)return t;{var{installationEntry:r,registrationPromise:a}=await ue(e);return a||r}}(e)}:{installationEntry:t};if(!navigator.onLine){var r=Promise.reject(x.create("app-offline"));return{installationEntry:t,registrationPromise:r}}var a={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,r){try{var e=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:r}){const a=V(e),i=z(e),s=t.getImmediate({optional:!0});!s||(n=await s.getHeartbeatsHeader())&&i.append("x-firebase-client",n);var n={fid:r,authVersion:R,appId:e.appId,sdkVersion:A};const o={method:"POST",headers:i,body:JSON.stringify(n)},c=await W(()=>fetch(a,o));if(c.ok){n=await c.json();return{fid:n.fid||r,registrationStatus:2,refreshToken:n.refreshToken,authToken:K(n.authToken)}}throw await U("Create Installation",c)}(t,r);return oe(t.appConfig,e)}catch(e){throw q(e)&&409===e.customData.serverCode?await ce(t.appConfig):await oe(t.appConfig,{fid:r.fid,registrationStatus:0}),e}}(e,a);return{installationEntry:a,registrationPromise:r}}}(r,t);return a=t.registrationPromise,t.installationEntry});return e.fid===Z?{installationEntry:await a}:{installationEntry:e,registrationPromise:a}}function ge(e){return le(e,e=>{if(!e)throw x.create("installation-not-found");return he(e)})}function he(e){return 1===(t=e).registrationStatus&&t.registrationTime+j<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function de({appConfig:e,heartbeatServiceProvider:t},r){const a=([i,s]=[e,r["fid"]],`${V(i)}/${s}/authTokens:generate`);var i,s;const n=G(e,r),o=t.getImmediate({optional:!0});!o||(c=await o.getHeartbeatsHeader())&&n.append("x-firebase-client",c);var c={installation:{sdkVersion:A,appId:e.appId}};const l={method:"POST",headers:n,body:JSON.stringify(c)},u=await W(()=>fetch(a,l));if(u.ok)return K(await u.json());throw await U("Generate Auth Token",u)}async function fe(a,i=!1){let s;var e=await le(a.appConfig,e=>{if(!me(e))throw x.create("not-registered");var t,r=e.authToken;if(i||2!==(t=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+$}(t)){if(1===r.requestStatus)return s=async function(e,t){let r=await pe(e.appConfig);for(;1===r.authToken.requestStatus;)await J(100),r=await pe(e.appConfig);var a=r.authToken;return 0===a.requestStatus?fe(e,t):a}(a,i),e;if(!navigator.onLine)throw x.create("app-offline");r=(t=e,r={requestStatus:1,requestTime:Date.now()},Object.assign(Object.assign({},t),{authToken:r}));return s=async function(t,r){try{var a=await de(t,r),e=Object.assign(Object.assign({},r),{authToken:a});return await oe(t.appConfig,e),a}catch(e){throw!q(e)||401!==e.customData.serverCode&&404!==e.customData.serverCode?(a=Object.assign(Object.assign({},r),{authToken:{requestStatus:0}}),await oe(t.appConfig,a)):await ce(t.appConfig),e}}(a,r),r}return e});return s?await s:e.authToken}function pe(e){return le(e,e=>{if(!me(e))throw x.create("not-registered");var t,r=e.authToken;return 1===(t=r).requestStatus&&t.requestTime+j<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}function me(e){return void 0!==e&&2===e.registrationStatus}async function ve(e,t=!1){var r,a=e;return await((r=(await ue(a)).registrationPromise)&&await r),(await fe(a,t)).token}function we(e){return x.create("missing-app-config-values",{valueName:e})}const _e="installations",ye=e=>{var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){if(!e||!e.options)throw we("App Configuration");if(!e.name)throw we("App Name");for(const t of["projectId","apiKey","appId"])if(!e.options[t])throw we(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Ke._getProvider(t,"heartbeat"),_delete:()=>Promise.resolve()}},be=e=>{var t=e.getProvider("app").getImmediate();const r=Ke._getProvider(t,_e).getImmediate();return{getId:()=>async function(e){var t=e;const{installationEntry:r,registrationPromise:a}=await ue(t);return(a||fe(t)).catch(console.error),r.fid}(r),getToken:e=>ve(r,e)}};Ke._registerComponent(new o(_e,ye,"PUBLIC")),Ke._registerComponent(new o("installations-internal",be,"PRIVATE")),Ke.registerVersion(O,N),Ke.registerVersion(O,N,"esm2017");const Se="@firebase/remote-config";class Ee{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}const Ce=new i("remoteconfig","Remote Config",{"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"});const Ie=["1","true","t","yes","y","on"];class Te{constructor(e,t=""){this._source=e,this._value=t}asString(){return this._value}asBoolean(){return"static"!==this._source&&0<=Ie.indexOf(this._value.toLowerCase())}asNumber(){if("static"===this._source)return 0;let e=Number(this._value);return isNaN(e)&&(e=0),e}getSource(){return this._source}}async function Le(e){const t=s(e);var[r,a]=await Promise.all([t._storage.getLastSuccessfulFetchResponse(),t._storage.getActiveConfigEtag()]);return!!(r&&r.config&&r.eTag&&r.eTag!==a)&&(await Promise.all([t._storageCache.setActiveConfig(r.config),t._storage.setActiveConfigEtag(r.eTag)]),!0)}function Me(e){const t=s(e);return t._initializePromise||(t._initializePromise=t._storageCache.loadFromStorage().then(()=>{t._isInitializationComplete=!0})),t._initializePromise}async function De(t){const r=s(t),e=new Ee;setTimeout(async()=>{e.abort()},r.settings.fetchTimeoutMillis);try{await r._client.fetch({cacheMaxAgeMillis:r.settings.minimumFetchIntervalMillis,signal:e}),await r._storageCache.setLastFetchStatus("success")}catch(e){var a=(i="fetch-throttle",(t=e)instanceof c&&-1!==t.code.indexOf(i)?"throttle":"failure");throw await r._storageCache.setLastFetchStatus(a),e}var i}function Fe(r){const e=s(r);return[t={},a={}]=[e._storageCache.getActiveConfig(),e.defaultConfig],Object.keys(Object.assign(Object.assign({},t),a)).reduce((e,t)=>(e[t]=Pe(r,t),e),{});var t,a}function Pe(e,t){const r=s(e);r._isInitializationComplete||r._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.");var a=r._storageCache.getActiveConfig();return a&&void 0!==a[t]?new Te("remote",a[t]):r.defaultConfig&&void 0!==r.defaultConfig[t]?new Te("default",String(r.defaultConfig[t])):(r._logger.debug(`Returning static value for key "${t}".`+" Define a default or remote value if this is unintentional."),new Te("static"))}class ke{constructor(e,t,r,a){this.client=e,this.storage=t,this.storageCache=r,this.logger=a}isCachedDataFresh(e,t){if(!t)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var r=Date.now()-t,a=r<=e;return this.logger.debug("Config fetch cache check."+` Cache age millis: ${r}.`+` Cache max age millis (minimumFetchIntervalMillis setting): ${e}.`+` Is cache hit: ${a}.`),a}async fetch(e){var[t,r]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(r&&this.isCachedDataFresh(e.cacheMaxAgeMillis,t))return r;e.eTag=r&&r.eTag;r=await this.client.fetch(e);const a=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===r.status&&a.push(this.storage.setLastSuccessfulFetchResponse(r)),await Promise.all(a),r}}class Oe{constructor(e,t,r,a,i,s){this.firebaseInstallations=e,this.sdkVersion=t,this.namespace=r,this.projectId=a,this.apiKey=i,this.appId=s}async fetch(r){var e,[t,a]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),i=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,s={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":r.eTag||"*"},a={sdk_version:this.sdkVersion,app_instance_id:t,app_instance_id_token:a,app_id:this.appId,language_code:(e=navigator).languages&&e.languages[0]||e.language},a={method:"POST",headers:s,body:JSON.stringify(a)},i=fetch(i,a),a=new Promise((e,t)=>{r.signal.addEventListener(()=>{const e=new Error("The operation was aborted.");e.name="AbortError",t(e)})});let n;try{await Promise.race([i,a]),n=await i}catch(e){let t="fetch-client-network";throw"AbortError"===(null===e||void 0===e?void 0:e.name)&&(t="fetch-timeout"),Ce.create(t,{originalErrorMessage:null===e||void 0===e?void 0:e.message})}let o=n.status;i=n.headers.get("ETag")||void 0;let c,l;if(200===n.status){let e;try{e=await n.json()}catch(e){throw Ce.create("fetch-client-parse",{originalErrorMessage:null===e||void 0===e?void 0:e.message})}c=e.entries,l=e.state}if("INSTANCE_STATE_UNSPECIFIED"===l?o=500:"NO_CHANGE"===l?o=304:"NO_TEMPLATE"!==l&&"EMPTY_CONFIG"!==l||(c={}),304!==o&&200!==o)throw Ce.create("fetch-status",{httpStatus:o});return{status:o,eTag:i,config:c}}}class Ne{constructor(e,t){this.client=e,this.storage=t}async fetch(e){var t=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(e,t)}async attemptFetch(t,{throttleEndTimeMillis:r,backoffCount:a}){var i,s;i=t.signal,s=r,await new Promise((e,t)=>{var r=Math.max(s-Date.now(),0);const a=setTimeout(e,r);i.addEventListener(()=>{clearTimeout(a),t(Ce.create("fetch-throttle",{throttleEndTimeMillis:s}))})});try{var n=await this.client.fetch(t);return await this.storage.deleteThrottleMetadata(),n}catch(e){if(!function(e){if(e instanceof c&&e.customData){var t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}}(e))throw e;var o={throttleEndTimeMillis:Date.now()+(r=2,n=1e3*Math.pow(r,a),o=Math.round(.5*n*(Math.random()-.5)*2),Math.min(144e5,n+o)),backoffCount:a+1};return await this.storage.setThrottleMetadata(o),this.attemptFetch(t,o)}}}class je{constructor(e,t,r,a,i){this.app=e,this._client=t,this._storageCache=r,this._storage=a,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}}function Ae(e,t){var r=e.target.error||void 0;return Ce.create(t,{originalErrorMessage:r&&(null===r||void 0===r?void 0:r.message)})}const Re="app_namespace_store";class Be{constructor(e,t,r,a=function(){return new Promise((t,r)=>{try{const e=indexedDB.open("firebase_remote_config",1);e.onerror=e=>{r(Ae(e,"storage-open"))},e.onsuccess=e=>{t(e.target.result)},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(Re,{keyPath:"compositeKey"})}}catch(e){r(Ce.create("storage-open",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}()){this.appId=e,this.appName=t,this.namespace=r,this.openDbPromise=a}getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(e){return this.set("last_fetch_status",e)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(e){return this.set("last_successful_fetch_timestamp_millis",e)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(e){return this.set("last_successful_fetch_response",e)}getActiveConfig(){return this.get("active_config")}setActiveConfig(e){return this.set("active_config",e)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(e){return this.set("active_config_etag",e)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(e){return this.set("throttle_metadata",e)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}async get(n){const o=await this.openDbPromise;return new Promise((r,t)=>{const e=o.transaction([Re],"readonly"),a=e.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.get(i);s.onerror=e=>{t(Ae(e,"storage-get"))},s.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)}}catch(e){t(Ce.create("storage-get",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}async set(n,o){const c=await this.openDbPromise;return new Promise((e,t)=>{const r=c.transaction([Re],"readwrite"),a=r.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.put({compositeKey:i,value:o});s.onerror=e=>{t(Ae(e,"storage-set"))},s.onsuccess=()=>{e()}}catch(e){t(Ce.create("storage-set",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}async delete(n){const o=await this.openDbPromise;return new Promise((e,t)=>{const r=o.transaction([Re],"readwrite"),a=r.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.delete(i);s.onerror=e=>{t(Ae(e,"storage-delete"))},s.onsuccess=()=>{e()}}catch(e){t(Ce.create("storage-delete",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}createCompositeKey(e){return[this.appId,this.appName,this.namespace,e].join()}}class $e{constructor(e){this.storage=e}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}async loadFromStorage(){var e=this.storage.getLastFetchStatus(),t=this.storage.getLastSuccessfulFetchTimestampMillis(),r=this.storage.getActiveConfig(),e=await e;e&&(this.lastFetchStatus=e);t=await t;t&&(this.lastSuccessfulFetchTimestampMillis=t);r=await r;r&&(this.activeConfig=r)}setLastFetchStatus(e){return this.lastFetchStatus=e,this.storage.setLastFetchStatus(e)}setLastSuccessfulFetchTimestampMillis(e){return this.lastSuccessfulFetchTimestampMillis=e,this.storage.setLastSuccessfulFetchTimestampMillis(e)}setActiveConfig(e){return this.activeConfig=e,this.storage.setActiveConfig(e)}}async function He(){if(!g())return!1;try{return await new Promise((t,r)=>{try{let e=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),e||self.indexedDB.deleteDatabase(a),t(!0)},i.onupgradeneeded=()=>{e=!1},i.onerror=()=>{var e;r((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){r(e)}})}catch(e){return!1}}Ke._registerComponent(new o("remote-config",function(e,{instanceIdentifier:t}){var r=e.getProvider("app").getImmediate(),a=e.getProvider("installations-internal").getImmediate();if("undefined"==typeof window)throw Ce.create("registration-window");if(!g())throw Ce.create("indexed-db-unavailable");var{projectId:i,apiKey:s,appId:n}=r.options;if(!i)throw Ce.create("registration-project-id");if(!s)throw Ce.create("registration-api-key");if(!n)throw Ce.create("registration-app-id");t=t||"firebase";const o=new Be(n,r.name,t),c=new $e(o),l=new p(Se);l.logLevel=u.ERROR;n=new Oe(a,Ke.SDK_VERSION,t,i,s,n),n=new Ne(n,o),n=new ke(n,o,c,l),n=new je(r,n,c,o,l);return Me(n),n},"PUBLIC").setMultipleInstances(!0)),Ke.registerVersion(Se,"0.3.14"),Ke.registerVersion(Se,"0.3.14","esm2017");class xe{constructor(e,t){this.app=e,this._delegate=t}get defaultConfig(){return this._delegate.defaultConfig}set defaultConfig(e){this._delegate.defaultConfig=e}get fetchTimeMillis(){return this._delegate.fetchTimeMillis}get lastFetchStatus(){return this._delegate.lastFetchStatus}get settings(){return this._delegate.settings}set settings(e){this._delegate.settings=e}activate(){return Le(this._delegate)}ensureInitialized(){return Me(this._delegate)}fetch(){return De(this._delegate)}fetchAndActivate(){return async function(e){return await De(e=s(e)),Le(e)}(this._delegate)}getAll(){return Fe(this._delegate)}getBoolean(e){return Pe(s(this._delegate),e).asBoolean()}getNumber(e){return Pe(s(this._delegate),e).asNumber()}getString(e){return Pe(s(this._delegate),e).asString()}getValue(e){return Pe(this._delegate,e)}setLogLevel(e){!function(e,t){const r=s(e);switch(t){case"debug":r._logger.logLevel=u.DEBUG;break;case"silent":r._logger.logLevel=u.SILENT;break;default:r._logger.logLevel=u.ERROR}}(this._delegate,e)}}function qe(e,{instanceIdentifier:t}){var r=e.getProvider("app-compat").getImmediate(),a=e.getProvider("remote-config").getImmediate({identifier:t});return new xe(r,a)}(H=r.default).INTERNAL.registerComponent(new o("remoteConfig-compat",qe,"PUBLIC").setMultipleInstances(!0).setServiceProps({isSupported:He})),H.registerVersion("@firebase/remote-config-compat","0.1.15")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-remote-config-compat.js - be sure to load firebase-app.js first.")}});
1
+ !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(Ve,Ke){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u,t,a,r=e(Ve);function g(){return"object"==typeof indexedDB}class c extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,i.prototype.create)}}class i{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var a,r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],s=s?(a=r,s.replace(n,(e,t)=>{var r=a[t];return null!=r?String(r):`<${t}?>`})):"Error",s=`${this.serviceName}: ${s} (${i}).`;return new c(i,s,r)}}const n=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class o{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}}(t=u=u||{})[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 l={debug:u.DEBUG,verbose:u.VERBOSE,info:u.INFO,warn:u.WARN,error:u.ERROR,silent:u.SILENT},h=u.INFO,d={[u.DEBUG]:"log",[u.VERBOSE]:"log",[u.INFO]:"info",[u.WARN]:"warn",[u.ERROR]:"error"},f=(e,t,...r)=>{if(!(t<e.logLevel)){var a=(new Date).toISOString(),i=d[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${a}] ${e.name}:`,...r)}};class p{constructor(e){this.name=e,this._logLevel=h,this._logHandler=f,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in u))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?l[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,u.DEBUG,...e),this._logHandler(this,u.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,u.VERBOSE,...e),this._logHandler(this,u.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,u.INFO,...e),this._logHandler(this,u.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,u.WARN,...e),this._logHandler(this,u.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,u.ERROR,...e),this._logHandler(this,u.ERROR,...e)}}const m=(t,e)=>e.some(e=>t instanceof e);let v,w;const _=new WeakMap,y=new WeakMap,b=new WeakMap,S=new WeakMap,E=new WeakMap;let C={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return y.get(e);if("objectStoreNames"===t)return e.objectStoreNames||b.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return L(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function I(a){return a!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(w=w||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(a)?function(...e){return a.apply(M(this),e),L(_.get(this))}:function(...e){return L(a.apply(M(this),e))}:function(e,...t){var r=a.call(M(this),e,...t);return b.set(r,e.sort?e.sort():[e]),L(r)}}function T(e){return"function"==typeof e?I(e):(e instanceof IDBTransaction&&(s=e,y.has(s)||(t=new Promise((e,t)=>{const r=()=>{s.removeEventListener("complete",a),s.removeEventListener("error",i),s.removeEventListener("abort",i)},a=()=>{e(),r()},i=()=>{t(s.error||new DOMException("AbortError","AbortError")),r()};s.addEventListener("complete",a),s.addEventListener("error",i),s.addEventListener("abort",i)}),y.set(s,t))),m(e,v=v||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,C):e);var s,t}function L(e){if(e instanceof IDBRequest)return function(s){const e=new Promise((e,t)=>{const r=()=>{s.removeEventListener("success",a),s.removeEventListener("error",i)},a=()=>{e(L(s.result)),r()},i=()=>{t(s.error),r()};s.addEventListener("success",a),s.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&_.set(e,s)}).catch(()=>{}),E.set(e,s),e}(e);if(S.has(e))return S.get(e);var t=T(e);return t!==e&&(S.set(e,t),E.set(t,e)),t}const M=e=>E.get(e);const D=["get","getKey","getAll","getAllKeys","count"],F=["put","add","delete","clear"],P=new Map;function k(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(P.get(t))return P.get(t);const i=t.replace(/FromIndex$/,""),s=t!==i,n=F.includes(i);if(i in(s?IDBIndex:IDBObjectStore).prototype&&(n||D.includes(i))){var r=async function(e,...t){var r=this.transaction(e,n?"readwrite":"readonly");let a=r.store;return s&&(a=a.index(t.shift())),(await Promise.all([a[i](...t),n&&r.done]))[0]};return P.set(t,r),r}}}C={...a=C,get:(e,t,r)=>k(e,t)||a.get(e,t,r),has:(e,t)=>!!k(e,t)||a.has(e,t)};var O="@firebase/installations",N="0.5.16";const j=1e4,A=`w:${N}`,R="FIS_v2",B="https://firebaseinstallations.googleapis.com/v1",$=36e5;var H;const x=new i("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 q(e){return e instanceof c&&e.code.includes("request-failed")}function V({projectId:e}){return`${B}/projects/${e}/installations`}function K(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function U(e,t){var r=(await t.json()).error;return x.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function z({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function G(e,{refreshToken:t}){const r=z(e);return r.append("Authorization",(t=t,`${R} ${t}`)),r}async function W(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function J(t){return new Promise(e=>{setTimeout(e,t)})}const Y=/^[cdef][\w-]{21}$/,Z="";function Q(){try{const t=new Uint8Array(17),r=self.crypto||self.msCrypto;r.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 Y.test(e)?e:Z}catch(e){return Z}}function X(e){return`${e.appName}!${e.appId}`}const ee=new Map;function te(e,t){var r=X(e);re(r,t),function(e,t){const r=function(){!ae&&"BroadcastChannel"in self&&(ae=new BroadcastChannel("[Firebase] FID Change"),ae.onmessage=e=>{re(e.data.key,e.data.fid)});return ae}();r&&r.postMessage({key:e,fid:t});0===ee.size&&ae&&(ae.close(),ae=null)}(r,t)}function re(e,t){var r=ee.get(e);if(r)for(const a of r)a(t)}let ae=null;const ie="firebase-installations-store";let se=null;function ne(){return se=se||function(e,t,{blocked:r,upgrade:a,blocking:i,terminated:s}){const n=indexedDB.open(e,t),o=L(n);return a&&n.addEventListener("upgradeneeded",e=>{a(L(n.result),e.oldVersion,e.newVersion,L(n.transaction))}),r&&n.addEventListener("blocked",()=>r()),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),o}("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(ie)}}),se}async function oe(e,t){var r=X(e);const a=await ne(),i=a.transaction(ie,"readwrite"),s=i.objectStore(ie);var n=await s.get(r);return await s.put(t,r),await i.done,n&&n.fid===t.fid||te(e,t.fid),t}async function ce(e){var t=X(e);const r=await ne(),a=r.transaction(ie,"readwrite");await a.objectStore(ie).delete(t),await a.done}async function le(e,t){var r=X(e);const a=await ne(),i=a.transaction(ie,"readwrite"),s=i.objectStore(ie);var n=await s.get(r),o=t(n);return void 0===o?await s.delete(r):await s.put(o,r),await i.done,!o||n&&n.fid===o.fid||te(e,o.fid),o}async function ue(r){let a;var e=await le(r.appConfig,e=>{var t=he(e||{fid:Q(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await ge(e.appConfig);for(;1===t.registrationStatus;)await J(100),t=await ge(e.appConfig);if(0!==t.registrationStatus)return t;{var{installationEntry:r,registrationPromise:a}=await ue(e);return a||r}}(e)}:{installationEntry:t};if(!navigator.onLine){var r=Promise.reject(x.create("app-offline"));return{installationEntry:t,registrationPromise:r}}var a={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,r){try{var e=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:r}){const a=V(e),i=z(e),s=t.getImmediate({optional:!0});!s||(n=await s.getHeartbeatsHeader())&&i.append("x-firebase-client",n);var n={fid:r,authVersion:R,appId:e.appId,sdkVersion:A};const o={method:"POST",headers:i,body:JSON.stringify(n)},c=await W(()=>fetch(a,o));if(c.ok){n=await c.json();return{fid:n.fid||r,registrationStatus:2,refreshToken:n.refreshToken,authToken:K(n.authToken)}}throw await U("Create Installation",c)}(t,r);return oe(t.appConfig,e)}catch(e){throw q(e)&&409===e.customData.serverCode?await ce(t.appConfig):await oe(t.appConfig,{fid:r.fid,registrationStatus:0}),e}}(e,a);return{installationEntry:a,registrationPromise:r}}}(r,t);return a=t.registrationPromise,t.installationEntry});return e.fid===Z?{installationEntry:await a}:{installationEntry:e,registrationPromise:a}}function ge(e){return le(e,e=>{if(!e)throw x.create("installation-not-found");return he(e)})}function he(e){return 1===(t=e).registrationStatus&&t.registrationTime+j<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function de({appConfig:e,heartbeatServiceProvider:t},r){const a=([i,s]=[e,r["fid"]],`${V(i)}/${s}/authTokens:generate`);var i,s;const n=G(e,r),o=t.getImmediate({optional:!0});!o||(c=await o.getHeartbeatsHeader())&&n.append("x-firebase-client",c);var c={installation:{sdkVersion:A,appId:e.appId}};const l={method:"POST",headers:n,body:JSON.stringify(c)},u=await W(()=>fetch(a,l));if(u.ok)return K(await u.json());throw await U("Generate Auth Token",u)}async function fe(a,i=!1){let s;var e=await le(a.appConfig,e=>{if(!me(e))throw x.create("not-registered");var t,r=e.authToken;if(i||2!==(t=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+$}(t)){if(1===r.requestStatus)return s=async function(e,t){let r=await pe(e.appConfig);for(;1===r.authToken.requestStatus;)await J(100),r=await pe(e.appConfig);var a=r.authToken;return 0===a.requestStatus?fe(e,t):a}(a,i),e;if(!navigator.onLine)throw x.create("app-offline");r=(t=e,r={requestStatus:1,requestTime:Date.now()},Object.assign(Object.assign({},t),{authToken:r}));return s=async function(t,r){try{var a=await de(t,r),e=Object.assign(Object.assign({},r),{authToken:a});return await oe(t.appConfig,e),a}catch(e){throw!q(e)||401!==e.customData.serverCode&&404!==e.customData.serverCode?(a=Object.assign(Object.assign({},r),{authToken:{requestStatus:0}}),await oe(t.appConfig,a)):await ce(t.appConfig),e}}(a,r),r}return e});return s?await s:e.authToken}function pe(e){return le(e,e=>{if(!me(e))throw x.create("not-registered");var t,r=e.authToken;return 1===(t=r).requestStatus&&t.requestTime+j<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}function me(e){return void 0!==e&&2===e.registrationStatus}async function ve(e,t=!1){var r,a=e;return await((r=(await ue(a)).registrationPromise)&&await r),(await fe(a,t)).token}function we(e){return x.create("missing-app-config-values",{valueName:e})}const _e="installations",ye=e=>{var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){if(!e||!e.options)throw we("App Configuration");if(!e.name)throw we("App Name");for(const t of["projectId","apiKey","appId"])if(!e.options[t])throw we(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Ke._getProvider(t,"heartbeat"),_delete:()=>Promise.resolve()}},be=e=>{var t=e.getProvider("app").getImmediate();const r=Ke._getProvider(t,_e).getImmediate();return{getId:()=>async function(e){var t=e;const{installationEntry:r,registrationPromise:a}=await ue(t);return(a||fe(t)).catch(console.error),r.fid}(r),getToken:e=>ve(r,e)}};Ke._registerComponent(new o(_e,ye,"PUBLIC")),Ke._registerComponent(new o("installations-internal",be,"PRIVATE")),Ke.registerVersion(O,N),Ke.registerVersion(O,N,"esm2017");const Se="@firebase/remote-config";class Ee{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}const Ce=new i("remoteconfig","Remote Config",{"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"});const Ie=["1","true","t","yes","y","on"];class Te{constructor(e,t=""){this._source=e,this._value=t}asString(){return this._value}asBoolean(){return"static"!==this._source&&0<=Ie.indexOf(this._value.toLowerCase())}asNumber(){if("static"===this._source)return 0;let e=Number(this._value);return isNaN(e)&&(e=0),e}getSource(){return this._source}}async function Le(e){const t=s(e);var[r,a]=await Promise.all([t._storage.getLastSuccessfulFetchResponse(),t._storage.getActiveConfigEtag()]);return!!(r&&r.config&&r.eTag&&r.eTag!==a)&&(await Promise.all([t._storageCache.setActiveConfig(r.config),t._storage.setActiveConfigEtag(r.eTag)]),!0)}function Me(e){const t=s(e);return t._initializePromise||(t._initializePromise=t._storageCache.loadFromStorage().then(()=>{t._isInitializationComplete=!0})),t._initializePromise}async function De(t){const r=s(t),e=new Ee;setTimeout(async()=>{e.abort()},r.settings.fetchTimeoutMillis);try{await r._client.fetch({cacheMaxAgeMillis:r.settings.minimumFetchIntervalMillis,signal:e}),await r._storageCache.setLastFetchStatus("success")}catch(e){var a=(i="fetch-throttle",(t=e)instanceof c&&-1!==t.code.indexOf(i)?"throttle":"failure");throw await r._storageCache.setLastFetchStatus(a),e}var i}function Fe(r){const e=s(r);return[t={},a={}]=[e._storageCache.getActiveConfig(),e.defaultConfig],Object.keys(Object.assign(Object.assign({},t),a)).reduce((e,t)=>(e[t]=Pe(r,t),e),{});var t,a}function Pe(e,t){const r=s(e);r._isInitializationComplete||r._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.");var a=r._storageCache.getActiveConfig();return a&&void 0!==a[t]?new Te("remote",a[t]):r.defaultConfig&&void 0!==r.defaultConfig[t]?new Te("default",String(r.defaultConfig[t])):(r._logger.debug(`Returning static value for key "${t}".`+" Define a default or remote value if this is unintentional."),new Te("static"))}class ke{constructor(e,t,r,a){this.client=e,this.storage=t,this.storageCache=r,this.logger=a}isCachedDataFresh(e,t){if(!t)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;var r=Date.now()-t,a=r<=e;return this.logger.debug("Config fetch cache check."+` Cache age millis: ${r}.`+` Cache max age millis (minimumFetchIntervalMillis setting): ${e}.`+` Is cache hit: ${a}.`),a}async fetch(e){var[t,r]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(r&&this.isCachedDataFresh(e.cacheMaxAgeMillis,t))return r;e.eTag=r&&r.eTag;r=await this.client.fetch(e);const a=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===r.status&&a.push(this.storage.setLastSuccessfulFetchResponse(r)),await Promise.all(a),r}}class Oe{constructor(e,t,r,a,i,s){this.firebaseInstallations=e,this.sdkVersion=t,this.namespace=r,this.projectId=a,this.apiKey=i,this.appId=s}async fetch(r){var e,[t,a]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),i=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,s={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":r.eTag||"*"},a={sdk_version:this.sdkVersion,app_instance_id:t,app_instance_id_token:a,app_id:this.appId,language_code:(e=navigator).languages&&e.languages[0]||e.language},a={method:"POST",headers:s,body:JSON.stringify(a)},i=fetch(i,a),a=new Promise((e,t)=>{r.signal.addEventListener(()=>{const e=new Error("The operation was aborted.");e.name="AbortError",t(e)})});let n;try{await Promise.race([i,a]),n=await i}catch(e){let t="fetch-client-network";throw"AbortError"===(null===e||void 0===e?void 0:e.name)&&(t="fetch-timeout"),Ce.create(t,{originalErrorMessage:null===e||void 0===e?void 0:e.message})}let o=n.status;i=n.headers.get("ETag")||void 0;let c,l;if(200===n.status){let e;try{e=await n.json()}catch(e){throw Ce.create("fetch-client-parse",{originalErrorMessage:null===e||void 0===e?void 0:e.message})}c=e.entries,l=e.state}if("INSTANCE_STATE_UNSPECIFIED"===l?o=500:"NO_CHANGE"===l?o=304:"NO_TEMPLATE"!==l&&"EMPTY_CONFIG"!==l||(c={}),304!==o&&200!==o)throw Ce.create("fetch-status",{httpStatus:o});return{status:o,eTag:i,config:c}}}class Ne{constructor(e,t){this.client=e,this.storage=t}async fetch(e){var t=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(e,t)}async attemptFetch(t,{throttleEndTimeMillis:r,backoffCount:a}){var i,s;i=t.signal,s=r,await new Promise((e,t)=>{var r=Math.max(s-Date.now(),0);const a=setTimeout(e,r);i.addEventListener(()=>{clearTimeout(a),t(Ce.create("fetch-throttle",{throttleEndTimeMillis:s}))})});try{var n=await this.client.fetch(t);return await this.storage.deleteThrottleMetadata(),n}catch(e){if(!function(e){if(e instanceof c&&e.customData){var t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}}(e))throw e;var o={throttleEndTimeMillis:Date.now()+(r=2,n=1e3*Math.pow(r,a),o=Math.round(.5*n*(Math.random()-.5)*2),Math.min(144e5,n+o)),backoffCount:a+1};return await this.storage.setThrottleMetadata(o),this.attemptFetch(t,o)}}}class je{constructor(e,t,r,a,i){this.app=e,this._client=t,this._storageCache=r,this._storage=a,this._logger=i,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}}function Ae(e,t){var r=e.target.error||void 0;return Ce.create(t,{originalErrorMessage:r&&(null===r||void 0===r?void 0:r.message)})}const Re="app_namespace_store";class Be{constructor(e,t,r,a=function(){return new Promise((t,r)=>{try{const e=indexedDB.open("firebase_remote_config",1);e.onerror=e=>{r(Ae(e,"storage-open"))},e.onsuccess=e=>{t(e.target.result)},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(Re,{keyPath:"compositeKey"})}}catch(e){r(Ce.create("storage-open",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}()){this.appId=e,this.appName=t,this.namespace=r,this.openDbPromise=a}getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(e){return this.set("last_fetch_status",e)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(e){return this.set("last_successful_fetch_timestamp_millis",e)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(e){return this.set("last_successful_fetch_response",e)}getActiveConfig(){return this.get("active_config")}setActiveConfig(e){return this.set("active_config",e)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(e){return this.set("active_config_etag",e)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(e){return this.set("throttle_metadata",e)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}async get(n){const o=await this.openDbPromise;return new Promise((r,t)=>{const e=o.transaction([Re],"readonly"),a=e.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.get(i);s.onerror=e=>{t(Ae(e,"storage-get"))},s.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)}}catch(e){t(Ce.create("storage-get",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}async set(n,o){const c=await this.openDbPromise;return new Promise((e,t)=>{const r=c.transaction([Re],"readwrite"),a=r.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.put({compositeKey:i,value:o});s.onerror=e=>{t(Ae(e,"storage-set"))},s.onsuccess=()=>{e()}}catch(e){t(Ce.create("storage-set",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}async delete(n){const o=await this.openDbPromise;return new Promise((e,t)=>{const r=o.transaction([Re],"readwrite"),a=r.objectStore(Re);var i=this.createCompositeKey(n);try{const s=a.delete(i);s.onerror=e=>{t(Ae(e,"storage-delete"))},s.onsuccess=()=>{e()}}catch(e){t(Ce.create("storage-delete",{originalErrorMessage:null===e||void 0===e?void 0:e.message}))}})}createCompositeKey(e){return[this.appId,this.appName,this.namespace,e].join()}}class $e{constructor(e){this.storage=e}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}async loadFromStorage(){var e=this.storage.getLastFetchStatus(),t=this.storage.getLastSuccessfulFetchTimestampMillis(),r=this.storage.getActiveConfig(),e=await e;e&&(this.lastFetchStatus=e);t=await t;t&&(this.lastSuccessfulFetchTimestampMillis=t);r=await r;r&&(this.activeConfig=r)}setLastFetchStatus(e){return this.lastFetchStatus=e,this.storage.setLastFetchStatus(e)}setLastSuccessfulFetchTimestampMillis(e){return this.lastSuccessfulFetchTimestampMillis=e,this.storage.setLastSuccessfulFetchTimestampMillis(e)}setActiveConfig(e){return this.activeConfig=e,this.storage.setActiveConfig(e)}}async function He(){if(!g())return!1;try{return await new Promise((t,r)=>{try{let e=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),e||self.indexedDB.deleteDatabase(a),t(!0)},i.onupgradeneeded=()=>{e=!1},i.onerror=()=>{var e;r((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){r(e)}})}catch(e){return!1}}Ke._registerComponent(new o("remote-config",function(e,{instanceIdentifier:t}){var r=e.getProvider("app").getImmediate(),a=e.getProvider("installations-internal").getImmediate();if("undefined"==typeof window)throw Ce.create("registration-window");if(!g())throw Ce.create("indexed-db-unavailable");var{projectId:i,apiKey:s,appId:n}=r.options;if(!i)throw Ce.create("registration-project-id");if(!s)throw Ce.create("registration-api-key");if(!n)throw Ce.create("registration-app-id");t=t||"firebase";const o=new Be(n,r.name,t),c=new $e(o),l=new p(Se);l.logLevel=u.ERROR;n=new Oe(a,Ke.SDK_VERSION,t,i,s,n),n=new Ne(n,o),n=new ke(n,o,c,l),n=new je(r,n,c,o,l);return Me(n),n},"PUBLIC").setMultipleInstances(!0)),Ke.registerVersion(Se,"0.3.15"),Ke.registerVersion(Se,"0.3.15","esm2017");class xe{constructor(e,t){this.app=e,this._delegate=t}get defaultConfig(){return this._delegate.defaultConfig}set defaultConfig(e){this._delegate.defaultConfig=e}get fetchTimeMillis(){return this._delegate.fetchTimeMillis}get lastFetchStatus(){return this._delegate.lastFetchStatus}get settings(){return this._delegate.settings}set settings(e){this._delegate.settings=e}activate(){return Le(this._delegate)}ensureInitialized(){return Me(this._delegate)}fetch(){return De(this._delegate)}fetchAndActivate(){return async function(e){return await De(e=s(e)),Le(e)}(this._delegate)}getAll(){return Fe(this._delegate)}getBoolean(e){return Pe(s(this._delegate),e).asBoolean()}getNumber(e){return Pe(s(this._delegate),e).asNumber()}getString(e){return Pe(s(this._delegate),e).asString()}getValue(e){return Pe(this._delegate,e)}setLogLevel(e){!function(e,t){const r=s(e);switch(t){case"debug":r._logger.logLevel=u.DEBUG;break;case"silent":r._logger.logLevel=u.SILENT;break;default:r._logger.logLevel=u.ERROR}}(this._delegate,e)}}function qe(e,{instanceIdentifier:t}){var r=e.getProvider("app-compat").getImmediate(),a=e.getProvider("remote-config").getImmediate({identifier:t});return new xe(r,a)}(H=r.default).INTERNAL.registerComponent(new o("remoteConfig-compat",qe,"PUBLIC").setMultipleInstances(!0).setServiceProps({isSupported:He})),H.registerVersion("@firebase/remote-config-compat","0.1.16")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-remote-config-compat.js - be sure to load firebase-app.js first.")}});
2
2
  //# sourceMappingURL=firebase-remote-config-compat.js.map
@@ -1,3 +1,3 @@
1
- import{registerVersion as t,_registerComponent as e,_getProvider as n,getApp as s,SDK_VERSION as r}from"https://www.gstatic.com/firebasejs/9.12.1/firebase-app.js";function i(){return"object"==typeof indexedDB}class a extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,o.prototype.create)}}class o{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){return t.replace(c,((t,n)=>{const s=e[n];return null!=s?String(s):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new a(s,o,n)}}const c=/\{\$([^}]+)}/g;function u(t,e=1e3,n=2){const s=e*Math.pow(n,t),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function l(t){return t&&t._delegate?t._delegate:t}class g{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}var h;!function(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"}(h||(h={}));const f={debug:h.DEBUG,verbose:h.VERBOSE,info:h.INFO,warn:h.WARN,error:h.ERROR,silent:h.SILENT},d=h.INFO,p={[h.DEBUG]:"log",[h.VERBOSE]:"log",[h.INFO]:"info",[h.WARN]:"warn",[h.ERROR]:"error"},m=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=p[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class w{constructor(t){this.name=t,this._logLevel=d,this._logHandler=m,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in h))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?f[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,h.DEBUG,...t),this._logHandler(this,h.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,h.VERBOSE,...t),this._logHandler(this,h.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,h.INFO,...t),this._logHandler(this,h.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,h.WARN,...t),this._logHandler(this,h.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,h.ERROR,...t),this._logHandler(this,h.ERROR,...t)}}let v,_;const y=new WeakMap,b=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap;let C={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return b.get(t);if("objectStoreNames"===e)return t.objectStoreNames||E.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return M(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function T(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(_||(_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(D(this),e),M(y.get(this))}:function(...e){return M(t.apply(D(this),e))}:function(e,...n){const s=t.call(D(this),e,...n);return E.set(s,e.sort?e.sort():[e]),M(s)}}function L(t){return"function"==typeof t?T(t):(t instanceof IDBTransaction&&function(t){if(b.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));b.set(t,e)}(t),e=t,(v||(v=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,C):t);var e}function M(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(M(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&y.set(e,t)})).catch((()=>{})),I.set(e,t),e}(t);if(S.has(t))return S.get(t);const e=L(t);return e!==t&&(S.set(t,e),I.set(e,t)),e}const D=t=>I.get(t);const k=["get","getKey","getAll","getAllKeys","count"],F=["put","add","delete","clear"],P=new Map;function O(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(P.get(e))return P.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=F.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!k.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let a=i.store;return s&&(a=a.index(e.shift())),(await Promise.all([a[n](...e),r&&i.done]))[0]};return P.set(e,i),i}C=(t=>({...t,get:(e,n,s)=>O(e,n)||t.get(e,n,s),has:(e,n)=>!!O(e,n)||t.has(e,n)}))(C);const N="@firebase/installations",j=new o("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 R(t){return t instanceof a&&t.code.includes("request-failed")}function A({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function B(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function $(t,e){const n=(await e.json()).error;return j.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function H({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function x(t,{refreshToken:e}){const n=H(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function q(t){const e=await t();return e.status>=500&&e.status<600?t():e}function K(t){return new Promise((e=>{setTimeout(e,t)}))}const U=/^[cdef][\w-]{21}$/;function V(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return U.test(e)?e:""}catch(t){return""}}function z(t){return`${t.appName}!${t.appId}`}const G=new Map;function W(t,e){const n=z(t);J(n,e),function(t,e){const n=function(){!Y&&"BroadcastChannel"in self&&(Y=new BroadcastChannel("[Firebase] FID Change"),Y.onmessage=t=>{J(t.data.key,t.data.fid)});return Y}();n&&n.postMessage({key:t,fid:e});0===G.size&&Y&&(Y.close(),Y=null)}(n,e)}function J(t,e){const n=G.get(t);if(n)for(const t of n)t(e)}let Y=null;const Z="firebase-installations-store";let Q=null;function X(){return Q||(Q=function(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const a=indexedDB.open(t,e),o=M(a);return s&&a.addEventListener("upgradeneeded",(t=>{s(M(a.result),t.oldVersion,t.newVersion,M(a.transaction))})),n&&a.addEventListener("blocked",(()=>n())),o.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(()=>r()))})).catch((()=>{})),o}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Z)}})),Q}async function tt(t,e){const n=z(t),s=(await X()).transaction(Z,"readwrite"),r=s.objectStore(Z),i=await r.get(n);return await r.put(e,n),await s.done,i&&i.fid===e.fid||W(t,e.fid),e}async function et(t){const e=z(t),n=(await X()).transaction(Z,"readwrite");await n.objectStore(Z).delete(e),await n.done}async function nt(t,e){const n=z(t),s=(await X()).transaction(Z,"readwrite"),r=s.objectStore(Z),i=await r.get(n),a=e(i);return void 0===a?await r.delete(n):await r.put(a,n),await s.done,!a||i&&i.fid===a.fid||W(t,a.fid),a}async function st(t){let e;const n=await nt(t.appConfig,(n=>{const s=function(t){return at(t||{fid:V(),registrationStatus:0})}(n),r=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(j.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=A(t),r=H(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const a={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.5.15"},o={method:"POST",headers:r,body:JSON.stringify(a)},c=await q((()=>fetch(s,o)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:B(t.authToken)}}throw await $("Create Installation",c)}(t,e);return tt(t.appConfig,n)}catch(n){throw R(n)&&409===n.customData.serverCode?await et(t.appConfig):await tt(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:s}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:rt(t)}:{installationEntry:e}}(t,s);return e=r.registrationPromise,r.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function rt(t){let e=await it(t.appConfig);for(;1===e.registrationStatus;)await K(100),e=await it(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await st(t);return n||e}return e}function it(t){return nt(t,(t=>{if(!t)throw j.create("installation-not-found");return at(t)}))}function at(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function ot({appConfig:t,heartbeatServiceProvider:e},n){const s=function(t,{fid:e}){return`${A(t)}/${e}/authTokens:generate`}(t,n),r=x(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const a={installation:{sdkVersion:"w:0.5.15",appId:t.appId}},o={method:"POST",headers:r,body:JSON.stringify(a)},c=await q((()=>fetch(s,o)));if(c.ok){return B(await c.json())}throw await $("Generate Auth Token",c)}async function ct(t,e=!1){let n;const s=await nt(t.appConfig,(s=>{if(!lt(s))throw j.create("not-registered");const r=s.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(r))return s;if(1===r.requestStatus)return n=async function(t,e){let n=await ut(t.appConfig);for(;1===n.authToken.requestStatus;)await K(100),n=await ut(t.appConfig);const s=n.authToken;return 0===s.requestStatus?ct(t,e):s}(t,e),s;{if(!navigator.onLine)throw j.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(s);return n=async function(t,e){try{const n=await ot(t,e),s=Object.assign(Object.assign({},e),{authToken:n});return await tt(t.appConfig,s),n}catch(n){if(!R(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await tt(t.appConfig,n)}else await et(t.appConfig);throw n}}(t,e),e}}));return n?await n:s.authToken}function ut(t){return nt(t,(t=>{if(!lt(t))throw j.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function lt(t){return void 0!==t&&2===t.registrationStatus}async function gt(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await st(t);e&&await e}(n);return(await ct(n,e)).token}function ht(t){return j.create("missing-app-config-values",{valueName:t})}const ft=t=>{const e=t.getProvider("app").getImmediate(),s=n(e,"installations").getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:s}=await st(e);return s?s.catch(console.error):ct(e).catch(console.error),n.fid}(s),getToken:t=>gt(s,t)}};e(new g("installations",(t=>{const e=t.getProvider("app").getImmediate(),s=function(t){if(!t||!t.options)throw ht("App Configuration");if(!t.name)throw ht("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw ht(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:s,heartbeatServiceProvider:n(e,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),e(new g("installations-internal",ft,"PRIVATE")),t(N,"0.5.15"),t(N,"0.5.15","esm2017");const dt="@firebase/remote-config";class pt{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach((t=>t()))}}const mt=new o("remoteconfig","Remote Config",{"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"});const wt=["1","true","t","yes","y","on"];class vt{constructor(t,e=""){this._source=t,this._value=e}asString(){return this._value}asBoolean(){return"static"!==this._source&&wt.indexOf(this._value.toLowerCase())>=0}asNumber(){if("static"===this._source)return 0;let t=Number(this._value);return isNaN(t)&&(t=0),t}getSource(){return this._source}}function _t(t=s()){t=l(t);return n(t,"remote-config").getImmediate()}async function yt(t){const e=l(t),[n,s]=await Promise.all([e._storage.getLastSuccessfulFetchResponse(),e._storage.getActiveConfigEtag()]);return!!(n&&n.config&&n.eTag&&n.eTag!==s)&&(await Promise.all([e._storageCache.setActiveConfig(n.config),e._storage.setActiveConfigEtag(n.eTag)]),!0)}function bt(t){const e=l(t);return e._initializePromise||(e._initializePromise=e._storageCache.loadFromStorage().then((()=>{e._isInitializationComplete=!0}))),e._initializePromise}async function Et(t){const e=l(t),n=new pt;setTimeout((async()=>{n.abort()}),e.settings.fetchTimeoutMillis);try{await e._client.fetch({cacheMaxAgeMillis:e.settings.minimumFetchIntervalMillis,signal:n}),await e._storageCache.setLastFetchStatus("success")}catch(t){const n=function(t,e){return t instanceof a&&-1!==t.code.indexOf(e)}(t,"fetch-throttle")?"throttle":"failure";throw await e._storageCache.setLastFetchStatus(n),t}}function St(t){const e=l(t);return function(t={},e={}){return Object.keys(Object.assign(Object.assign({},t),e))}(e._storageCache.getActiveConfig(),e.defaultConfig).reduce(((e,n)=>(e[n]=Lt(t,n),e)),{})}function It(t,e){return Lt(l(t),e).asBoolean()}function Ct(t,e){return Lt(l(t),e).asNumber()}function Tt(t,e){return Lt(l(t),e).asString()}function Lt(t,e){const n=l(t);n._isInitializationComplete||n._logger.debug(`A value was requested for key "${e}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);const s=n._storageCache.getActiveConfig();return s&&void 0!==s[e]?new vt("remote",s[e]):n.defaultConfig&&void 0!==n.defaultConfig[e]?new vt("default",String(n.defaultConfig[e])):(n._logger.debug(`Returning static value for key "${e}". Define a default or remote value if this is unintentional.`),new vt("static"))}function Mt(t,e){const n=l(t);switch(e){case"debug":n._logger.logLevel=h.DEBUG;break;case"silent":n._logger.logLevel=h.SILENT;break;default:n._logger.logLevel=h.ERROR}}class Dt{constructor(t,e,n,s){this.client=t,this.storage=e,this.storageCache=n,this.logger=s}isCachedDataFresh(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;const n=Date.now()-e,s=n<=t;return this.logger.debug(`Config fetch cache check. Cache age millis: ${n}. Cache max age millis (minimumFetchIntervalMillis setting): ${t}. Is cache hit: ${s}.`),s}async fetch(t){const[e,n]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(n&&this.isCachedDataFresh(t.cacheMaxAgeMillis,e))return n;t.eTag=n&&n.eTag;const s=await this.client.fetch(t),r=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===s.status&&r.push(this.storage.setLastSuccessfulFetchResponse(s)),await Promise.all(r),s}}function kt(t=navigator){return t.languages&&t.languages[0]||t.language}class Ft{constructor(t,e,n,s,r,i){this.firebaseInstallations=t,this.sdkVersion=e,this.namespace=n,this.projectId=s,this.apiKey=r,this.appId=i}async fetch(t){var e,n,s;const[r,i]=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}`,o={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":t.eTag||"*"},c={sdk_version:this.sdkVersion,app_instance_id:r,app_instance_id_token:i,app_id:this.appId,language_code:kt()},u={method:"POST",headers:o,body:JSON.stringify(c)},l=fetch(a,u),g=new Promise(((e,n)=>{t.signal.addEventListener((()=>{const t=new Error("The operation was aborted.");t.name="AbortError",n(t)}))}));let h;try{await Promise.race([l,g]),h=await l}catch(t){let s="fetch-client-network";throw"AbortError"===(null===(e=t)||void 0===e?void 0:e.name)&&(s="fetch-timeout"),mt.create(s,{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message})}let f=h.status;const d=h.headers.get("ETag")||void 0;let p,m;if(200===h.status){let t;try{t=await h.json()}catch(t){throw mt.create("fetch-client-parse",{originalErrorMessage:null===(s=t)||void 0===s?void 0:s.message})}p=t.entries,m=t.state}if("INSTANCE_STATE_UNSPECIFIED"===m?f=500:"NO_CHANGE"===m?f=304:"NO_TEMPLATE"!==m&&"EMPTY_CONFIG"!==m||(p={}),304!==f&&200!==f)throw mt.create("fetch-status",{httpStatus:f});return{status:f,eTag:d,config:p}}}class Pt{constructor(t,e){this.client=t,this.storage=e}async fetch(t){const e=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(t,e)}async attemptFetch(t,{throttleEndTimeMillis:e,backoffCount:n}){await function(t,e){return new Promise(((n,s)=>{const r=Math.max(e-Date.now(),0),i=setTimeout(n,r);t.addEventListener((()=>{clearTimeout(i),s(mt.create("fetch-throttle",{throttleEndTimeMillis:e}))}))}))}(t.signal,e);try{const e=await this.client.fetch(t);return await this.storage.deleteThrottleMetadata(),e}catch(e){if(!function(t){if(!(t instanceof a&&t.customData))return!1;const e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(e))throw e;const s={throttleEndTimeMillis:Date.now()+u(n),backoffCount:n+1};return await this.storage.setThrottleMetadata(s),this.attemptFetch(t,s)}}}class Ot{constructor(t,e,n,s,r){this.app=t,this._client=e,this._storageCache=n,this._storage=s,this._logger=r,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}}function Nt(t,e){var n;const s=t.target.error||void 0;return mt.create(e,{originalErrorMessage:s&&(null===(n=s)||void 0===n?void 0:n.message)})}class jt{constructor(t,e,n,s=function(){return new Promise(((t,e)=>{var n;try{const n=indexedDB.open("firebase_remote_config",1);n.onerror=t=>{e(Nt(t,"storage-open"))},n.onsuccess=e=>{t(e.target.result)},n.onupgradeneeded=t=>{const e=t.target.result;0===t.oldVersion&&e.createObjectStore("app_namespace_store",{keyPath:"compositeKey"})}}catch(t){e(mt.create("storage-open",{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message}))}}))}()){this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=s}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 e=await this.openDbPromise;return new Promise(((n,s)=>{var r;const i=e.transaction(["app_namespace_store"],"readonly").objectStore("app_namespace_store"),a=this.createCompositeKey(t);try{const t=i.get(a);t.onerror=t=>{s(Nt(t,"storage-get"))},t.onsuccess=t=>{const e=t.target.result;n(e?e.value:void 0)}}catch(t){s(mt.create("storage-get",{originalErrorMessage:null===(r=t)||void 0===r?void 0:r.message}))}}))}async set(t,e){const n=await this.openDbPromise;return new Promise(((s,r)=>{var i;const a=n.transaction(["app_namespace_store"],"readwrite").objectStore("app_namespace_store"),o=this.createCompositeKey(t);try{const t=a.put({compositeKey:o,value:e});t.onerror=t=>{r(Nt(t,"storage-set"))},t.onsuccess=()=>{s()}}catch(t){r(mt.create("storage-set",{originalErrorMessage:null===(i=t)||void 0===i?void 0:i.message}))}}))}async delete(t){const e=await this.openDbPromise;return new Promise(((n,s)=>{var r;const i=e.transaction(["app_namespace_store"],"readwrite").objectStore("app_namespace_store"),a=this.createCompositeKey(t);try{const t=i.delete(a);t.onerror=t=>{s(Nt(t,"storage-delete"))},t.onsuccess=()=>{n()}}catch(t){s(mt.create("storage-delete",{originalErrorMessage:null===(r=t)||void 0===r?void 0:r.message}))}}))}createCompositeKey(t){return[this.appId,this.appName,this.namespace,t].join()}}class Rt{constructor(t){this.storage=t}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}async loadFromStorage(){const t=this.storage.getLastFetchStatus(),e=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),s=await t;s&&(this.lastFetchStatus=s);const r=await e;r&&(this.lastSuccessfulFetchTimestampMillis=r);const i=await n;i&&(this.activeConfig=i)}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)}}async function At(t){return t=l(t),await Et(t),yt(t)}async function Bt(){if(!i())return!1;try{return await new Promise(((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var t;e((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}}))}catch(t){return!1}}e(new g("remote-config",(function(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("installations-internal").getImmediate();if("undefined"==typeof window)throw mt.create("registration-window");if(!i())throw mt.create("indexed-db-unavailable");const{projectId:a,apiKey:o,appId:c}=n.options;if(!a)throw mt.create("registration-project-id");if(!o)throw mt.create("registration-api-key");if(!c)throw mt.create("registration-app-id");e=e||"firebase";const u=new jt(c,n.name,e),l=new Rt(u),g=new w(dt);g.logLevel=h.ERROR;const f=new Ft(s,r,e,a,o,c),d=new Pt(f,u),p=new Dt(d,u,l,g),m=new Ot(n,p,l,u,g);return bt(m),m}),"PUBLIC").setMultipleInstances(!0)),t(dt,"0.3.14"),t(dt,"0.3.14","esm2017");export{yt as activate,bt as ensureInitialized,At as fetchAndActivate,Et as fetchConfig,St as getAll,It as getBoolean,Ct as getNumber,_t as getRemoteConfig,Tt as getString,Lt as getValue,Bt as isSupported,Mt as setLogLevel};
1
+ import{registerVersion as t,_registerComponent as e,_getProvider as n,getApp as s,SDK_VERSION as r}from"https://www.gstatic.com/firebasejs/9.13.0/firebase-app.js";function i(){return"object"==typeof indexedDB}class a extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,o.prototype.create)}}class o{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){return t.replace(c,((t,n)=>{const s=e[n];return null!=s?String(s):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new a(s,o,n)}}const c=/\{\$([^}]+)}/g;function u(t,e=1e3,n=2){const s=e*Math.pow(n,t),r=Math.round(.5*s*(Math.random()-.5)*2);return Math.min(144e5,s+r)}function l(t){return t&&t._delegate?t._delegate:t}class g{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}var h;!function(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"}(h||(h={}));const f={debug:h.DEBUG,verbose:h.VERBOSE,info:h.INFO,warn:h.WARN,error:h.ERROR,silent:h.SILENT},d=h.INFO,p={[h.DEBUG]:"log",[h.VERBOSE]:"log",[h.INFO]:"info",[h.WARN]:"warn",[h.ERROR]:"error"},m=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=p[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class w{constructor(t){this.name=t,this._logLevel=d,this._logHandler=m,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in h))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?f[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,h.DEBUG,...t),this._logHandler(this,h.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,h.VERBOSE,...t),this._logHandler(this,h.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,h.INFO,...t),this._logHandler(this,h.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,h.WARN,...t),this._logHandler(this,h.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,h.ERROR,...t),this._logHandler(this,h.ERROR,...t)}}let v,_;const y=new WeakMap,b=new WeakMap,E=new WeakMap,S=new WeakMap,I=new WeakMap;let C={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return b.get(t);if("objectStoreNames"===e)return t.objectStoreNames||E.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return M(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function T(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(_||(_=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(D(this),e),M(y.get(this))}:function(...e){return M(t.apply(D(this),e))}:function(e,...n){const s=t.call(D(this),e,...n);return E.set(s,e.sort?e.sort():[e]),M(s)}}function L(t){return"function"==typeof t?T(t):(t instanceof IDBTransaction&&function(t){if(b.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));b.set(t,e)}(t),e=t,(v||(v=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,C):t);var e}function M(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(M(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&y.set(e,t)})).catch((()=>{})),I.set(e,t),e}(t);if(S.has(t))return S.get(t);const e=L(t);return e!==t&&(S.set(t,e),I.set(e,t)),e}const D=t=>I.get(t);const k=["get","getKey","getAll","getAllKeys","count"],F=["put","add","delete","clear"],P=new Map;function O(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(P.get(e))return P.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=F.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!k.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let a=i.store;return s&&(a=a.index(e.shift())),(await Promise.all([a[n](...e),r&&i.done]))[0]};return P.set(e,i),i}C=(t=>({...t,get:(e,n,s)=>O(e,n)||t.get(e,n,s),has:(e,n)=>!!O(e,n)||t.has(e,n)}))(C);const N="@firebase/installations",j=new o("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 R(t){return t instanceof a&&t.code.includes("request-failed")}function A({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function B(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function $(t,e){const n=(await e.json()).error;return j.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function H({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function x(t,{refreshToken:e}){const n=H(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function q(t){const e=await t();return e.status>=500&&e.status<600?t():e}function K(t){return new Promise((e=>{setTimeout(e,t)}))}const U=/^[cdef][\w-]{21}$/;function V(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return U.test(e)?e:""}catch(t){return""}}function z(t){return`${t.appName}!${t.appId}`}const G=new Map;function W(t,e){const n=z(t);J(n,e),function(t,e){const n=function(){!Y&&"BroadcastChannel"in self&&(Y=new BroadcastChannel("[Firebase] FID Change"),Y.onmessage=t=>{J(t.data.key,t.data.fid)});return Y}();n&&n.postMessage({key:t,fid:e});0===G.size&&Y&&(Y.close(),Y=null)}(n,e)}function J(t,e){const n=G.get(t);if(n)for(const t of n)t(e)}let Y=null;const Z="firebase-installations-store";let Q=null;function X(){return Q||(Q=function(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const a=indexedDB.open(t,e),o=M(a);return s&&a.addEventListener("upgradeneeded",(t=>{s(M(a.result),t.oldVersion,t.newVersion,M(a.transaction))})),n&&a.addEventListener("blocked",(()=>n())),o.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(()=>r()))})).catch((()=>{})),o}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Z)}})),Q}async function tt(t,e){const n=z(t),s=(await X()).transaction(Z,"readwrite"),r=s.objectStore(Z),i=await r.get(n);return await r.put(e,n),await s.done,i&&i.fid===e.fid||W(t,e.fid),e}async function et(t){const e=z(t),n=(await X()).transaction(Z,"readwrite");await n.objectStore(Z).delete(e),await n.done}async function nt(t,e){const n=z(t),s=(await X()).transaction(Z,"readwrite"),r=s.objectStore(Z),i=await r.get(n),a=e(i);return void 0===a?await r.delete(n):await r.put(a,n),await s.done,!a||i&&i.fid===a.fid||W(t,a.fid),a}async function st(t){let e;const n=await nt(t.appConfig,(n=>{const s=function(t){return at(t||{fid:V(),registrationStatus:0})}(n),r=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(j.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},s=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=A(t),r=H(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const a={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.5.16"},o={method:"POST",headers:r,body:JSON.stringify(a)},c=await q((()=>fetch(s,o)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:B(t.authToken)}}throw await $("Create Installation",c)}(t,e);return tt(t.appConfig,n)}catch(n){throw R(n)&&409===n.customData.serverCode?await et(t.appConfig):await tt(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:s}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:rt(t)}:{installationEntry:e}}(t,s);return e=r.registrationPromise,r.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function rt(t){let e=await it(t.appConfig);for(;1===e.registrationStatus;)await K(100),e=await it(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await st(t);return n||e}return e}function it(t){return nt(t,(t=>{if(!t)throw j.create("installation-not-found");return at(t)}))}function at(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function ot({appConfig:t,heartbeatServiceProvider:e},n){const s=function(t,{fid:e}){return`${A(t)}/${e}/authTokens:generate`}(t,n),r=x(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&r.append("x-firebase-client",t)}const a={installation:{sdkVersion:"w:0.5.16",appId:t.appId}},o={method:"POST",headers:r,body:JSON.stringify(a)},c=await q((()=>fetch(s,o)));if(c.ok){return B(await c.json())}throw await $("Generate Auth Token",c)}async function ct(t,e=!1){let n;const s=await nt(t.appConfig,(s=>{if(!lt(s))throw j.create("not-registered");const r=s.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(r))return s;if(1===r.requestStatus)return n=async function(t,e){let n=await ut(t.appConfig);for(;1===n.authToken.requestStatus;)await K(100),n=await ut(t.appConfig);const s=n.authToken;return 0===s.requestStatus?ct(t,e):s}(t,e),s;{if(!navigator.onLine)throw j.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(s);return n=async function(t,e){try{const n=await ot(t,e),s=Object.assign(Object.assign({},e),{authToken:n});return await tt(t.appConfig,s),n}catch(n){if(!R(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await tt(t.appConfig,n)}else await et(t.appConfig);throw n}}(t,e),e}}));return n?await n:s.authToken}function ut(t){return nt(t,(t=>{if(!lt(t))throw j.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function lt(t){return void 0!==t&&2===t.registrationStatus}async function gt(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await st(t);e&&await e}(n);return(await ct(n,e)).token}function ht(t){return j.create("missing-app-config-values",{valueName:t})}const ft=t=>{const e=t.getProvider("app").getImmediate(),s=n(e,"installations").getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:s}=await st(e);return s?s.catch(console.error):ct(e).catch(console.error),n.fid}(s),getToken:t=>gt(s,t)}};e(new g("installations",(t=>{const e=t.getProvider("app").getImmediate(),s=function(t){if(!t||!t.options)throw ht("App Configuration");if(!t.name)throw ht("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw ht(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:s,heartbeatServiceProvider:n(e,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),e(new g("installations-internal",ft,"PRIVATE")),t(N,"0.5.16"),t(N,"0.5.16","esm2017");const dt="@firebase/remote-config";class pt{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}abort(){this.listeners.forEach((t=>t()))}}const mt=new o("remoteconfig","Remote Config",{"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"});const wt=["1","true","t","yes","y","on"];class vt{constructor(t,e=""){this._source=t,this._value=e}asString(){return this._value}asBoolean(){return"static"!==this._source&&wt.indexOf(this._value.toLowerCase())>=0}asNumber(){if("static"===this._source)return 0;let t=Number(this._value);return isNaN(t)&&(t=0),t}getSource(){return this._source}}function _t(t=s()){t=l(t);return n(t,"remote-config").getImmediate()}async function yt(t){const e=l(t),[n,s]=await Promise.all([e._storage.getLastSuccessfulFetchResponse(),e._storage.getActiveConfigEtag()]);return!!(n&&n.config&&n.eTag&&n.eTag!==s)&&(await Promise.all([e._storageCache.setActiveConfig(n.config),e._storage.setActiveConfigEtag(n.eTag)]),!0)}function bt(t){const e=l(t);return e._initializePromise||(e._initializePromise=e._storageCache.loadFromStorage().then((()=>{e._isInitializationComplete=!0}))),e._initializePromise}async function Et(t){const e=l(t),n=new pt;setTimeout((async()=>{n.abort()}),e.settings.fetchTimeoutMillis);try{await e._client.fetch({cacheMaxAgeMillis:e.settings.minimumFetchIntervalMillis,signal:n}),await e._storageCache.setLastFetchStatus("success")}catch(t){const n=function(t,e){return t instanceof a&&-1!==t.code.indexOf(e)}(t,"fetch-throttle")?"throttle":"failure";throw await e._storageCache.setLastFetchStatus(n),t}}function St(t){const e=l(t);return function(t={},e={}){return Object.keys(Object.assign(Object.assign({},t),e))}(e._storageCache.getActiveConfig(),e.defaultConfig).reduce(((e,n)=>(e[n]=Lt(t,n),e)),{})}function It(t,e){return Lt(l(t),e).asBoolean()}function Ct(t,e){return Lt(l(t),e).asNumber()}function Tt(t,e){return Lt(l(t),e).asString()}function Lt(t,e){const n=l(t);n._isInitializationComplete||n._logger.debug(`A value was requested for key "${e}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);const s=n._storageCache.getActiveConfig();return s&&void 0!==s[e]?new vt("remote",s[e]):n.defaultConfig&&void 0!==n.defaultConfig[e]?new vt("default",String(n.defaultConfig[e])):(n._logger.debug(`Returning static value for key "${e}". Define a default or remote value if this is unintentional.`),new vt("static"))}function Mt(t,e){const n=l(t);switch(e){case"debug":n._logger.logLevel=h.DEBUG;break;case"silent":n._logger.logLevel=h.SILENT;break;default:n._logger.logLevel=h.ERROR}}class Dt{constructor(t,e,n,s){this.client=t,this.storage=e,this.storageCache=n,this.logger=s}isCachedDataFresh(t,e){if(!e)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;const n=Date.now()-e,s=n<=t;return this.logger.debug(`Config fetch cache check. Cache age millis: ${n}. Cache max age millis (minimumFetchIntervalMillis setting): ${t}. Is cache hit: ${s}.`),s}async fetch(t){const[e,n]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(n&&this.isCachedDataFresh(t.cacheMaxAgeMillis,e))return n;t.eTag=n&&n.eTag;const s=await this.client.fetch(t),r=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return 200===s.status&&r.push(this.storage.setLastSuccessfulFetchResponse(s)),await Promise.all(r),s}}function kt(t=navigator){return t.languages&&t.languages[0]||t.language}class Ft{constructor(t,e,n,s,r,i){this.firebaseInstallations=t,this.sdkVersion=e,this.namespace=n,this.projectId=s,this.apiKey=r,this.appId=i}async fetch(t){var e,n,s;const[r,i]=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}`,o={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":t.eTag||"*"},c={sdk_version:this.sdkVersion,app_instance_id:r,app_instance_id_token:i,app_id:this.appId,language_code:kt()},u={method:"POST",headers:o,body:JSON.stringify(c)},l=fetch(a,u),g=new Promise(((e,n)=>{t.signal.addEventListener((()=>{const t=new Error("The operation was aborted.");t.name="AbortError",n(t)}))}));let h;try{await Promise.race([l,g]),h=await l}catch(t){let s="fetch-client-network";throw"AbortError"===(null===(e=t)||void 0===e?void 0:e.name)&&(s="fetch-timeout"),mt.create(s,{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message})}let f=h.status;const d=h.headers.get("ETag")||void 0;let p,m;if(200===h.status){let t;try{t=await h.json()}catch(t){throw mt.create("fetch-client-parse",{originalErrorMessage:null===(s=t)||void 0===s?void 0:s.message})}p=t.entries,m=t.state}if("INSTANCE_STATE_UNSPECIFIED"===m?f=500:"NO_CHANGE"===m?f=304:"NO_TEMPLATE"!==m&&"EMPTY_CONFIG"!==m||(p={}),304!==f&&200!==f)throw mt.create("fetch-status",{httpStatus:f});return{status:f,eTag:d,config:p}}}class Pt{constructor(t,e){this.client=t,this.storage=e}async fetch(t){const e=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(t,e)}async attemptFetch(t,{throttleEndTimeMillis:e,backoffCount:n}){await function(t,e){return new Promise(((n,s)=>{const r=Math.max(e-Date.now(),0),i=setTimeout(n,r);t.addEventListener((()=>{clearTimeout(i),s(mt.create("fetch-throttle",{throttleEndTimeMillis:e}))}))}))}(t.signal,e);try{const e=await this.client.fetch(t);return await this.storage.deleteThrottleMetadata(),e}catch(e){if(!function(t){if(!(t instanceof a&&t.customData))return!1;const e=Number(t.customData.httpStatus);return 429===e||500===e||503===e||504===e}(e))throw e;const s={throttleEndTimeMillis:Date.now()+u(n),backoffCount:n+1};return await this.storage.setThrottleMetadata(s),this.attemptFetch(t,s)}}}class Ot{constructor(t,e,n,s,r){this.app=t,this._client=e,this._storageCache=n,this._storage=s,this._logger=r,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:6e4,minimumFetchIntervalMillis:432e5},this.defaultConfig={}}get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}}function Nt(t,e){var n;const s=t.target.error||void 0;return mt.create(e,{originalErrorMessage:s&&(null===(n=s)||void 0===n?void 0:n.message)})}class jt{constructor(t,e,n,s=function(){return new Promise(((t,e)=>{var n;try{const n=indexedDB.open("firebase_remote_config",1);n.onerror=t=>{e(Nt(t,"storage-open"))},n.onsuccess=e=>{t(e.target.result)},n.onupgradeneeded=t=>{const e=t.target.result;0===t.oldVersion&&e.createObjectStore("app_namespace_store",{keyPath:"compositeKey"})}}catch(t){e(mt.create("storage-open",{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message}))}}))}()){this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=s}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 e=await this.openDbPromise;return new Promise(((n,s)=>{var r;const i=e.transaction(["app_namespace_store"],"readonly").objectStore("app_namespace_store"),a=this.createCompositeKey(t);try{const t=i.get(a);t.onerror=t=>{s(Nt(t,"storage-get"))},t.onsuccess=t=>{const e=t.target.result;n(e?e.value:void 0)}}catch(t){s(mt.create("storage-get",{originalErrorMessage:null===(r=t)||void 0===r?void 0:r.message}))}}))}async set(t,e){const n=await this.openDbPromise;return new Promise(((s,r)=>{var i;const a=n.transaction(["app_namespace_store"],"readwrite").objectStore("app_namespace_store"),o=this.createCompositeKey(t);try{const t=a.put({compositeKey:o,value:e});t.onerror=t=>{r(Nt(t,"storage-set"))},t.onsuccess=()=>{s()}}catch(t){r(mt.create("storage-set",{originalErrorMessage:null===(i=t)||void 0===i?void 0:i.message}))}}))}async delete(t){const e=await this.openDbPromise;return new Promise(((n,s)=>{var r;const i=e.transaction(["app_namespace_store"],"readwrite").objectStore("app_namespace_store"),a=this.createCompositeKey(t);try{const t=i.delete(a);t.onerror=t=>{s(Nt(t,"storage-delete"))},t.onsuccess=()=>{n()}}catch(t){s(mt.create("storage-delete",{originalErrorMessage:null===(r=t)||void 0===r?void 0:r.message}))}}))}createCompositeKey(t){return[this.appId,this.appName,this.namespace,t].join()}}class Rt{constructor(t){this.storage=t}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}async loadFromStorage(){const t=this.storage.getLastFetchStatus(),e=this.storage.getLastSuccessfulFetchTimestampMillis(),n=this.storage.getActiveConfig(),s=await t;s&&(this.lastFetchStatus=s);const r=await e;r&&(this.lastSuccessfulFetchTimestampMillis=r);const i=await n;i&&(this.activeConfig=i)}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)}}async function At(t){return t=l(t),await Et(t),yt(t)}async function Bt(){if(!i())return!1;try{return await new Promise(((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var t;e((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}}))}catch(t){return!1}}e(new g("remote-config",(function(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("installations-internal").getImmediate();if("undefined"==typeof window)throw mt.create("registration-window");if(!i())throw mt.create("indexed-db-unavailable");const{projectId:a,apiKey:o,appId:c}=n.options;if(!a)throw mt.create("registration-project-id");if(!o)throw mt.create("registration-api-key");if(!c)throw mt.create("registration-app-id");e=e||"firebase";const u=new jt(c,n.name,e),l=new Rt(u),g=new w(dt);g.logLevel=h.ERROR;const f=new Ft(s,r,e,a,o,c),d=new Pt(f,u),p=new Dt(d,u,l,g),m=new Ot(n,p,l,u,g);return bt(m),m}),"PUBLIC").setMultipleInstances(!0)),t(dt,"0.3.15"),t(dt,"0.3.15","esm2017");export{yt as activate,bt as ensureInitialized,At as fetchAndActivate,Et as fetchConfig,St as getAll,It as getBoolean,Ct as getNumber,_t as getRemoteConfig,Tt as getString,Lt as getValue,Bt as isSupported,Mt as setLogLevel};
2
2
 
3
3
  //# sourceMappingURL=firebase-remote-config.js.map
@@ -1,2 +1,2 @@
1
- !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(Ze,Ye){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o,t,r,s,n=e(Ze);function i(t){const r=[];let s=0;for(let n=0;n<t.length;n++){let e=t.charCodeAt(n);e<128?r[s++]=e:(e<2048?r[s++]=e>>6|192:(55296==(64512&e)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++n)),r[s++]=e>>18|240,r[s++]=e>>12&63|128):r[s++]=e>>12|224,r[s++]=e>>6&63|128),r[s++]=63&e|128)}return r}function a(e){return l(e).replace(/\./g,"")}const h={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:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var s=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let u=0;u<r.length;u+=3){var i=r[u],o=u+1<r.length,a=o?r[u+1]:0,h=u+2<r.length,l=h?r[u+2]:0;let e=(15&a)<<2|l>>6,t=63&l;h||(t=64,o||(e=64)),n.push(s[i>>2],s[(3&i)<<4|a>>4],s[e],s[t])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,s=0;for(;r<e.length;){var n,i,o=e[r++];o<128?t[s++]=String.fromCharCode(o):191<o&&o<224?(n=e[r++],t[s++]=String.fromCharCode((31&o)<<6|63&n)):239<o&&o<365?(i=((7&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[s++]=String.fromCharCode(55296+(i>>10)),t[s++]=String.fromCharCode(56320+(1023&i))):(n=e[r++],i=e[r++],t[s++]=String.fromCharCode((15&o)<<12|(63&n)<<6|63&i))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const s=[];for(let h=0;h<e.length;){var n=r[e.charAt(h++)],i=h<e.length?r[e.charAt(h)]:0;++h;var o=h<e.length?r[e.charAt(h)]:64;++h;var a=h<e.length?r[e.charAt(h)]:64;if(++h,null==n||null==i||null==o||null==a)throw Error();s.push(n<<2|i>>4),64!==o&&(s.push(i<<4&240|o>>2),64!==a&&s.push(o<<6&192|a))}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},l=function(e){var t=i(e);return h.encodeByteArray(t,!0)};class u extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,u.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var s,r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],i=i?(s=r,i.replace(d,(e,t)=>{var r=s[t];return null!=r?String(r):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${n}).`;return new u(n,i,r)}}const d=/\{\$([^}]+)}/g;function _(e){return e&&e._delegate?e._delegate:e}class p{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}}const f="firebasestorage.googleapis.com",g="storageBucket";class m extends u{constructor(e,t,r=0){super(b(e),`Firebase Storage: ${t} (${b(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,m.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return b(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}function b(e){return"storage/"+e}function v(){return new m("unknown","An unknown error occurred, please check the error payload for server response.")}function w(){return new m("retry-limit-exceeded","Max retry time for operation exceeded, please try again.")}function y(){return new m("canceled","User canceled the upload/download.")}function T(){return new m("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function R(e){return new m("invalid-argument",e)}function k(){return new m("app-deleted","The Firebase app was deleted.")}function S(e){return new m("invalid-root-operation","The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function C(e,t){return new m("invalid-format","String does not match format '"+e+"': "+t)}function x(e){throw new m("internal-error","Internal error: "+e)}class E{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let r;try{r=E.makeFromUrl(t,e)}catch(e){return new E(t,"")}if(""===r.path)return r;throw t=t,new m("invalid-default-bucket","Invalid default bucket '"+t+"'.")}static makeFromUrl(e,t){let r=null;var s="([A-Za-z0-9.\\-_]+)";var n=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(e){e.path_=decodeURIComponent(e.path)}var o=t.replace(/[.]/g,"\\."),a=new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),o=t===f?"(?:storage.googleapis.com|storage.cloud.google.com)":t,h=[{regex:n,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:a,indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${o}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let c=0;c<h.length;c++){const d=h[c];var l=d.regex.exec(e);if(l){var u=l[d.indices.bucket];let e=l[d.indices.path];e=e||"",r=new E(u,e),d.postModify(r);break}}if(null==r)throw t=e,new m("invalid-url","Invalid URL '"+t+"'.");return r}}class A{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=0){}}function U(e){return"string"==typeof e||e instanceof String}function O(e){return P()&&e instanceof Blob}function P(){return"undefined"!=typeof Blob}function I(e,t,r,s){if(s<t)throw R(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r<s)throw R(`Invalid value for '${e}'. Expected ${r} or less.`)}function B(e,t,r){let s=null==r?`https://${t}`:t;return`${r}://${s}/v0${e}`}function M(e){const t=encodeURIComponent;let r="?";for(const n in e){var s;e.hasOwnProperty(n)&&(s=t(n)+"="+t(e[n]),r=r+s+"&")}return r=r.slice(0,-1),r}function N(e,t){var r=500<=e&&e<600,s=-1!==[408,429].indexOf(e),n=-1!==t.indexOf(e);return r||s||n}(t=o=o||{})[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT";class D{constructor(e,t,r,s,n,i,o,a,h,l,u,c=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=n,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=a,this.timeout_=h,this.progressCallback_=l,this.connectionFactory_=u,this.retry=c,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){var e=(s,e)=>{if(e)s(!1,new L(!1,null,!0));else{const n=this.connectionFactory_();this.pendingConnection_=n;const i=e=>{var t=e.loaded,r=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,r)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;var e,t=n.getErrorCode()===o.NO_ERROR,r=n.getStatus();t&&!N(r,this.additionalRetryCodes_)||!this.retry?(e=-1!==this.successCodes_.indexOf(r),s(!0,new L(e,n))):(e=n.getErrorCode()===o.ABORT,s(!1,new L(!1,null,e)))})}},t=(e,t)=>{const r=this.resolve_,s=this.reject_,n=t.connection;if(t.wasSuccessCode)try{var i=this.callback_(n,n.getResponse());void 0!==i?r(i):r()}catch(e){s(e)}else if(null!==n){const a=v();a.serverResponse=n.getErrorText(),this.errorCallback_?s(this.errorCallback_(n,a)):s(a)}else{var o;t.canceled?(o=(this.appDelete_?k:y)(),s(o)):(o=w(),s(o))}};this.canceled_?t(0,new L(!1,null,!0)):this.backoffId_=function(t,r,e){let s=1,n=null,i=null,o=!1,a=0;function h(){return 2===a}let l=!1;function u(...e){l||(l=!0,r.apply(null,e))}function c(e){n=setTimeout(()=>{n=null,t(_,h())},e)}function d(){i&&clearTimeout(i)}function _(t,...r){if(l)d();else{if(t)return d(),void u.call(null,t,...r);if(h()||o)return d(),void u.call(null,t,...r);s<64&&(s*=2);let e;e=1===a?(a=2,0):1e3*(s+Math.random()),c(e)}}let p=!1;function f(e){p||(p=!0,d(),l||(null!==n?(e||(a=2),clearTimeout(n),c(0)):e||(a=1)))}return c(0),i=setTimeout(()=>{f(o=!0)},e),f}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class L{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function q(...t){const r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0;if(void 0!==r){const s=new r;for(let e=0;e<t.length;e++)s.append(t[e]);return s.getBlob()}if(P())return new Blob(t);throw new m("unsupported-environment","This browser doesn't seem to support creating Blobs")}const F={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class z{constructor(e,t){this.data=e,this.contentType=t||null}}function j(e,t){switch(e){case F.RAW:return new z(H(t));case F.BASE64:case F.BASE64URL:return new z($(e,t));case F.DATA_URL:return new z((r=t,(s=new W(r)).base64?$(F.BASE64,s.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw C(F.DATA_URL,"Malformed data URL.")}return H(t)}(s.rest)),(r=t,new W(r).contentType))}var r,s;throw v()}function H(t){const r=[];for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);var s,n;e<=127?r.push(e):e<=2047?r.push(192|e>>6,128|63&e):55296==(64512&e)?i<t.length-1&&56320==(64512&t.charCodeAt(i+1))?(s=e,n=t.charCodeAt(++i),e=65536|(1023&s)<<10|1023&n,r.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e)):r.push(239,191,189):56320==(64512&e)?r.push(239,191,189):r.push(224|e>>12,128|e>>6&63,128|63&e)}return new Uint8Array(r)}function $(t,e){switch(t){case F.BASE64:var r=-1!==e.indexOf("-"),s=-1!==e.indexOf("_");if(r||s)throw C(t,"Invalid character '"+(r?"-":"_")+"' found: is it base64url encoded?");break;case F.BASE64URL:s=-1!==e.indexOf("+"),r=-1!==e.indexOf("/");if(s||r)throw C(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}let n;try{n=atob(e)}catch(e){throw C(t,"Invalid character found")}const i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i}class W{constructor(e){this.base64=!1,this.contentType=null;var t,r,s=e.match(/^data:([^,]+)?,/);if(null===s)throw C(F.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=s[1]||null;null!=n&&(this.base64=(t=n,r=";base64",t.length>=r.length&&t.substring(t.length-r.length)===r),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=e.substring(e.indexOf(",")+1)}}class V{constructor(e,t){let r=0,s="";O(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(O(this.data_)){var r=this.data_,r=(n=e,i=t,(s=r).webkitSlice?s.webkitSlice(n,i):s.mozSlice?s.mozSlice(n,i):s.slice?s.slice(n,i):null);return null===r?null:new V(r)}var s,n,i,r=new Uint8Array(this.data_.buffer,e,t-e);return new V(r,!0)}static getBlob(...e){if(P()){var t=e.map(e=>e instanceof V?e.data_:e);return new V(q.apply(null,t))}{const s=e.map(e=>U(e)?j(F.RAW,e).data:e.data_);let t=0;s.forEach(e=>{t+=e.byteLength});const n=new Uint8Array(t);let r=0;return s.forEach(e=>{for(let t=0;t<e.length;t++)n[r++]=e[t]}),new V(n,!0)}}uploadData(){return this.data_}}function G(e){let t;try{t=JSON.parse(e)}catch(e){return null}return"object"!=typeof(e=t)||Array.isArray(e)?null:t}function X(e){var t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function K(e,t){return t}class J{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||K}}let Z=null;function Y(){if(Z)return Z;const e=[];e.push(new J("bucket")),e.push(new J("generation")),e.push(new J("metageneration")),e.push(new J("name","fullPath",!0));const t=new J("name");t.xform=function(e,t){return!U(t=t)||t.length<2?t:X(t)},e.push(t);const r=new J("size");return r.xform=function(e,t){return void 0!==t?Number(t):t},e.push(r),e.push(new J("timeCreated")),e.push(new J("updated")),e.push(new J("md5Hash",null,!0)),e.push(new J("cacheControl",null,!0)),e.push(new J("contentDisposition",null,!0)),e.push(new J("contentEncoding",null,!0)),e.push(new J("contentLanguage",null,!0)),e.push(new J("contentType",null,!0)),e.push(new J("metadata","customMetadata",!0)),Z=e,Z}function Q(r,s){Object.defineProperty(r,"ref",{get:function(){var e=r.bucket,t=r.fullPath,t=new E(e,t);return s._makeStorageReference(t)}})}function ee(e,t,r){var s=G(t);return null===s?null:function(e,t,r){const s={type:"file"};var n=r.length;for(let i=0;i<n;i++){const o=r[i];s[o.local]=o.xform(s,t[o.server])}return Q(s,e),s}(e,s,r)}function te(e,t){const r={};var s=t.length;for(let i=0;i<s;i++){var n=t[i];n.writable&&(r[n.server]=e[n.local])}return JSON.stringify(r)}const re="prefixes";function se(e,t,r){var s=G(r);return null===s?null:function(e,t,r){const s={prefixes:[],items:[],nextPageToken:r.nextPageToken};if(r[re])for(const o of r[re]){var n=o.replace(/\/$/,""),n=e._makeStorageReference(new E(t,n));s.prefixes.push(n)}if(r.items)for(const a of r.items){var i=e._makeStorageReference(new E(t,a.name));s.items.push(i)}return s}(e,t,s)}class ne{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function ie(e){if(!e)throw v()}function oe(s,n){return function(e,t){var r=ee(s,t,n);return ie(null!==r),r}}function ae(s,n){return function(e,t){var r=se(s,n,t);return ie(null!==r),r}}function he(s,n){return function(e,t){var r=ee(s,t,n);return ie(null!==r),function(s,e,n,i){var t=G(e);if(null===t)return null;if(!U(t.downloadTokens))return null;const r=t.downloadTokens;if(0===r.length)return null;const o=encodeURIComponent,a=r.split(",");return a.map(e=>{var t=s.bucket,r=s.fullPath;return B("/b/"+o(t)+"/o/"+o(r),n,i)+M({alt:"media",token:e})})[0]}(r,t,s.host,s._protocol)}}function le(n){return function(e,t){let r;var s;return r=401===e.getStatus()?e.getErrorText().includes("Firebase App Check token is invalid")?new m("unauthorized-app","This app does not have permission to access Firebase Storage on this project."):new m("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(s=n.bucket,new m("quota-exceeded","Quota for bucket '"+s+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(s=n.path,new m("unauthorized","User does not have permission to access '"+s+"'.")):t,r.status=e.getStatus(),r.serverResponse=t.serverResponse,r}}function ue(s){const n=le(s);return function(e,t){let r=n(e,t);return 404===e.getStatus()&&(r=(e=s.path,new m("object-not-found","Object '"+e+"' does not exist."))),r.serverResponse=t.serverResponse,r}}function ce(e,t,r){var s=B(t.fullServerUrl(),e.host,e._protocol),n=e.maxOperationRetryTime;const i=new ne(s,"GET",oe(e,r),n);return i.errorHandler=ue(t),i}function de(e,t,r){const s=Object.assign({},r);return s.fullPath=e.path,s.size=t.size(),s.contentType||(s.contentType=(e=t,(t=null)&&t.contentType||e&&e.type()||"application/octet-stream")),s}function _e(e,t,r,s,n){var i=t.bucketOnlyServerUrl();const o={"X-Goog-Upload-Protocol":"multipart"};var a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();o["Content-Type"]="multipart/related; boundary="+a;var h=de(t,s,n),l="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+te(h,r)+"\r\n--"+a+"\r\nContent-Type: "+h.contentType+"\r\n\r\n",a="\r\n--"+a+"--";const u=V.getBlob(l,s,a);if(null===u)throw T();a={name:h.fullPath},h=B(i,e.host,e._protocol),i=e.maxUploadRetryTime;const c=new ne(h,"POST",oe(e,r),i);return c.urlParams=a,c.headers=o,c.body=u.uploadData(),c.errorHandler=le(t),c}class pe{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function fe(e,t){let r=null;try{r=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){ie(!1)}const s=t||["active"];return ie(!!r&&-1!==s.indexOf(r)),r}function ge(e,t,r,s,n){var i=t.bucketOnlyServerUrl(),o=de(t,s,n),a={name:o.fullPath},h=B(i,e.host,e._protocol),l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},i=te(o,r),o=e.maxUploadRetryTime;const u=new ne(h,"POST",function(e){fe(e);let t;try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){ie(!1)}return ie(U(t)),t},o);return u.urlParams=a,u.headers=l,u.body=i,u.errorHandler=le(t),u}function me(e,t,r,n){var s=e.maxUploadRetryTime;const i=new ne(r,"POST",function(e){var t=fe(e,["active","final"]);let r=null;try{r=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){ie(!1)}r||ie(!1);var s=Number(r);return ie(!isNaN(s)),new pe(s,n.size(),"final"===t)},s);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=le(t),i}function be(e,o,t,a,r,h,s,n){const l=new pe(0,0);if(s?(l.current=s.current,l.total=s.total):(l.current=0,l.total=a.size()),a.size()!==l.total)throw new m("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var i=l.total-l.current;let u=i;0<r&&(u=Math.min(u,r));var c=l.current,d=c+u;let _="";_=0===u?"finalize":i===u?"upload, finalize":"upload";i={"X-Goog-Upload-Command":_,"X-Goog-Upload-Offset":`${l.current}`};const p=a.slice(c,d);if(null===p)throw T();d=o.maxUploadRetryTime;const f=new ne(t,"POST",function(e,t){var r=fe(e,["active","final"]),s=l.current+u,n=a.size();let i;return i="final"===r?oe(o,h)(e,t):null,new pe(s,n,"final"===r,i)},d);return f.headers=i,f.body=p.uploadData(),f.progressCallback=n||null,f.errorHandler=le(e),f}const ve={STATE_CHANGED:"state_changed"},we={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function ye(e){switch(e){case"running":case"pausing":case"canceling":return we.RUNNING;case"paused":return we.PAUSED;case"success":return we.SUCCESS;case"canceled":return we.CANCELED;default:return we.ERROR}}class Te{constructor(e,t,r){var s;"function"==typeof e||null!=t||null!=r?(this.next=e,this.error=null!=t?t:void 0,this.complete=null!=r?r:void 0):(this.next=(s=e).next,this.error=s.error,this.complete=s.complete)}}function Re(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class ke extends class{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=o.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=o.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=o.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw x("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==s)for(const n in s)s.hasOwnProperty(n)&&this.xhr_.setRequestHeader(n,s[n].toString());return void 0!==r?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw x("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw x("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw x("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw x("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}{initXhr(){this.xhr_.responseType="text"}}function Se(){return new ke}class Ce{constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=Y(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals("canceled"))this._needToFetchStatus=!0,this.completeTransitions_();else{var t=this.isExponentialBackoffExpired();if(N(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=w()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals("canceled")?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(e){return 262144<e.size()}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(r){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,t])=>{switch(this._state){case"running":r(e,t);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{var r=ge(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const n=this._uploadUrl;this._resolveToken((e,t)=>{var r=me(this._ref.storage,this._ref._location,n,this._blob);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const n=262144*this._chunkMultiplier,i=new pe(this._transferred,this._blob.size()),o=this._uploadUrl;this._resolveToken((e,t)=>{let r;try{r=be(this._ref._location,this._ref.storage,o,this._blob,n,this._mappings,i,this._makeProgressCallback())}catch(e){return this._error=e,void this._transition("error")}const s=this._ref.storage._makeRequest(r,Se,e,t,!1);this._request=s,s.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(262144*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{var r=ce(this._ref.storage,this._ref._location,this._mappings);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{var r=_e(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){var t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":var t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=y(),this._state=e,this._notifyObservers();break;case"error":case"success":this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){var e=ye(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const n=new Te(t||void 0,r||void 0,s||void 0);return this._addObserver(n),()=>{this._removeObserver(n)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){var t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();const e=this._observers.slice();e.forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(ye(this._state)){case we.SUCCESS:Re(this._resolve.bind(null,this.snapshot))();break;case we.CANCELED:case we.ERROR:const t=this._reject;Re(t.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(ye(this._state)){case we.RUNNING:case we.PAUSED:e.next&&Re(e.next.bind(e,this.snapshot))();break;case we.SUCCESS:e.complete&&Re(e.complete.bind(e))();break;case we.CANCELED:case we.ERROR:default:e.error&&Re(e.error.bind(e,this._error))()}}resume(){var e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){var e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){var e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class xe{constructor(e,t){this._service=e,t instanceof E?this._location=t:this._location=E.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new xe(e,t)}get root(){var e=new E(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return X(this._location.path)}get storage(){return this._service}get parent(){var e=function(e){if(0===e.length)return null;var t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;e=new E(this._location.bucket,e);return new xe(this._service,e)}_throwIfRoot(e){if(""===this._location.path)throw S(e)}}function Ee(e){const t={prefixes:[],items:[]};return async function e(t,r,s){const n={pageToken:s};const i=await Ae(t,n);r.prefixes.push(...i.prefixes);r.items.push(...i.items);null!=i.nextPageToken&&await e(t,r,i.nextPageToken)}(e,t).then(()=>t)}function Ae(e,t){null!=t&&"number"==typeof t.maxResults&&I("options.maxResults",1,1e3,t.maxResults);var r=t||{},r=function(e,t,r,s,n){const i={};t.isRoot?i.prefix="":i.prefix=t.path+"/",r&&0<r.length&&(i.delimiter=r),s&&(i.pageToken=s),n&&(i.maxResults=n);var o=B(t.bucketOnlyServerUrl(),e.host,e._protocol),a=e.maxOperationRetryTime;const h=new ne(o,"GET",ae(e,t.bucket),a);return h.urlParams=i,h.errorHandler=le(t),h}(e.storage,e._location,"/",r.pageToken,r.maxResults);return e.storage.makeRequestWithTokens(r,Se)}function Ue(e,t){e._throwIfRoot("updateMetadata");var r=function(e,t,r,s){var n=B(t.fullServerUrl(),e.host,e._protocol),i=te(r,s),o=e.maxOperationRetryTime;const a=new ne(n,"PATCH",oe(e,s),o);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=i,a.errorHandler=ue(t),a}(e.storage,e._location,t,Y());return e.storage.makeRequestWithTokens(r,Se)}function Oe(e){e._throwIfRoot("getDownloadURL");var t=function(e,t,r){var s=B(t.fullServerUrl(),e.host,e._protocol),n=e.maxOperationRetryTime;const i=new ne(s,"GET",he(e,r),n);return i.errorHandler=ue(t),i}(e.storage,e._location,Y());return e.storage.makeRequestWithTokens(t,Se).then(e=>{if(null===e)throw new m("no-download-url","The given file does not have any download URLs.");return e})}function Pe(e){e._throwIfRoot("deleteObject");var t=function(e,t){var r=B(t.fullServerUrl(),e.host,e._protocol),s=e.maxOperationRetryTime;const n=new ne(r,"DELETE",function(e,t){},s);return n.successCodes=[200,204],n.errorHandler=ue(t),n}(e.storage,e._location);return e.storage.makeRequestWithTokens(t,Se)}function Ie(e,t){var r,s=(r=e._location.path,s=t.split("/").filter(e=>0<e.length).join("/"),0===r.length?s:r+"/"+s),s=new E(e._location.bucket,s);return new xe(e.storage,s)}function Be(e,t){if(e instanceof Le){var r=e;if(null==r._bucket)throw new m("no-default-bucket","No default bucket found. Did you set the '"+g+"' property when initializing the app?");r=new xe(r,r._bucket);return null!=t?Be(r,t):r}return void 0!==t?Ie(e,t):e}function Me(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof Le)return r=e,s=t,new xe(r,s);throw R("To use ref(service, url), the first argument must be a Storage instance.")}return Be(e,t);var r,s}function Ne(e,t){var r=null==t?void 0:t[g];return null==r?null:E.makeFromBucketSpec(r,e)}function De(e,t,r,s={}){e.host=`${t}:${r}`,e._protocol="http";var n=s["mockUserToken"];n&&(e._overrideAuthToken="string"==typeof n?n:function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var r=t||"demo-project",s=e.iat||0,n=e.sub||e.user_id;if(!n)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");return n=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:n,user_id:n,firebase:{sign_in_provider:"custom",identities:{}}},e),[a(JSON.stringify({alg:"none",type:"JWT"})),a(JSON.stringify(n)),""].join(".")}(n,e.app.options.projectId))}class Le{constructor(e,t,r,s,n){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=n,this._bucket=null,this._host=f,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?E.makeFromBucketSpec(s,this._host):Ne(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=E.makeFromBucketSpec(this._url,e):this._bucket=Ne(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){I("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){I("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){var t=await e.getToken();if(null!==t)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 xe(this,e)}_makeRequest(e,t,r,s,n=!0){if(this._deleted)return new A(k());{const u=([i,o,a,e,r,s,t=!0]=[e,this._appId,r,s,t,this._firebaseVersion,n],h=M(i.urlParams),l=i.url+h,h=Object.assign({},i.headers),n=h,(o=o)&&(n["X-Firebase-GMPID"]=o),o=h,null!==(a=a)&&0<a.length&&(o.Authorization="Firebase "+a),s=s,h["X-Firebase-Storage-Version"]="webjs/"+(null!=s?s:"AppManager"),s=h,null!==(e=e)&&(s["X-Firebase-AppCheck"]=e),new D(l,i.method,h,i.body,i.successCodes,i.additionalRetryCodes,i.handler,i.errorHandler,i.timeout,i.progressCallback,r,t));return this._requests.add(u),u.getPromise().then(()=>this._requests.delete(u),()=>this._requests.delete(u)),u}var i,o,a,h,l}async makeRequestWithTokens(e,t){var[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const qe="@firebase/storage";function Fe(e,t,r){return e=_(e),t=t,r=r,(e=e)._throwIfRoot("uploadBytesResumable"),new Ce(e,new V(t),r)}function ze(e){return function(e){e._throwIfRoot("getMetadata");var t=ce(e.storage,e._location,Y());return e.storage.makeRequestWithTokens(t,Se)}(e=_(e))}function je(e,t){return Me(e=_(e),t)}function He(e,{instanceIdentifier:t}){var r=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),n=e.getProvider("app-check-internal");return new Le(r,s,n,t,Ye.SDK_VERSION)}Ye._registerComponent(new p("storage",He,"PUBLIC").setMultipleInstances(!0)),Ye.registerVersion(qe,"0.9.12",""),Ye.registerVersion(qe,"0.9.12","esm2017");class $e{constructor(e,t,r){this._delegate=e,this.task=t,this.ref=r}get bytesTransferred(){return this._delegate.bytesTransferred}get metadata(){return this._delegate.metadata}get state(){return this._delegate.state}get totalBytes(){return this._delegate.totalBytes}}class We{constructor(e,t){this._delegate=e,this._ref=t,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate)}get snapshot(){return new $e(this._delegate.snapshot,this,this._ref)}then(t,e){return this._delegate.then(e=>{if(t)return t(new $e(e,this,this._ref))},e)}on(e,t,r,s){let n=void 0;return t&&(n="function"==typeof t?e=>t(new $e(e,this,this._ref)):{next:t.next?e=>t.next(new $e(e,this,this._ref)):void 0,complete:t.complete||void 0,error:t.error||void 0}),this._delegate.on(e,n,r||void 0,s||void 0)}}class Ve{constructor(e,t){this._delegate=e,this._service=t}get prefixes(){return this._delegate.prefixes.map(e=>new Ge(e,this._service))}get items(){return this._delegate.items.map(e=>new Ge(e,this._service))}get nextPageToken(){return this._delegate.nextPageToken||null}}class Ge{constructor(e,t){this._delegate=e,this.storage=t}get name(){return this._delegate.name}get bucket(){return this._delegate.bucket}get fullPath(){return this._delegate.fullPath}toString(){return this._delegate.toString()}child(e){var t=Ie(this._delegate,e);return new Ge(t,this.storage)}get root(){return new Ge(this._delegate.root,this.storage)}get parent(){var e=this._delegate.parent;return null==e?null:new Ge(e,this.storage)}put(e,t){return this._throwIfRoot("put"),new We(Fe(this._delegate,e,t),this)}putString(e,t=F.RAW,r){this._throwIfRoot("putString");var s=j(t,e);const n=Object.assign({},r);return null==n.contentType&&null!=s.contentType&&(n.contentType=s.contentType),new We(new Ce(this._delegate,new V(s.data,!0),n),this)}listAll(){return Ee(_(this._delegate)).then(e=>new Ve(e,this.storage))}list(e){return t=this._delegate,e=e||void 0,Ae(t=_(t),e).then(e=>new Ve(e,this.storage));var t}getMetadata(){return ze(this._delegate)}updateMetadata(e){return Ue(_(this._delegate),e)}getDownloadURL(){return Oe(_(this._delegate))}delete(){return this._throwIfRoot("delete"),Pe(_(this._delegate))}_throwIfRoot(e){if(""===this._delegate._location.path)throw S(e)}}class Xe{constructor(e,t){this.app=e,this._delegate=t}get maxOperationRetryTime(){return this._delegate.maxOperationRetryTime}get maxUploadRetryTime(){return this._delegate.maxUploadRetryTime}ref(e){if(Ke(e))throw R("ref() expected a child path but got a URL, use refFromURL instead.");return new Ge(je(this._delegate,e),this)}refFromURL(e){if(!Ke(e))throw R("refFromURL() expected a full URL but got a child path, use ref() instead.");try{E.makeFromUrl(e,this._delegate.host)}catch(e){throw R("refFromUrl() expected a valid full URL but got an invalid one.")}return new Ge(je(this._delegate,e),this)}setMaxUploadRetryTime(e){this._delegate.maxUploadRetryTime=e}setMaxOperationRetryTime(e){this._delegate.maxOperationRetryTime=e}useEmulator(e,t,r={}){var s;[s,e,t,r={}]=[this._delegate,e,t,r],De(s,e,t,r)}}function Ke(e){return/^[A-Za-z]+:\/\//.test(e)}function Je(e,{instanceIdentifier:t}){var r=e.getProvider("app-compat").getImmediate(),s=e.getProvider("storage").getImmediate({identifier:t});return new Xe(r,s)}r=n.default,s={TaskState:we,TaskEvent:ve,StringFormat:F,Storage:Xe,Reference:Ge},r.INTERNAL.registerComponent(new p("storage-compat",Je,"PUBLIC").setServiceProps(s).setMultipleInstances(!0)),r.registerVersion("@firebase/storage-compat","0.1.20")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-storage-compat.js - be sure to load firebase-app.js first.")}});
1
+ !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(Ze,Ye){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o,t,r,s,n=e(Ze);function i(t){const r=[];let s=0;for(let n=0;n<t.length;n++){let e=t.charCodeAt(n);e<128?r[s++]=e:(e<2048?r[s++]=e>>6|192:(55296==(64512&e)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++n)),r[s++]=e>>18|240,r[s++]=e>>12&63|128):r[s++]=e>>12|224,r[s++]=e>>6&63|128),r[s++]=63&e|128)}return r}function a(e){return l(e).replace(/\./g,"")}const h={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:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var s=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let u=0;u<r.length;u+=3){var i=r[u],o=u+1<r.length,a=o?r[u+1]:0,h=u+2<r.length,l=h?r[u+2]:0;let e=(15&a)<<2|l>>6,t=63&l;h||(t=64,o||(e=64)),n.push(s[i>>2],s[(3&i)<<4|a>>4],s[e],s[t])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,s=0;for(;r<e.length;){var n,i,o=e[r++];o<128?t[s++]=String.fromCharCode(o):191<o&&o<224?(n=e[r++],t[s++]=String.fromCharCode((31&o)<<6|63&n)):239<o&&o<365?(i=((7&o)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[s++]=String.fromCharCode(55296+(i>>10)),t[s++]=String.fromCharCode(56320+(1023&i))):(n=e[r++],i=e[r++],t[s++]=String.fromCharCode((15&o)<<12|(63&n)<<6|63&i))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const s=[];for(let h=0;h<e.length;){var n=r[e.charAt(h++)],i=h<e.length?r[e.charAt(h)]:0;++h;var o=h<e.length?r[e.charAt(h)]:64;++h;var a=h<e.length?r[e.charAt(h)]:64;if(++h,null==n||null==i||null==o||null==a)throw Error();s.push(n<<2|i>>4),64!==o&&(s.push(i<<4&240|o>>2),64!==a&&s.push(o<<6&192|a))}return s},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},l=function(e){var t=i(e);return h.encodeByteArray(t,!0)};class u extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,u.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var s,r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],i=i?(s=r,i.replace(d,(e,t)=>{var r=s[t];return null!=r?String(r):`<${t}?>`})):"Error",i=`${this.serviceName}: ${i} (${n}).`;return new u(n,i,r)}}const d=/\{\$([^}]+)}/g;function _(e){return e&&e._delegate?e._delegate:e}class p{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}}const f="firebasestorage.googleapis.com",g="storageBucket";class m extends u{constructor(e,t,r=0){super(b(e),`Firebase Storage: ${t} (${b(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,m.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return b(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}\n${this.customData.serverResponse}`:this.message=this._baseMessage}}function b(e){return"storage/"+e}function v(){return new m("unknown","An unknown error occurred, please check the error payload for server response.")}function y(){return new m("retry-limit-exceeded","Max retry time for operation exceeded, please try again.")}function w(){return new m("canceled","User canceled the upload/download.")}function T(){return new m("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function R(e){return new m("invalid-argument",e)}function k(){return new m("app-deleted","The Firebase app was deleted.")}function S(e){return new m("invalid-root-operation","The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function C(e,t){return new m("invalid-format","String does not match format '"+e+"': "+t)}function x(e){throw new m("internal-error","Internal error: "+e)}class E{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o"}static makeFromBucketSpec(t,e){let r;try{r=E.makeFromUrl(t,e)}catch(e){return new E(t,"")}if(""===r.path)return r;throw t=t,new m("invalid-default-bucket","Invalid default bucket '"+t+"'.")}static makeFromUrl(e,t){let r=null;var s="([A-Za-z0-9.\\-_]+)";var n=new RegExp("^gs://"+s+"(/(.*))?$","i");function i(e){e.path_=decodeURIComponent(e.path)}var o=t.replace(/[.]/g,"\\."),a=new RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${s}/o(/([^?#]*).*)?$`,"i"),o=t===f?"(?:storage.googleapis.com|storage.cloud.google.com)":t,h=[{regex:n,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:a,indices:{bucket:1,path:3},postModify:i},{regex:new RegExp(`^https?://${o}/${s}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:i}];for(let c=0;c<h.length;c++){const d=h[c];var l=d.regex.exec(e);if(l){var u=l[d.indices.bucket];let e=l[d.indices.path];e=e||"",r=new E(u,e),d.postModify(r);break}}if(null==r)throw t=e,new m("invalid-url","Invalid URL '"+t+"'.");return r}}class A{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=0){}}function U(e){return"string"==typeof e||e instanceof String}function O(e){return P()&&e instanceof Blob}function P(){return"undefined"!=typeof Blob&&!function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return}}()}function I(e,t,r,s){if(s<t)throw R(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r<s)throw R(`Invalid value for '${e}'. Expected ${r} or less.`)}function B(e,t,r){let s=null==r?`https://${t}`:t;return`${r}://${s}/v0${e}`}function M(e){const t=encodeURIComponent;let r="?";for(const n in e){var s;e.hasOwnProperty(n)&&(s=t(n)+"="+t(e[n]),r=r+s+"&")}return r=r.slice(0,-1),r}function N(e,t){var r=500<=e&&e<600,s=-1!==[408,429].indexOf(e),n=-1!==t.indexOf(e);return r||s||n}(t=o=o||{})[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT";class D{constructor(e,t,r,s,n,i,o,a,h,l,u,c=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=n,this.additionalRetryCodes_=i,this.callback_=o,this.errorCallback_=a,this.timeout_=h,this.progressCallback_=l,this.connectionFactory_=u,this.retry=c,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){var e=(s,e)=>{if(e)s(!1,new L(!1,null,!0));else{const n=this.connectionFactory_();this.pendingConnection_=n;const i=e=>{var t=e.loaded,r=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,r)};null!==this.progressCallback_&&n.addUploadProgressListener(i),n.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(i),this.pendingConnection_=null;var e,t=n.getErrorCode()===o.NO_ERROR,r=n.getStatus();t&&!N(r,this.additionalRetryCodes_)||!this.retry?(e=-1!==this.successCodes_.indexOf(r),s(!0,new L(e,n))):(e=n.getErrorCode()===o.ABORT,s(!1,new L(!1,null,e)))})}},t=(e,t)=>{const r=this.resolve_,s=this.reject_,n=t.connection;if(t.wasSuccessCode)try{var i=this.callback_(n,n.getResponse());void 0!==i?r(i):r()}catch(e){s(e)}else if(null!==n){const a=v();a.serverResponse=n.getErrorText(),this.errorCallback_?s(this.errorCallback_(n,a)):s(a)}else{var o;t.canceled?(o=(this.appDelete_?k:w)(),s(o)):(o=y(),s(o))}};this.canceled_?t(0,new L(!1,null,!0)):this.backoffId_=function(t,r,e){let s=1,n=null,i=null,o=!1,a=0;function h(){return 2===a}let l=!1;function u(...e){l||(l=!0,r.apply(null,e))}function c(e){n=setTimeout(()=>{n=null,t(_,h())},e)}function d(){i&&clearTimeout(i)}function _(t,...r){if(l)d();else{if(t)return d(),void u.call(null,t,...r);if(h()||o)return d(),void u.call(null,t,...r);s<64&&(s*=2);let e;e=1===a?(a=2,0):1e3*(s+Math.random()),c(e)}}let p=!1;function f(e){p||(p=!0,d(),l||(null!==n?(e||(a=2),clearTimeout(n),c(0)):e||(a=1)))}return c(0),i=setTimeout(()=>{f(o=!0)},e),f}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class L{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function q(...t){const r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0;if(void 0!==r){const s=new r;for(let e=0;e<t.length;e++)s.append(t[e]);return s.getBlob()}if(P())return new Blob(t);throw new m("unsupported-environment","This browser doesn't seem to support creating Blobs")}const F={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class j{constructor(e,t){this.data=e,this.contentType=t||null}}function z(e,t){switch(e){case F.RAW:return new j(H(t));case F.BASE64:case F.BASE64URL:return new j($(e,t));case F.DATA_URL:return new j((r=t,(s=new W(r)).base64?$(F.BASE64,s.rest):function(e){let t;try{t=decodeURIComponent(e)}catch(e){throw C(F.DATA_URL,"Malformed data URL.")}return H(t)}(s.rest)),(r=t,new W(r).contentType))}var r,s;throw v()}function H(t){const r=[];for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);var s,n;e<=127?r.push(e):e<=2047?r.push(192|e>>6,128|63&e):55296==(64512&e)?i<t.length-1&&56320==(64512&t.charCodeAt(i+1))?(s=e,n=t.charCodeAt(++i),e=65536|(1023&s)<<10|1023&n,r.push(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e)):r.push(239,191,189):56320==(64512&e)?r.push(239,191,189):r.push(224|e>>12,128|e>>6&63,128|63&e)}return new Uint8Array(r)}function $(t,e){switch(t){case F.BASE64:var r=-1!==e.indexOf("-"),s=-1!==e.indexOf("_");if(r||s)throw C(t,"Invalid character '"+(r?"-":"_")+"' found: is it base64url encoded?");break;case F.BASE64URL:s=-1!==e.indexOf("+"),r=-1!==e.indexOf("/");if(s||r)throw C(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}let n;try{n=atob(e)}catch(e){throw C(t,"Invalid character found")}const i=new Uint8Array(n.length);for(let o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return i}class W{constructor(e){this.base64=!1,this.contentType=null;var t,r,s=e.match(/^data:([^,]+)?,/);if(null===s)throw C(F.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const n=s[1]||null;null!=n&&(this.base64=(t=n,r=";base64",t.length>=r.length&&t.substring(t.length-r.length)===r),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=e.substring(e.indexOf(",")+1)}}class V{constructor(e,t){let r=0,s="";O(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(O(this.data_)){var r=this.data_,r=(n=e,i=t,(s=r).webkitSlice?s.webkitSlice(n,i):s.mozSlice?s.mozSlice(n,i):s.slice?s.slice(n,i):null);return null===r?null:new V(r)}var s,n,i,r=new Uint8Array(this.data_.buffer,e,t-e);return new V(r,!0)}static getBlob(...e){if(P()){var t=e.map(e=>e instanceof V?e.data_:e);return new V(q.apply(null,t))}{const s=e.map(e=>U(e)?z(F.RAW,e).data:e.data_);let t=0;s.forEach(e=>{t+=e.byteLength});const n=new Uint8Array(t);let r=0;return s.forEach(e=>{for(let t=0;t<e.length;t++)n[r++]=e[t]}),new V(n,!0)}}uploadData(){return this.data_}}function G(e){let t;try{t=JSON.parse(e)}catch(e){return null}return"object"!=typeof(e=t)||Array.isArray(e)?null:t}function X(e){var t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function K(e,t){return t}class J{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||K}}let Z=null;function Y(){if(Z)return Z;const e=[];e.push(new J("bucket")),e.push(new J("generation")),e.push(new J("metageneration")),e.push(new J("name","fullPath",!0));const t=new J("name");t.xform=function(e,t){return!U(t=t)||t.length<2?t:X(t)},e.push(t);const r=new J("size");return r.xform=function(e,t){return void 0!==t?Number(t):t},e.push(r),e.push(new J("timeCreated")),e.push(new J("updated")),e.push(new J("md5Hash",null,!0)),e.push(new J("cacheControl",null,!0)),e.push(new J("contentDisposition",null,!0)),e.push(new J("contentEncoding",null,!0)),e.push(new J("contentLanguage",null,!0)),e.push(new J("contentType",null,!0)),e.push(new J("metadata","customMetadata",!0)),Z=e,Z}function Q(r,s){Object.defineProperty(r,"ref",{get:function(){var e=r.bucket,t=r.fullPath,t=new E(e,t);return s._makeStorageReference(t)}})}function ee(e,t,r){var s=G(t);return null===s?null:function(e,t,r){const s={type:"file"};var n=r.length;for(let i=0;i<n;i++){const o=r[i];s[o.local]=o.xform(s,t[o.server])}return Q(s,e),s}(e,s,r)}function te(e,t){const r={};var s=t.length;for(let i=0;i<s;i++){var n=t[i];n.writable&&(r[n.server]=e[n.local])}return JSON.stringify(r)}const re="prefixes";function se(e,t,r){var s=G(r);return null===s?null:function(e,t,r){const s={prefixes:[],items:[],nextPageToken:r.nextPageToken};if(r[re])for(const o of r[re]){var n=o.replace(/\/$/,""),n=e._makeStorageReference(new E(t,n));s.prefixes.push(n)}if(r.items)for(const a of r.items){var i=e._makeStorageReference(new E(t,a.name));s.items.push(i)}return s}(e,t,s)}class ne{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}function ie(e){if(!e)throw v()}function oe(s,n){return function(e,t){var r=ee(s,t,n);return ie(null!==r),r}}function ae(s,n){return function(e,t){var r=se(s,n,t);return ie(null!==r),r}}function he(s,n){return function(e,t){var r=ee(s,t,n);return ie(null!==r),function(s,e,n,i){var t=G(e);if(null===t)return null;if(!U(t.downloadTokens))return null;const r=t.downloadTokens;if(0===r.length)return null;const o=encodeURIComponent,a=r.split(",");return a.map(e=>{var t=s.bucket,r=s.fullPath;return B("/b/"+o(t)+"/o/"+o(r),n,i)+M({alt:"media",token:e})})[0]}(r,t,s.host,s._protocol)}}function le(n){return function(e,t){let r;var s;return r=401===e.getStatus()?e.getErrorText().includes("Firebase App Check token is invalid")?new m("unauthorized-app","This app does not have permission to access Firebase Storage on this project."):new m("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(s=n.bucket,new m("quota-exceeded","Quota for bucket '"+s+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(s=n.path,new m("unauthorized","User does not have permission to access '"+s+"'.")):t,r.status=e.getStatus(),r.serverResponse=t.serverResponse,r}}function ue(s){const n=le(s);return function(e,t){let r=n(e,t);return 404===e.getStatus()&&(r=(e=s.path,new m("object-not-found","Object '"+e+"' does not exist."))),r.serverResponse=t.serverResponse,r}}function ce(e,t,r){var s=B(t.fullServerUrl(),e.host,e._protocol),n=e.maxOperationRetryTime;const i=new ne(s,"GET",oe(e,r),n);return i.errorHandler=ue(t),i}function de(e,t,r){const s=Object.assign({},r);return s.fullPath=e.path,s.size=t.size(),s.contentType||(s.contentType=(e=t,(t=null)&&t.contentType||e&&e.type()||"application/octet-stream")),s}function _e(e,t,r,s,n){var i=t.bucketOnlyServerUrl();const o={"X-Goog-Upload-Protocol":"multipart"};var a=function(){let e="";for(let t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();o["Content-Type"]="multipart/related; boundary="+a;var h=de(t,s,n),l="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+te(h,r)+"\r\n--"+a+"\r\nContent-Type: "+h.contentType+"\r\n\r\n",a="\r\n--"+a+"--";const u=V.getBlob(l,s,a);if(null===u)throw T();a={name:h.fullPath},h=B(i,e.host,e._protocol),i=e.maxUploadRetryTime;const c=new ne(h,"POST",oe(e,r),i);return c.urlParams=a,c.headers=o,c.body=u.uploadData(),c.errorHandler=le(t),c}class pe{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function fe(e,t){let r=null;try{r=e.getResponseHeader("X-Goog-Upload-Status")}catch(e){ie(!1)}const s=t||["active"];return ie(!!r&&-1!==s.indexOf(r)),r}function ge(e,t,r,s,n){var i=t.bucketOnlyServerUrl(),o=de(t,s,n),a={name:o.fullPath},h=B(i,e.host,e._protocol),l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},i=te(o,r),o=e.maxUploadRetryTime;const u=new ne(h,"POST",function(e){fe(e);let t;try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(e){ie(!1)}return ie(U(t)),t},o);return u.urlParams=a,u.headers=l,u.body=i,u.errorHandler=le(t),u}function me(e,t,r,n){var s=e.maxUploadRetryTime;const i=new ne(r,"POST",function(e){var t=fe(e,["active","final"]);let r=null;try{r=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(e){ie(!1)}r||ie(!1);var s=Number(r);return ie(!isNaN(s)),new pe(s,n.size(),"final"===t)},s);return i.headers={"X-Goog-Upload-Command":"query"},i.errorHandler=le(t),i}function be(e,o,t,a,r,h,s,n){const l=new pe(0,0);if(s?(l.current=s.current,l.total=s.total):(l.current=0,l.total=a.size()),a.size()!==l.total)throw new m("server-file-wrong-size","Server recorded incorrect upload file size, please retry the upload.");var i=l.total-l.current;let u=i;0<r&&(u=Math.min(u,r));var c=l.current,d=c+u;let _="";_=0===u?"finalize":i===u?"upload, finalize":"upload";i={"X-Goog-Upload-Command":_,"X-Goog-Upload-Offset":`${l.current}`};const p=a.slice(c,d);if(null===p)throw T();d=o.maxUploadRetryTime;const f=new ne(t,"POST",function(e,t){var r=fe(e,["active","final"]),s=l.current+u,n=a.size();let i;return i="final"===r?oe(o,h)(e,t):null,new pe(s,n,"final"===r,i)},d);return f.headers=i,f.body=p.uploadData(),f.progressCallback=n||null,f.errorHandler=le(e),f}const ve={STATE_CHANGED:"state_changed"},ye={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function we(e){switch(e){case"running":case"pausing":case"canceling":return ye.RUNNING;case"paused":return ye.PAUSED;case"success":return ye.SUCCESS;case"canceled":return ye.CANCELED;default:return ye.ERROR}}class Te{constructor(e,t,r){var s;"function"==typeof e||null!=t||null!=r?(this.next=e,this.error=null!=t?t:void 0,this.complete=null!=r?r:void 0):(this.next=(s=e).next,this.error=s.error,this.complete=s.complete)}}function Re(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class ke extends class{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=o.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=o.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=o.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw x("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),void 0!==s)for(const n in s)s.hasOwnProperty(n)&&this.xhr_.setRequestHeader(n,s[n].toString());return void 0!==r?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw x("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw x("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}}getResponse(){if(!this.sent_)throw x("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw x("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",e)}}{initXhr(){this.xhr_.responseType="text"}}function Se(){return new ke}class Ce{constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=Y(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=e=>{if(this._request=void 0,this._chunkMultiplier=1,e._codeEquals("canceled"))this._needToFetchStatus=!0,this.completeTransitions_();else{var t=this.isExponentialBackoffExpired();if(N(e.status,[])){if(!t)return this.sleepTime=Math.max(2*this.sleepTime,1e3),this._needToFetchStatus=!0,void this.completeTransitions_();e=y()}this._error=e,this._transition("error")}},this._metadataErrorHandler=e=>{this._request=void 0,e._codeEquals("canceled")?this.completeTransitions_():(this._error=e,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const t=this._transferred;return e=>this._updateProgress(t+e)}_shouldDoResumable(e){return 262144<e.size()}_start(){"running"===this._state&&void 0===this._request&&(this._resumable?void 0===this._uploadUrl?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(r){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([e,t])=>{switch(this._state){case"running":r(e,t);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused")}})}_createResumable(){this._resolveToken((e,t)=>{var r=ge(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._uploadUrl=e,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const n=this._uploadUrl;this._resolveToken((e,t)=>{var r=me(this._ref.storage,this._ref._location,n,this._blob);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._updateProgress(e.current),this._needToFetchStatus=!1,e.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const n=262144*this._chunkMultiplier,i=new pe(this._transferred,this._blob.size()),o=this._uploadUrl;this._resolveToken((e,t)=>{let r;try{r=be(this._ref._location,this._ref.storage,o,this._blob,n,this._mappings,i,this._makeProgressCallback())}catch(e){return this._error=e,void this._transition("error")}const s=this._ref.storage._makeRequest(r,Se,e,t,!1);this._request=s,s.getPromise().then(e=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(e.current),e.finalized?(this._metadata=e.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){2*(262144*this._chunkMultiplier)<33554432&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{var r=ce(this._ref.storage,this._ref._location,this._mappings);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{var r=_e(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata);const s=this._ref.storage._makeRequest(r,Se,e,t);this._request=s,s.getPromise().then(e=>{this._request=void 0,this._metadata=e,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){var t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,void 0!==this._request?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":var t="paused"===this._state;this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=w(),this._state=e,this._notifyObservers();break;case"error":case"success":this._state=e,this._notifyObservers()}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}}get snapshot(){var e=we(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const n=new Te(t||void 0,r||void 0,s||void 0);return this._addObserver(n),()=>{this._removeObserver(n)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){var t=this._observers.indexOf(e);-1!==t&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise();const e=this._observers.slice();e.forEach(e=>{this._notifyObserver(e)})}_finishPromise(){if(void 0!==this._resolve){let e=!0;switch(we(this._state)){case ye.SUCCESS:Re(this._resolve.bind(null,this.snapshot))();break;case ye.CANCELED:case ye.ERROR:const t=this._reject;Re(t.bind(null,this._error))();break;default:e=!1}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(we(this._state)){case ye.RUNNING:case ye.PAUSED:e.next&&Re(e.next.bind(e,this.snapshot))();break;case ye.SUCCESS:e.complete&&Re(e.complete.bind(e))();break;case ye.CANCELED:case ye.ERROR:default:e.error&&Re(e.error.bind(e,this._error))()}}resume(){var e="paused"===this._state||"pausing"===this._state;return e&&this._transition("running"),e}pause(){var e="running"===this._state;return e&&this._transition("pausing"),e}cancel(){var e="running"===this._state||"pausing"===this._state;return e&&this._transition("canceling"),e}}class xe{constructor(e,t){this._service=e,t instanceof E?this._location=t:this._location=E.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new xe(e,t)}get root(){var e=new E(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return X(this._location.path)}get storage(){return this._service}get parent(){var e=function(e){if(0===e.length)return null;var t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;e=new E(this._location.bucket,e);return new xe(this._service,e)}_throwIfRoot(e){if(""===this._location.path)throw S(e)}}function Ee(e){const t={prefixes:[],items:[]};return async function e(t,r,s){const n={pageToken:s};const i=await Ae(t,n);r.prefixes.push(...i.prefixes);r.items.push(...i.items);null!=i.nextPageToken&&await e(t,r,i.nextPageToken)}(e,t).then(()=>t)}function Ae(e,t){null!=t&&"number"==typeof t.maxResults&&I("options.maxResults",1,1e3,t.maxResults);var r=t||{},r=function(e,t,r,s,n){const i={};t.isRoot?i.prefix="":i.prefix=t.path+"/",r&&0<r.length&&(i.delimiter=r),s&&(i.pageToken=s),n&&(i.maxResults=n);var o=B(t.bucketOnlyServerUrl(),e.host,e._protocol),a=e.maxOperationRetryTime;const h=new ne(o,"GET",ae(e,t.bucket),a);return h.urlParams=i,h.errorHandler=le(t),h}(e.storage,e._location,"/",r.pageToken,r.maxResults);return e.storage.makeRequestWithTokens(r,Se)}function Ue(e,t){e._throwIfRoot("updateMetadata");var r=function(e,t,r,s){var n=B(t.fullServerUrl(),e.host,e._protocol),i=te(r,s),o=e.maxOperationRetryTime;const a=new ne(n,"PATCH",oe(e,s),o);return a.headers={"Content-Type":"application/json; charset=utf-8"},a.body=i,a.errorHandler=ue(t),a}(e.storage,e._location,t,Y());return e.storage.makeRequestWithTokens(r,Se)}function Oe(e){e._throwIfRoot("getDownloadURL");var t=function(e,t,r){var s=B(t.fullServerUrl(),e.host,e._protocol),n=e.maxOperationRetryTime;const i=new ne(s,"GET",he(e,r),n);return i.errorHandler=ue(t),i}(e.storage,e._location,Y());return e.storage.makeRequestWithTokens(t,Se).then(e=>{if(null===e)throw new m("no-download-url","The given file does not have any download URLs.");return e})}function Pe(e){e._throwIfRoot("deleteObject");var t=function(e,t){var r=B(t.fullServerUrl(),e.host,e._protocol),s=e.maxOperationRetryTime;const n=new ne(r,"DELETE",function(e,t){},s);return n.successCodes=[200,204],n.errorHandler=ue(t),n}(e.storage,e._location);return e.storage.makeRequestWithTokens(t,Se)}function Ie(e,t){var r,s=(r=e._location.path,s=t.split("/").filter(e=>0<e.length).join("/"),0===r.length?s:r+"/"+s),s=new E(e._location.bucket,s);return new xe(e.storage,s)}function Be(e,t){if(e instanceof Le){var r=e;if(null==r._bucket)throw new m("no-default-bucket","No default bucket found. Did you set the '"+g+"' property when initializing the app?");r=new xe(r,r._bucket);return null!=t?Be(r,t):r}return void 0!==t?Ie(e,t):e}function Me(e,t){if(t&&/^[A-Za-z]+:\/\//.test(t)){if(e instanceof Le)return r=e,s=t,new xe(r,s);throw R("To use ref(service, url), the first argument must be a Storage instance.")}return Be(e,t);var r,s}function Ne(e,t){var r=null==t?void 0:t[g];return null==r?null:E.makeFromBucketSpec(r,e)}function De(e,t,r,s={}){e.host=`${t}:${r}`,e._protocol="http";var n=s["mockUserToken"];n&&(e._overrideAuthToken="string"==typeof n?n:function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var r=t||"demo-project",s=e.iat||0,n=e.sub||e.user_id;if(!n)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");return n=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:n,user_id:n,firebase:{sign_in_provider:"custom",identities:{}}},e),[a(JSON.stringify({alg:"none",type:"JWT"})),a(JSON.stringify(n)),""].join(".")}(n,e.app.options.projectId))}class Le{constructor(e,t,r,s,n){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=n,this._bucket=null,this._host=f,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=s?E.makeFromBucketSpec(s,this._host):Ne(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=E.makeFromBucketSpec(this._url,e):this._bucket=Ne(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){I("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){I("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){var t=await e.getToken();if(null!==t)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 xe(this,e)}_makeRequest(e,t,r,s,n=!0){if(this._deleted)return new A(k());{const u=([i,o,a,e,r,s,t=!0]=[e,this._appId,r,s,t,this._firebaseVersion,n],h=M(i.urlParams),l=i.url+h,h=Object.assign({},i.headers),n=h,(o=o)&&(n["X-Firebase-GMPID"]=o),o=h,null!==(a=a)&&0<a.length&&(o.Authorization="Firebase "+a),s=s,h["X-Firebase-Storage-Version"]="webjs/"+(null!=s?s:"AppManager"),s=h,null!==(e=e)&&(s["X-Firebase-AppCheck"]=e),new D(l,i.method,h,i.body,i.successCodes,i.additionalRetryCodes,i.handler,i.errorHandler,i.timeout,i.progressCallback,r,t));return this._requests.add(u),u.getPromise().then(()=>this._requests.delete(u),()=>this._requests.delete(u)),u}var i,o,a,h,l}async makeRequestWithTokens(e,t){var[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const qe="@firebase/storage";function Fe(e,t,r){return e=_(e),t=t,r=r,(e=e)._throwIfRoot("uploadBytesResumable"),new Ce(e,new V(t),r)}function je(e){return function(e){e._throwIfRoot("getMetadata");var t=ce(e.storage,e._location,Y());return e.storage.makeRequestWithTokens(t,Se)}(e=_(e))}function ze(e,t){return Me(e=_(e),t)}function He(e,{instanceIdentifier:t}){var r=e.getProvider("app").getImmediate(),s=e.getProvider("auth-internal"),n=e.getProvider("app-check-internal");return new Le(r,s,n,t,Ye.SDK_VERSION)}Ye._registerComponent(new p("storage",He,"PUBLIC").setMultipleInstances(!0)),Ye.registerVersion(qe,"0.9.13",""),Ye.registerVersion(qe,"0.9.13","esm2017");class $e{constructor(e,t,r){this._delegate=e,this.task=t,this.ref=r}get bytesTransferred(){return this._delegate.bytesTransferred}get metadata(){return this._delegate.metadata}get state(){return this._delegate.state}get totalBytes(){return this._delegate.totalBytes}}class We{constructor(e,t){this._delegate=e,this._ref=t,this.cancel=this._delegate.cancel.bind(this._delegate),this.catch=this._delegate.catch.bind(this._delegate),this.pause=this._delegate.pause.bind(this._delegate),this.resume=this._delegate.resume.bind(this._delegate)}get snapshot(){return new $e(this._delegate.snapshot,this,this._ref)}then(t,e){return this._delegate.then(e=>{if(t)return t(new $e(e,this,this._ref))},e)}on(e,t,r,s){let n=void 0;return t&&(n="function"==typeof t?e=>t(new $e(e,this,this._ref)):{next:t.next?e=>t.next(new $e(e,this,this._ref)):void 0,complete:t.complete||void 0,error:t.error||void 0}),this._delegate.on(e,n,r||void 0,s||void 0)}}class Ve{constructor(e,t){this._delegate=e,this._service=t}get prefixes(){return this._delegate.prefixes.map(e=>new Ge(e,this._service))}get items(){return this._delegate.items.map(e=>new Ge(e,this._service))}get nextPageToken(){return this._delegate.nextPageToken||null}}class Ge{constructor(e,t){this._delegate=e,this.storage=t}get name(){return this._delegate.name}get bucket(){return this._delegate.bucket}get fullPath(){return this._delegate.fullPath}toString(){return this._delegate.toString()}child(e){var t=Ie(this._delegate,e);return new Ge(t,this.storage)}get root(){return new Ge(this._delegate.root,this.storage)}get parent(){var e=this._delegate.parent;return null==e?null:new Ge(e,this.storage)}put(e,t){return this._throwIfRoot("put"),new We(Fe(this._delegate,e,t),this)}putString(e,t=F.RAW,r){this._throwIfRoot("putString");var s=z(t,e);const n=Object.assign({},r);return null==n.contentType&&null!=s.contentType&&(n.contentType=s.contentType),new We(new Ce(this._delegate,new V(s.data,!0),n),this)}listAll(){return Ee(_(this._delegate)).then(e=>new Ve(e,this.storage))}list(e){return t=this._delegate,e=e||void 0,Ae(t=_(t),e).then(e=>new Ve(e,this.storage));var t}getMetadata(){return je(this._delegate)}updateMetadata(e){return Ue(_(this._delegate),e)}getDownloadURL(){return Oe(_(this._delegate))}delete(){return this._throwIfRoot("delete"),Pe(_(this._delegate))}_throwIfRoot(e){if(""===this._delegate._location.path)throw S(e)}}class Xe{constructor(e,t){this.app=e,this._delegate=t}get maxOperationRetryTime(){return this._delegate.maxOperationRetryTime}get maxUploadRetryTime(){return this._delegate.maxUploadRetryTime}ref(e){if(Ke(e))throw R("ref() expected a child path but got a URL, use refFromURL instead.");return new Ge(ze(this._delegate,e),this)}refFromURL(e){if(!Ke(e))throw R("refFromURL() expected a full URL but got a child path, use ref() instead.");try{E.makeFromUrl(e,this._delegate.host)}catch(e){throw R("refFromUrl() expected a valid full URL but got an invalid one.")}return new Ge(ze(this._delegate,e),this)}setMaxUploadRetryTime(e){this._delegate.maxUploadRetryTime=e}setMaxOperationRetryTime(e){this._delegate.maxOperationRetryTime=e}useEmulator(e,t,r={}){var s;[s,e,t,r={}]=[this._delegate,e,t,r],De(s,e,t,r)}}function Ke(e){return/^[A-Za-z]+:\/\//.test(e)}function Je(e,{instanceIdentifier:t}){var r=e.getProvider("app-compat").getImmediate(),s=e.getProvider("storage").getImmediate({identifier:t});return new Xe(r,s)}r=n.default,s={TaskState:ye,TaskEvent:ve,StringFormat:F,Storage:Xe,Reference:Ge},r.INTERNAL.registerComponent(new p("storage-compat",Je,"PUBLIC").setServiceProps(s).setMultipleInstances(!0)),r.registerVersion("@firebase/storage-compat","0.1.21")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-storage-compat.js - be sure to load firebase-app.js first.")}});
2
2
  //# sourceMappingURL=firebase-storage-compat.js.map