@firebase-oss/ui-react 0.0.2-exp.c228b3f → 0.0.2-exp.cfc61d6
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/LICENSE +202 -0
- package/README.md +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +37 -38
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2016 Google Inc
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
'use strict';var uiCore=require('@firebase-oss/ui-core'),react=require('react'),react$1=require('@nanostores/react'),jsxRuntime=require('react/jsx-runtime'),reactForm=require('@tanstack/react-form'),reactSlot=require('@radix-ui/react-slot'),uiStyles=require('@firebase-oss/ui-styles'),tailwindMerge=require('tailwind-merge'),clsx=require('clsx'),auth=require('firebase/auth');var
|
|
1
|
+
'use strict';var uiCore=require('@firebase-oss/ui-core'),react=require('react'),react$1=require('@nanostores/react'),jsxRuntime=require('react/jsx-runtime'),reactForm=require('@tanstack/react-form'),reactSlot=require('@radix-ui/react-slot'),uiStyles=require('@firebase-oss/ui-styles'),tailwindMerge=require('tailwind-merge'),clsx=require('clsx'),auth=require('firebase/auth');var rr={version:"0.0.2-exp.cfc61d6"};var At=react.createContext(void 0);function or({children:t,policies:e}){return jsxRuntime.jsx(At.Provider,{value:e,children:t})}function A(){let t=s(),e=react.useContext(At);if(!e)return null;let{termsOfServiceUrl:r,privacyPolicyUrl:o,onNavigate:n}=e,a=uiCore.getTranslation(t,"messages","termsAndPrivacy").split(/(\{tos\}|\{privacy\})/),C=n?jsxRuntime.jsx("button",{}):jsxRuntime.jsx("a",{target:"_blank",rel:"noopener noreferrer"});return jsxRuntime.jsx("div",{className:"fui-policies",children:a.map((v,T)=>v==="{tos}"?react.cloneElement(C,{key:T,onClick:n?()=>n(r):void 0,href:n?void 0:r,children:uiCore.getTranslation(t,"labels","termsOfService")}):v==="{privacy}"?react.cloneElement(C,{key:T,onClick:n?()=>n(o):void 0,href:n?void 0:o,children:uiCore.getTranslation(t,"labels","privacyPolicy")}):jsxRuntime.jsx("span",{children:v},T))})}var Pt=react.createContext(null);function De({children:t,ui:e,policies:r}){let o=react$1.useStore(e);return jsxRuntime.jsx(Pt.Provider,{value:o,children:jsxRuntime.jsx(or,{policies:r,children:t})})}function s(){let t=react.useContext(Pt);if(!t)throw new Error(`No FirebaseUI context found. Your application must be wrapped in a FirebaseUIProvider:
|
|
2
2
|
|
|
3
3
|
const ui = initializeUI(...);
|
|
4
4
|
|
|
5
5
|
<FirebaseUIProvider ui={ui}>
|
|
6
6
|
<App />
|
|
7
7
|
</FirebaseUIProvider>
|
|
8
|
-
`);return t}function N(t){let r=s().auth;react.useEffect(()=>r.onAuthStateChanged(o=>{o&&!o.isAnonymous&&t?.(o);}),[r,t]);}function ir(){let t=s();return react.useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function sr(){let t=s();return react.useMemo(()=>uiCore.createSignInAuthFormSchema(t),[t])}function ar(){let t=s();return react.useMemo(()=>uiCore.createSignUpAuthFormSchema(t),[t])}function ur(){let t=s();return react.useMemo(()=>uiCore.createForgotPasswordAuthFormSchema(t),[t])}function mr(){let t=s();return react.useMemo(()=>uiCore.createEmailLinkAuthFormSchema(t),[t])}function cr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthNumberFormSchema(t),[t])}function lr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthVerifyFormSchema(t),[t])}function pr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function ct(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function fr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthNumberFormSchema(t),[t])}function lt(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function W(t){let e=s(),r=react.useRef(null),o=react.useRef(e),n=react.useRef(null);return o.current=e,react.useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=uiCore.getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}function u(...t){return tailwindMerge.twMerge(clsx.clsx(...t))}function x({className:t,variant:e="primary",asChild:r,...o}){return jsxRuntime.jsx(r?reactSlot.Slot:"button",{className:u(uiStyles.buttonVariant({variant:e}),t),...o})}var{fieldContext:oo,useFieldContext:no,formContext:io,useFormContext:dr}=reactForm.createFormHookContexts();function so({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsxRuntime.jsx("div",{children:jsxRuntime.jsx("div",{role:"alert","aria-live":"polite",className:u("fui-error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function ao({children:t,before:e,label:r,action:o,description:n,...i}){let a=no();return jsxRuntime.jsxs("label",{htmlFor:a.name,children:[jsxRuntime.jsxs("div",{"data-input-label":true,children:[jsxRuntime.jsx("div",{children:r}),o?jsxRuntime.jsx("div",{children:o}):null]}),n?jsxRuntime.jsx("div",{"data-input-description":true,children:n}):null,jsxRuntime.jsxs("div",{"data-input-group":true,children:[e,jsxRuntime.jsx("input",{...i,"aria-invalid":a.state.meta.isTouched&&a.state.meta.errors.length>0,id:a.name,name:a.name,value:a.state.value,onBlur:()=>{a.handleBlur();},onChange:C=>{a.handleChange(C.target.value);}})]}),t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):null,jsxRuntime.jsx(so,{field:a})]})}function uo({className:t,...e}){return jsxRuntime.jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function mo(t){let e=dr();return jsxRuntime.jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsxRuntime.jsx(x,{...t,type:"submit",disabled:r})})}function co(){let t=dr();return jsxRuntime.jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsxRuntime.jsx("div",{className:"fui-error",children:e.onSubmit}):null})}var m=reactForm.createFormHook({fieldComponents:{Input:ao},formComponents:{SubmitButton:mo,ErrorMessage:co,Action:uo},fieldContext:oo,formContext:io});function Fr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Sr(t){let e=mr(),r=Fr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function gr(t){let e=s();react.useEffect(()=>{(async()=>{let o=await uiCore.completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[t]);}function It({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=react.useState(false),i=Sr(()=>{n(!0),t?.();});return gr(e),o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","signInLinkSent")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","sendSignInLink")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function yr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendPasswordResetEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Ar(t){let e=ur(),r=yr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Mt({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=react.useState(false),i=Ar(()=>{n(!0),e?.();});return o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","checkEmailForReset")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","resetPassword")}),jsxRuntime.jsx(i.ErrorMessage,{})]}),t?jsxRuntime.jsxs(i.Action,{onClick:t,children:["\u2190 ",uiCore.getTranslation(r,"labels","backToSignIn")]}):null]})})}function Pr(){let t=s();return react.useCallback(async({verificationCode:e,hint:r})=>{let o=auth.TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await uiCore.signInWithMultiFactorAssertion(t,o)},[t])}function br({hint:t,onSuccess:e}){let r=Pr(),o=lt();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r({verificationCode:n.verificationCode,hint:t});return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function wt(t){let e=s(),r=br({hint:t.hint,onSuccess:o=>{t.onSuccess?.(o);}});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","enterVerificationCode"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function xr(){let t=s();return react.useCallback(async({hint:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,"",r,void 0,e),[t])}function Vo({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=xr();return m.useAppForm({validators:{onSubmitAsync:async()=>{try{let n=await o({hint:t,recaptchaVerifier:e});return r(n)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function Bo(t){let e=s(),r=react.useRef(null),o=W(r),n=Vo({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("label",{children:jsxRuntime.jsx("div",{"data-input-description":true,children:uiCore.getTranslation(e,"messages","mfaSmsAssertionPrompt",{phoneNumber:t.hint.phoneNumber||""})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(n.ErrorMessage,{})]})]})})}function Mr(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>{let o=auth.PhoneAuthProvider.credential(e,r),n=auth.PhoneMultiFactorGenerator.assertion(o);return await uiCore.signInWithMultiFactorAssertion(t,n)},[t])}function ko({verificationId:t,onSuccess:e}){let r=Mr(),o=ct();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Ro(t){let e=s(),r=ko({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Nt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(Ro,{verificationId:e.verificationId,onSuccess:o=>{t.onSuccess?.(o);}}):jsxRuntime.jsx(Bo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function Nr(){let t=s();react.useEffect(()=>()=>{t.setMultiFactorResolver();},[]);}function Tt(t){let e=s(),r=e.multiFactorResolver,o=uiCore.getTranslation(e,"prompts","mfaAssertionFactorPrompt");if(Nr(),!r)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[n,i]=react.useState(r.hints.length===1?r.hints[0]:void 0);if(n){if(n.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(Nt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}});if(n.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(wt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}})}return jsxRuntime.jsxs("div",{className:"fui-content",children:[jsxRuntime.jsx("p",{children:o}),r.hints.map(a=>a.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(_o,{onClick:()=>i(a)},a.factorId):a.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(Do,{onClick:()=>i(a)},a.factorId):null)]})}function _o(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{...t,children:r})}function Do(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{...t,children:r})}function Tr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().allowedCountries}function Vr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().defaultCountry}var q=react.forwardRef(({className:t,...e},r)=>{let o=Tr(),n=Vr(),[i,a]=react.useState(n),C=react.useCallback(y=>{let T=o.find(yt=>yt.code===y);a(T);},[o]);return react.useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:C}),[i,C]),jsxRuntime.jsx("div",{className:u("fui-country-selector",t),...e,children:jsxRuntime.jsxs("div",{className:"fui-country-selector__wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxRuntime.jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsxRuntime.jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:y=>{let T=o.find(yt=>yt.code===y.target.value);T&&a(T);},children:o.map(y=>jsxRuntime.jsxs("option",{value:y.code,children:[y.dialCode," (",y.name,")"]},`${y.code}-${y.dialCode}`))})]})]})})});q.displayName="CountrySelector";function Gr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=auth.multiFactor(t.auth.currentUser);return await uiCore.verifyPhoneNumber(t,e,r,o)},[t])}function Lr({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Gr(),n=pr();return m.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C,i.displayName)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function jo(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=Lr({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"displayName",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(q,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function _r(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=auth.PhoneAuthProvider.credential(e,r),i=auth.PhoneMultiFactorGenerator.assertion(n);return await uiCore.enrollWithMultiFactorAssertion(t,i,o)},[t])}function Dr({verificationId:t,displayName:e,onSuccess:r}){let o=ct(),n=_r();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Or(t){let e=s(),r=Dr({...t,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Bt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Or,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(jo,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function zr(){let t=s();return react.useCallback(async()=>await uiCore.generateTotpSecret(t),[t])}function qr({onSuccess:t}){let e=zr(),r=fr();return m.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function sn(t){let e=s(),r=qr({onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"displayName",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","generateQrCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function $r(){let t=s();return react.useCallback(async({secret:e,verificationCode:r,displayName:o})=>{let n=auth.TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await uiCore.enrollWithMultiFactorAssertion(t,n,o)},[t])}function Qr({secret:t,displayName:e,onSuccess:r}){let o=lt(),n=$r();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Jr(t){let e=s(),r=Qr({...t,onSuccess:t.onSuccess}),o=uiCore.generateTotpQrCode(e,t.secret,t.displayName);return jsxRuntime.jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxRuntime.jsxs("div",{className:"fui-qr-code-container",children:[jsxRuntime.jsx("img",{src:o,alt:"TOTP QR Code"}),jsxRuntime.jsx("code",{children:t.secret.secretKey.toString()}),jsxRuntime.jsx("p",{children:uiCore.getTranslation(e,"prompts","mfaTotpQrCodePrompt")})]}),jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:n=>jsxRuntime.jsx(n.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","mfaTotpEnrollmentVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})]})}function kt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Jr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(sn,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var un=[auth.FactorId.TOTP,auth.FactorId.PHONE];function Rt(t){let e=t.hints??un;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=react.useState(e.length===1?e[0]:void 0);if(r){if(r===auth.FactorId.TOTP)return jsxRuntime.jsx(kt,{onSuccess:t.onEnrollment});if(r===auth.FactorId.PHONE)return jsxRuntime.jsx(Bt,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsxRuntime.jsx("div",{className:"fui-content",children:e.map(n=>n===auth.FactorId.TOTP?jsxRuntime.jsx(mn,{onClick:()=>o(n)},n):n===auth.FactorId.PHONE?jsxRuntime.jsx(cn,{onClick:()=>o(n)},n):null)})}function mn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function cn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function jr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,e,r),[t])}function te({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=jr(),n=cr();return m.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function hn(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=te({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(q,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function re(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>await uiCore.confirmPhoneNumber(t,e,r),[t])}function ee({verificationId:t,onSuccess:e}){let r=lr(),o=re();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Fn(t){let e=s(),r=ee({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Gt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(Fn,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsxRuntime.jsx(hn,{onSubmit:r})}function oe(){let t=s();return react.useCallback(async({email:e,password:r})=>{try{return await uiCore.signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof uiCore.FirebaseUIError?new Error(o.message):(console.error(o),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function ne(t){let e=sr(),r=oe();return m.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function _t({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=ne(t);return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","password"),type:"password",action:e?jsxRuntime.jsx(n.Action,{onClick:e,children:uiCore.getTranslation(o,"labels","forgotPassword")}):null})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(o,"labels","signIn")}),jsxRuntime.jsx(n.ErrorMessage,{})]}),r?jsxRuntime.jsxs(n.Action,{onClick:r,children:[uiCore.getTranslation(o,"prompts","noAccount")," ",uiCore.getTranslation(o,"labels","signUp")]}):null]})})}function Ot(){let t=s();return uiCore.hasBehavior(t,"requireDisplayName")}function ie(){let t=s();return react.useCallback(async({email:e,password:r,displayName:o})=>{try{return await uiCore.createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof uiCore.FirebaseUIError?new Error(n.message):(console.error(n),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function se(t){let e=ar(),r=ie(),o=Ot();return m.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Ht({onSignInClick:t,onSignUp:e}){let r=s(),o=se(e),n=Ot();return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxRuntime.jsxs(o.AppForm,{children:[n?jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"displayName",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","displayName")})})}):null,jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","password"),type:"password"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(o.SubmitButton,{children:uiCore.getTranslation(r,"labels","createAccount")}),jsxRuntime.jsx(o.ErrorMessage,{})]}),t?jsxRuntime.jsxs(o.Action,{onClick:t,children:[uiCore.getTranslation(r,"prompts","haveAccount")," ",uiCore.getTranslation(r,"labels","signIn")]}):null]})})}function U({className:t,children:e,...r}){return e?jsxRuntime.jsxs("div",{className:u("fui-divider",t),...r,children:[jsxRuntime.jsx("div",{className:"fui-divider__line"}),jsxRuntime.jsx("div",{className:"fui-divider__text",children:e}),jsxRuntime.jsx("div",{className:"fui-divider__line"})]}):jsxRuntime.jsx("div",{className:u("fui-divider",t),...r,children:jsxRuntime.jsx("div",{className:"fui-divider__line"})})}function p({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card",e),...r,children:t})}function f({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__header",e),...r,children:t})}function d({children:t,className:e,...r}){return jsxRuntime.jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function h({children:t,className:e,...r}){return jsxRuntime.jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function F({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__content",e),...r,children:t})}function E(){let t=ir();return t?jsxRuntime.jsx("div",{className:"fui-error",children:t}):null}function w(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorAssertion"),o=uiCore.getTranslation(e,"prompts","mfaAssertionPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Tt,{...t})})]})})}function xn({children:t,onEmailSent:e,onSignIn:r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount"),a=o.multiFactorResolver;return N(r),a?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(It,{onEmailSent:e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function En(t){let e=s(),r=uiCore.getTranslation(e,"labels","resetPassword"),o=uiCore.getTranslation(e,"prompts","enterEmailToReset");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Mt,{...t})})]})})}function wn(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorEnrollment"),o=uiCore.getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Rt,{...t})})]})})}function Nn({children:t,onSignIn:e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{}),jsxRuntime.jsx(A,{})]})]})})}function Un({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e.onSignIn),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Gt,{}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function Vn({children:t,onSignIn:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(_t,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function kn({children:t,onSignUp:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signUp"),i=uiCore.getTranslation(o,"prompts","enterDetailsToCreate");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Ht,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function he(t,e){let r=s(),[o,n]=react.useState(null),i=react.useCallback(async()=>{n(null);try{let a=await uiCore.signInWithProvider(r,t);e?.(a);}catch(a){if(a instanceof uiCore.FirebaseUIError){n(a.message);return}console.error(a),n(uiCore.getTranslation(r,"errors","unknownError"));}},[r,t,n,e]);return {error:o,callback:i}}function b({provider:t,children:e,themed:r,onSignIn:o}){let n=s(),{error:i,callback:a}=he(t,o);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(x,{type:"button",variant:r?"primary":"secondary","data-themed":r,"data-provider":t.providerId,disabled:n.state!=="idle",onClick:a,className:"fui-provider__button",children:e}),i&&jsxRuntime.jsx("div",{className:"fui-error",children:i})]})}var Wn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),Se=Wn;function $n({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.OAuthProvider("apple.com"),children:[jsxRuntime.jsx(ge,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithApple")})]})}function ge({className:t,...e}){return jsxRuntime.jsx(Se,{className:u("fui-provider__icon",t),...e})}var Jn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Ae=Jn;function Xn({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.FacebookAuthProvider,children:[jsxRuntime.jsx(ve,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithFacebook")})]})}function ve({className:t,...e}){return jsxRuntime.jsx(Ae,{className:u("fui-provider__icon",t),...e})}var jn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),be=jn;function ei({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.GithubAuthProvider,children:[jsxRuntime.jsx(Ce,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGitHub")})]})}function Ce({className:t,...e}){return jsxRuntime.jsx(be,{className:u("fui-provider__icon",t),...e})}var ni=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsxRuntime.jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsxRuntime.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsxRuntime.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),Ie=ni;function ui({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.GoogleAuthProvider,children:[jsxRuntime.jsx(xe,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGoogle")})]})}function xe({className:t,...e}){return jsxRuntime.jsx(Ie,{className:u("fui-provider__icon",t),...e})}var ci=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsxRuntime.jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsxRuntime.jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsxRuntime.jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),Me=ci;function di({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.OAuthProvider("microsoft.com"),children:[jsxRuntime.jsx(Ee,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithMicrosoft")})]})}function Ee({className:t,...e}){return jsxRuntime.jsx(Me,{className:u("fui-provider__icon",t),...e})}var Fi=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),Ne=Fi;function yi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(b,{...e,provider:t||new auth.TwitterAuthProvider,children:[jsxRuntime.jsx(Ue,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithTwitter")})]})}function Ue({className:t,...e}){return jsxRuntime.jsx(Ne,{className:u("fui-provider__icon",t),...e})}uiCore.registerFramework("react",tr.version);
|
|
9
|
-
exports.AppleLogo=
|
|
8
|
+
`);return t}function N(t){let r=s().auth;react.useEffect(()=>r.onAuthStateChanged(o=>{o&&!o.isAnonymous&&t?.(o);}),[r,t]);}function sr(){let t=s();return react.useMemo(()=>{if(t.redirectError)return t.redirectError instanceof Error?t.redirectError.message:String(t.redirectError)},[t.redirectError])}function ar(){let t=s();return react.useMemo(()=>uiCore.createSignInAuthFormSchema(t),[t])}function ur(){let t=s();return react.useMemo(()=>uiCore.createSignUpAuthFormSchema(t),[t])}function mr(){let t=s();return react.useMemo(()=>uiCore.createForgotPasswordAuthFormSchema(t),[t])}function cr(){let t=s();return react.useMemo(()=>uiCore.createEmailLinkAuthFormSchema(t),[t])}function lr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthNumberFormSchema(t),[t])}function pr(){let t=s();return react.useMemo(()=>uiCore.createPhoneAuthVerifyFormSchema(t),[t])}function fr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthNumberFormSchema(t),[t])}function ct(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorPhoneAuthVerifyFormSchema(t),[t])}function dr(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthNumberFormSchema(t),[t])}function lt(){let t=s();return react.useMemo(()=>uiCore.createMultiFactorTotpAuthVerifyFormSchema(t),[t])}function W(t){let e=s(),r=react.useRef(null),o=react.useRef(e),n=react.useRef(null);return o.current=e,react.useEffect(()=>{let i=t.current,a=o.current;i!==n.current&&(n.current=i,i?(r.current=uiCore.getBehavior(a,"recaptchaVerification")(a,i),r.current.render()):r.current=null);},[t]),r.current}function u(...t){return tailwindMerge.twMerge(clsx.clsx(...t))}function x({className:t,variant:e="primary",asChild:r,...o}){return jsxRuntime.jsx(r?reactSlot.Slot:"button",{className:u(uiStyles.buttonVariant({variant:e}),t),...o})}var{fieldContext:ao,useFieldContext:uo,formContext:mo,useFormContext:hr}=reactForm.createFormHookContexts();function co({className:t,...e}){return !e.field.state.meta.isTouched||!e.field.state.meta.errors.length?null:jsxRuntime.jsx("div",{children:jsxRuntime.jsx("div",{role:"alert","aria-live":"polite",className:u("fui-error",t),...e,children:e.field.state.meta.errors.map(r=>r.message).join(", ")})})}function lo({children:t,before:e,label:r,action:o,description:n,...i}){let a=uo();return jsxRuntime.jsxs("label",{htmlFor:a.name,children:[jsxRuntime.jsxs("div",{"data-input-label":true,children:[jsxRuntime.jsx("div",{children:r}),o?jsxRuntime.jsx("div",{children:o}):null]}),n?jsxRuntime.jsx("div",{"data-input-description":true,children:n}):null,jsxRuntime.jsxs("div",{"data-input-group":true,children:[e,jsxRuntime.jsx("input",{...i,"aria-invalid":a.state.meta.isTouched&&a.state.meta.errors.length>0,id:a.name,name:a.name,value:a.state.value,onBlur:()=>{a.handleBlur();},onChange:C=>{a.handleChange(C.target.value);}})]}),t?jsxRuntime.jsx(jsxRuntime.Fragment,{children:t}):null,jsxRuntime.jsx(co,{field:a})]})}function po({className:t,...e}){return jsxRuntime.jsx("button",{type:"button",...e,className:u("fui-form__action",t)})}function fo(t){let e=hr();return jsxRuntime.jsx(e.Subscribe,{selector:r=>r.isSubmitting,children:r=>jsxRuntime.jsx(x,{...t,type:"submit",disabled:r})})}function ho(){let t=hr();return jsxRuntime.jsx(t.Subscribe,{selector:e=>[e.errorMap],children:([e])=>e?.onSubmit&&typeof e.onSubmit=="string"?jsxRuntime.jsx("div",{className:"fui-error",children:e.onSubmit}):null})}var m=reactForm.createFormHook({fieldComponents:{Input:lo},formComponents:{SubmitButton:fo,ErrorMessage:ho,Action:po},fieldContext:ao,formContext:mo});function Sr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendSignInLinkToEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function gr(t){let e=cr(),r=Sr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function yr(t){let e=s();react.useEffect(()=>{(async()=>{let o=await uiCore.completeEmailLinkSignIn(e,window.location.href);o&&t?.(o);})();},[t]);}function It({onEmailSent:t,onSignIn:e}){let r=s(),[o,n]=react.useState(false),i=gr(()=>{n(!0),t?.();});return yr(e),o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","signInLinkSent")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","sendSignInLink")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function vr(){let t=s();return react.useCallback(async({email:e})=>{try{return await uiCore.sendPasswordResetEmail(t,e)}catch(r){throw r instanceof uiCore.FirebaseUIError?new Error(r.message):(console.error(r),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function Ar(t){let e=mr(),r=vr();return m.useAppForm({defaultValues:{email:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{return await r(o),t?.()}catch(n){return n instanceof Error?n.message:String(n)}}}})}function Mt({onBackToSignInClick:t,onPasswordSent:e}){let r=s(),[o,n]=react.useState(false),i=Ar(()=>{n(!0),e?.();});return o?jsxRuntime.jsx("div",{className:"fui-success",children:uiCore.getTranslation(r,"messages","checkEmailForReset")}):jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"email",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(r,"labels","resetPassword")}),jsxRuntime.jsx(i.ErrorMessage,{})]}),t?jsxRuntime.jsxs(i.Action,{onClick:t,children:["\u2190 ",uiCore.getTranslation(r,"labels","backToSignIn")]}):null]})})}function br(){let t=s();return react.useCallback(async({verificationCode:e,hint:r})=>{let o=auth.TotpMultiFactorGenerator.assertionForSignIn(r.uid,e);return await uiCore.signInWithMultiFactorAssertion(t,o)},[t])}function Cr({hint:t,onSuccess:e}){let r=br(),o=lt();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r({verificationCode:n.verificationCode,hint:t});return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function wt(t){let e=s(),r=Cr({hint:t.hint,onSuccess:o=>{t.onSuccess?.(o);}});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","enterVerificationCode"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",placeholder:"123456",maxLength:6})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Mr(){let t=s();return react.useCallback(async({hint:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,"",r,void 0,e),[t])}function Go({hint:t,recaptchaVerifier:e,onSuccess:r}){let o=Mr();return m.useAppForm({validators:{onSubmitAsync:async()=>{try{let n=await o({hint:t,recaptchaVerifier:e});return r(n)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function Lo(t){let e=s(),r=react.useRef(null),o=W(r),n=Go({hint:t.hint,recaptchaVerifier:o,onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("label",{children:jsxRuntime.jsx("div",{"data-input-description":true,children:uiCore.getTranslation(e,"messages","mfaSmsAssertionPrompt",{phoneNumber:t.hint.phoneNumber||""})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(n.ErrorMessage,{})]})]})})}function Er(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>{let o=auth.PhoneAuthProvider.credential(e,r),n=auth.PhoneMultiFactorGenerator.assertion(o);return await uiCore.signInWithMultiFactorAssertion(t,n)},[t])}function _o({verificationId:t,onSuccess:e}){let r=Er(),o=ct();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function Oo(t){let e=s(),r=_o({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Nt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(Oo,{verificationId:e.verificationId,onSuccess:o=>{t.onSuccess?.(o);}}):jsxRuntime.jsx(Lo,{hint:t.hint,onSubmit:o=>r({verificationId:o})})}function Ur(){let t=s();react.useEffect(()=>()=>{t.setMultiFactorResolver();},[]);}function Tt(t){let e=s(),r=e.multiFactorResolver,o=uiCore.getTranslation(e,"prompts","mfaAssertionFactorPrompt");if(Ur(),!r)throw new Error("MultiFactorAuthAssertionForm requires a multi-factor resolver");let[n,i]=react.useState(r.hints.length===1?r.hints[0]:void 0);if(n){if(n.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(Nt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}});if(n.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID)return jsxRuntime.jsx(wt,{hint:n,onSuccess:a=>{t.onSuccess?.(a);}})}return jsxRuntime.jsxs("div",{className:"fui-content",children:[jsxRuntime.jsx("p",{children:o}),r.hints.map(a=>a.factorId===auth.TotpMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(Wo,{onClick:()=>i(a)},a.factorId):a.factorId===auth.PhoneMultiFactorGenerator.FACTOR_ID?jsxRuntime.jsx(zo,{onClick:()=>i(a)},a.factorId):null)]})}function Wo(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{...t,children:r})}function zo(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{...t,children:r})}function Vr(){let t=s();return uiCore.getBehavior(t,"countryCodes")().allowedCountries}function Br(){let t=s();return uiCore.getBehavior(t,"countryCodes")().defaultCountry}var Y=react.forwardRef(({className:t,...e},r)=>{let o=Vr(),n=Br(),[i,a]=react.useState(n),C=react.useCallback(v=>{let T=o.find(yt=>yt.code===v);a(T);},[o]);return react.useImperativeHandle(r,()=>({getCountry:()=>i,setCountry:C}),[i,C]),jsxRuntime.jsx("div",{className:u("fui-country-selector",t),...e,children:jsxRuntime.jsxs("div",{className:"fui-country-selector__wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__flag",children:i.emoji}),jsxRuntime.jsxs("div",{className:"fui-country-selector__select-wrapper",children:[jsxRuntime.jsx("span",{className:"fui-country-selector__dial-code",children:i.dialCode}),jsxRuntime.jsx("select",{className:"fui-country-selector__select",value:i.code,onChange:v=>{let T=o.find(yt=>yt.code===v.target.value);T&&a(T);},children:o.map(v=>jsxRuntime.jsxs("option",{value:v.code,children:[v.dialCode," (",v.name,")"]},`${v.code}-${v.dialCode}`))})]})]})})});Y.displayName="CountrySelector";function Lr(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>{let o=auth.multiFactor(t.auth.currentUser);return await uiCore.verifyPhoneNumber(t,e,r,o)},[t])}function _r({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=Lr(),n=fr();return m.useAppForm({defaultValues:{displayName:"",phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C,i.displayName)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function on(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=_r({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"displayName",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(Y,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function Or(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r,displayName:o})=>{let n=auth.PhoneAuthProvider.credential(e,r),i=auth.PhoneMultiFactorGenerator.assertion(n);return await uiCore.enrollWithMultiFactorAssertion(t,i,o)},[t])}function Dr({verificationId:t,displayName:e,onSuccess:r}){let o=ct(),n=Or();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({...i,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Hr(t){let e=s(),r=Dr({...t,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Bt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Hr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(on,{onSubmit:(n,i)=>o({verificationId:n,displayName:i})})}function Yr(){let t=s();return react.useCallback(async()=>await uiCore.generateTotpSecret(t),[t])}function qr({onSuccess:t}){let e=Yr(),r=dr();return m.useAppForm({defaultValues:{displayName:""},validators:{onBlur:r,onSubmitAsync:async({value:o})=>{try{let n=await e();return t(n,o.displayName)}catch(n){return n instanceof uiCore.FirebaseUIError?n.message:String(n)}}}})}function cn(t){let e=s(),r=qr({onSuccess:t.onSubmit});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"displayName",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","displayName"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","generateQrCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function $r(){let t=s();return react.useCallback(async({secret:e,verificationCode:r,displayName:o})=>{let n=auth.TotpMultiFactorGenerator.assertionForEnrollment(e,r);return await uiCore.enrollWithMultiFactorAssertion(t,n,o)},[t])}function Qr({secret:t,displayName:e,onSuccess:r}){let o=lt(),n=$r();return m.useAppForm({defaultValues:{verificationCode:""},validators:{onBlur:o,onSubmitAsync:async({value:i})=>{try{return await n({secret:t,verificationCode:i.verificationCode,displayName:e}),r()}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function Jr(t){let e=s(),r=Qr({...t,onSuccess:t.onSuccess}),o=uiCore.generateTotpQrCode(e,t.secret,t.displayName);return jsxRuntime.jsxs("form",{className:"fui-form",onSubmit:async n=>{n.preventDefault(),n.stopPropagation(),await r.handleSubmit();},children:[jsxRuntime.jsxs("div",{className:"fui-qr-code-container",children:[jsxRuntime.jsx("img",{src:o,alt:"TOTP QR Code"}),jsxRuntime.jsx("code",{children:t.secret.secretKey.toString()}),jsxRuntime.jsx("p",{children:uiCore.getTranslation(e,"prompts","mfaTotpQrCodePrompt")})]}),jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:n=>jsxRuntime.jsx(n.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),type:"text",description:uiCore.getTranslation(e,"prompts","mfaTotpEnrollmentVerificationPrompt")})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})]})}function kt(t){let e=s(),[r,o]=react.useState(null);if(!e.auth.currentUser)throw new Error("User must be authenticated to enroll with multi-factor authentication");return r?jsxRuntime.jsx(Jr,{...r,onSuccess:()=>{t.onSuccess?.();}}):jsxRuntime.jsx(cn,{onSubmit:(n,i)=>o({secret:n,displayName:i})})}var pn=[auth.FactorId.TOTP,auth.FactorId.PHONE];function Rt(t){let e=t.hints??pn;if(e.length===0)throw new Error("MultiFactorAuthEnrollmentForm must have at least one hint");let[r,o]=react.useState(e.length===1?e[0]:void 0);if(r){if(r===auth.FactorId.TOTP)return jsxRuntime.jsx(kt,{onSuccess:t.onEnrollment});if(r===auth.FactorId.PHONE)return jsxRuntime.jsx(Bt,{onSuccess:t.onEnrollment});throw new Error(`Unknown multi-factor enrollment type: ${r}`)}return jsxRuntime.jsx("div",{className:"fui-content",children:e.map(n=>n===auth.FactorId.TOTP?jsxRuntime.jsx(fn,{onClick:()=>o(n)},n):n===auth.FactorId.PHONE?jsxRuntime.jsx(dn,{onClick:()=>o(n)},n):null)})}function fn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaTotpVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function dn(t){let e=s(),r=uiCore.getTranslation(e,"labels","mfaSmsVerification");return jsxRuntime.jsx(x,{variant:"secondary",...t,children:r})}function te(){let t=s();return react.useCallback(async({phoneNumber:e,recaptchaVerifier:r})=>await uiCore.verifyPhoneNumber(t,e,r),[t])}function re({recaptchaVerifier:t,onSuccess:e,formatPhoneNumber:r}){let o=te(),n=lr();return m.useAppForm({defaultValues:{phoneNumber:""},validators:{onBlur:n,onSubmitAsync:async({value:i})=>{try{let a=r?r(i.phoneNumber):i.phoneNumber,C=await o({phoneNumber:a,recaptchaVerifier:t});return e(C)}catch(a){return a instanceof uiCore.FirebaseUIError?a.message:String(a)}}}})}function yn(t){let e=s(),r=react.useRef(null),o=W(r),n=react.useRef(null),i=re({recaptchaVerifier:o,onSuccess:t.onSubmit,formatPhoneNumber:a=>uiCore.formatPhoneNumber(a,n.current.getCountry())});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async a=>{a.preventDefault(),a.stopPropagation(),await i.handleSubmit();},children:jsxRuntime.jsxs(i.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(i.AppField,{name:"phoneNumber",children:a=>jsxRuntime.jsx(a.Input,{label:uiCore.getTranslation(e,"labels","phoneNumber"),type:"tel",before:jsxRuntime.jsx(Y,{ref:n})})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx("div",{className:"fui-recaptcha-container",ref:r})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(i.SubmitButton,{children:uiCore.getTranslation(e,"labels","sendCode")}),jsxRuntime.jsx(i.ErrorMessage,{})]})]})})}function ee(){let t=s();return react.useCallback(async({verificationId:e,verificationCode:r})=>await uiCore.confirmPhoneNumber(t,e,r),[t])}function oe({verificationId:t,onSuccess:e}){let r=pr(),o=ee();return m.useAppForm({defaultValues:{verificationId:t,verificationCode:""},validators:{onBlur:r,onSubmitAsync:async({value:n})=>{try{let i=await o(n);return e(i)}catch(i){return i instanceof uiCore.FirebaseUIError?i.message:String(i)}}}})}function vn(t){let e=s(),r=oe({verificationId:t.verificationId,onSuccess:t.onSuccess});return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async o=>{o.preventDefault(),o.stopPropagation(),await r.handleSubmit();},children:jsxRuntime.jsxs(r.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(r.AppField,{name:"verificationCode",children:o=>jsxRuntime.jsx(o.Input,{label:uiCore.getTranslation(e,"labels","verificationCode"),description:uiCore.getTranslation(e,"prompts","smsVerificationPrompt"),type:"text"})})}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(r.SubmitButton,{children:uiCore.getTranslation(e,"labels","verifyCode")}),jsxRuntime.jsx(r.ErrorMessage,{})]})]})})}function Gt(t){let[e,r]=react.useState(null);return e?jsxRuntime.jsx(vn,{verificationId:e,onSuccess:o=>{t.onSignIn?.(o);}}):jsxRuntime.jsx(yn,{onSubmit:r})}function ne(){let t=s();return react.useCallback(async({email:e,password:r})=>{try{return await uiCore.signInWithEmailAndPassword(t,e,r)}catch(o){throw o instanceof uiCore.FirebaseUIError?new Error(o.message):(console.error(o),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function ie(t){let e=ar(),r=ne();return m.useAppForm({defaultValues:{email:"",password:""},validators:{onBlur:e,onSubmitAsync:async({value:o})=>{try{let n=await r(o);return t?.(n)}catch(n){return n instanceof Error?n.message:String(n)}}}})}function _t({onSignIn:t,onForgotPasswordClick:e,onSignUpClick:r}){let o=s(),n=ie(t);return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await n.handleSubmit();},children:jsxRuntime.jsxs(n.AppForm,{children:[jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(n.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(o,"labels","password"),type:"password",action:e?jsxRuntime.jsx(n.Action,{onClick:e,children:uiCore.getTranslation(o,"labels","forgotPassword")}):null})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(n.SubmitButton,{children:uiCore.getTranslation(o,"labels","signIn")}),jsxRuntime.jsx(n.ErrorMessage,{})]}),r?jsxRuntime.jsxs(n.Action,{onClick:r,children:[uiCore.getTranslation(o,"prompts","noAccount")," ",uiCore.getTranslation(o,"labels","signUp")]}):null]})})}function Dt(){let t=s();return uiCore.hasBehavior(t,"requireDisplayName")}function se(){let t=s();return react.useCallback(async({email:e,password:r,displayName:o})=>{try{return await uiCore.createUserWithEmailAndPassword(t,e,r,o)}catch(n){throw n instanceof uiCore.FirebaseUIError?new Error(n.message):(console.error(n),new Error(uiCore.getTranslation(t,"errors","unknownError")))}},[t])}function ae(t){let e=ur(),r=se(),o=Dt();return m.useAppForm({defaultValues:{email:"",password:"",displayName:o?"":void 0},validators:{onBlur:e,onSubmitAsync:async({value:n})=>{try{let i=await r(n);return t?.(i)}catch(i){return i instanceof Error?i.message:String(i)}}}})}function Ht({onSignInClick:t,onSignUp:e}){let r=s(),o=ae(e),n=Dt();return jsxRuntime.jsx("form",{className:"fui-form",onSubmit:async i=>{i.preventDefault(),i.stopPropagation(),await o.handleSubmit();},children:jsxRuntime.jsxs(o.AppForm,{children:[n?jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"displayName",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","displayName")})})}):null,jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"email",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","emailAddress"),type:"email"})})}),jsxRuntime.jsx("fieldset",{children:jsxRuntime.jsx(o.AppField,{name:"password",children:i=>jsxRuntime.jsx(i.Input,{label:uiCore.getTranslation(r,"labels","password"),type:"password"})})}),jsxRuntime.jsx(A,{}),jsxRuntime.jsxs("fieldset",{children:[jsxRuntime.jsx(o.SubmitButton,{children:uiCore.getTranslation(r,"labels","createAccount")}),jsxRuntime.jsx(o.ErrorMessage,{})]}),t?jsxRuntime.jsxs(o.Action,{onClick:t,children:[uiCore.getTranslation(r,"prompts","haveAccount")," ",uiCore.getTranslation(r,"labels","signIn")]}):null]})})}function U({className:t,children:e,...r}){return e?jsxRuntime.jsxs("div",{className:u("fui-divider",t),...r,children:[jsxRuntime.jsx("div",{className:"fui-divider__line"}),jsxRuntime.jsx("div",{className:"fui-divider__text",children:e}),jsxRuntime.jsx("div",{className:"fui-divider__line"})]}):jsxRuntime.jsx("div",{className:u("fui-divider",t),...r,children:jsxRuntime.jsx("div",{className:"fui-divider__line"})})}function p({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card",e),...r,children:t})}function f({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__header",e),...r,children:t})}function d({children:t,className:e,...r}){return jsxRuntime.jsx("h2",{className:u("fui-card__title",e),...r,children:t})}function h({children:t,className:e,...r}){return jsxRuntime.jsx("p",{className:u("fui-card__subtitle",e),...r,children:t})}function F({children:t,className:e,...r}){return jsxRuntime.jsx("div",{className:u("fui-card__content",e),...r,children:t})}function E(){let t=sr();return t?jsxRuntime.jsx("div",{className:"fui-error",children:t}):null}function w(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorAssertion"),o=uiCore.getTranslation(e,"prompts","mfaAssertionPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Tt,{...t})})]})})}function Nn({children:t,onEmailSent:e,onSignIn:r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount"),a=o.multiFactorResolver;return N(r),a?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(It,{onEmailSent:e}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function Tn(t){let e=s(),r=uiCore.getTranslation(e,"labels","resetPassword"),o=uiCore.getTranslation(e,"prompts","enterEmailToReset");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Mt,{...t})})]})})}function Vn(t){let e=s(),r=uiCore.getTranslation(e,"labels","multiFactorEnrollment"),o=uiCore.getTranslation(e,"prompts","mfaEnrollmentPrompt");return jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:r}),jsxRuntime.jsx(h,{children:o})]}),jsxRuntime.jsx(F,{children:jsxRuntime.jsx(Rt,{...t})})]})})}function Bn({children:t,onSignIn:e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{}),jsxRuntime.jsx(A,{})]})]})})}function kn({children:t,...e}){let r=s(),o=uiCore.getTranslation(r,"labels","signIn"),n=uiCore.getTranslation(r,"prompts","signInToAccount"),i=r.multiFactorResolver;return N(e.onSignIn),i?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:o}),jsxRuntime.jsx(h,{children:n})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Gt,{}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(r,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function Gn({children:t,onSignIn:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signIn"),i=uiCore.getTranslation(o,"prompts","signInToAccount");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(_t,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function _n({children:t,onSignUp:e,...r}){let o=s(),n=uiCore.getTranslation(o,"labels","signUp"),i=uiCore.getTranslation(o,"prompts","enterDetailsToCreate");return N(e),o.multiFactorResolver?jsxRuntime.jsx(w,{}):jsxRuntime.jsx("div",{className:"fui-screen",children:jsxRuntime.jsxs(p,{children:[jsxRuntime.jsxs(f,{children:[jsxRuntime.jsx(d,{children:n}),jsxRuntime.jsx(h,{children:i})]}),jsxRuntime.jsxs(F,{children:[jsxRuntime.jsx(Ht,{...r}),t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(U,{children:uiCore.getTranslation(o,"messages","dividerOr")}),jsxRuntime.jsxs("div",{className:"fui-screen__children",children:[t,jsxRuntime.jsx(E,{})]})]}):null]})]})})}function Fe(t,e){let r=s(),[o,n]=react.useState(null),i=react.useCallback(async()=>{n(null);try{let a=await uiCore.signInWithProvider(r,t);e?.(a);}catch(a){if(a instanceof uiCore.FirebaseUIError){n(a.message);return}console.error(a),n(uiCore.getTranslation(r,"errors","unknownError"));}},[r,t,n,e]);return {error:o,callback:i}}function y({provider:t,children:e,themed:r,onSignIn:o}){let n=s(),{error:i,callback:a}=Fe(t,o);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(x,{type:"button",variant:r?"primary":"secondary","data-themed":r,"data-provider":t.providerId,disabled:n.state!=="idle",onClick:a,className:"fui-provider__button",children:e}),i&&jsxRuntime.jsx("div",{className:"fui-error",children:i})]})}var $n=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M44.527 34.75c-1.078 2.395-1.597 3.465-2.984 5.578-1.941 2.953-4.68 6.64-8.063 6.664-3.011.028-3.789-1.965-7.878-1.93-4.086.02-4.938 1.97-7.954 1.938-3.386-.031-5.976-3.352-7.918-6.3-5.43-8.27-6.003-17.966-2.648-23.122 2.375-3.656 6.129-5.805 9.656-5.805 3.594 0 5.852 1.973 8.82 1.973 2.883 0 4.637-1.976 8.794-1.976 3.14 0 6.46 1.71 8.836 4.664-7.766 4.257-6.504 15.347 1.34 18.316M31.195 8.469c1.512-1.942 2.66-4.68 2.242-7.469-2.464.168-5.347 1.742-7.03 3.781-1.528 1.86-2.794 4.617-2.302 7.285 2.692.086 5.477-1.52 7.09-3.597"})}),ge=$n;function Kn({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.OAuthProvider("apple.com"),children:[jsxRuntime.jsx(ye,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithApple")})]})}function ye({className:t,...e}){return jsxRuntime.jsx(ge,{className:u("fui-provider__icon",t),...e})}var Zn=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 50 50",...t,children:jsxRuntime.jsx("path",{fill:"currentColor",d:"M25 3C12.85 3 3 12.85 3 25c0 11.03 8.125 20.137 18.712 21.728V30.831h-5.443v-5.783h5.443V21.2c0-6.371 3.104-9.168 8.399-9.168 2.536 0 3.877.188 4.512.274v5.048h-3.612c-2.248 0-3.033 2.131-3.033 4.533v3.161h6.588l-.894 5.783h-5.694v15.944C38.716 45.318 47 36.137 47 25c0-12.15-9.85-22-22-22"})}),Ae=Zn;function ri({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.FacebookAuthProvider,children:[jsxRuntime.jsx(Pe,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithFacebook")})]})}function Pe({className:t,...e}){return jsxRuntime.jsx(Ae,{className:u("fui-provider__icon",t),...e})}var oi=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"M15 3C8.373 3 3 8.373 3 15c0 5.623 3.872 10.328 9.092 11.63a1.8 1.8 0 0 1-.092-.583v-2.051h-1.508c-.821 0-1.551-.353-1.905-1.009-.393-.729-.461-1.844-1.435-2.526-.289-.227-.069-.486.264-.451.615.174 1.125.596 1.605 1.222.478.627.703.769 1.596.769.433 0 1.081-.025 1.691-.121.328-.833.895-1.6 1.588-1.962-3.996-.411-5.903-2.399-5.903-5.098 0-1.162.495-2.286 1.336-3.233-.276-.94-.623-2.857.106-3.587 1.798 0 2.885 1.166 3.146 1.481A9 9 0 0 1 15.495 9c1.036 0 2.024.174 2.922.483C18.675 9.17 19.763 8 21.565 8c.732.731.381 2.656.102 3.594.836.945 1.328 2.066 1.328 3.226 0 2.697-1.904 4.684-5.894 5.097C18.199 20.49 19 22.1 19 23.313v2.734c0 .104-.023.179-.035.268C23.641 24.676 27 20.236 27 15c0-6.627-5.373-12-12-12"})}),Ce=oi;function si({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.GithubAuthProvider,children:[jsxRuntime.jsx(Ie,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGitHub")})]})}function Ie({className:t,...e}){return jsxRuntime.jsx(Ce,{className:u("fui-provider__icon",t),...e})}var ui=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#FFC107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 12.955 4 4 12.955 4 24s8.955 20 20 20 20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),jsxRuntime.jsx("path",{fill:"#FF3D00",d:"m6.306 14.691 6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4 16.318 4 9.656 8.337 6.306 14.691"}),jsxRuntime.jsx("path",{fill:"#4CAF50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),jsxRuntime.jsx("path",{fill:"#1976D2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002 6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]}),xe=ui;function pi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.GoogleAuthProvider,children:[jsxRuntime.jsx(Me,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithGoogle")})]})}function Me({className:t,...e}){return jsxRuntime.jsx(xe,{className:u("fui-provider__icon",t),...e})}var di=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...t,children:[jsxRuntime.jsx("path",{fill:"#ff5722",d:"M22 22H6V6h16z"}),jsxRuntime.jsx("path",{fill:"#4caf50",d:"M42 22H26V6h16z"}),jsxRuntime.jsx("path",{fill:"#ffc107",d:"M42 42H26V26h16z"}),jsxRuntime.jsx("path",{fill:"#03a9f4",d:"M22 42H6V26h16z"})]}),Ee=di;function gi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.OAuthProvider("microsoft.com"),children:[jsxRuntime.jsx(we,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithMicrosoft")})]})}function we({className:t,...e}){return jsxRuntime.jsx(Ee,{className:u("fui-provider__icon",t),...e})}var vi=t=>jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 30 30",...t,children:jsxRuntime.jsx("path",{d:"m26.37 26-8.795-12.822.015.012L25.52 4h-2.65l-6.46 7.48L11.28 4H4.33l8.211 11.971-.001-.001L3.88 26h2.65l7.182-8.322L19.42 26zM10.23 6l12.34 18h-2.1L8.12 6z"})}),Ue=vi;function bi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.TwitterAuthProvider,children:[jsxRuntime.jsx(Te,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithTwitter")})]})}function Te({className:t,...e}){return jsxRuntime.jsx(Ue,{className:u("fui-provider__icon",t),...e})}var Ii=t=>jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"1em",height:"1em",fill:"currentColor",viewBox:"-271 324 256 153",...t,children:[jsxRuntime.jsx("path",{d:"M-37.5 356.3h.2l7.1-10.3h-.4l.7-1.1h-99.9l3.9 15.7h27.3l-46 41.5c-9.4-13-31.4-39.9-46.7-62.3h34.4v-12l.4-2.6c-.1 0-.3-.1-.4-.1V324H-271v15.8h33.8c13.1 10.3 63.4 73 65.4 79.2.8 5.9 1.6 40.4-.9 43-4.9 5.2-27.5 3.8-32.9 4.2l-1.9 10.7c9.9.3 42.2-.8 52.2-.8 19.8 0 54.4-.1 59.3.3l.6-11.2c-5-.8-32.3-.1-36-1-.8-5.4-1.7-41.8-.9-45.6 3.9-10.9 61.2-55.1 67.5-56.8 1.4-.3 3.5-.8 5.9-1.3h18.5z"}),jsxRuntime.jsx("path",{d:"m-48.2 447.8 15.3 1.2 17.9-69c-3-.1-30.1-2.7-33.6-3.3zM-50.8 458.9l.1 16.8 7.7.7 8.4.6 2.5-16.5-8.9-.4z"})]}),Be=Ii;function wi({provider:t,...e}){let r=s();return jsxRuntime.jsxs(y,{...e,provider:t||new auth.OAuthProvider("yahoo.com"),children:[jsxRuntime.jsx(ke,{}),jsxRuntime.jsx("span",{children:uiCore.getTranslation(r,"labels","signInWithYahoo")})]})}function ke({className:t,...e}){return jsxRuntime.jsx(Be,{className:u("fui-provider__icon",t),...e})}uiCore.registerFramework("react",rr.version);
|
|
9
|
+
exports.AppleLogo=ye;exports.AppleSignInButton=Kn;exports.Button=x;exports.Card=p;exports.CardContent=F;exports.CardHeader=f;exports.CardSubtitle=h;exports.CardTitle=d;exports.CountrySelector=Y;exports.Divider=U;exports.EmailLinkAuthForm=It;exports.EmailLinkAuthScreen=Nn;exports.FacebookLogo=Pe;exports.FacebookSignInButton=ri;exports.FirebaseUIProvider=De;exports.ForgotPasswordAuthForm=Mt;exports.ForgotPasswordAuthScreen=Tn;exports.GitHubLogo=Ie;exports.GitHubSignInButton=si;exports.GoogleLogo=Me;exports.GoogleSignInButton=pi;exports.MicrosoftLogo=we;exports.MicrosoftSignInButton=gi;exports.MultiFactorAuthAssertionForm=Tt;exports.MultiFactorAuthAssertionScreen=w;exports.MultiFactorAuthEnrollmentForm=Rt;exports.MultiFactorAuthEnrollmentScreen=Vn;exports.MultiFactorEnrollmentVerifyPhoneNumberForm=Hr;exports.MultiFactorEnrollmentVerifyTotpForm=Jr;exports.OAuthButton=y;exports.OAuthScreen=Bn;exports.PhoneAuthForm=Gt;exports.PhoneAuthScreen=kn;exports.Policies=A;exports.PolicyContext=At;exports.RedirectError=E;exports.SignInAuthForm=_t;exports.SignInAuthScreen=Gn;exports.SignUpAuthForm=Ht;exports.SignUpAuthScreen=_n;exports.SmsMultiFactorAssertionForm=Nt;exports.SmsMultiFactorEnrollmentForm=Bt;exports.TotpMultiFactorAssertionForm=wt;exports.TotpMultiFactorEnrollmentForm=kt;exports.TwitterLogo=Te;exports.TwitterSignInButton=bi;exports.YahooLogo=ke;exports.YahooSignInButton=wi;exports.form=m;exports.useCountries=Vr;exports.useDefaultCountry=Br;exports.useEmailLinkAuthForm=gr;exports.useEmailLinkAuthFormAction=Sr;exports.useEmailLinkAuthFormCompleteSignIn=yr;exports.useEmailLinkAuthFormSchema=cr;exports.useForgotPasswordAuthForm=Ar;exports.useForgotPasswordAuthFormAction=vr;exports.useForgotPasswordAuthFormSchema=mr;exports.useMultiFactorAssertionCleanup=Ur;exports.useMultiFactorEnrollmentVerifyPhoneNumberForm=Dr;exports.useMultiFactorEnrollmentVerifyPhoneNumberFormAction=Or;exports.useMultiFactorEnrollmentVerifyTotpForm=Qr;exports.useMultiFactorEnrollmentVerifyTotpFormAction=$r;exports.useMultiFactorPhoneAuthNumberFormSchema=fr;exports.useMultiFactorPhoneAuthVerifyFormSchema=ct;exports.useMultiFactorTotpAuthNumberFormSchema=dr;exports.useMultiFactorTotpAuthVerifyFormSchema=lt;exports.useOnUserAuthenticated=N;exports.usePhoneAuthNumberFormSchema=lr;exports.usePhoneAuthVerifyFormSchema=pr;exports.usePhoneNumberForm=re;exports.usePhoneNumberFormAction=te;exports.useRecaptchaVerifier=W;exports.useRedirectError=sr;exports.useRequireDisplayName=Dt;exports.useSignInAuthForm=ie;exports.useSignInAuthFormAction=ne;exports.useSignInAuthFormSchema=ar;exports.useSignInWithProvider=Fe;exports.useSignUpAuthForm=ae;exports.useSignUpAuthFormAction=se;exports.useSignUpAuthFormSchema=ur;exports.useSmsMultiFactorAssertionPhoneFormAction=Mr;exports.useSmsMultiFactorAssertionVerifyFormAction=Er;exports.useSmsMultiFactorEnrollmentPhoneAuthFormAction=Lr;exports.useSmsMultiFactorEnrollmentPhoneNumberForm=_r;exports.useTotpMultiFactorAssertionForm=Cr;exports.useTotpMultiFactorAssertionFormAction=br;exports.useTotpMultiFactorSecretGenerationForm=qr;exports.useTotpMultiFactorSecretGenerationFormAction=Yr;exports.useUI=s;exports.useVerifyPhoneNumberForm=oe;exports.useVerifyPhoneNumberFormAction=ee;//# sourceMappingURL=index.cjs.map
|
|
10
10
|
//# sourceMappingURL=index.cjs.map
|