cloudcommerce 0.0.75 → 0.0.76
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.
- package/.vscode/extensions.json +2 -1
- package/.vscode/settings.json +9 -0
- package/CHANGELOG.md +17 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/cli/config/firebase.json +7 -0
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/astro.config.mjs +9 -3
- package/packages/storefront/dist/client/assets/_...3d331176.css +1 -0
- package/packages/storefront/dist/client/assets/{fallback.9cd2ed3f.css → _...b330a555.css} +1 -1
- package/packages/storefront/dist/client/assets/_...c1ec409f.css +4 -0
- package/packages/storefront/dist/client/assets/fallback-index.552fd862.css +1 -0
- package/packages/storefront/dist/client/assets/{_...27b7eb4d.css → fallback.a3f85892.css} +1 -1
- package/packages/storefront/dist/client/assets/{index.c5a9ea80.css → index.73f26ab5.css} +1 -1
- package/packages/storefront/dist/client/client.80baece3.js +1 -0
- package/packages/storefront/dist/client/hoisted.61a32b69.js +661 -0
- package/packages/storefront/dist/server/entry.mjs +326 -161
- package/packages/storefront/package.json +6 -1
- package/packages/storefront/src/html.d.ts +23 -0
- package/packages/storefront/src/lib/components/Card.astro +1 -1
- package/packages/storefront/src/lib/components/LoginModal.vue +14 -20
- package/packages/storefront/src/lib/layouts/Base.astro +129 -0
- package/packages/storefront/src/lib/layouts/Checkout.astro +0 -0
- package/packages/storefront/src/lib/layouts/Pages.astro +30 -0
- package/packages/storefront/src/lib/layouts/meta/Head.astro +62 -1
- package/packages/storefront/src/lib/layouts/meta/Json.astro +49 -10
- package/packages/storefront/src/lib/main/Home.astro +84 -0
- package/packages/storefront/src/lib/main/Wildcard.astro +0 -0
- package/packages/storefront/src/lib/ssr-context.ts +2 -1
- package/packages/storefront/src/lib/views/[...slug].astro +3 -3
- package/packages/storefront/src/lib/views/fallback.astro +5 -3
- package/packages/storefront/src/lib/views/index.astro +4 -3
- package/packages/storefront/src/pages/index.astro +7 -2
- package/packages/storefront/tailwind.config.ts +0 -0
- package/packages/storefront/uno.config.ts +98 -0
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/LoginModal.d6b935cf.js +0 -1
- package/packages/storefront/dist/client/assets/_...b3f65c5c.css +0 -1
- package/packages/storefront/dist/client/assets/fallback-index.90217cf0.css +0 -1
- package/packages/storefront/dist/client/chunks/index.esm.69f70489.js +0 -1726
- package/packages/storefront/dist/client/chunks/index.esm2017.1194d1a1.js +0 -457
- package/packages/storefront/dist/client/chunks/runtime-core.esm-bundler.a7337834.js +0 -1
- package/packages/storefront/dist/client/client.80b904f3.js +0 -1
- package/packages/storefront/dist/client/hoisted.24787260.js +0 -376
- package/packages/storefront/src/lib/layouts/Layout.astro +0 -84
|
@@ -1,1726 +0,0 @@
|
|
|
1
|
-
import{E as ht,L as ci,j as li,k as ft,g as f,_ as Wt,C as it,r as Vt,i as sn,S as Ue,l as di,m as g,q as re,n as Q,p as he,s as ui,F as H,t as on,u as hi,w as fi,f as pt,x as an,e as rt}from"./index.esm2017.1194d1a1.js";function mt(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}const le={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},X={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/function pi(){return{["admin-restricted-operation"]:"This operation is restricted to administrators only.",["argument-error"]:"",["app-not-authorized"]:"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.",["app-not-installed"]:"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.",["captcha-check-failed"]:"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.",["code-expired"]:"The SMS code has expired. Please re-send the verification code to try again.",["cordova-not-ready"]:"Cordova framework is not ready.",["cors-unsupported"]:"This browser is not supported.",["credential-already-in-use"]:"This credential is already associated with a different user account.",["custom-token-mismatch"]:"The custom token corresponds to a different audience.",["requires-recent-login"]:"This operation is sensitive and requires recent authentication. Log in again before retrying this request.",["dependent-sdk-initialized-before-auth"]:"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK.",["dynamic-link-not-activated"]:"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.",["email-change-needs-verification"]:"Multi-factor users must always have a verified email.",["email-already-in-use"]:"The email address is already in use by another account.",["emulator-config-failed"]:'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',["expired-action-code"]:"The action code has expired.",["cancelled-popup-request"]:"This operation has been cancelled due to another conflicting popup being opened.",["internal-error"]:"An internal AuthError has occurred.",["invalid-app-credential"]:"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.",["invalid-app-id"]:"The mobile app identifier is not registed for the current project.",["invalid-user-token"]:"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.",["invalid-auth-event"]:"An internal AuthError has occurred.",["invalid-verification-code"]:"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.",["invalid-continue-uri"]:"The continue URL provided in the request is invalid.",["invalid-cordova-configuration"]:"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.",["invalid-custom-token"]:"The custom token format is incorrect. Please check the documentation.",["invalid-dynamic-link-domain"]:"The provided dynamic link domain is not configured or authorized for the current project.",["invalid-email"]:"The email address is badly formatted.",["invalid-emulator-scheme"]:"Emulator URL must start with a valid scheme (http:// or https://).",["invalid-api-key"]:"Your API key is invalid, please check you have copied it correctly.",["invalid-cert-hash"]:"The SHA-1 certificate hash provided is invalid.",["invalid-credential"]:"The supplied auth credential is malformed or has expired.",["invalid-message-payload"]:"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.",["invalid-multi-factor-session"]:"The request does not contain a valid proof of first factor successful sign-in.",["invalid-oauth-provider"]:"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.",["invalid-oauth-client-id"]:"The OAuth client ID provided is either invalid or does not match the specified API key.",["unauthorized-domain"]:"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.",["invalid-action-code"]:"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.",["wrong-password"]:"The password is invalid or the user does not have a password.",["invalid-persistence-type"]:"The specified persistence type is invalid. It can only be local, session or none.",["invalid-phone-number"]:"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].",["invalid-provider-id"]:"The specified provider ID is invalid.",["invalid-recipient-email"]:"The email corresponding to this action failed to send as the provided recipient email address is invalid.",["invalid-sender"]:"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.",["invalid-verification-id"]:"The verification ID used to create the phone auth credential is invalid.",["invalid-tenant-id"]:"The Auth instance's tenant ID is invalid.",["login-blocked"]:"Login blocked by user-provided method: {$originalMessage}",["missing-android-pkg-name"]:"An Android Package Name must be provided if the Android App is required to be installed.",["auth-domain-config-required"]:"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.",["missing-app-credential"]:"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.",["missing-verification-code"]:"The phone auth credential was created with an empty SMS verification code.",["missing-continue-uri"]:"A continue URL must be provided in the request.",["missing-iframe-start"]:"An internal AuthError has occurred.",["missing-ios-bundle-id"]:"An iOS Bundle ID must be provided if an App Store ID is provided.",["missing-or-invalid-nonce"]:"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.",["missing-multi-factor-info"]:"No second factor identifier is provided.",["missing-multi-factor-session"]:"The request is missing proof of first factor successful sign-in.",["missing-phone-number"]:"To send verification codes, provide a phone number for the recipient.",["missing-verification-id"]:"The phone auth credential was created with an empty verification ID.",["app-deleted"]:"This instance of FirebaseApp has been deleted.",["multi-factor-info-not-found"]:"The user does not have a second factor matching the identifier provided.",["multi-factor-auth-required"]:"Proof of ownership of a second factor is required to complete sign-in.",["account-exists-with-different-credential"]:"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.",["network-request-failed"]:"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.",["no-auth-event"]:"An internal AuthError has occurred.",["no-such-provider"]:"User was not linked to an account with the given provider.",["null-user"]:"A null user object was provided as the argument for an operation which requires a non-null user object.",["operation-not-allowed"]:"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.",["operation-not-supported-in-this-environment"]:'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',["popup-blocked"]:"Unable to establish a connection with the popup. It may have been blocked by the browser.",["popup-closed-by-user"]:"The popup has been closed by the user before finalizing the operation.",["provider-already-linked"]:"User can only be linked to one identity for the given provider.",["quota-exceeded"]:"The project's quota for this operation has been exceeded.",["redirect-cancelled-by-user"]:"The redirect operation has been cancelled by the user before finalizing.",["redirect-operation-pending"]:"A redirect sign-in operation is already pending.",["rejected-credential"]:"The request contains malformed or mismatching credentials.",["second-factor-already-in-use"]:"The second factor is already enrolled on this account.",["maximum-second-factor-count-exceeded"]:"The maximum allowed number of second factors on a user has been exceeded.",["tenant-id-mismatch"]:"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.",["user-token-expired"]:"The user's credential is no longer valid. The user must sign in again.",["too-many-requests"]:"We have blocked all requests from this device due to unusual activity. Try again later.",["unauthorized-continue-uri"]:"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.",["unsupported-first-factor"]:"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.",["unsupported-persistence-type"]:"The current environment does not support the specified persistence type.",["unsupported-tenant-operation"]:"This operation is not supported in a multi-tenant context.",["unverified-email"]:"The operation requires a verified email.",["user-cancelled"]:"The user did not grant your application the permissions it requested.",["user-not-found"]:"There is no user record corresponding to this identifier. The user may have been deleted.",["user-disabled"]:"The user account has been disabled by an administrator.",["user-mismatch"]:"The supplied credentials do not correspond to the previously signed in user.",["user-signed-out"]:"",["weak-password"]:"The password must be 6 characters long or more.",["web-storage-unsupported"]:"This browser is not supported or 3rd party cookies and data may be disabled.",["already-initialized"]:"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance."}}function cn(){return{["dependent-sdk-initialized-before-auth"]:"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const mi=pi,gi=cn,ln=new ht("auth","Firebase",cn());/**
|
|
17
|
-
* @license
|
|
18
|
-
* Copyright 2020 Google LLC
|
|
19
|
-
*
|
|
20
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License.
|
|
22
|
-
* You may obtain a copy of the License at
|
|
23
|
-
*
|
|
24
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
-
*
|
|
26
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
27
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
28
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
29
|
-
* See the License for the specific language governing permissions and
|
|
30
|
-
* limitations under the License.
|
|
31
|
-
*/const qt=new ci("@firebase/auth");function Pe(n,...e){qt.logLevel<=ui.ERROR&&qt.error(`Auth (${Ue}): ${n}`,...e)}/**
|
|
32
|
-
* @license
|
|
33
|
-
* Copyright 2020 Google LLC
|
|
34
|
-
*
|
|
35
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
36
|
-
* you may not use this file except in compliance with the License.
|
|
37
|
-
* You may obtain a copy of the License at
|
|
38
|
-
*
|
|
39
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
40
|
-
*
|
|
41
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
42
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
43
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
44
|
-
* See the License for the specific language governing permissions and
|
|
45
|
-
* limitations under the License.
|
|
46
|
-
*/function y(n,...e){throw gt(n,...e)}function I(n,...e){return gt(n,...e)}function dn(n,e,t){const i=Object.assign(Object.assign({},gi()),{[e]:t});return new ht("auth","Firebase",i).create(e,{appName:n.name})}function se(n,e,t){const i=t;if(!(e instanceof i))throw i.name!==e.constructor.name&&y(n,"argument-error"),dn(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function gt(n,...e){if(typeof n!="string"){const t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return ln.create(n,...e)}function l(n,e,...t){if(!n)throw gt(e,...t)}function C(n){const e="INTERNAL ASSERTION FAILED: "+n;throw Pe(e),new Error(e)}function S(n,e){n||C(e)}/**
|
|
47
|
-
* @license
|
|
48
|
-
* Copyright 2020 Google LLC
|
|
49
|
-
*
|
|
50
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
51
|
-
* you may not use this file except in compliance with the License.
|
|
52
|
-
* You may obtain a copy of the License at
|
|
53
|
-
*
|
|
54
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
-
*
|
|
56
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
57
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
58
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
59
|
-
* See the License for the specific language governing permissions and
|
|
60
|
-
* limitations under the License.
|
|
61
|
-
*/const Ht=new Map;function E(n){S(n instanceof Function,"Expected a class definition");let e=Ht.get(n);return e?(S(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Ht.set(n,e),e)}function vi(n,e){const t=e?.persistence||[],i=(Array.isArray(t)?t:[t]).map(E);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e?.popupRedirectResolver)}/**
|
|
62
|
-
* @license
|
|
63
|
-
* Copyright 2020 Google LLC
|
|
64
|
-
*
|
|
65
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
66
|
-
* you may not use this file except in compliance with the License.
|
|
67
|
-
* You may obtain a copy of the License at
|
|
68
|
-
*
|
|
69
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
70
|
-
*
|
|
71
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
72
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
73
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
74
|
-
* See the License for the specific language governing permissions and
|
|
75
|
-
* limitations under the License.
|
|
76
|
-
*/function ve(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function vt(){return zt()==="http:"||zt()==="https:"}function zt(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
|
|
77
|
-
* @license
|
|
78
|
-
* Copyright 2020 Google LLC
|
|
79
|
-
*
|
|
80
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
|
-
* you may not use this file except in compliance with the License.
|
|
82
|
-
* You may obtain a copy of the License at
|
|
83
|
-
*
|
|
84
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
85
|
-
*
|
|
86
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
87
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
88
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
|
-
* See the License for the specific language governing permissions and
|
|
90
|
-
* limitations under the License.
|
|
91
|
-
*/function _i(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(vt()||sn()||"connection"in navigator)?navigator.onLine:!0}function Ii(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
|
92
|
-
* @license
|
|
93
|
-
* Copyright 2020 Google LLC
|
|
94
|
-
*
|
|
95
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
96
|
-
* you may not use this file except in compliance with the License.
|
|
97
|
-
* You may obtain a copy of the License at
|
|
98
|
-
*
|
|
99
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
100
|
-
*
|
|
101
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
102
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
103
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
104
|
-
* See the License for the specific language governing permissions and
|
|
105
|
-
* limitations under the License.
|
|
106
|
-
*/class Te{constructor(e,t){this.shortDelay=e,this.longDelay=t,S(t>e,"Short delay should be less than long delay!"),this.isMobile=li()||ft()}get(){return _i()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
107
|
-
* @license
|
|
108
|
-
* Copyright 2020 Google LLC
|
|
109
|
-
*
|
|
110
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
-
* you may not use this file except in compliance with the License.
|
|
112
|
-
* You may obtain a copy of the License at
|
|
113
|
-
*
|
|
114
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
-
*
|
|
116
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
-
* See the License for the specific language governing permissions and
|
|
120
|
-
* limitations under the License.
|
|
121
|
-
*/function _t(n,e){S(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
|
122
|
-
* @license
|
|
123
|
-
* Copyright 2020 Google LLC
|
|
124
|
-
*
|
|
125
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
126
|
-
* you may not use this file except in compliance with the License.
|
|
127
|
-
* You may obtain a copy of the License at
|
|
128
|
-
*
|
|
129
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
130
|
-
*
|
|
131
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
132
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
133
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
|
-
* See the License for the specific language governing permissions and
|
|
135
|
-
* limitations under the License.
|
|
136
|
-
*/class un{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;C("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;C("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;C("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2020 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/const yi={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"};/**
|
|
152
|
-
* @license
|
|
153
|
-
* Copyright 2020 Google LLC
|
|
154
|
-
*
|
|
155
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
156
|
-
* you may not use this file except in compliance with the License.
|
|
157
|
-
* You may obtain a copy of the License at
|
|
158
|
-
*
|
|
159
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
160
|
-
*
|
|
161
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
162
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
163
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
164
|
-
* See the License for the specific language governing permissions and
|
|
165
|
-
* limitations under the License.
|
|
166
|
-
*/const wi=new Te(3e4,6e4);function m(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function _(n,e,t,i,r={}){return hn(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});const a=re(Object.assign({key:n.config.apiKey},o)).slice(1),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/json",n.languageCode&&(c["X-Firebase-Locale"]=n.languageCode),un.fetch()(fn(n,n.config.apiHost,t,a),Object.assign({method:e,headers:c,referrerPolicy:"no-referrer"},s))})}async function hn(n,e,t){n._canInitEmulator=!1;const i=Object.assign(Object.assign({},yi),e);try{const r=new Ti(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw fe(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[c,d]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw fe(n,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw fe(n,"email-already-in-use",o);if(c==="USER_DISABLED")throw fe(n,"user-disabled",o);const u=i[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw dn(n,u,d);y(n,u)}}catch(r){if(r instanceof H)throw r;y(n,"network-request-failed")}}async function x(n,e,t,i,r={}){const s=await _(n,e,t,i,r);return"mfaPendingCredential"in s&&y(n,"multi-factor-auth-required",{_serverResponse:s}),s}function fn(n,e,t,i){const r=`${e}${t}?${i}`;return n.config.emulator?_t(n.config,r):`${n.config.apiScheme}://${r}`}class Ti{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(I(this.auth,"network-request-failed")),wi.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function fe(n,e,t){const i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);const r=I(n,e,i);return r.customData._tokenResponse=t,r}/**
|
|
167
|
-
* @license
|
|
168
|
-
* Copyright 2020 Google LLC
|
|
169
|
-
*
|
|
170
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
-
* you may not use this file except in compliance with the License.
|
|
172
|
-
* You may obtain a copy of the License at
|
|
173
|
-
*
|
|
174
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
-
*
|
|
176
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
-
* See the License for the specific language governing permissions and
|
|
180
|
-
* limitations under the License.
|
|
181
|
-
*/async function ki(n,e){return _(n,"POST","/v1/accounts:delete",e)}async function Ei(n,e){return _(n,"POST","/v1/accounts:update",e)}async function bi(n,e){return _(n,"POST","/v1/accounts:lookup",e)}/**
|
|
182
|
-
* @license
|
|
183
|
-
* Copyright 2020 Google LLC
|
|
184
|
-
*
|
|
185
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
186
|
-
* you may not use this file except in compliance with the License.
|
|
187
|
-
* You may obtain a copy of the License at
|
|
188
|
-
*
|
|
189
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
190
|
-
*
|
|
191
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
192
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
193
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
194
|
-
* See the License for the specific language governing permissions and
|
|
195
|
-
* limitations under the License.
|
|
196
|
-
*/function pe(n){if(!!n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Ri(n,e=!1){const t=f(n),i=await t.getIdToken(e),r=Fe(i);l(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");const s=typeof r.firebase=="object"?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:pe(Qe(r.auth_time)),issuedAtTime:pe(Qe(r.iat)),expirationTime:pe(Qe(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Qe(n){return Number(n)*1e3}function Fe(n){var e;const[t,i,r]=n.split(".");if(t===void 0||i===void 0||r===void 0)return Pe("JWT malformed, contained fewer than 3 sections"),null;try{const s=hi(i);return s?JSON.parse(s):(Pe("Failed to decode base64 JWT payload"),null)}catch(s){return Pe("Caught error parsing JWT payload as JSON",(e=s)===null||e===void 0?void 0:e.toString()),null}}function Si(n){const e=Fe(n);return l(e,"internal-error"),l(typeof e.exp<"u","internal-error"),l(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
|
197
|
-
* @license
|
|
198
|
-
* Copyright 2020 Google LLC
|
|
199
|
-
*
|
|
200
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
-
* you may not use this file except in compliance with the License.
|
|
202
|
-
* You may obtain a copy of the License at
|
|
203
|
-
*
|
|
204
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
-
*
|
|
206
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
207
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
-
* See the License for the specific language governing permissions and
|
|
210
|
-
* limitations under the License.
|
|
211
|
-
*/async function F(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof H&&Ai(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Ai({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
|
212
|
-
* @license
|
|
213
|
-
* Copyright 2020 Google LLC
|
|
214
|
-
*
|
|
215
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
-
* you may not use this file except in compliance with the License.
|
|
217
|
-
* You may obtain a copy of the License at
|
|
218
|
-
*
|
|
219
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
-
*
|
|
221
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
-
* See the License for the specific language governing permissions and
|
|
225
|
-
* limitations under the License.
|
|
226
|
-
*/class Pi{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){!this.isRunning||(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const i=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),i}else{this.errorBackoff=3e4;const r=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){var e;try{await this.user.getIdToken(!0)}catch(t){((e=t)===null||e===void 0?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
|
227
|
-
* @license
|
|
228
|
-
* Copyright 2020 Google LLC
|
|
229
|
-
*
|
|
230
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
231
|
-
* you may not use this file except in compliance with the License.
|
|
232
|
-
* You may obtain a copy of the License at
|
|
233
|
-
*
|
|
234
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
-
*
|
|
236
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
237
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
238
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
239
|
-
* See the License for the specific language governing permissions and
|
|
240
|
-
* limitations under the License.
|
|
241
|
-
*/class pn{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=pe(this.lastLoginAt),this.creationTime=pe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
242
|
-
* @license
|
|
243
|
-
* Copyright 2019 Google LLC
|
|
244
|
-
*
|
|
245
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
246
|
-
* you may not use this file except in compliance with the License.
|
|
247
|
-
* You may obtain a copy of the License at
|
|
248
|
-
*
|
|
249
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
250
|
-
*
|
|
251
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
252
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
253
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
|
-
* See the License for the specific language governing permissions and
|
|
255
|
-
* limitations under the License.
|
|
256
|
-
*/async function _e(n){var e;const t=n.auth,i=await n.getIdToken(),r=await F(n,bi(t,{idToken:i}));l(r?.users.length,t,"internal-error");const s=r.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?Ci(s.providerUserInfo):[],a=Oi(n.providerData,o),c=n.isAnonymous,d=!(n.email&&s.passwordHash)&&!a?.length,u=c?d:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new pn(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(n,h)}async function Ni(n){const e=f(n);await _e(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Oi(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function Ci(n){return n.map(e=>{var{providerId:t}=e,i=mt(e,["providerId"]);return{providerId:t,uid:i.rawId||"",displayName:i.displayName||null,email:i.email||null,phoneNumber:i.phoneNumber||null,photoURL:i.photoUrl||null}})}/**
|
|
257
|
-
* @license
|
|
258
|
-
* Copyright 2020 Google LLC
|
|
259
|
-
*
|
|
260
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
261
|
-
* you may not use this file except in compliance with the License.
|
|
262
|
-
* You may obtain a copy of the License at
|
|
263
|
-
*
|
|
264
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
265
|
-
*
|
|
266
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
267
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
268
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
269
|
-
* See the License for the specific language governing permissions and
|
|
270
|
-
* limitations under the License.
|
|
271
|
-
*/async function Li(n,e){const t=await hn(n,{},async()=>{const i=re({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=fn(n,r,"/v1/token",`key=${s}`),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",un.fetch()(o,{method:"POST",headers:a,body:i})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}/**
|
|
272
|
-
* @license
|
|
273
|
-
* Copyright 2020 Google LLC
|
|
274
|
-
*
|
|
275
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
276
|
-
* you may not use this file except in compliance with the License.
|
|
277
|
-
* You may obtain a copy of the License at
|
|
278
|
-
*
|
|
279
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
280
|
-
*
|
|
281
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
282
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
283
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
|
-
* See the License for the specific language governing permissions and
|
|
285
|
-
* limitations under the License.
|
|
286
|
-
*/class Ie{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){l(e.idToken,"internal-error"),l(typeof e.idToken<"u","internal-error"),l(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Si(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return l(!this.accessToken||this.refreshToken,e,"user-token-expired"),!t&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:i,refreshToken:r,expiresIn:s}=await Li(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){const{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new Ie;return i&&(l(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(l(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(l(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ie,this.toJSON())}_performRefresh(){return C("not implemented")}}/**
|
|
287
|
-
* @license
|
|
288
|
-
* Copyright 2020 Google LLC
|
|
289
|
-
*
|
|
290
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
291
|
-
* you may not use this file except in compliance with the License.
|
|
292
|
-
* You may obtain a copy of the License at
|
|
293
|
-
*
|
|
294
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
295
|
-
*
|
|
296
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
297
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
298
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
|
-
* See the License for the specific language governing permissions and
|
|
300
|
-
* limitations under the License.
|
|
301
|
-
*/function V(n,e){l(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class j{constructor(e){var{uid:t,auth:i,stsTokenManager:r}=e,s=mt(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Pi(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=i,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new pn(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await F(this,this.stsTokenManager.getToken(this.auth,e));return l(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return Ri(this,e)}reload(){return Ni(this)}_assign(e){this!==e&&(l(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new j(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){l(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await _e(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await F(this,ki(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var i,r,s,o,a,c,d,u;const h=(i=t.displayName)!==null&&i!==void 0?i:void 0,w=(r=t.email)!==null&&r!==void 0?r:void 0,Re=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,Se=(o=t.photoURL)!==null&&o!==void 0?o:void 0,Lt=(a=t.tenantId)!==null&&a!==void 0?a:void 0,Ke=(c=t._redirectEventId)!==null&&c!==void 0?c:void 0,Dt=(d=t.createdAt)!==null&&d!==void 0?d:void 0,Mt=(u=t.lastLoginAt)!==null&&u!==void 0?u:void 0,{uid:Je,emailVerified:Ut,isAnonymous:Ft,providerData:Ye,stsTokenManager:xt}=t;l(Je&&xt,e,"internal-error");const oi=Ie.fromJSON(this.name,xt);l(typeof Je=="string",e,"internal-error"),V(h,e.name),V(w,e.name),l(typeof Ut=="boolean",e,"internal-error"),l(typeof Ft=="boolean",e,"internal-error"),V(Re,e.name),V(Se,e.name),V(Lt,e.name),V(Ke,e.name),V(Dt,e.name),V(Mt,e.name);const Xe=new j({uid:Je,auth:e,email:w,emailVerified:Ut,displayName:h,isAnonymous:Ft,photoURL:Se,phoneNumber:Re,tenantId:Lt,stsTokenManager:oi,createdAt:Dt,lastLoginAt:Mt});return Ye&&Array.isArray(Ye)&&(Xe.providerData=Ye.map(ai=>Object.assign({},ai))),Ke&&(Xe._redirectEventId=Ke),Xe}static async _fromIdTokenResponse(e,t,i=!1){const r=new Ie;r.updateFromServerResponse(t);const s=new j({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await _e(s),s}}/**
|
|
302
|
-
* @license
|
|
303
|
-
* Copyright 2019 Google LLC
|
|
304
|
-
*
|
|
305
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
306
|
-
* you may not use this file except in compliance with the License.
|
|
307
|
-
* You may obtain a copy of the License at
|
|
308
|
-
*
|
|
309
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
310
|
-
*
|
|
311
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
312
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
313
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
314
|
-
* See the License for the specific language governing permissions and
|
|
315
|
-
* limitations under the License.
|
|
316
|
-
*/class mn{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}mn.type="NONE";const ne=mn;/**
|
|
317
|
-
* @license
|
|
318
|
-
* Copyright 2019 Google LLC
|
|
319
|
-
*
|
|
320
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
321
|
-
* you may not use this file except in compliance with the License.
|
|
322
|
-
* You may obtain a copy of the License at
|
|
323
|
-
*
|
|
324
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
325
|
-
*
|
|
326
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
327
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
328
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
|
-
* See the License for the specific language governing permissions and
|
|
330
|
-
* limitations under the License.
|
|
331
|
-
*/function B(n,e,t){return`firebase:${n}:${e}:${t}`}class Z{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;const{config:r,name:s}=this.auth;this.fullUserKey=B(this.userKey,r.apiKey,s),this.fullPersistenceKey=B("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?j._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,i="authUser"){if(!t.length)return new Z(E(ne),e,i);const r=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let s=r[0]||E(ne);const o=B(i,e.config.apiKey,e.name);let a=null;for(const d of t)try{const u=await d._get(o);if(u){const h=j._fromJSON(e,u);d!==s&&(a=h),s=d;break}}catch{}const c=r.filter(d=>d._shouldAllowMigration);return!s._shouldAllowMigration||!c.length?new Z(s,e,i):(s=c[0],a&&await s._set(o,a.toJSON()),await Promise.all(t.map(async d=>{if(d!==s)try{await d._remove(o)}catch{}})),new Z(s,e,i))}}/**
|
|
332
|
-
* @license
|
|
333
|
-
* Copyright 2020 Google LLC
|
|
334
|
-
*
|
|
335
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
336
|
-
* you may not use this file except in compliance with the License.
|
|
337
|
-
* You may obtain a copy of the License at
|
|
338
|
-
*
|
|
339
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
340
|
-
*
|
|
341
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
342
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
343
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
|
-
* See the License for the specific language governing permissions and
|
|
345
|
-
* limitations under the License.
|
|
346
|
-
*/function Gt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(_n(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(gn(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(In(e))return"Blackberry";if(yn(e))return"Webos";if(It(e))return"Safari";if((e.includes("chrome/")||vn(e))&&!e.includes("edge/"))return"Chrome";if(ke(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if(i?.length===2)return i[1]}return"Other"}function gn(n=g()){return/firefox\//i.test(n)}function It(n=g()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vn(n=g()){return/crios\//i.test(n)}function _n(n=g()){return/iemobile/i.test(n)}function ke(n=g()){return/android/i.test(n)}function In(n=g()){return/blackberry/i.test(n)}function yn(n=g()){return/webos/i.test(n)}function oe(n=g()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Di(n=g()){return/(iPad|iPhone|iPod).*OS 7_\d/i.test(n)||/(iPad|iPhone|iPod).*OS 8_\d/i.test(n)}function Mi(n=g()){var e;return oe(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Ui(){return on()&&document.documentMode===10}function wn(n=g()){return oe(n)||ke(n)||yn(n)||In(n)||/windows phone/i.test(n)||_n(n)}function Fi(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
|
|
347
|
-
* @license
|
|
348
|
-
* Copyright 2020 Google LLC
|
|
349
|
-
*
|
|
350
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
351
|
-
* you may not use this file except in compliance with the License.
|
|
352
|
-
* You may obtain a copy of the License at
|
|
353
|
-
*
|
|
354
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
355
|
-
*
|
|
356
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
357
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
358
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
359
|
-
* See the License for the specific language governing permissions and
|
|
360
|
-
* limitations under the License.
|
|
361
|
-
*/function Tn(n,e=[]){let t;switch(n){case"Browser":t=Gt(g());break;case"Worker":t=`${Gt(g())}-${n}`;break;default:t=n}const i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${Ue}/${i}`}/**
|
|
362
|
-
* @license
|
|
363
|
-
* Copyright 2022 Google LLC
|
|
364
|
-
*
|
|
365
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
366
|
-
* you may not use this file except in compliance with the License.
|
|
367
|
-
* You may obtain a copy of the License at
|
|
368
|
-
*
|
|
369
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
370
|
-
*
|
|
371
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
372
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
373
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
374
|
-
* See the License for the specific language governing permissions and
|
|
375
|
-
* limitations under the License.
|
|
376
|
-
*/class xi{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const i=s=>new Promise((o,a)=>{try{const c=e(s);o(c)}catch(c){a(c)}});i.onAbort=t,this.queue.push(i);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){var t;if(this.auth.currentUser===e)return;const i=[];try{for(const r of this.queue)await r(e),r.onAbort&&i.push(r.onAbort)}catch(r){i.reverse();for(const s of i)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:(t=r)===null||t===void 0?void 0:t.message})}}}/**
|
|
377
|
-
* @license
|
|
378
|
-
* Copyright 2020 Google LLC
|
|
379
|
-
*
|
|
380
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
381
|
-
* you may not use this file except in compliance with the License.
|
|
382
|
-
* You may obtain a copy of the License at
|
|
383
|
-
*
|
|
384
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
385
|
-
*
|
|
386
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
387
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
388
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
389
|
-
* See the License for the specific language governing permissions and
|
|
390
|
-
* limitations under the License.
|
|
391
|
-
*/class Wi{constructor(e,t,i){this.app=e,this.heartbeatServiceProvider=t,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jt(this),this.idTokenSubscription=new jt(this),this.beforeStateQueue=new xi(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ln,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=E(t)),this._initializationPromise=this.queue(async()=>{var i,r;if(!this._deleted&&(this.persistenceManager=await Z.create(this,e),!this._deleted)){if(!((i=this._popupRedirectResolver)===null||i===void 0)&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((r=this.currentUser)===null||r===void 0?void 0:r.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t;const i=await this.assertedPersistence.getCurrentUser();let r=i,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&c?.user&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=i,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return l(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){var t;try{await _e(e)}catch(i){if(((t=i)===null||t===void 0?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Ii()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?f(e):null;return t&&l(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&l(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue(async()=>{await this.assertedPersistence.setPersistence(E(e))})}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new ht("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&E(e)||this._popupRedirectResolver;l(t,this,"argument-error"),this.redirectPersistenceManager=await Z.create(this,[E(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,i;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((i=this.redirectUser)===null||i===void 0?void 0:i._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const i=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==i&&(this.lastNotifiedUid=i,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,i,r){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t),o=this._isInitialized?Promise.resolve():this._initializationPromise;return l(o,this,"internal-error"),o.then(()=>s(this.currentUser)),typeof t=="function"?e.addObserver(t,i,r):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return l(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Tn(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={["X-Client-Version"]:this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const i=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());return i&&(t["X-Firebase-Client"]=i),t}}function v(n){return f(n)}class jt{constructor(e){this.auth=e,this.observer=null,this.addObserver=di(t=>this.observer=t)}get next(){return l(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Vi(n,e,t){const i=v(n);l(i._canInitEmulator,i,"emulator-config-failed"),l(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!!t?.disableWarnings,s=kn(e),{host:o,port:a}=qi(e),c=a===null?"":`:${a}`;i.config.emulator={url:`${s}//${o}${c}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||Hi()}function kn(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function qi(n){const e=kn(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const s=r[1];return{host:s,port:Bt(i.substr(s.length+1))}}else{const[s,o]=i.split(":");return{host:s,port:Bt(o)}}}function Bt(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function Hi(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
|
|
392
|
-
* @license
|
|
393
|
-
* Copyright 2020 Google LLC
|
|
394
|
-
*
|
|
395
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
396
|
-
* you may not use this file except in compliance with the License.
|
|
397
|
-
* You may obtain a copy of the License at
|
|
398
|
-
*
|
|
399
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
400
|
-
*
|
|
401
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
402
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
403
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
404
|
-
* See the License for the specific language governing permissions and
|
|
405
|
-
* limitations under the License.
|
|
406
|
-
*/class ae{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return C("not implemented")}_getIdTokenResponse(e){return C("not implemented")}_linkToIdToken(e,t){return C("not implemented")}_getReauthenticationResolver(e){return C("not implemented")}}/**
|
|
407
|
-
* @license
|
|
408
|
-
* Copyright 2020 Google LLC
|
|
409
|
-
*
|
|
410
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
411
|
-
* you may not use this file except in compliance with the License.
|
|
412
|
-
* You may obtain a copy of the License at
|
|
413
|
-
*
|
|
414
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
415
|
-
*
|
|
416
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
417
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
418
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
419
|
-
* See the License for the specific language governing permissions and
|
|
420
|
-
* limitations under the License.
|
|
421
|
-
*/async function En(n,e){return _(n,"POST","/v1/accounts:resetPassword",m(n,e))}async function bn(n,e){return _(n,"POST","/v1/accounts:update",e)}async function zi(n,e){return _(n,"POST","/v1/accounts:update",m(n,e))}/**
|
|
422
|
-
* @license
|
|
423
|
-
* Copyright 2020 Google LLC
|
|
424
|
-
*
|
|
425
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
426
|
-
* you may not use this file except in compliance with the License.
|
|
427
|
-
* You may obtain a copy of the License at
|
|
428
|
-
*
|
|
429
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
430
|
-
*
|
|
431
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
432
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
433
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
434
|
-
* See the License for the specific language governing permissions and
|
|
435
|
-
* limitations under the License.
|
|
436
|
-
*/async function Gi(n,e){return x(n,"POST","/v1/accounts:signInWithPassword",m(n,e))}async function xe(n,e){return _(n,"POST","/v1/accounts:sendOobCode",m(n,e))}async function ji(n,e){return xe(n,e)}async function Bi(n,e){return xe(n,e)}async function $i(n,e){return xe(n,e)}async function Ki(n,e){return xe(n,e)}/**
|
|
437
|
-
* @license
|
|
438
|
-
* Copyright 2020 Google LLC
|
|
439
|
-
*
|
|
440
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
441
|
-
* you may not use this file except in compliance with the License.
|
|
442
|
-
* You may obtain a copy of the License at
|
|
443
|
-
*
|
|
444
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
445
|
-
*
|
|
446
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
447
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
448
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
449
|
-
* See the License for the specific language governing permissions and
|
|
450
|
-
* limitations under the License.
|
|
451
|
-
*/async function Ji(n,e){return x(n,"POST","/v1/accounts:signInWithEmailLink",m(n,e))}async function Yi(n,e){return x(n,"POST","/v1/accounts:signInWithEmailLink",m(n,e))}/**
|
|
452
|
-
* @license
|
|
453
|
-
* Copyright 2020 Google LLC
|
|
454
|
-
*
|
|
455
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
456
|
-
* you may not use this file except in compliance with the License.
|
|
457
|
-
* You may obtain a copy of the License at
|
|
458
|
-
*
|
|
459
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
460
|
-
*
|
|
461
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
462
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
463
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
464
|
-
* See the License for the specific language governing permissions and
|
|
465
|
-
* limitations under the License.
|
|
466
|
-
*/class ye extends ae{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new ye(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new ye(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return Gi(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return Ji(e,{email:this._email,oobCode:this._password});default:y(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return bn(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return Yi(e,{idToken:t,email:this._email,oobCode:this._password});default:y(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
|
467
|
-
* @license
|
|
468
|
-
* Copyright 2020 Google LLC
|
|
469
|
-
*
|
|
470
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
471
|
-
* you may not use this file except in compliance with the License.
|
|
472
|
-
* You may obtain a copy of the License at
|
|
473
|
-
*
|
|
474
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
475
|
-
*
|
|
476
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
477
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
478
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
|
-
* See the License for the specific language governing permissions and
|
|
480
|
-
* limitations under the License.
|
|
481
|
-
*/async function U(n,e){return x(n,"POST","/v1/accounts:signInWithIdp",m(n,e))}/**
|
|
482
|
-
* @license
|
|
483
|
-
* Copyright 2020 Google LLC
|
|
484
|
-
*
|
|
485
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
486
|
-
* you may not use this file except in compliance with the License.
|
|
487
|
-
* You may obtain a copy of the License at
|
|
488
|
-
*
|
|
489
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
490
|
-
*
|
|
491
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
492
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
493
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
494
|
-
* See the License for the specific language governing permissions and
|
|
495
|
-
* limitations under the License.
|
|
496
|
-
*/const Xi="http://localhost";class L extends ae{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new L(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):y("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r}=t,s=mt(t,["providerId","signInMethod"]);if(!i||!r)return null;const o=new L(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return U(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,U(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,U(e,t)}buildRequest(){const e={requestUri:Xi,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=re(t)}return e}}/**
|
|
497
|
-
* @license
|
|
498
|
-
* Copyright 2020 Google LLC
|
|
499
|
-
*
|
|
500
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
501
|
-
* you may not use this file except in compliance with the License.
|
|
502
|
-
* You may obtain a copy of the License at
|
|
503
|
-
*
|
|
504
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
505
|
-
*
|
|
506
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
507
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
508
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
509
|
-
* See the License for the specific language governing permissions and
|
|
510
|
-
* limitations under the License.
|
|
511
|
-
*/async function Qi(n,e){return _(n,"POST","/v1/accounts:sendVerificationCode",m(n,e))}async function Zi(n,e){return x(n,"POST","/v1/accounts:signInWithPhoneNumber",m(n,e))}async function er(n,e){const t=await x(n,"POST","/v1/accounts:signInWithPhoneNumber",m(n,e));if(t.temporaryProof)throw fe(n,"account-exists-with-different-credential",t);return t}const tr={USER_NOT_FOUND:"user-not-found"};async function nr(n,e){const t=Object.assign(Object.assign({},e),{operation:"REAUTH"});return x(n,"POST","/v1/accounts:signInWithPhoneNumber",m(n,t),tr)}/**
|
|
512
|
-
* @license
|
|
513
|
-
* Copyright 2020 Google LLC
|
|
514
|
-
*
|
|
515
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
516
|
-
* you may not use this file except in compliance with the License.
|
|
517
|
-
* You may obtain a copy of the License at
|
|
518
|
-
*
|
|
519
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
520
|
-
*
|
|
521
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
522
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
523
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
524
|
-
* See the License for the specific language governing permissions and
|
|
525
|
-
* limitations under the License.
|
|
526
|
-
*/class $ extends ae{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new $({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new $({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return Zi(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return er(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return nr(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:i,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:i,code:r}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){typeof e=="string"&&(e=JSON.parse(e));const{verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s}=e;return!i&&!t&&!r&&!s?null:new $({verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s})}}/**
|
|
527
|
-
* @license
|
|
528
|
-
* Copyright 2020 Google LLC
|
|
529
|
-
*
|
|
530
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
531
|
-
* you may not use this file except in compliance with the License.
|
|
532
|
-
* You may obtain a copy of the License at
|
|
533
|
-
*
|
|
534
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
535
|
-
*
|
|
536
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
537
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
538
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
539
|
-
* See the License for the specific language governing permissions and
|
|
540
|
-
* limitations under the License.
|
|
541
|
-
*/function ir(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function rr(n){const e=Q(he(n)).link,t=e?Q(he(e)).deep_link_id:null,i=Q(he(n)).deep_link_id;return(i?Q(he(i)).link:null)||i||t||e||n}class We{constructor(e){var t,i,r,s,o,a;const c=Q(he(e)),d=(t=c.apiKey)!==null&&t!==void 0?t:null,u=(i=c.oobCode)!==null&&i!==void 0?i:null,h=ir((r=c.mode)!==null&&r!==void 0?r:null);l(d&&u&&h,"argument-error"),this.apiKey=d,this.operation=h,this.code=u,this.continueUrl=(s=c.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const t=rr(e);try{return new We(t)}catch{return null}}}/**
|
|
542
|
-
* @license
|
|
543
|
-
* Copyright 2020 Google LLC
|
|
544
|
-
*
|
|
545
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
546
|
-
* you may not use this file except in compliance with the License.
|
|
547
|
-
* You may obtain a copy of the License at
|
|
548
|
-
*
|
|
549
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
550
|
-
*
|
|
551
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
552
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
553
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
554
|
-
* See the License for the specific language governing permissions and
|
|
555
|
-
* limitations under the License.
|
|
556
|
-
*/class z{constructor(){this.providerId=z.PROVIDER_ID}static credential(e,t){return ye._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const i=We.parseLink(t);return l(i,"argument-error"),ye._fromEmailAndCode(e,i.code,i.tenantId)}}z.PROVIDER_ID="password";z.EMAIL_PASSWORD_SIGN_IN_METHOD="password";z.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
|
557
|
-
* @license
|
|
558
|
-
* Copyright 2020 Google LLC
|
|
559
|
-
*
|
|
560
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
561
|
-
* you may not use this file except in compliance with the License.
|
|
562
|
-
* You may obtain a copy of the License at
|
|
563
|
-
*
|
|
564
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
565
|
-
*
|
|
566
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
567
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
568
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
569
|
-
* See the License for the specific language governing permissions and
|
|
570
|
-
* limitations under the License.
|
|
571
|
-
*/class W{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/**
|
|
572
|
-
* @license
|
|
573
|
-
* Copyright 2019 Google LLC
|
|
574
|
-
*
|
|
575
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
576
|
-
* you may not use this file except in compliance with the License.
|
|
577
|
-
* You may obtain a copy of the License at
|
|
578
|
-
*
|
|
579
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
580
|
-
*
|
|
581
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
582
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
583
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
584
|
-
* See the License for the specific language governing permissions and
|
|
585
|
-
* limitations under the License.
|
|
586
|
-
*/class ce extends W{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class ee extends ce{static credentialFromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;return l("providerId"in t&&"signInMethod"in t,"argument-error"),L._fromParams(t)}credential(e){return this._credential(Object.assign(Object.assign({},e),{nonce:e.rawNonce}))}_credential(e){return l(e.idToken||e.accessToken,"argument-error"),L._fromParams(Object.assign(Object.assign({},e),{providerId:this.providerId,signInMethod:this.providerId}))}static credentialFromResult(e){return ee.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return ee.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:a}=e;if(!i&&!r&&!t&&!s||!a)return null;try{return new ee(a)._credential({idToken:t,accessToken:i,nonce:o,pendingToken:s})}catch{return null}}}/**
|
|
587
|
-
* @license
|
|
588
|
-
* Copyright 2020 Google LLC
|
|
589
|
-
*
|
|
590
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
591
|
-
* you may not use this file except in compliance with the License.
|
|
592
|
-
* You may obtain a copy of the License at
|
|
593
|
-
*
|
|
594
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
595
|
-
*
|
|
596
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
597
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
598
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
599
|
-
* See the License for the specific language governing permissions and
|
|
600
|
-
* limitations under the License.
|
|
601
|
-
*/class A extends ce{constructor(){super("facebook.com")}static credential(e){return L._fromParams({providerId:A.PROVIDER_ID,signInMethod:A.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return A.credentialFromTaggedObject(e)}static credentialFromError(e){return A.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return A.credential(e.oauthAccessToken)}catch{return null}}}A.FACEBOOK_SIGN_IN_METHOD="facebook.com";A.PROVIDER_ID="facebook.com";/**
|
|
602
|
-
* @license
|
|
603
|
-
* Copyright 2020 Google LLC
|
|
604
|
-
*
|
|
605
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
606
|
-
* you may not use this file except in compliance with the License.
|
|
607
|
-
* You may obtain a copy of the License at
|
|
608
|
-
*
|
|
609
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
610
|
-
*
|
|
611
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
612
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
613
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
614
|
-
* See the License for the specific language governing permissions and
|
|
615
|
-
* limitations under the License.
|
|
616
|
-
*/class P extends ce{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return L._fromParams({providerId:P.PROVIDER_ID,signInMethod:P.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return P.credentialFromTaggedObject(e)}static credentialFromError(e){return P.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return P.credential(t,i)}catch{return null}}}P.GOOGLE_SIGN_IN_METHOD="google.com";P.PROVIDER_ID="google.com";/**
|
|
617
|
-
* @license
|
|
618
|
-
* Copyright 2020 Google LLC
|
|
619
|
-
*
|
|
620
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
621
|
-
* you may not use this file except in compliance with the License.
|
|
622
|
-
* You may obtain a copy of the License at
|
|
623
|
-
*
|
|
624
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
625
|
-
*
|
|
626
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
627
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
628
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
629
|
-
* See the License for the specific language governing permissions and
|
|
630
|
-
* limitations under the License.
|
|
631
|
-
*/class N extends ce{constructor(){super("github.com")}static credential(e){return L._fromParams({providerId:N.PROVIDER_ID,signInMethod:N.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return N.credentialFromTaggedObject(e)}static credentialFromError(e){return N.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return N.credential(e.oauthAccessToken)}catch{return null}}}N.GITHUB_SIGN_IN_METHOD="github.com";N.PROVIDER_ID="github.com";/**
|
|
632
|
-
* @license
|
|
633
|
-
* Copyright 2020 Google LLC
|
|
634
|
-
*
|
|
635
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
636
|
-
* you may not use this file except in compliance with the License.
|
|
637
|
-
* You may obtain a copy of the License at
|
|
638
|
-
*
|
|
639
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
640
|
-
*
|
|
641
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
642
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
643
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
644
|
-
* See the License for the specific language governing permissions and
|
|
645
|
-
* limitations under the License.
|
|
646
|
-
*/const sr="http://localhost";class ie extends ae{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){const t=this.buildRequest();return U(e,t)}_linkToIdToken(e,t){const i=this.buildRequest();return i.idToken=t,U(e,i)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,U(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,pendingToken:s}=t;return!i||!r||!s||i!==r?null:new ie(i,s)}static _create(e,t){return new ie(e,t)}buildRequest(){return{requestUri:sr,returnSecureToken:!0,pendingToken:this.pendingToken}}}/**
|
|
647
|
-
* @license
|
|
648
|
-
* Copyright 2020 Google LLC
|
|
649
|
-
*
|
|
650
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
651
|
-
* you may not use this file except in compliance with the License.
|
|
652
|
-
* You may obtain a copy of the License at
|
|
653
|
-
*
|
|
654
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
655
|
-
*
|
|
656
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
657
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
658
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
659
|
-
* See the License for the specific language governing permissions and
|
|
660
|
-
* limitations under the License.
|
|
661
|
-
*/const or="saml.";class Ce extends W{constructor(e){l(e.startsWith(or),"argument-error"),super(e)}static credentialFromResult(e){return Ce.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return Ce.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){const t=ie.fromJSON(e);return l(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{pendingToken:t,providerId:i}=e;if(!t||!i)return null;try{return ie._create(i,t)}catch{return null}}}/**
|
|
662
|
-
* @license
|
|
663
|
-
* Copyright 2020 Google LLC
|
|
664
|
-
*
|
|
665
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
666
|
-
* you may not use this file except in compliance with the License.
|
|
667
|
-
* You may obtain a copy of the License at
|
|
668
|
-
*
|
|
669
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
670
|
-
*
|
|
671
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
672
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
673
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
674
|
-
* See the License for the specific language governing permissions and
|
|
675
|
-
* limitations under the License.
|
|
676
|
-
*/class O extends ce{constructor(){super("twitter.com")}static credential(e,t){return L._fromParams({providerId:O.PROVIDER_ID,signInMethod:O.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return O.credentialFromTaggedObject(e)}static credentialFromError(e){return O.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return O.credential(t,i)}catch{return null}}}O.TWITTER_SIGN_IN_METHOD="twitter.com";O.PROVIDER_ID="twitter.com";/**
|
|
677
|
-
* @license
|
|
678
|
-
* Copyright 2020 Google LLC
|
|
679
|
-
*
|
|
680
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
681
|
-
* you may not use this file except in compliance with the License.
|
|
682
|
-
* You may obtain a copy of the License at
|
|
683
|
-
*
|
|
684
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
685
|
-
*
|
|
686
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
687
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
688
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
689
|
-
* See the License for the specific language governing permissions and
|
|
690
|
-
* limitations under the License.
|
|
691
|
-
*/async function Rn(n,e){return x(n,"POST","/v1/accounts:signUp",m(n,e))}/**
|
|
692
|
-
* @license
|
|
693
|
-
* Copyright 2020 Google LLC
|
|
694
|
-
*
|
|
695
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
696
|
-
* you may not use this file except in compliance with the License.
|
|
697
|
-
* You may obtain a copy of the License at
|
|
698
|
-
*
|
|
699
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
700
|
-
*
|
|
701
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
702
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
703
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
704
|
-
* See the License for the specific language governing permissions and
|
|
705
|
-
* limitations under the License.
|
|
706
|
-
*/class b{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){const s=await j._fromIdTokenResponse(e,i,r),o=$t(i);return new b({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);const r=$t(i);return new b({user:e,providerId:r,_tokenResponse:i,operationType:t})}}function $t(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
|
707
|
-
* @license
|
|
708
|
-
* Copyright 2020 Google LLC
|
|
709
|
-
*
|
|
710
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
711
|
-
* you may not use this file except in compliance with the License.
|
|
712
|
-
* You may obtain a copy of the License at
|
|
713
|
-
*
|
|
714
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
715
|
-
*
|
|
716
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
717
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
718
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
|
-
* See the License for the specific language governing permissions and
|
|
720
|
-
* limitations under the License.
|
|
721
|
-
*/async function ar(n){var e;const t=v(n);if(await t._initializationPromise,!((e=t.currentUser)===null||e===void 0)&&e.isAnonymous)return new b({user:t.currentUser,providerId:null,operationType:"signIn"});const i=await Rn(t,{returnSecureToken:!0}),r=await b._fromIdTokenResponse(t,"signIn",i,!0);return await t._updateCurrentUser(r.user),r}/**
|
|
722
|
-
* @license
|
|
723
|
-
* Copyright 2020 Google LLC
|
|
724
|
-
*
|
|
725
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
726
|
-
* you may not use this file except in compliance with the License.
|
|
727
|
-
* You may obtain a copy of the License at
|
|
728
|
-
*
|
|
729
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
730
|
-
*
|
|
731
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
732
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
733
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
734
|
-
* See the License for the specific language governing permissions and
|
|
735
|
-
* limitations under the License.
|
|
736
|
-
*/class Le extends H{constructor(e,t,i,r){var s;super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,Le.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new Le(e,t,i,r)}}function Sn(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Le._fromErrorAndOperation(n,s,e,i):s})}/**
|
|
737
|
-
* @license
|
|
738
|
-
* Copyright 2020 Google LLC
|
|
739
|
-
*
|
|
740
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
741
|
-
* you may not use this file except in compliance with the License.
|
|
742
|
-
* You may obtain a copy of the License at
|
|
743
|
-
*
|
|
744
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
745
|
-
*
|
|
746
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
747
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
748
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
749
|
-
* See the License for the specific language governing permissions and
|
|
750
|
-
* limitations under the License.
|
|
751
|
-
*/function An(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}/**
|
|
752
|
-
* @license
|
|
753
|
-
* Copyright 2019 Google LLC
|
|
754
|
-
*
|
|
755
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
756
|
-
* you may not use this file except in compliance with the License.
|
|
757
|
-
* You may obtain a copy of the License at
|
|
758
|
-
*
|
|
759
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
760
|
-
*
|
|
761
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
762
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
763
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
764
|
-
* See the License for the specific language governing permissions and
|
|
765
|
-
* limitations under the License.
|
|
766
|
-
*/async function cr(n,e){const t=f(n);await Ve(!0,t,e);const{providerUserInfo:i}=await Ei(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),r=An(i||[]);return t.providerData=t.providerData.filter(s=>r.has(s.providerId)),r.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function yt(n,e,t=!1){const i=await F(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return b._forOperation(n,"link",i)}async function Ve(n,e,t){await _e(e);const i=An(e.providerData),r=n===!1?"provider-already-linked":"no-such-provider";l(i.has(t)===n,e.auth,r)}/**
|
|
767
|
-
* @license
|
|
768
|
-
* Copyright 2019 Google LLC
|
|
769
|
-
*
|
|
770
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
771
|
-
* you may not use this file except in compliance with the License.
|
|
772
|
-
* You may obtain a copy of the License at
|
|
773
|
-
*
|
|
774
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
775
|
-
*
|
|
776
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
777
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
778
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
779
|
-
* See the License for the specific language governing permissions and
|
|
780
|
-
* limitations under the License.
|
|
781
|
-
*/async function Pn(n,e,t=!1){var i;const{auth:r}=n,s="reauthenticate";try{const o=await F(n,Sn(r,s,e,n),t);l(o.idToken,r,"internal-error");const a=Fe(o.idToken);l(a,r,"internal-error");const{sub:c}=a;return l(n.uid===c,r,"user-mismatch"),b._forOperation(n,s,o)}catch(o){throw((i=o)===null||i===void 0?void 0:i.code)==="auth/user-not-found"&&y(r,"user-mismatch"),o}}/**
|
|
782
|
-
* @license
|
|
783
|
-
* Copyright 2020 Google LLC
|
|
784
|
-
*
|
|
785
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
786
|
-
* you may not use this file except in compliance with the License.
|
|
787
|
-
* You may obtain a copy of the License at
|
|
788
|
-
*
|
|
789
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
790
|
-
*
|
|
791
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
792
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
793
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
794
|
-
* See the License for the specific language governing permissions and
|
|
795
|
-
* limitations under the License.
|
|
796
|
-
*/async function Nn(n,e,t=!1){const i="signIn",r=await Sn(n,i,e),s=await b._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function qe(n,e){return Nn(v(n),e)}async function On(n,e){const t=f(n);return await Ve(!1,t,e.providerId),yt(t,e)}async function Cn(n,e){return Pn(f(n),e)}/**
|
|
797
|
-
* @license
|
|
798
|
-
* Copyright 2020 Google LLC
|
|
799
|
-
*
|
|
800
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
801
|
-
* you may not use this file except in compliance with the License.
|
|
802
|
-
* You may obtain a copy of the License at
|
|
803
|
-
*
|
|
804
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
805
|
-
*
|
|
806
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
807
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
808
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
809
|
-
* See the License for the specific language governing permissions and
|
|
810
|
-
* limitations under the License.
|
|
811
|
-
*/async function lr(n,e){return x(n,"POST","/v1/accounts:signInWithCustomToken",m(n,e))}/**
|
|
812
|
-
* @license
|
|
813
|
-
* Copyright 2020 Google LLC
|
|
814
|
-
*
|
|
815
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
816
|
-
* you may not use this file except in compliance with the License.
|
|
817
|
-
* You may obtain a copy of the License at
|
|
818
|
-
*
|
|
819
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
820
|
-
*
|
|
821
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
822
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
823
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
824
|
-
* See the License for the specific language governing permissions and
|
|
825
|
-
* limitations under the License.
|
|
826
|
-
*/async function dr(n,e){const t=v(n),i=await lr(t,{token:e,returnSecureToken:!0}),r=await b._fromIdTokenResponse(t,"signIn",i);return await t._updateCurrentUser(r.user),r}/**
|
|
827
|
-
* @license
|
|
828
|
-
* Copyright 2020 Google LLC
|
|
829
|
-
*
|
|
830
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
831
|
-
* you may not use this file except in compliance with the License.
|
|
832
|
-
* You may obtain a copy of the License at
|
|
833
|
-
*
|
|
834
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
835
|
-
*
|
|
836
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
837
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
838
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
839
|
-
* See the License for the specific language governing permissions and
|
|
840
|
-
* limitations under the License.
|
|
841
|
-
*/class He{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?wt._fromServerResponse(e,t):y(e,"internal-error")}}class wt extends He{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new wt(t)}}/**
|
|
842
|
-
* @license
|
|
843
|
-
* Copyright 2020 Google LLC
|
|
844
|
-
*
|
|
845
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
846
|
-
* you may not use this file except in compliance with the License.
|
|
847
|
-
* You may obtain a copy of the License at
|
|
848
|
-
*
|
|
849
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
850
|
-
*
|
|
851
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
852
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
853
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
854
|
-
* See the License for the specific language governing permissions and
|
|
855
|
-
* limitations under the License.
|
|
856
|
-
*/function ze(n,e,t){var i;l(((i=t.url)===null||i===void 0?void 0:i.length)>0,n,"invalid-continue-uri"),l(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(l(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(l(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
|
|
857
|
-
* @license
|
|
858
|
-
* Copyright 2020 Google LLC
|
|
859
|
-
*
|
|
860
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
861
|
-
* you may not use this file except in compliance with the License.
|
|
862
|
-
* You may obtain a copy of the License at
|
|
863
|
-
*
|
|
864
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
865
|
-
*
|
|
866
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
867
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
868
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
869
|
-
* See the License for the specific language governing permissions and
|
|
870
|
-
* limitations under the License.
|
|
871
|
-
*/async function ur(n,e,t){const i=f(n),r={requestType:"PASSWORD_RESET",email:e};t&&ze(i,r,t),await Bi(i,r)}async function hr(n,e,t){await En(f(n),{oobCode:e,newPassword:t})}async function fr(n,e){await zi(f(n),{oobCode:e})}async function Ln(n,e){const t=f(n),i=await En(t,{oobCode:e}),r=i.requestType;switch(l(r,t,"internal-error"),r){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":l(i.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":l(i.mfaInfo,t,"internal-error");default:l(i.email,t,"internal-error")}let s=null;return i.mfaInfo&&(s=He._fromServerResponse(v(t),i.mfaInfo)),{data:{email:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.newEmail:i.email)||null,previousEmail:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.email:i.newEmail)||null,multiFactorInfo:s},operation:r}}async function pr(n,e){const{data:t}=await Ln(f(n),e);return t.email}async function mr(n,e,t){const i=v(n),r=await Rn(i,{returnSecureToken:!0,email:e,password:t}),s=await b._fromIdTokenResponse(i,"signIn",r);return await i._updateCurrentUser(s.user),s}function gr(n,e,t){return qe(f(n),z.credential(e,t))}/**
|
|
872
|
-
* @license
|
|
873
|
-
* Copyright 2020 Google LLC
|
|
874
|
-
*
|
|
875
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
876
|
-
* you may not use this file except in compliance with the License.
|
|
877
|
-
* You may obtain a copy of the License at
|
|
878
|
-
*
|
|
879
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
880
|
-
*
|
|
881
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
882
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
883
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
884
|
-
* See the License for the specific language governing permissions and
|
|
885
|
-
* limitations under the License.
|
|
886
|
-
*/async function vr(n,e,t){const i=f(n),r={requestType:"EMAIL_SIGNIN",email:e};l(t.handleCodeInApp,i,"argument-error"),t&&ze(i,r,t),await $i(i,r)}function _r(n,e){const t=We.parseLink(e);return t?.operation==="EMAIL_SIGNIN"}async function Ir(n,e,t){const i=f(n),r=z.credentialWithLink(e,t||ve());return l(r._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),qe(i,r)}/**
|
|
887
|
-
* @license
|
|
888
|
-
* Copyright 2020 Google LLC
|
|
889
|
-
*
|
|
890
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
891
|
-
* you may not use this file except in compliance with the License.
|
|
892
|
-
* You may obtain a copy of the License at
|
|
893
|
-
*
|
|
894
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
895
|
-
*
|
|
896
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
897
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
898
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
899
|
-
* See the License for the specific language governing permissions and
|
|
900
|
-
* limitations under the License.
|
|
901
|
-
*/async function yr(n,e){return _(n,"POST","/v1/accounts:createAuthUri",m(n,e))}/**
|
|
902
|
-
* @license
|
|
903
|
-
* Copyright 2020 Google LLC
|
|
904
|
-
*
|
|
905
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
906
|
-
* you may not use this file except in compliance with the License.
|
|
907
|
-
* You may obtain a copy of the License at
|
|
908
|
-
*
|
|
909
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
910
|
-
*
|
|
911
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
912
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
913
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
914
|
-
* See the License for the specific language governing permissions and
|
|
915
|
-
* limitations under the License.
|
|
916
|
-
*/async function wr(n,e){const t=vt()?ve():"http://localhost",i={identifier:e,continueUri:t},{signinMethods:r}=await yr(f(n),i);return r||[]}async function Tr(n,e){const t=f(n),i=await n.getIdToken(),r={requestType:"VERIFY_EMAIL",idToken:i};e&&ze(t.auth,r,e);const{email:s}=await ji(t.auth,r);s!==n.email&&await n.reload()}async function kr(n,e,t){const i=f(n),r=await n.getIdToken(),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:r,newEmail:e};t&&ze(i.auth,s,t);const{email:o}=await Ki(i.auth,s);o!==n.email&&await n.reload()}/**
|
|
917
|
-
* @license
|
|
918
|
-
* Copyright 2020 Google LLC
|
|
919
|
-
*
|
|
920
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
921
|
-
* you may not use this file except in compliance with the License.
|
|
922
|
-
* You may obtain a copy of the License at
|
|
923
|
-
*
|
|
924
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
925
|
-
*
|
|
926
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
927
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
928
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
929
|
-
* See the License for the specific language governing permissions and
|
|
930
|
-
* limitations under the License.
|
|
931
|
-
*/async function Er(n,e){return _(n,"POST","/v1/accounts:update",e)}/**
|
|
932
|
-
* @license
|
|
933
|
-
* Copyright 2020 Google LLC
|
|
934
|
-
*
|
|
935
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
936
|
-
* you may not use this file except in compliance with the License.
|
|
937
|
-
* You may obtain a copy of the License at
|
|
938
|
-
*
|
|
939
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
940
|
-
*
|
|
941
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
942
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
943
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
944
|
-
* See the License for the specific language governing permissions and
|
|
945
|
-
* limitations under the License.
|
|
946
|
-
*/async function br(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;const i=f(n),s={idToken:await i.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await F(i,Er(i.auth,s));i.displayName=o.displayName||null,i.photoURL=o.photoUrl||null;const a=i.providerData.find(({providerId:c})=>c==="password");a&&(a.displayName=i.displayName,a.photoURL=i.photoURL),await i._updateTokensIfNecessary(o)}function Rr(n,e){return Dn(f(n),e,null)}function Sr(n,e){return Dn(f(n),null,e)}async function Dn(n,e,t){const{auth:i}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);const o=await F(n,bn(i,s));await n._updateTokensIfNecessary(o,!0)}/**
|
|
947
|
-
* @license
|
|
948
|
-
* Copyright 2019 Google LLC
|
|
949
|
-
*
|
|
950
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
951
|
-
* you may not use this file except in compliance with the License.
|
|
952
|
-
* You may obtain a copy of the License at
|
|
953
|
-
*
|
|
954
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
955
|
-
*
|
|
956
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
957
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
958
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
|
-
* See the License for the specific language governing permissions and
|
|
960
|
-
* limitations under the License.
|
|
961
|
-
*/function Ar(n){var e,t;if(!n)return null;const{providerId:i}=n,r=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},s=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!i&&n?.idToken){const o=(t=(e=Fe(n.idToken))===null||e===void 0?void 0:e.firebase)===null||t===void 0?void 0:t.sign_in_provider;if(o){const a=o!=="anonymous"&&o!=="custom"?o:null;return new te(s,a)}}if(!i)return null;switch(i){case"facebook.com":return new Pr(s,r);case"github.com":return new Nr(s,r);case"google.com":return new Or(s,r);case"twitter.com":return new Cr(s,r,n.screenName||null);case"custom":case"anonymous":return new te(s,null);default:return new te(s,i,r)}}class te{constructor(e,t,i={}){this.isNewUser=e,this.providerId=t,this.profile=i}}class Mn extends te{constructor(e,t,i,r){super(e,t,i),this.username=r}}class Pr extends te{constructor(e,t){super(e,"facebook.com",t)}}class Nr extends Mn{constructor(e,t){super(e,"github.com",t,typeof t?.login=="string"?t?.login:null)}}class Or extends te{constructor(e,t){super(e,"google.com",t)}}class Cr extends Mn{constructor(e,t,i){super(e,"twitter.com",t,i)}}function Lr(n){const{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Ar(t)}class G{constructor(e,t){this.type=e,this.credential=t}static _fromIdtoken(e){return new G("enroll",e)}static _fromMfaPendingCredential(e){return new G("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){var t,i;if(e?.multiFactorSession){if(!((t=e.multiFactorSession)===null||t===void 0)&&t.pendingCredential)return G._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(!((i=e.multiFactorSession)===null||i===void 0)&&i.idToken)return G._fromIdtoken(e.multiFactorSession.idToken)}return null}}/**
|
|
962
|
-
* @license
|
|
963
|
-
* Copyright 2020 Google LLC
|
|
964
|
-
*
|
|
965
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
966
|
-
* you may not use this file except in compliance with the License.
|
|
967
|
-
* You may obtain a copy of the License at
|
|
968
|
-
*
|
|
969
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
970
|
-
*
|
|
971
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
972
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
973
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
|
-
* See the License for the specific language governing permissions and
|
|
975
|
-
* limitations under the License.
|
|
976
|
-
*/class Tt{constructor(e,t,i){this.session=e,this.hints=t,this.signInResolver=i}static _fromError(e,t){const i=v(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(a=>He._fromServerResponse(i,a));l(r.mfaPendingCredential,i,"internal-error");const o=G._fromMfaPendingCredential(r.mfaPendingCredential);return new Tt(o,s,async a=>{const c=await a._process(i,o);delete r.mfaInfo,delete r.mfaPendingCredential;const d=Object.assign(Object.assign({},r),{idToken:c.idToken,refreshToken:c.refreshToken});switch(t.operationType){case"signIn":const u=await b._fromIdTokenResponse(i,t.operationType,d);return await i._updateCurrentUser(u.user),u;case"reauthenticate":return l(t.user,i,"internal-error"),b._forOperation(t.user,t.operationType,d);default:y(i,"internal-error")}})}async resolveSignIn(e){const t=e;return this.signInResolver(t)}}function Dr(n,e){var t;const i=f(n),r=e;return l(e.customData.operationType,i,"argument-error"),l((t=r.customData._serverResponse)===null||t===void 0?void 0:t.mfaPendingCredential,i,"argument-error"),Tt._fromError(i,r)}/**
|
|
977
|
-
* @license
|
|
978
|
-
* Copyright 2020 Google LLC
|
|
979
|
-
*
|
|
980
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
981
|
-
* you may not use this file except in compliance with the License.
|
|
982
|
-
* You may obtain a copy of the License at
|
|
983
|
-
*
|
|
984
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
985
|
-
*
|
|
986
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
987
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
988
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
989
|
-
* See the License for the specific language governing permissions and
|
|
990
|
-
* limitations under the License.
|
|
991
|
-
*/function Mr(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",m(n,e))}function Ur(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",m(n,e))}function Fr(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:withdraw",m(n,e))}class kt{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(i=>He._fromServerResponse(e.auth,i)))})}static _fromUser(e){return new kt(e)}async getSession(){return G._fromIdtoken(await this.user.getIdToken())}async enroll(e,t){const i=e,r=await this.getSession(),s=await F(this.user,i._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){var t;const i=typeof e=="string"?e:e.uid,r=await this.user.getIdToken(),s=await F(this.user,Fr(this.user.auth,{idToken:r,mfaEnrollmentId:i}));this.enrolledFactors=this.enrolledFactors.filter(({uid:o})=>o!==i),await this.user._updateTokensIfNecessary(s);try{await this.user.reload()}catch(o){if(((t=o)===null||t===void 0?void 0:t.code)!=="auth/user-token-expired")throw o}}}const Ze=new WeakMap;function xr(n){const e=f(n);return Ze.has(e)||Ze.set(e,kt._fromUser(e)),Ze.get(e)}const De="__sak";/**
|
|
992
|
-
* @license
|
|
993
|
-
* Copyright 2019 Google LLC
|
|
994
|
-
*
|
|
995
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
996
|
-
* you may not use this file except in compliance with the License.
|
|
997
|
-
* You may obtain a copy of the License at
|
|
998
|
-
*
|
|
999
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1000
|
-
*
|
|
1001
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1002
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1003
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1004
|
-
* See the License for the specific language governing permissions and
|
|
1005
|
-
* limitations under the License.
|
|
1006
|
-
*/class Un{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(De,"1"),this.storage.removeItem(De),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
|
|
1007
|
-
* @license
|
|
1008
|
-
* Copyright 2020 Google LLC
|
|
1009
|
-
*
|
|
1010
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1011
|
-
* you may not use this file except in compliance with the License.
|
|
1012
|
-
* You may obtain a copy of the License at
|
|
1013
|
-
*
|
|
1014
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1015
|
-
*
|
|
1016
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1017
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1018
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1019
|
-
* See the License for the specific language governing permissions and
|
|
1020
|
-
* limitations under the License.
|
|
1021
|
-
*/function Wr(){const n=g();return It(n)||oe(n)}const Vr=1e3,qr=10;class Fn extends Un{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=Wr()&&Fi(),this.fallbackToPolling=wn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const i=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(i);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(i,e.newValue):this.storage.removeItem(i);else if(this.localCache[i]===e.newValue&&!t)return}const r=()=>{const o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);Ui()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,qr):r()}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Vr)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Fn.type="LOCAL";const Et=Fn;/**
|
|
1022
|
-
* @license
|
|
1023
|
-
* Copyright 2020 Google LLC
|
|
1024
|
-
*
|
|
1025
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1026
|
-
* you may not use this file except in compliance with the License.
|
|
1027
|
-
* You may obtain a copy of the License at
|
|
1028
|
-
*
|
|
1029
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1030
|
-
*
|
|
1031
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1032
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1033
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1034
|
-
* See the License for the specific language governing permissions and
|
|
1035
|
-
* limitations under the License.
|
|
1036
|
-
*/class xn extends Un{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}xn.type="SESSION";const K=xn;/**
|
|
1037
|
-
* @license
|
|
1038
|
-
* Copyright 2019 Google LLC
|
|
1039
|
-
*
|
|
1040
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1041
|
-
* you may not use this file except in compliance with the License.
|
|
1042
|
-
* You may obtain a copy of the License at
|
|
1043
|
-
*
|
|
1044
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1045
|
-
*
|
|
1046
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1047
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1048
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1049
|
-
* See the License for the specific language governing permissions and
|
|
1050
|
-
* limitations under the License.
|
|
1051
|
-
*/function Hr(n){return Promise.all(n.map(async e=>{try{const t=await e;return{fulfilled:!0,value:t}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
|
1052
|
-
* @license
|
|
1053
|
-
* Copyright 2019 Google LLC
|
|
1054
|
-
*
|
|
1055
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1056
|
-
* you may not use this file except in compliance with the License.
|
|
1057
|
-
* You may obtain a copy of the License at
|
|
1058
|
-
*
|
|
1059
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1060
|
-
*
|
|
1061
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1062
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1063
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1064
|
-
* See the License for the specific language governing permissions and
|
|
1065
|
-
* limitations under the License.
|
|
1066
|
-
*/class Ge{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;const i=new Ge(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});const a=Array.from(o).map(async d=>d(t.origin,s)),c=await Hr(a);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:c})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ge.receivers=[];/**
|
|
1067
|
-
* @license
|
|
1068
|
-
* Copyright 2020 Google LLC
|
|
1069
|
-
*
|
|
1070
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1071
|
-
* you may not use this file except in compliance with the License.
|
|
1072
|
-
* You may obtain a copy of the License at
|
|
1073
|
-
*
|
|
1074
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1075
|
-
*
|
|
1076
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1077
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1078
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1079
|
-
* See the License for the specific language governing permissions and
|
|
1080
|
-
* limitations under the License.
|
|
1081
|
-
*/function Ee(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}/**
|
|
1082
|
-
* @license
|
|
1083
|
-
* Copyright 2019 Google LLC
|
|
1084
|
-
*
|
|
1085
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1086
|
-
* you may not use this file except in compliance with the License.
|
|
1087
|
-
* You may obtain a copy of the License at
|
|
1088
|
-
*
|
|
1089
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1090
|
-
*
|
|
1091
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1092
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1093
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1094
|
-
* See the License for the specific language governing permissions and
|
|
1095
|
-
* limitations under the License.
|
|
1096
|
-
*/class zr{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,i=50){const r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((a,c)=>{const d=Ee("",20);r.port1.start();const u=setTimeout(()=>{c(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){const w=h;if(w.data.eventId===d)switch(w.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(w.data.response);break;default:clearTimeout(u),clearTimeout(s),c(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
|
1097
|
-
* @license
|
|
1098
|
-
* Copyright 2020 Google LLC
|
|
1099
|
-
*
|
|
1100
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1101
|
-
* you may not use this file except in compliance with the License.
|
|
1102
|
-
* You may obtain a copy of the License at
|
|
1103
|
-
*
|
|
1104
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1105
|
-
*
|
|
1106
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1107
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1108
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1109
|
-
* See the License for the specific language governing permissions and
|
|
1110
|
-
* limitations under the License.
|
|
1111
|
-
*/function p(){return window}function Gr(n){p().location.href=n}/**
|
|
1112
|
-
* @license
|
|
1113
|
-
* Copyright 2020 Google LLC.
|
|
1114
|
-
*
|
|
1115
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1116
|
-
* you may not use this file except in compliance with the License.
|
|
1117
|
-
* You may obtain a copy of the License at
|
|
1118
|
-
*
|
|
1119
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1120
|
-
*
|
|
1121
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1122
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1123
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1124
|
-
* See the License for the specific language governing permissions and
|
|
1125
|
-
* limitations under the License.
|
|
1126
|
-
*/function bt(){return typeof p().WorkerGlobalScope<"u"&&typeof p().importScripts=="function"}async function jr(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Br(){var n;return((n=navigator?.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function $r(){return bt()?self:null}/**
|
|
1127
|
-
* @license
|
|
1128
|
-
* Copyright 2019 Google LLC
|
|
1129
|
-
*
|
|
1130
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1131
|
-
* you may not use this file except in compliance with the License.
|
|
1132
|
-
* You may obtain a copy of the License at
|
|
1133
|
-
*
|
|
1134
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1135
|
-
*
|
|
1136
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1137
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1138
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
|
-
* See the License for the specific language governing permissions and
|
|
1140
|
-
* limitations under the License.
|
|
1141
|
-
*/const Wn="firebaseLocalStorageDb",Kr=1,Me="firebaseLocalStorage",Vn="fbase_key";class be{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function je(n,e){return n.transaction([Me],e?"readwrite":"readonly").objectStore(Me)}function Jr(){const n=indexedDB.deleteDatabase(Wn);return new be(n).toPromise()}function st(){const n=indexedDB.open(Wn,Kr);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const i=n.result;try{i.createObjectStore(Me,{keyPath:Vn})}catch(r){t(r)}}),n.addEventListener("success",async()=>{const i=n.result;i.objectStoreNames.contains(Me)?e(i):(i.close(),await Jr(),e(await st()))})})}async function Kt(n,e,t){const i=je(n,!0).put({[Vn]:e,value:t});return new be(i).toPromise()}async function Yr(n,e){const t=je(n,!1).get(e),i=await new be(t).toPromise();return i===void 0?null:i.value}function Jt(n,e){const t=je(n,!0).delete(e);return new be(t).toPromise()}const Xr=800,Qr=3;class qn{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await st(),this.db)}async _withRetries(e){let t=0;for(;;)try{const i=await this._openDb();return await e(i)}catch(i){if(t++>Qr)throw i;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return bt()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ge._getInstance($r()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await jr(),!this.activeServiceWorker)return;this.sender=new zr(this.activeServiceWorker);const i=await this.sender._send("ping",{},800);!i||((e=i[0])===null||e===void 0?void 0:e.fulfilled)&&((t=i[0])===null||t===void 0?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Br()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await st();return await Kt(e,De,"1"),await Jt(e,De),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>Kt(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(i=>Yr(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Jt(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(r=>{const s=je(r,!1).getAll();return new be(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],i=new Set;for(const{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;const i=this.listeners[e];if(i)for(const r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Xr)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}qn.type="LOCAL";const we=qn;/**
|
|
1142
|
-
* @license
|
|
1143
|
-
* Copyright 2020 Google LLC
|
|
1144
|
-
*
|
|
1145
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1146
|
-
* you may not use this file except in compliance with the License.
|
|
1147
|
-
* You may obtain a copy of the License at
|
|
1148
|
-
*
|
|
1149
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1150
|
-
*
|
|
1151
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1152
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1153
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1154
|
-
* See the License for the specific language governing permissions and
|
|
1155
|
-
* limitations under the License.
|
|
1156
|
-
*/function Zr(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:start",m(n,e))}function es(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",m(n,e))}/**
|
|
1157
|
-
* @license
|
|
1158
|
-
* Copyright 2020 Google LLC
|
|
1159
|
-
*
|
|
1160
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1161
|
-
* you may not use this file except in compliance with the License.
|
|
1162
|
-
* You may obtain a copy of the License at
|
|
1163
|
-
*
|
|
1164
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1165
|
-
*
|
|
1166
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1167
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1168
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1169
|
-
* See the License for the specific language governing permissions and
|
|
1170
|
-
* limitations under the License.
|
|
1171
|
-
*/async function ts(n){return(await _(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}/**
|
|
1172
|
-
* @license
|
|
1173
|
-
* Copyright 2020 Google LLC
|
|
1174
|
-
*
|
|
1175
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1176
|
-
* you may not use this file except in compliance with the License.
|
|
1177
|
-
* You may obtain a copy of the License at
|
|
1178
|
-
*
|
|
1179
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1180
|
-
*
|
|
1181
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1182
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1183
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1184
|
-
* See the License for the specific language governing permissions and
|
|
1185
|
-
* limitations under the License.
|
|
1186
|
-
*/function ns(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}function Hn(n){return new Promise((e,t)=>{const i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{const s=I("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",ns().appendChild(i)})}function zn(n){return`__${n}${Math.floor(Math.random()*1e6)}`}/**
|
|
1187
|
-
* @license
|
|
1188
|
-
* Copyright 2020 Google LLC
|
|
1189
|
-
*
|
|
1190
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1191
|
-
* you may not use this file except in compliance with the License.
|
|
1192
|
-
* You may obtain a copy of the License at
|
|
1193
|
-
*
|
|
1194
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1195
|
-
*
|
|
1196
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1197
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1198
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1199
|
-
* See the License for the specific language governing permissions and
|
|
1200
|
-
* limitations under the License.
|
|
1201
|
-
*/const is=500,rs=6e4,Ae=1e12;class ss{constructor(e){this.auth=e,this.counter=Ae,this._widgets=new Map}render(e,t){const i=this.counter;return this._widgets.set(i,new os(e,this.auth.name,t||{})),this.counter++,i}reset(e){var t;const i=e||Ae;(t=this._widgets.get(i))===null||t===void 0||t.delete(),this._widgets.delete(i)}getResponse(e){var t;const i=e||Ae;return((t=this._widgets.get(i))===null||t===void 0?void 0:t.getResponse())||""}async execute(e){var t;const i=e||Ae;return(t=this._widgets.get(i))===null||t===void 0||t.execute(),""}}class os{constructor(e,t,i){this.params=i,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};const r=typeof e=="string"?document.getElementById(e):e;l(r,"argument-error",{appName:t}),this.container=r,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=as(50);const{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},rs)},is))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}}function as(n){const e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let i=0;i<n;i++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}/**
|
|
1202
|
-
* @license
|
|
1203
|
-
* Copyright 2020 Google LLC
|
|
1204
|
-
*
|
|
1205
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1206
|
-
* you may not use this file except in compliance with the License.
|
|
1207
|
-
* You may obtain a copy of the License at
|
|
1208
|
-
*
|
|
1209
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1210
|
-
*
|
|
1211
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1212
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1213
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1214
|
-
* See the License for the specific language governing permissions and
|
|
1215
|
-
* limitations under the License.
|
|
1216
|
-
*/const et=zn("rcb"),cs=new Te(3e4,6e4),ls="https://www.google.com/recaptcha/api.js?";class ds{constructor(){var e;this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!(!((e=p().grecaptcha)===null||e===void 0)&&e.render)}load(e,t=""){return l(us(t),e,"argument-error"),this.shouldResolveImmediately(t)?Promise.resolve(p().grecaptcha):new Promise((i,r)=>{const s=p().setTimeout(()=>{r(I(e,"network-request-failed"))},cs.get());p()[et]=()=>{p().clearTimeout(s),delete p()[et];const a=p().grecaptcha;if(!a){r(I(e,"internal-error"));return}const c=a.render;a.render=(d,u)=>{const h=c(d,u);return this.counter++,h},this.hostLanguage=t,i(a)};const o=`${ls}?${re({onload:et,render:"explicit",hl:t})}`;Hn(o).catch(()=>{clearTimeout(s),r(I(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){var t;return!!(!((t=p().grecaptcha)===null||t===void 0)&&t.render)&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}}function us(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}class hs{async load(e){return new ss(e)}clearedOneInstance(){}}/**
|
|
1217
|
-
* @license
|
|
1218
|
-
* Copyright 2020 Google LLC
|
|
1219
|
-
*
|
|
1220
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1221
|
-
* you may not use this file except in compliance with the License.
|
|
1222
|
-
* You may obtain a copy of the License at
|
|
1223
|
-
*
|
|
1224
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1225
|
-
*
|
|
1226
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1227
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1228
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1229
|
-
* See the License for the specific language governing permissions and
|
|
1230
|
-
* limitations under the License.
|
|
1231
|
-
*/const Gn="recaptcha",fs={theme:"light",type:"image"};class ps{constructor(e,t=Object.assign({},fs),i){this.parameters=t,this.type=Gn,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=v(i),this.isInvisible=this.parameters.size==="invisible",l(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");const r=typeof e=="string"?document.getElementById(e):e;l(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new hs:new ds,this.validateStartingState()}async verify(){this.assertNotDestroyed();const e=await this.render(),t=this.getAssertedRecaptcha(),i=t.getResponse(e);return i||new Promise(r=>{const s=o=>{!o||(this.tokenChangeListeners.delete(s),r(o))};this.tokenChangeListeners.add(s),this.isInvisible&&t.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){l(!this.parameters.sitekey,this.auth,"argument-error"),l(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),l(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return t=>{if(this.tokenChangeListeners.forEach(i=>i(t)),typeof e=="function")e(t);else if(typeof e=="string"){const i=p()[e];typeof i=="function"&&i(t)}}}assertNotDestroyed(){l(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){const t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){l(vt()&&!bt(),this.auth,"internal-error"),await ms(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);const e=await ts(this.auth);l(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return l(this.recaptcha,this.auth,"internal-error"),this.recaptcha}}function ms(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}/**
|
|
1232
|
-
* @license
|
|
1233
|
-
* Copyright 2020 Google LLC
|
|
1234
|
-
*
|
|
1235
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1236
|
-
* you may not use this file except in compliance with the License.
|
|
1237
|
-
* You may obtain a copy of the License at
|
|
1238
|
-
*
|
|
1239
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1240
|
-
*
|
|
1241
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1242
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1243
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1244
|
-
* See the License for the specific language governing permissions and
|
|
1245
|
-
* limitations under the License.
|
|
1246
|
-
*/class Rt{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){const t=$._fromVerification(this.verificationId,e);return this.onConfirmation(t)}}async function gs(n,e,t){const i=v(n),r=await Be(i,e,f(t));return new Rt(r,s=>qe(i,s))}async function vs(n,e,t){const i=f(n);await Ve(!1,i,"phone");const r=await Be(i.auth,e,f(t));return new Rt(r,s=>On(i,s))}async function _s(n,e,t){const i=f(n),r=await Be(i.auth,e,f(t));return new Rt(r,s=>Cn(i,s))}async function Be(n,e,t){var i;const r=await t.verify();try{l(typeof r=="string",n,"argument-error"),l(t.type===Gn,n,"argument-error");let s;if(typeof e=="string"?s={phoneNumber:e}:s=e,"session"in s){const o=s.session;if("phoneNumber"in s)return l(o.type==="enroll",n,"internal-error"),(await Mr(n,{idToken:o.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:r}})).phoneSessionInfo.sessionInfo;{l(o.type==="signin",n,"internal-error");const a=((i=s.multiFactorHint)===null||i===void 0?void 0:i.uid)||s.multiFactorUid;return l(a,n,"missing-multi-factor-info"),(await Zr(n,{mfaPendingCredential:o.credential,mfaEnrollmentId:a,phoneSignInInfo:{recaptchaToken:r}})).phoneResponseInfo.sessionInfo}}else{const{sessionInfo:o}=await Qi(n,{phoneNumber:s.phoneNumber,recaptchaToken:r});return o}}finally{t._reset()}}async function Is(n,e){await yt(f(n),e)}/**
|
|
1247
|
-
* @license
|
|
1248
|
-
* Copyright 2020 Google LLC
|
|
1249
|
-
*
|
|
1250
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1251
|
-
* you may not use this file except in compliance with the License.
|
|
1252
|
-
* You may obtain a copy of the License at
|
|
1253
|
-
*
|
|
1254
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1255
|
-
*
|
|
1256
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1257
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1258
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1259
|
-
* See the License for the specific language governing permissions and
|
|
1260
|
-
* limitations under the License.
|
|
1261
|
-
*/class R{constructor(e){this.providerId=R.PROVIDER_ID,this.auth=v(e)}verifyPhoneNumber(e,t){return Be(this.auth,e,f(t))}static credential(e,t){return $._fromVerification(e,t)}static credentialFromResult(e){const t=e;return R.credentialFromTaggedObject(t)}static credentialFromError(e){return R.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:i}=e;return t&&i?$._fromTokenResponse(t,i):null}}R.PROVIDER_ID="phone";R.PHONE_SIGN_IN_METHOD="phone";/**
|
|
1262
|
-
* @license
|
|
1263
|
-
* Copyright 2021 Google LLC
|
|
1264
|
-
*
|
|
1265
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1266
|
-
* you may not use this file except in compliance with the License.
|
|
1267
|
-
* You may obtain a copy of the License at
|
|
1268
|
-
*
|
|
1269
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1270
|
-
*
|
|
1271
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1272
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1273
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1274
|
-
* See the License for the specific language governing permissions and
|
|
1275
|
-
* limitations under the License.
|
|
1276
|
-
*/function Y(n,e){return e?E(e):(l(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
|
1277
|
-
* @license
|
|
1278
|
-
* Copyright 2019 Google LLC
|
|
1279
|
-
*
|
|
1280
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1281
|
-
* you may not use this file except in compliance with the License.
|
|
1282
|
-
* You may obtain a copy of the License at
|
|
1283
|
-
*
|
|
1284
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1285
|
-
*
|
|
1286
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1287
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1288
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1289
|
-
* See the License for the specific language governing permissions and
|
|
1290
|
-
* limitations under the License.
|
|
1291
|
-
*/class St extends ae{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return U(e,this._buildIdpRequest())}_linkToIdToken(e,t){return U(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return U(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ys(n){return Nn(n.auth,new St(n),n.bypassAuthState)}function ws(n){const{auth:e,user:t}=n;return l(t,e,"internal-error"),Pn(t,new St(n),n.bypassAuthState)}async function Ts(n){const{auth:e,user:t}=n;return l(t,e,"internal-error"),yt(t,new St(n),n.bypassAuthState)}/**
|
|
1292
|
-
* @license
|
|
1293
|
-
* Copyright 2020 Google LLC
|
|
1294
|
-
*
|
|
1295
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1296
|
-
* you may not use this file except in compliance with the License.
|
|
1297
|
-
* You may obtain a copy of the License at
|
|
1298
|
-
*
|
|
1299
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1300
|
-
*
|
|
1301
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1302
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1303
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1304
|
-
* See the License for the specific language governing permissions and
|
|
1305
|
-
* limitations under the License.
|
|
1306
|
-
*/class jn{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ys;case"linkViaPopup":case"linkViaRedirect":return Ts;case"reauthViaPopup":case"reauthViaRedirect":return ws;default:y(this.auth,"internal-error")}}resolve(e){S(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){S(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
|
|
1307
|
-
* @license
|
|
1308
|
-
* Copyright 2020 Google LLC
|
|
1309
|
-
*
|
|
1310
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1311
|
-
* you may not use this file except in compliance with the License.
|
|
1312
|
-
* You may obtain a copy of the License at
|
|
1313
|
-
*
|
|
1314
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1315
|
-
*
|
|
1316
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1317
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1318
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1319
|
-
* See the License for the specific language governing permissions and
|
|
1320
|
-
* limitations under the License.
|
|
1321
|
-
*/const ks=new Te(2e3,1e4);async function Es(n,e,t){const i=v(n);se(n,e,W);const r=Y(i,t);return new D(i,"signInViaPopup",e,r).executeNotNull()}async function bs(n,e,t){const i=f(n);se(i.auth,e,W);const r=Y(i.auth,t);return new D(i.auth,"reauthViaPopup",e,r,i).executeNotNull()}async function Rs(n,e,t){const i=f(n);se(i.auth,e,W);const r=Y(i.auth,t);return new D(i.auth,"linkViaPopup",e,r,i).executeNotNull()}class D extends jn{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,D.currentPopupAction&&D.currentPopupAction.cancel(),D.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return l(e,this.auth,"internal-error"),e}async onExecution(){S(this.filter.length===1,"Popup operations only handle one event");const e=Ee();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(I(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(I(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,D.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,i;if(!((i=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||i===void 0)&&i.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(I(this.auth,"popup-closed-by-user"))},2e3);return}this.pollId=window.setTimeout(e,ks.get())};e()}}D.currentPopupAction=null;/**
|
|
1322
|
-
* @license
|
|
1323
|
-
* Copyright 2020 Google LLC
|
|
1324
|
-
*
|
|
1325
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1326
|
-
* you may not use this file except in compliance with the License.
|
|
1327
|
-
* You may obtain a copy of the License at
|
|
1328
|
-
*
|
|
1329
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1330
|
-
*
|
|
1331
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1332
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1333
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1334
|
-
* See the License for the specific language governing permissions and
|
|
1335
|
-
* limitations under the License.
|
|
1336
|
-
*/const Ss="pendingRedirect",me=new Map;class As extends jn{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=me.get(this.auth._key());if(!e){try{const i=await Ps(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}me.set(this.auth._key(),e)}return this.bypassAuthState||me.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function Ps(n,e){const t=$n(e),i=Bn(n);if(!await i._isAvailable())return!1;const r=await i._get(t)==="true";return await i._remove(t),r}async function At(n,e){return Bn(n)._set($n(e),"true")}function Ns(){me.clear()}function Pt(n,e){me.set(n._key(),e)}function Bn(n){return E(n._redirectPersistence)}function $n(n){return B(Ss,n.config.apiKey,n.name)}/**
|
|
1337
|
-
* @license
|
|
1338
|
-
* Copyright 2020 Google LLC
|
|
1339
|
-
*
|
|
1340
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1341
|
-
* you may not use this file except in compliance with the License.
|
|
1342
|
-
* You may obtain a copy of the License at
|
|
1343
|
-
*
|
|
1344
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1345
|
-
*
|
|
1346
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1347
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1348
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1349
|
-
* See the License for the specific language governing permissions and
|
|
1350
|
-
* limitations under the License.
|
|
1351
|
-
*/function Os(n,e,t){return Cs(n,e,t)}async function Cs(n,e,t){const i=v(n);se(n,e,W);const r=Y(i,t);return await At(r,i),r._openRedirect(i,e,"signInViaRedirect")}function Ls(n,e,t){return Ds(n,e,t)}async function Ds(n,e,t){const i=f(n);se(i.auth,e,W);const r=Y(i.auth,t);await At(r,i.auth);const s=await Kn(i);return r._openRedirect(i.auth,e,"reauthViaRedirect",s)}function Ms(n,e,t){return Us(n,e,t)}async function Us(n,e,t){const i=f(n);se(i.auth,e,W);const r=Y(i.auth,t);await Ve(!1,i,e.providerId),await At(r,i.auth);const s=await Kn(i);return r._openRedirect(i.auth,e,"linkViaRedirect",s)}async function Fs(n,e){return await v(n)._initializationPromise,$e(n,e,!1)}async function $e(n,e,t=!1){const i=v(n),r=Y(i,e),o=await new As(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}async function Kn(n){const e=Ee(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}/**
|
|
1352
|
-
* @license
|
|
1353
|
-
* Copyright 2020 Google LLC
|
|
1354
|
-
*
|
|
1355
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1356
|
-
* you may not use this file except in compliance with the License.
|
|
1357
|
-
* You may obtain a copy of the License at
|
|
1358
|
-
*
|
|
1359
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1360
|
-
*
|
|
1361
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1362
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1363
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1364
|
-
* See the License for the specific language governing permissions and
|
|
1365
|
-
* limitations under the License.
|
|
1366
|
-
*/const xs=10*60*1e3;class Jn{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Ws(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var i;if(e.error&&!Yn(e)){const r=((i=e.error.code)===null||i===void 0?void 0:i.split("auth/")[1])||"internal-error";t.onError(I(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=xs&&this.cachedEventUids.clear(),this.cachedEventUids.has(Yt(e))}saveEventToCache(e){this.cachedEventUids.add(Yt(e)),this.lastProcessedEventTime=Date.now()}}function Yt(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Yn({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function Ws(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Yn(n);default:return!1}}/**
|
|
1367
|
-
* @license
|
|
1368
|
-
* Copyright 2020 Google LLC
|
|
1369
|
-
*
|
|
1370
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1371
|
-
* you may not use this file except in compliance with the License.
|
|
1372
|
-
* You may obtain a copy of the License at
|
|
1373
|
-
*
|
|
1374
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1375
|
-
*
|
|
1376
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1377
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1378
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
|
-
* See the License for the specific language governing permissions and
|
|
1380
|
-
* limitations under the License.
|
|
1381
|
-
*/async function Xn(n,e={}){return _(n,"GET","/v1/projects",e)}/**
|
|
1382
|
-
* @license
|
|
1383
|
-
* Copyright 2020 Google LLC
|
|
1384
|
-
*
|
|
1385
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1386
|
-
* you may not use this file except in compliance with the License.
|
|
1387
|
-
* You may obtain a copy of the License at
|
|
1388
|
-
*
|
|
1389
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1390
|
-
*
|
|
1391
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1392
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1393
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1394
|
-
* See the License for the specific language governing permissions and
|
|
1395
|
-
* limitations under the License.
|
|
1396
|
-
*/const Vs=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,qs=/^https?/;async function Hs(n){if(n.config.emulator)return;const{authorizedDomains:e}=await Xn(n);for(const t of e)try{if(zs(t))return}catch{}y(n,"unauthorized-domain")}function zs(n){const e=ve(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!qs.test(t))return!1;if(Vs.test(n))return i===n;const r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}/**
|
|
1397
|
-
* @license
|
|
1398
|
-
* Copyright 2020 Google LLC.
|
|
1399
|
-
*
|
|
1400
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1401
|
-
* you may not use this file except in compliance with the License.
|
|
1402
|
-
* You may obtain a copy of the License at
|
|
1403
|
-
*
|
|
1404
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1405
|
-
*
|
|
1406
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1407
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1408
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1409
|
-
* See the License for the specific language governing permissions and
|
|
1410
|
-
* limitations under the License.
|
|
1411
|
-
*/const Gs=new Te(3e4,6e4);function Xt(){const n=p().___jsl;if(n?.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function js(n){return new Promise((e,t)=>{var i,r,s;function o(){Xt(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Xt(),t(I(n,"network-request-failed"))},timeout:Gs.get()})}if(!((r=(i=p().gapi)===null||i===void 0?void 0:i.iframes)===null||r===void 0)&&r.Iframe)e(gapi.iframes.getContext());else if(!((s=p().gapi)===null||s===void 0)&&s.load)o();else{const a=zn("iframefcb");return p()[a]=()=>{gapi.load?o():t(I(n,"network-request-failed"))},Hn(`https://apis.google.com/js/api.js?onload=${a}`).catch(c=>t(c))}}).catch(e=>{throw Ne=null,e})}let Ne=null;function Bs(n){return Ne=Ne||js(n),Ne}/**
|
|
1412
|
-
* @license
|
|
1413
|
-
* Copyright 2020 Google LLC.
|
|
1414
|
-
*
|
|
1415
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1416
|
-
* you may not use this file except in compliance with the License.
|
|
1417
|
-
* You may obtain a copy of the License at
|
|
1418
|
-
*
|
|
1419
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1420
|
-
*
|
|
1421
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1422
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1423
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1424
|
-
* See the License for the specific language governing permissions and
|
|
1425
|
-
* limitations under the License.
|
|
1426
|
-
*/const $s=new Te(5e3,15e3),Ks="__/auth/iframe",Js="emulator/auth/iframe",Ys={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Xs=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Qs(n){const e=n.config;l(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?_t(e,Js):`https://${n.config.authDomain}/${Ks}`,i={apiKey:e.apiKey,appName:n.name,v:Ue},r=Xs.get(n.config.apiHost);r&&(i.eid=r);const s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${re(i).slice(1)}`}async function Zs(n){const e=await Bs(n),t=p().gapi;return l(t,n,"internal-error"),e.open({where:document.body,url:Qs(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Ys,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});const o=I(n,"network-request-failed"),a=p().setTimeout(()=>{s(o)},$s.get());function c(){p().clearTimeout(a),r(i)}i.ping(c).then(c,()=>{s(o)})}))}/**
|
|
1427
|
-
* @license
|
|
1428
|
-
* Copyright 2020 Google LLC.
|
|
1429
|
-
*
|
|
1430
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1431
|
-
* you may not use this file except in compliance with the License.
|
|
1432
|
-
* You may obtain a copy of the License at
|
|
1433
|
-
*
|
|
1434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1435
|
-
*
|
|
1436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1439
|
-
* See the License for the specific language governing permissions and
|
|
1440
|
-
* limitations under the License.
|
|
1441
|
-
*/const eo={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},to=500,no=600,io="_blank",ro="http://localhost";class Qt{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function so(n,e,t,i=to,r=no){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c=Object.assign(Object.assign({},eo),{width:i.toString(),height:r.toString(),top:s,left:o}),d=g().toLowerCase();t&&(a=vn(d)?io:t),gn(d)&&(e=e||ro,c.scrollbars="yes");const u=Object.entries(c).reduce((w,[Re,Se])=>`${w}${Re}=${Se},`,"");if(Mi(d)&&a!=="_self")return oo(e||"",a),new Qt(null);const h=window.open(e||"",a,u);l(h,n,"popup-blocked");try{h.focus()}catch{}return new Qt(h)}function oo(n,e){const t=document.createElement("a");t.href=n,t.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}/**
|
|
1442
|
-
* @license
|
|
1443
|
-
* Copyright 2021 Google LLC
|
|
1444
|
-
*
|
|
1445
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1446
|
-
* you may not use this file except in compliance with the License.
|
|
1447
|
-
* You may obtain a copy of the License at
|
|
1448
|
-
*
|
|
1449
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1450
|
-
*
|
|
1451
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1452
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1453
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1454
|
-
* See the License for the specific language governing permissions and
|
|
1455
|
-
* limitations under the License.
|
|
1456
|
-
*/const ao="__/auth/handler",co="emulator/auth/handler";function ot(n,e,t,i,r,s){l(n.config.authDomain,n,"auth-domain-config-required"),l(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:Ue,eventId:r};if(e instanceof W){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",fi(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[c,d]of Object.entries(s||{}))o[c]=d}if(e instanceof ce){const c=e.getScopes().filter(d=>d!=="");c.length>0&&(o.scopes=c.join(","))}n.tenantId&&(o.tid=n.tenantId);const a=o;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];return`${lo(n)}?${re(a).slice(1)}`}function lo({config:n}){return n.emulator?_t(n,co):`https://${n.authDomain}/${ao}`}/**
|
|
1457
|
-
* @license
|
|
1458
|
-
* Copyright 2020 Google LLC
|
|
1459
|
-
*
|
|
1460
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1461
|
-
* you may not use this file except in compliance with the License.
|
|
1462
|
-
* You may obtain a copy of the License at
|
|
1463
|
-
*
|
|
1464
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1465
|
-
*
|
|
1466
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1467
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1468
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1469
|
-
* See the License for the specific language governing permissions and
|
|
1470
|
-
* limitations under the License.
|
|
1471
|
-
*/const tt="webStorageSupport";class uo{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=K,this._completeRedirectFn=$e,this._overrideRedirectResult=Pt}async _openPopup(e,t,i,r){var s;S((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=ot(e,t,i,ve(),r);return so(e,o,Ee())}async _openRedirect(e,t,i,r){return await this._originValidation(e),Gr(ot(e,t,i,ve(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(S(s,"If manager is not set, promise should be"),s)}const i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){const t=await Zs(e),i=new Jn(e);return t.register("authEvent",r=>(l(r?.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(tt,{type:tt},r=>{var s;const o=(s=r?.[0])===null||s===void 0?void 0:s[tt];o!==void 0&&t(!!o),y(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Hs(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return wn()||It()||oe()}}const ho=uo;class fo{constructor(e){this.factorId=e}_process(e,t,i){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,i);case"signin":return this._finalizeSignIn(e,t.credential);default:return C("unexpected MultiFactorSessionType")}}}class Nt extends fo{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new Nt(e)}_finalizeEnroll(e,t,i){return Ur(e,{idToken:t,displayName:i,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return es(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}}class Qn{constructor(){}static assertion(e){return Nt._fromCredential(e)}}Qn.FACTOR_ID="phone";var Zt="@firebase/auth",en="0.20.6";/**
|
|
1472
|
-
* @license
|
|
1473
|
-
* Copyright 2020 Google LLC
|
|
1474
|
-
*
|
|
1475
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1476
|
-
* you may not use this file except in compliance with the License.
|
|
1477
|
-
* You may obtain a copy of the License at
|
|
1478
|
-
*
|
|
1479
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1480
|
-
*
|
|
1481
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1482
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1483
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1484
|
-
* See the License for the specific language governing permissions and
|
|
1485
|
-
* limitations under the License.
|
|
1486
|
-
*/class po{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(i=>{var r;e(((r=i)===null||r===void 0?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);!t||(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){l(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1487
|
-
* @license
|
|
1488
|
-
* Copyright 2020 Google LLC
|
|
1489
|
-
*
|
|
1490
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1491
|
-
* you may not use this file except in compliance with the License.
|
|
1492
|
-
* You may obtain a copy of the License at
|
|
1493
|
-
*
|
|
1494
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1495
|
-
*
|
|
1496
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1497
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1498
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1499
|
-
* See the License for the specific language governing permissions and
|
|
1500
|
-
* limitations under the License.
|
|
1501
|
-
*/function mo(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function go(n){Wt(new it("auth",(e,{options:t})=>{const i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),{apiKey:s,authDomain:o}=i.options;return((a,c)=>{l(s&&!s.includes(":"),"invalid-api-key",{appName:a.name}),l(!o?.includes(":"),"argument-error",{appName:a.name});const d={apiKey:s,authDomain:o,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Tn(n)},u=new Wi(a,c,d);return vi(u,t),u})(i,r)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),Wt(new it("auth-internal",e=>{const t=v(e.getProvider("auth").getImmediate());return(i=>new po(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(Zt,en,mo(n)),Vt(Zt,en,"esm2017")}go("Browser");/**
|
|
1502
|
-
* @license
|
|
1503
|
-
* Copyright 2021 Google LLC
|
|
1504
|
-
*
|
|
1505
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1506
|
-
* you may not use this file except in compliance with the License.
|
|
1507
|
-
* You may obtain a copy of the License at
|
|
1508
|
-
*
|
|
1509
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1510
|
-
*
|
|
1511
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1512
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1513
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1514
|
-
* See the License for the specific language governing permissions and
|
|
1515
|
-
* limitations under the License.
|
|
1516
|
-
*/function J(){return window}/**
|
|
1517
|
-
* @license
|
|
1518
|
-
* Copyright 2020 Google LLC
|
|
1519
|
-
*
|
|
1520
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1521
|
-
* you may not use this file except in compliance with the License.
|
|
1522
|
-
* You may obtain a copy of the License at
|
|
1523
|
-
*
|
|
1524
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1525
|
-
*
|
|
1526
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1527
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1528
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1529
|
-
* See the License for the specific language governing permissions and
|
|
1530
|
-
* limitations under the License.
|
|
1531
|
-
*/const vo=2e3;async function _o(n,e,t){var i;const{BuildInfo:r}=J();S(e.sessionId,"AuthEvent did not contain a session ID");const s=await ko(e.sessionId),o={};return oe()?o.ibi=r.packageName:ke()?o.apn=r.packageName:y(n,"operation-not-supported-in-this-environment"),r.displayName&&(o.appDisplayName=r.displayName),o.sessionId=s,ot(n,t,e.type,void 0,(i=e.eventId)!==null&&i!==void 0?i:void 0,o)}async function Io(n){const{BuildInfo:e}=J(),t={};oe()?t.iosBundleId=e.packageName:ke()?t.androidPackageName=e.packageName:y(n,"operation-not-supported-in-this-environment"),await Xn(n,t)}function yo(n){const{cordova:e}=J();return new Promise(t=>{e.plugins.browsertab.isAvailable(i=>{let r=null;i?e.plugins.browsertab.openUrl(n):r=e.InAppBrowser.open(n,Di()?"_blank":"_system","location=yes"),t(r)})})}async function wo(n,e,t){const{cordova:i}=J();let r=()=>{};try{await new Promise((s,o)=>{let a=null;function c(){var h;s();const w=(h=i.plugins.browsertab)===null||h===void 0?void 0:h.close;typeof w=="function"&&w(),typeof t?.close=="function"&&t.close()}function d(){a||(a=window.setTimeout(()=>{o(I(n,"redirect-cancelled-by-user"))},vo))}function u(){document?.visibilityState==="visible"&&d()}e.addPassiveListener(c),document.addEventListener("resume",d,!1),ke()&&document.addEventListener("visibilitychange",u,!1),r=()=>{e.removePassiveListener(c),document.removeEventListener("resume",d,!1),document.removeEventListener("visibilitychange",u,!1),a&&window.clearTimeout(a)}})}finally{r()}}function To(n){var e,t,i,r,s,o,a,c,d,u;const h=J();l(typeof((e=h?.universalLinks)===null||e===void 0?void 0:e.subscribe)=="function",n,"invalid-cordova-configuration",{missingPlugin:"cordova-universal-links-plugin-fix"}),l(typeof((t=h?.BuildInfo)===null||t===void 0?void 0:t.packageName)<"u",n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-buildInfo"}),l(typeof((s=(r=(i=h?.cordova)===null||i===void 0?void 0:i.plugins)===null||r===void 0?void 0:r.browsertab)===null||s===void 0?void 0:s.openUrl)=="function",n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),l(typeof((c=(a=(o=h?.cordova)===null||o===void 0?void 0:o.plugins)===null||a===void 0?void 0:a.browsertab)===null||c===void 0?void 0:c.isAvailable)=="function",n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-browsertab"}),l(typeof((u=(d=h?.cordova)===null||d===void 0?void 0:d.InAppBrowser)===null||u===void 0?void 0:u.open)=="function",n,"invalid-cordova-configuration",{missingPlugin:"cordova-plugin-inappbrowser"})}async function ko(n){const e=Eo(n),t=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("")}function Eo(n){if(S(/[0-9a-zA-Z]+/.test(n),"Can only convert alpha-numeric strings"),typeof TextEncoder<"u")return new TextEncoder().encode(n);const e=new ArrayBuffer(n.length),t=new Uint8Array(e);for(let i=0;i<n.length;i++)t[i]=n.charCodeAt(i);return t}/**
|
|
1532
|
-
* @license
|
|
1533
|
-
* Copyright 2020 Google LLC
|
|
1534
|
-
*
|
|
1535
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1536
|
-
* you may not use this file except in compliance with the License.
|
|
1537
|
-
* You may obtain a copy of the License at
|
|
1538
|
-
*
|
|
1539
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1540
|
-
*
|
|
1541
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1542
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1543
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1544
|
-
* See the License for the specific language governing permissions and
|
|
1545
|
-
* limitations under the License.
|
|
1546
|
-
*/const bo=20;class Ro extends Jn{constructor(){super(...arguments),this.passiveListeners=new Set,this.initPromise=new Promise(e=>{this.resolveInialized=e})}addPassiveListener(e){this.passiveListeners.add(e)}removePassiveListener(e){this.passiveListeners.delete(e)}resetRedirect(){this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1}onEvent(e){return this.resolveInialized(),this.passiveListeners.forEach(t=>t(e)),super.onEvent(e)}async initialized(){await this.initPromise}}function So(n,e,t=null){return{type:e,eventId:t,urlResponse:null,sessionId:No(),postBody:null,tenantId:n.tenantId,error:I(n,"no-auth-event")}}function Ao(n,e){return at()._set(ct(n),e)}async function tn(n){const e=await at()._get(ct(n));return e&&await at()._remove(ct(n)),e}function Po(n,e){var t,i;const r=Co(e);if(r.includes("/__/auth/callback")){const s=Oe(r),o=s.firebaseError?Oo(decodeURIComponent(s.firebaseError)):null,a=(i=(t=o?.code)===null||t===void 0?void 0:t.split("auth/"))===null||i===void 0?void 0:i[1],c=a?I(a):null;return c?{type:n.type,eventId:n.eventId,tenantId:n.tenantId,error:c,urlResponse:null,sessionId:null,postBody:null}:{type:n.type,eventId:n.eventId,tenantId:n.tenantId,sessionId:n.sessionId,urlResponse:r,postBody:null}}return null}function No(){const n=[],e="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let t=0;t<bo;t++){const i=Math.floor(Math.random()*e.length);n.push(e.charAt(i))}return n.join("")}function at(){return E(Et)}function ct(n){return B("authEvent",n.config.apiKey,n.name)}function Oo(n){try{return JSON.parse(n)}catch{return null}}function Co(n){const e=Oe(n),t=e.link?decodeURIComponent(e.link):void 0,i=Oe(t).link,r=e.deep_link_id?decodeURIComponent(e.deep_link_id):void 0;return Oe(r).link||r||i||t||n}function Oe(n){if(!n?.includes("?"))return{};const[e,...t]=n.split("?");return Q(t.join("?"))}/**
|
|
1547
|
-
* @license
|
|
1548
|
-
* Copyright 2021 Google LLC
|
|
1549
|
-
*
|
|
1550
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1551
|
-
* you may not use this file except in compliance with the License.
|
|
1552
|
-
* You may obtain a copy of the License at
|
|
1553
|
-
*
|
|
1554
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1555
|
-
*
|
|
1556
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1557
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1558
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1559
|
-
* See the License for the specific language governing permissions and
|
|
1560
|
-
* limitations under the License.
|
|
1561
|
-
*/const Lo=500;class Do{constructor(){this._redirectPersistence=K,this._shouldInitProactively=!0,this.eventManagers=new Map,this.originValidationPromises={},this._completeRedirectFn=$e,this._overrideRedirectResult=Pt}async _initialize(e){const t=e._key();let i=this.eventManagers.get(t);return i||(i=new Ro(e),this.eventManagers.set(t,i),this.attachCallbackListeners(e,i)),i}_openPopup(e){y(e,"operation-not-supported-in-this-environment")}async _openRedirect(e,t,i,r){To(e);const s=await this._initialize(e);await s.initialized(),s.resetRedirect(),Ns(),await this._originValidation(e);const o=So(e,i,r);await Ao(e,o);const a=await _o(e,o,t),c=await yo(a);return wo(e,s,c)}_isIframeWebStorageSupported(e,t){throw new Error("Method not implemented.")}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Io(e)),this.originValidationPromises[t]}attachCallbackListeners(e,t){const{universalLinks:i,handleOpenURL:r,BuildInfo:s}=J(),o=setTimeout(async()=>{await tn(e),t.onEvent(nn())},Lo),a=async u=>{clearTimeout(o);const h=await tn(e);let w=null;h&&u?.url&&(w=Po(h,u.url)),t.onEvent(w||nn())};typeof i<"u"&&typeof i.subscribe=="function"&&i.subscribe(null,a);const c=r,d=`${s.packageName.toLowerCase()}://`;J().handleOpenURL=async u=>{if(u.toLowerCase().startsWith(d)&&a({url:u}),typeof c=="function")try{c(u)}catch(h){console.error(h)}}}}const Mo=Do;function nn(){return{type:"unknown",eventId:null,sessionId:null,urlResponse:null,postBody:null,tenantId:null,error:I("no-auth-event")}}/**
|
|
1562
|
-
* @license
|
|
1563
|
-
* Copyright 2017 Google LLC
|
|
1564
|
-
*
|
|
1565
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1566
|
-
* you may not use this file except in compliance with the License.
|
|
1567
|
-
* You may obtain a copy of the License at
|
|
1568
|
-
*
|
|
1569
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1570
|
-
*
|
|
1571
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1572
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1573
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1574
|
-
* See the License for the specific language governing permissions and
|
|
1575
|
-
* limitations under the License.
|
|
1576
|
-
*/function Uo(n,e){v(n)._logFramework(e)}var Fo="@firebase/auth-compat",xo="0.2.19";/**
|
|
1577
|
-
* @license
|
|
1578
|
-
* Copyright 2020 Google LLC
|
|
1579
|
-
*
|
|
1580
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1581
|
-
* you may not use this file except in compliance with the License.
|
|
1582
|
-
* You may obtain a copy of the License at
|
|
1583
|
-
*
|
|
1584
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1585
|
-
*
|
|
1586
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1587
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1588
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1589
|
-
* See the License for the specific language governing permissions and
|
|
1590
|
-
* limitations under the License.
|
|
1591
|
-
*/const Wo=1e3;function ge(){var n;return((n=self?.location)===null||n===void 0?void 0:n.protocol)||null}function Vo(){return ge()==="http:"||ge()==="https:"}function Zn(n=g()){return!!((ge()==="file:"||ge()==="ionic:"||ge()==="capacitor:")&&n.toLowerCase().match(/iphone|ipad|ipod|android/))}function qo(){return ft()||an()}function Ho(){return on()&&document?.documentMode===11}function zo(n=g()){return/Edge\/\d+/.test(n)}function Go(n=g()){return Ho()||zo(n)}function ei(){try{const n=self.localStorage,e=Ee();if(n)return n.setItem(e,"1"),n.removeItem(e),Go()?rt():!0}catch{return Ot()&&rt()}return!1}function Ot(){return typeof global<"u"&&"WorkerGlobalScope"in global&&"importScripts"in global}function nt(){return(Vo()||sn()||Zn())&&!qo()&&ei()&&!Ot()}function ti(){return Zn()&&typeof document<"u"}async function jo(){return ti()?new Promise(n=>{const e=setTimeout(()=>{n(!1)},Wo);document.addEventListener("deviceready",()=>{clearTimeout(e),n(!0)})}):!1}function Bo(){return typeof window<"u"?window:null}/**
|
|
1592
|
-
* @license
|
|
1593
|
-
* Copyright 2020 Google LLC
|
|
1594
|
-
*
|
|
1595
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1596
|
-
* you may not use this file except in compliance with the License.
|
|
1597
|
-
* You may obtain a copy of the License at
|
|
1598
|
-
*
|
|
1599
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1600
|
-
*
|
|
1601
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1602
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1603
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1604
|
-
* See the License for the specific language governing permissions and
|
|
1605
|
-
* limitations under the License.
|
|
1606
|
-
*/const k={LOCAL:"local",NONE:"none",SESSION:"session"},de=l,ni="persistence";function $o(n,e){if(de(Object.values(k).includes(e),n,"invalid-persistence-type"),ft()){de(e!==k.SESSION,n,"unsupported-persistence-type");return}if(an()){de(e===k.NONE,n,"unsupported-persistence-type");return}if(Ot()){de(e===k.NONE||e===k.LOCAL&&rt(),n,"unsupported-persistence-type");return}de(e===k.NONE||ei(),n,"unsupported-persistence-type")}async function lt(n){await n._initializationPromise;const e=ii(),t=B(ni,n.config.apiKey,n.name);e&&e.setItem(t,n._getPersistence())}function Ko(n,e){const t=ii();if(!t)return[];const i=B(ni,n,e);switch(t.getItem(i)){case k.NONE:return[ne];case k.LOCAL:return[we,K];case k.SESSION:return[K];default:return[]}}function ii(){var n;try{return((n=Bo())===null||n===void 0?void 0:n.sessionStorage)||null}catch{return null}}/**
|
|
1607
|
-
* @license
|
|
1608
|
-
* Copyright 2020 Google LLC
|
|
1609
|
-
*
|
|
1610
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1611
|
-
* you may not use this file except in compliance with the License.
|
|
1612
|
-
* You may obtain a copy of the License at
|
|
1613
|
-
*
|
|
1614
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1615
|
-
*
|
|
1616
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1617
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1618
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
|
-
* See the License for the specific language governing permissions and
|
|
1620
|
-
* limitations under the License.
|
|
1621
|
-
*/const Jo=l;class q{constructor(){this.browserResolver=E(ho),this.cordovaResolver=E(Mo),this.underlyingResolver=null,this._redirectPersistence=K,this._completeRedirectFn=$e,this._overrideRedirectResult=Pt}async _initialize(e){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._initialize(e)}async _openPopup(e,t,i,r){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openPopup(e,t,i,r)}async _openRedirect(e,t,i,r){return await this.selectUnderlyingResolver(),this.assertedUnderlyingResolver._openRedirect(e,t,i,r)}_isIframeWebStorageSupported(e,t){this.assertedUnderlyingResolver._isIframeWebStorageSupported(e,t)}_originValidation(e){return this.assertedUnderlyingResolver._originValidation(e)}get _shouldInitProactively(){return ti()||this.browserResolver._shouldInitProactively}get assertedUnderlyingResolver(){return Jo(this.underlyingResolver,"internal-error"),this.underlyingResolver}async selectUnderlyingResolver(){if(this.underlyingResolver)return;const e=await jo();this.underlyingResolver=e?this.cordovaResolver:this.browserResolver}}/**
|
|
1622
|
-
* @license
|
|
1623
|
-
* Copyright 2020 Google LLC
|
|
1624
|
-
*
|
|
1625
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1626
|
-
* you may not use this file except in compliance with the License.
|
|
1627
|
-
* You may obtain a copy of the License at
|
|
1628
|
-
*
|
|
1629
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1630
|
-
*
|
|
1631
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1632
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1633
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1634
|
-
* See the License for the specific language governing permissions and
|
|
1635
|
-
* limitations under the License.
|
|
1636
|
-
*/function ri(n){return n.unwrap()}function Yo(n){return n.wrapped()}/**
|
|
1637
|
-
* @license
|
|
1638
|
-
* Copyright 2020 Google LLC
|
|
1639
|
-
*
|
|
1640
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1641
|
-
* you may not use this file except in compliance with the License.
|
|
1642
|
-
* You may obtain a copy of the License at
|
|
1643
|
-
*
|
|
1644
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1645
|
-
*
|
|
1646
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1647
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1648
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1649
|
-
* See the License for the specific language governing permissions and
|
|
1650
|
-
* limitations under the License.
|
|
1651
|
-
*/function Xo(n){return si(n)}function Qo(n,e){var t,i;const r=(t=e.customData)===null||t===void 0?void 0:t._tokenResponse;if(((i=e)===null||i===void 0?void 0:i.code)==="auth/multi-factor-auth-required"){const s=e;s.resolver=new Zo(n,Dr(n,e))}else if(r){const s=si(e),o=e;s&&(o.credential=s,o.tenantId=r.tenantId||void 0,o.email=r.email||void 0,o.phoneNumber=r.phoneNumber||void 0)}}function si(n){const{_tokenResponse:e}=n instanceof H?n.customData:n;if(!e)return null;if(!(n instanceof H)&&"temporaryProof"in e&&"phoneNumber"in e)return R.credentialFromResult(n);const t=e.providerId;if(!t||t===le.PASSWORD)return null;let i;switch(t){case le.GOOGLE:i=P;break;case le.FACEBOOK:i=A;break;case le.GITHUB:i=N;break;case le.TWITTER:i=O;break;default:const{oauthIdToken:r,oauthAccessToken:s,oauthTokenSecret:o,pendingToken:a,nonce:c}=e;return!s&&!o&&!r&&!a?null:a?t.startsWith("saml.")?ie._create(t,a):L._fromParams({providerId:t,signInMethod:t,pendingToken:a,idToken:r,accessToken:s}):new ee(t).credential({idToken:r,accessToken:s,rawNonce:c})}return n instanceof H?i.credentialFromError(n):i.credentialFromResult(n)}function T(n,e){return e.catch(t=>{throw t instanceof H&&Qo(n,t),t}).then(t=>{const i=t.operationType,r=t.user;return{operationType:i,credential:Xo(t),additionalUserInfo:Lr(t),user:M.getOrCreate(r)}})}async function dt(n,e){const t=await e;return{verificationId:t.verificationId,confirm:i=>T(n,t.confirm(i))}}class Zo{constructor(e,t){this.resolver=t,this.auth=Yo(e)}get session(){return this.resolver.session}get hints(){return this.resolver.hints}resolveSignIn(e){return T(ri(this.auth),this.resolver.resolveSignIn(e))}}/**
|
|
1652
|
-
* @license
|
|
1653
|
-
* Copyright 2020 Google LLC
|
|
1654
|
-
*
|
|
1655
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1656
|
-
* you may not use this file except in compliance with the License.
|
|
1657
|
-
* You may obtain a copy of the License at
|
|
1658
|
-
*
|
|
1659
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1660
|
-
*
|
|
1661
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1662
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1663
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1664
|
-
* See the License for the specific language governing permissions and
|
|
1665
|
-
* limitations under the License.
|
|
1666
|
-
*/class M{constructor(e){this._delegate=e,this.multiFactor=xr(e)}static getOrCreate(e){return M.USER_MAP.has(e)||M.USER_MAP.set(e,new M(e)),M.USER_MAP.get(e)}delete(){return this._delegate.delete()}reload(){return this._delegate.reload()}toJSON(){return this._delegate.toJSON()}getIdTokenResult(e){return this._delegate.getIdTokenResult(e)}getIdToken(e){return this._delegate.getIdToken(e)}linkAndRetrieveDataWithCredential(e){return this.linkWithCredential(e)}async linkWithCredential(e){return T(this.auth,On(this._delegate,e))}async linkWithPhoneNumber(e,t){return dt(this.auth,vs(this._delegate,e,t))}async linkWithPopup(e){return T(this.auth,Rs(this._delegate,e,q))}async linkWithRedirect(e){return await lt(v(this.auth)),Ms(this._delegate,e,q)}reauthenticateAndRetrieveDataWithCredential(e){return this.reauthenticateWithCredential(e)}async reauthenticateWithCredential(e){return T(this.auth,Cn(this._delegate,e))}reauthenticateWithPhoneNumber(e,t){return dt(this.auth,_s(this._delegate,e,t))}reauthenticateWithPopup(e){return T(this.auth,bs(this._delegate,e,q))}async reauthenticateWithRedirect(e){return await lt(v(this.auth)),Ls(this._delegate,e,q)}sendEmailVerification(e){return Tr(this._delegate,e)}async unlink(e){return await cr(this._delegate,e),this}updateEmail(e){return Rr(this._delegate,e)}updatePassword(e){return Sr(this._delegate,e)}updatePhoneNumber(e){return Is(this._delegate,e)}updateProfile(e){return br(this._delegate,e)}verifyBeforeUpdateEmail(e,t){return kr(this._delegate,e,t)}get emailVerified(){return this._delegate.emailVerified}get isAnonymous(){return this._delegate.isAnonymous}get metadata(){return this._delegate.metadata}get phoneNumber(){return this._delegate.phoneNumber}get providerData(){return this._delegate.providerData}get refreshToken(){return this._delegate.refreshToken}get tenantId(){return this._delegate.tenantId}get displayName(){return this._delegate.displayName}get email(){return this._delegate.email}get photoURL(){return this._delegate.photoURL}get providerId(){return this._delegate.providerId}get uid(){return this._delegate.uid}get auth(){return this._delegate.auth}}M.USER_MAP=new WeakMap;/**
|
|
1667
|
-
* @license
|
|
1668
|
-
* Copyright 2020 Google LLC
|
|
1669
|
-
*
|
|
1670
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1671
|
-
* you may not use this file except in compliance with the License.
|
|
1672
|
-
* You may obtain a copy of the License at
|
|
1673
|
-
*
|
|
1674
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1675
|
-
*
|
|
1676
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1677
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1678
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1679
|
-
* See the License for the specific language governing permissions and
|
|
1680
|
-
* limitations under the License.
|
|
1681
|
-
*/const ue=l;class ut{constructor(e,t){if(this.app=e,t.isInitialized()){this._delegate=t.getImmediate(),this.linkUnderlyingAuth();return}const{apiKey:i}=e.options;ue(i,"invalid-api-key",{appName:e.name}),ue(i,"invalid-api-key",{appName:e.name});const r=typeof window<"u"?q:void 0;this._delegate=t.initialize({options:{persistence:ea(i,e.name),popupRedirectResolver:r}}),this._delegate._updateErrorMap(mi),this.linkUnderlyingAuth()}get emulatorConfig(){return this._delegate.emulatorConfig}get currentUser(){return this._delegate.currentUser?M.getOrCreate(this._delegate.currentUser):null}get languageCode(){return this._delegate.languageCode}set languageCode(e){this._delegate.languageCode=e}get settings(){return this._delegate.settings}get tenantId(){return this._delegate.tenantId}set tenantId(e){this._delegate.tenantId=e}useDeviceLanguage(){this._delegate.useDeviceLanguage()}signOut(){return this._delegate.signOut()}useEmulator(e,t){Vi(this._delegate,e,t)}applyActionCode(e){return fr(this._delegate,e)}checkActionCode(e){return Ln(this._delegate,e)}confirmPasswordReset(e,t){return hr(this._delegate,e,t)}async createUserWithEmailAndPassword(e,t){return T(this._delegate,mr(this._delegate,e,t))}fetchProvidersForEmail(e){return this.fetchSignInMethodsForEmail(e)}fetchSignInMethodsForEmail(e){return wr(this._delegate,e)}isSignInWithEmailLink(e){return _r(this._delegate,e)}async getRedirectResult(){ue(nt(),this._delegate,"operation-not-supported-in-this-environment");const e=await Fs(this._delegate,q);return e?T(this._delegate,Promise.resolve(e)):{credential:null,user:null}}addFrameworkForLogging(e){Uo(this._delegate,e)}onAuthStateChanged(e,t,i){const{next:r,error:s,complete:o}=rn(e,t,i);return this._delegate.onAuthStateChanged(r,s,o)}onIdTokenChanged(e,t,i){const{next:r,error:s,complete:o}=rn(e,t,i);return this._delegate.onIdTokenChanged(r,s,o)}sendSignInLinkToEmail(e,t){return vr(this._delegate,e,t)}sendPasswordResetEmail(e,t){return ur(this._delegate,e,t||void 0)}async setPersistence(e){$o(this._delegate,e);let t;switch(e){case k.SESSION:t=K;break;case k.LOCAL:t=await E(we)._isAvailable()?we:Et;break;case k.NONE:t=ne;break;default:return y("argument-error",{appName:this._delegate.name})}return this._delegate.setPersistence(t)}signInAndRetrieveDataWithCredential(e){return this.signInWithCredential(e)}signInAnonymously(){return T(this._delegate,ar(this._delegate))}signInWithCredential(e){return T(this._delegate,qe(this._delegate,e))}signInWithCustomToken(e){return T(this._delegate,dr(this._delegate,e))}signInWithEmailAndPassword(e,t){return T(this._delegate,gr(this._delegate,e,t))}signInWithEmailLink(e,t){return T(this._delegate,Ir(this._delegate,e,t))}signInWithPhoneNumber(e,t){return dt(this._delegate,gs(this._delegate,e,t))}async signInWithPopup(e){return ue(nt(),this._delegate,"operation-not-supported-in-this-environment"),T(this._delegate,Es(this._delegate,e,q))}async signInWithRedirect(e){return ue(nt(),this._delegate,"operation-not-supported-in-this-environment"),await lt(this._delegate),Os(this._delegate,e,q)}updateCurrentUser(e){return this._delegate.updateCurrentUser(e)}verifyPasswordResetCode(e){return pr(this._delegate,e)}unwrap(){return this._delegate}_delete(){return this._delegate._delete()}linkUnderlyingAuth(){this._delegate.wrapped=()=>this}}ut.Persistence=k;function rn(n,e,t){let i=n;typeof n!="function"&&({next:i,error:e,complete:t}=n);const r=i;return{next:o=>r(o&&M.getOrCreate(o)),error:e,complete:t}}function ea(n,e){const t=Ko(n,e);if(typeof self<"u"&&!t.includes(we)&&t.push(we),typeof window<"u")for(const i of[Et,K])t.includes(i)||t.push(i);return t.includes(ne)||t.push(ne),t}/**
|
|
1682
|
-
* @license
|
|
1683
|
-
* Copyright 2020 Google LLC
|
|
1684
|
-
*
|
|
1685
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1686
|
-
* you may not use this file except in compliance with the License.
|
|
1687
|
-
* You may obtain a copy of the License at
|
|
1688
|
-
*
|
|
1689
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1690
|
-
*
|
|
1691
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1692
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1693
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1694
|
-
* See the License for the specific language governing permissions and
|
|
1695
|
-
* limitations under the License.
|
|
1696
|
-
*/class Ct{constructor(){this.providerId="phone",this._delegate=new R(ri(pt.auth()))}static credential(e,t){return R.credential(e,t)}verifyPhoneNumber(e,t){return this._delegate.verifyPhoneNumber(e,t)}unwrap(){return this._delegate}}Ct.PHONE_SIGN_IN_METHOD=R.PHONE_SIGN_IN_METHOD;Ct.PROVIDER_ID=R.PROVIDER_ID;/**
|
|
1697
|
-
* @license
|
|
1698
|
-
* Copyright 2020 Google LLC
|
|
1699
|
-
*
|
|
1700
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1701
|
-
* you may not use this file except in compliance with the License.
|
|
1702
|
-
* You may obtain a copy of the License at
|
|
1703
|
-
*
|
|
1704
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1705
|
-
*
|
|
1706
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1707
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1708
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1709
|
-
* See the License for the specific language governing permissions and
|
|
1710
|
-
* limitations under the License.
|
|
1711
|
-
*/const ta=l;class na{constructor(e,t,i=pt.app()){var r;ta((r=i.options)===null||r===void 0?void 0:r.apiKey,"invalid-api-key",{appName:i.name}),this._delegate=new ps(e,t,i.auth()),this.type=this._delegate.type}clear(){this._delegate.clear()}render(){return this._delegate.render()}verify(){return this._delegate.verify()}}/**
|
|
1712
|
-
* @license
|
|
1713
|
-
* Copyright 2020 Google LLC
|
|
1714
|
-
*
|
|
1715
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1716
|
-
* you may not use this file except in compliance with the License.
|
|
1717
|
-
* You may obtain a copy of the License at
|
|
1718
|
-
*
|
|
1719
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1720
|
-
*
|
|
1721
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1722
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1723
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1724
|
-
* See the License for the specific language governing permissions and
|
|
1725
|
-
* limitations under the License.
|
|
1726
|
-
*/const ia="auth-compat";function ra(n){n.INTERNAL.registerComponent(new it(ia,e=>{const t=e.getProvider("app-compat").getImmediate(),i=e.getProvider("auth");return new ut(t,i)},"PUBLIC").setServiceProps({ActionCodeInfo:{Operation:{EMAIL_SIGNIN:X.EMAIL_SIGNIN,PASSWORD_RESET:X.PASSWORD_RESET,RECOVER_EMAIL:X.RECOVER_EMAIL,REVERT_SECOND_FACTOR_ADDITION:X.REVERT_SECOND_FACTOR_ADDITION,VERIFY_AND_CHANGE_EMAIL:X.VERIFY_AND_CHANGE_EMAIL,VERIFY_EMAIL:X.VERIFY_EMAIL}},EmailAuthProvider:z,FacebookAuthProvider:A,GithubAuthProvider:N,GoogleAuthProvider:P,OAuthProvider:ee,SAMLAuthProvider:Ce,PhoneAuthProvider:Ct,PhoneMultiFactorGenerator:Qn,RecaptchaVerifier:na,TwitterAuthProvider:O,Auth:ut,AuthCredential:ae,Error:H}).setInstantiationMode("LAZY").setMultipleInstances(!1)),n.registerVersion(Fo,xo)}ra(pt);
|