mobileapplicationPassvault/node_modules/firebase/firebase-app-check-compat.js

5 lines
23 KiB
JavaScript
Raw Permalink Normal View History

2024-04-12 05:23:32 +00:00
!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(Ce,Se){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,n=e(Ce);const o={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 n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const o=[];for(let l=0;l<r.length;l+=3){var a=r[l],i=l+1<r.length,s=i?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&s)<<2|h>>6,t=63&h;c||(t=64,i||(e=64)),o.push(n[a>>2],n[(3&a)<<4|s>>4],n[e],n[t])}return o.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(t){const r=[];let n=0;for(let o=0;o<t.length;o++){let e=t.charCodeAt(o);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&o+1<t.length&&56320==(64512&t.charCodeAt(o+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++o)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){var o,a,i=e[r++];i<128?t[n++]=String.fromCharCode(i):191<i&&i<224?(o=e[r++],t[n++]=String.fromCharCode((31&i)<<6|63&o)):239<i&&i<365?(a=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(a>>10)),t[n++]=String.fromCharCode(56320+(1023&a))):(o=e[r++],a=e[r++],t[n++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const n=[];for(let c=0;c<e.length;){var o=r[e.charAt(c++)],a=c<e.length?r[e.charAt(c)]:0;++c;var i=c<e.length?r[e.charAt(c)]:64;++c;var s=c<e.length?r[e.charAt(c)]:64;if(++c,null==o||null==a||null==i||null==s)throw new h;n.push(o<<2|a>>4),64!==i&&(n.push(a<<4&240|i>>2),64!==s&&n.push(i<<6&192|s))}return n},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 h extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const i=function(e){try{return o.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}function a(){try{return"object"==typeof indexedDB}catch(e){return}}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,l.prototype.create)}}class l{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},o=`${this.service}/${e}`,a=this.errors[e],a=a?(n=r,a.replace(p,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})
Can't get debug token in production mode.
`)}function Z(){var e=function(){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 t=A;if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;const r=new s;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(X())}}const Q={error:"UNKNOWN_ERROR"};async function ee(e,t=!1){var r=e.app;O(r);const n=T(r);let o=n.token,a=void 0;if(o&&!ae(o)&&(n.token=void 0,o=void 0),o||(s=await n.cachedTokenPromise)&&(ae(s)?o=s:await G(r,void 0)),!t&&o&&ae(o))return{token:o.token};let i=!1;if(J()){n.exchangeTokenPromise||(n.exchangeTokenPromise=M(L(r,await Y()),e.heartbeatServiceProvider).finally(()=>{n.exchangeTokenPromise=void 0}),i=!0);var s=await n.exchangeTokenPromise;return await G(r,s),{token:(n.token=s).token}}try{n.exchangeTokenPromise||(n.exchangeTokenPromise=n.provider.getToken().finally(()=>{n.exchangeTokenPromise=void 0}),i=!0),o=await T(r).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?U.warn(e.message):U.error(e),a=e}let c;return o?a?c=ae(o)?{token:o.token,internalError:a}:ie(a):(c={token:o.token},n.token=o,await G(r,o)):c=ie(a),i&&oe(r,c),c}function te(e,t,r,n){var o=e["app"];const a=T(o);o={next:r,error:n,type:t};if(a.tokenObservers=[...a.tokenObservers,o],a.token&&ae(a.token)){const i=a.token;Promise.resolve().then(()=>{r({token:i.token}),ne(e)}).catch(()=>{})}a.cachedTokenPromise.then(()=>ne(e))}function re(e,t){const r=T(e);var n=r.tokenObservers.filter(e=>e.next!==t);0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function ne(e){var t=e["app"];const r=T(t);let n=r.tokenRefresher;n||(n=function(r){const n=r["app"];return new P(async()=>{var e=T(n);let t;if(t=e.token?await ee(r,!0):await ee(r),t.error)throw t.error;if(t.internalError)throw t.internalError},()=>!0,()=>{var e=T(n);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},R.RETRIAL_MIN_WAIT,R.RETRIAL_MAX_WAIT)}(e),r.tokenRefresher=n),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}function oe(e,t){for(const r of T(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function ae(e){return 0<e.expireTimeMillis-Date.now()}function ie(e){return{token:(t=Q,o.encodeString(JSON.stringify(t),!1)),error:e};var t}class se{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){var e=T(this.app)["tokenObservers"];for(const t of e)re(this.app,t.next);return Promise.resolve()}}function ce(t){return{getToken:e=>ee(t,e),getLimitedUseToken:()=>async function(e){var t=e.app;O(t);const r=T(t)["provider"];if(J()){var n=(await M(L(t,await Y()),e.heartbeatServiceProvider))["token"];return{token:n}}return{token:n=(await r.getToken())["token"]}}(t),addTokenListener:e=>te(t,"INTERNAL",e),removeTokenListener:e=>re(t.app,e)}}const he="https://www.google.com/recaptcha/api.js",le="https://www.google.com/recaptcha/enterprise.js";function pe(t,r){const n=new s,e=T(t);e.reCAPTCHAState={initialized:n};const o=ge(t);var a=D(!1);return a?de(t,r,a,o,n):function(e){const t=document.createElement("script");t.src=he,t.onload=e,document.head.appendChild(t)}(()=>{var e=D(!1);if(!e)throw new Error("no recaptcha");de(t,r,e,o,n)}),n.promise}function ue(t,r){const n=new s,e=T(t);e.reCAPTCHAState={initialized:n};const o=ge(t);var a=D(!0);return a?de(t,r,a,o,n):function(e){const t=document.createElement("script");t.src=le,t.onload=e,document.head.appendChild(t)}(()=>{var e=D(!0);if(!e)throw new Error("no recaptcha");de(t,r,e,o,n)}),n.promise}function de(e,t,r,n,o){r.ready(()=>{!function(e,t,r,n){const o=r.render(n,{sitekey:t,size:"invisible",callback:()=>{T(e).reCAPTCHAState.succeeded=!0},"error-callback":()=>{T(e).reCAPTCHAState.succeeded=!1}}),a=T(e);a.reCAPTCHAState=Ob
//# sourceMappingURL=firebase-app-check-compat.js.map