mobileapplicationPassvault/node_modules/firebase/firebase-compat.js

11 lines
762 KiB
JavaScript
Raw Permalink Normal View History

2024-04-12 05:23:32 +00:00
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";const t={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},f=function(e,t){if(!e)throw u(t)},u=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},n=function(t){const n=[];let r=0;for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);e<128?n[r++]=e:(e<2048?n[r++]=e>>6|192:(55296==(64512&e)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++i)),n[r++]=e>>18|240,n[r++]=e>>12&63|128):n[r++]=e>>12|224,n[r++]=e>>6&63|128),n[r++]=63&e|128)}return n},r={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(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();var r=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const i=[];for(let u=0;u<n.length;u+=3){var s=n[u],a=u+1<n.length,o=a?n[u+1]:0,c=u+2<n.length,l=c?n[u+2]:0;let e=(15&o)<<2|l>>6,t=63&l;c||(t=64,a||(e=64)),i.push(r[s>>2],r[(3&s)<<4|o>>4],r[e],r[t])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){var i,s,a=e[n++];a<128?t[r++]=String.fromCharCode(a):191<a&&a<224?(i=e[n++],t[r++]=String.fromCharCode((31&a)<<6|63&i)):239<a&&a<365?(s=((7&a)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))):(i=e[n++],s=e[n++],t[r++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&s))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var n=t?this.charToByteMapWebSafe_:this.charToByteMap_;const r=[];for(let c=0;c<e.length;){var i=n[e.charAt(c++)],s=c<e.length?n[e.charAt(c)]:0;++c;var a=c<e.length?n[e.charAt(c)]:64;++c;var o=c<e.length?n[e.charAt(c)]:64;if(++c,null==i||null==s||null==a||null==o)throw new l;r.push(i<<2|s>>4),64!==a&&(r.push(s<<4&240|a>>2),64!==o&&r.push(a<<6&192|o))}return r},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)}}};class l extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}function i(e){var t=n(e);return r.encodeByteArray(t,!0)}const s=function(e){return i(e).replace(/\./g,"")},a=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const n=t;return new Date(n.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=c(e[r],t[r]));return e}function o(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}const e=()=>o().__FIREBASE_DEFAULTS__,h=()=>{if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}},d=()=>{if("undefined"!=typeof document){let e;try{e=d
Warning: Firebase is already defined in the global scope. Please make sure
Firebase library is only loaded once.
`);const Z1=self.firebase.SDK_VERSION;Z1&&0<=Z1.indexOf("LITE")&&bt.warn(`
Warning: You are trying to load Firebase while using Firebase Performance standalone script.
You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.
`)}const It=wt;nt("@firebase/app-compat","0.2.27",void 0);It.registerVersion("firebase","10.8.0","app-compat");var Tt="@firebase/installations",Et="0.6.5";const Ct=1e4,St="w:0.6.5",kt="FIS_v2",At="https://firebaseinstallations.googleapis.com/v1",Nt=36e5;const Rt=new x("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 Pt(e){return e instanceof D&&e.code.includes("request-failed")}function Dt({projectId:e}){return`${At}/projects/${e}/installations`}function xt(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function Ot(e,t){var n=(await t.json()).error;return Rt.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function Mt({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Lt(e,{refreshToken:t}){const n=Mt(e);return n.append("Authorization",(t=t,`${kt} ${t}`)),n}async function Ft(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function Ut(t){return new Promise(e=>{setTimeout(e,t)})}const Vt=/^[cdef][\w-]{21}$/,qt="";function Bt(){try{const t=new Uint8Array(17),n=self.crypto||self.msCrypto;n.getRandomValues(t),t[0]=112+t[0]%16;var e=function(e){const t=function(e){const t=btoa(String.fromCharCode(...e));return t.replace(/\+/g,"-").replace(/\//g,"_")}(e);return t.substr(0,22)}(t);return Vt.test(e)?e:qt}catch(e){return qt}}function jt(e){return`${e.appName}!${e.appId}`}const zt=new Map;function $t(e,t){var n=jt(e);Kt(n,t),function(e,t){const n=function(){!Wt&&"BroadcastChannel"in self&&(Wt=new BroadcastChannel("[Firebase] FID Change"),Wt.onmessage=e=>{Kt(e.data.key,e.data.fid)});return Wt}();n&&n.postMessage({key:e,fid:t});0===zt.size&&Wt&&(Wt.close(),Wt=null)}(n,t)}function Kt(e,t){var n=zt.get(e);if(n)for(const r of n)r(t)}let Wt=null;const Gt="firebase-installations-store";let Ht=null;function Qt(){return Ht=Ht||De("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Gt)}}),Ht}async function Yt(e,t){var n=jt(e);const r=await Qt(),i=r.transaction(Gt,"readwrite"),s=i.objectStore(Gt);var a=await s.get(n);return await s.put(t,n),await i.done,a&&a.fid===t.fid||$t(e,t.fid),t}async function Jt(e){var t=jt(e);const n=await Qt(),r=n.transaction(Gt,"readwrite");await r.objectStore(Gt).delete(t),await r.done}async function Xt(e,t){var n=jt(e);const r=await Qt(),i=r.transaction(Gt,"readwrite"),s=i.objectStore(Gt);var a=await s.get(n),o=t(a);return void 0===o?await s.delete(n):await s.put(o,n),await i.done,!o||a&&a.fid===o.fid||$t(e,o.fid),o}async function Zt(n){let r;var e=await Xt(n.appConfig,e=>{var t=tn(e||{fid:Bt(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await en(e.appConfig);for(;1===t.registrationStatus;)await Ut(100),t=await en(e.appConfig);if(0!==t.registrationStatus)return t;{var{installationEntry:n,registrationPromise:r}=await Zt(e);return r||n}}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(Rt.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(t,n){try{var e=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=Dt(e),i=Mt(e),s=t.getImmediate({optional:!0});!s||(a=await s.getHeartbeatsHeader())&&i.append("x-firebase-client",a);var a={fid:n,authVersion:kt,appId:e.appId,sdkVersion:St};const o={method:"POST",headers:i,body:JSON.stringify(a)},c=await
Can't get debug token in production mode.
`)}const Nr={error:"UNKNOWN_ERROR"};async function Rr(e,t=!1){var n=e.app;lr(n);const r=nr(n);let i=r.token,s=void 0;if(i&&!Mr(i)&&(r.token=void 0,i=void 0),i||(o=await r.cachedTokenPromise)&&(Mr(o)?i=o:await Cr(n,void 0)),!t&&i&&Mr(i))return{token:i.token};let a=!1;if(kr()){r.exchangeTokenPromise||(r.exchangeTokenPromise=dr(pr(n,await Ar()),e.heartbeatServiceProvider).finally(()=>{r.exchangeTokenPromise=void 0}),a=!0);var o=await r.exchangeTokenPromise;return await Cr(n,o),{token:(r.token=o).token}}try{r.exchangeTokenPromise||(r.exchangeTokenPromise=r.provider.getToken().finally(()=>{r.exchangeTokenPromise=void 0}),a=!0),i=await nr(n).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?Tr.warn(e.message):Tr.error(e),s=e}let c;return i?s?c=Mr(i)?{token:i.token,internalError:s}:Lr(s):(c={token:i.token},r.token=i,await Cr(n,i)):c=Lr(s),a&&Or(n,c),c}function Pr(e,t,n,r){var i=e["app"];const s=nr(i);i={next:n,error:r,type:t};if(s.tokenObservers=[...s.tokenObservers,i],s.token&&Mr(s.token)){const a=s.token;Promise.resolve().then(()=>{n({token:a.token}),xr(e)}).catch(()=>{})}s.cachedTokenPromise.then(()=>xr(e))}function Dr(e,t){const n=nr(e);var r=n.tokenObservers.filter(e=>e.next!==t);0===r.length&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=r}function xr(e){var t=e["app"];const n=nr(t);let r=n.tokenRefresher;r||(r=function(n){const r=n["app"];return new ar(async()=>{var e=nr(r);let t;if(t=e.token?await Rr(n,!0):await Rr(n),t.error)throw t.error;if(t.internalError)throw t.internalError},()=>!0,()=>{var e=nr(r);if(e.token){var t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,e=e.token.expireTimeMillis-3e5,t=Math.min(t,e);return Math.max(0,t-Date.now())}return 0},sr.RETRIAL_MIN_WAIT,sr.RETRIAL_MAX_WAIT)}(e),n.tokenRefresher=r),!r.isRunning()&&n.isTokenAutoRefreshEnabled&&r.start()}function Or(e,t){for(const n of nr(e).tokenObservers)try{"EXTERNAL"===n.type&&null!=t.error?n.error(t.error):n.next(t)}catch(e){}}function Mr(e){return 0<e.expireTimeMillis-Date.now()}function Lr(e){return{token:(t=Nr,r.encodeString(JSON.stringify(t),!1)),error:e};var t}class Fr{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){var e=nr(this.app)["tokenObservers"];for(const t of e)Dr(this.app,t.next);return Promise.resolve()}}function Ur(t){return{getToken:e=>Rr(t,e),getLimitedUseToken:()=>async function(e){var t=e.app;lr(t);const n=nr(t)["provider"];if(kr()){var r=(await dr(pr(t,await Ar()),e.heartbeatServiceProvider))["token"];return{token:r}}return{token:r=(await n.getToken())["token"]}}(t),addTokenListener:e=>Pr(t,"INTERNAL",e),removeTokenListener:e=>Dr(t.app,e)}}const Vr="https://www.google.com/recaptcha/api.js",qr="https://www.google.com/recaptcha/enterprise.js";function Br(t,n){const r=new y,e=nr(t);e.reCAPTCHAState={initialized:r};const i=$r(t);var s=cr(!1);return s?zr(t,n,s,i,r):function(e){const t=document.createElement("script");t.src=Vr,t.onload=e,document.head.appendChild(t)}(()=>{var e=cr(!1);if(!e)throw new Error("no recaptcha");zr(t,n,e,i,r)}),r.promise}function jr(t,n){const r=new y,e=nr(t);e.reCAPTCHAState={initialized:r};const i=$r(t);var s=cr(!0);return s?zr(t,n,s,i,r):function(e){const t=document.createElement("script");t.src=qr,t.onload=e,document.head.appendChild(t)}(()=>{var e=cr(!0);if(!e)throw new Error("no recaptcha");zr(t,n,e,i,r)}),r.promise}function zr(e,t,n,r,i){n.ready(()=>{!function(e,t,n,r){const i=n.render(r,{sitekey:t,size:"invisible",callback:()=>{nr(e).reCAPTCHAState.succeeded=!0},"error-callback":()=>{nr(e).reCAPTCHAState.succeeded=!1}}),s=nr(e);s.reCAPTCHAState=Object.assign(Object.assign({},s.reCAPTCHAState),{widgetId:i})}(e,t,n,r),i.resolve(n)})}function $r(e){var t=`fire_app_check_${e.name}`;const n=document.createElement("div");return n.id=t,n.style.display="none",document.body.appendChild(n),t}async function Kr(r){lr(r);const i=await nr(r).reCAPTCHAState.initialized.promise;return new Promise((e,t)=>{const n=nr(r).reCAPTCHAState;i.ready(()=>{e(i.execute(n.widgetId,{action:"fire_app_chec
//# sourceMappingURL=firebase-compat.js.map