@privy-io/react-auth 1.54.0 → 1.54.1-beta-20240122155643
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/dist/esm/index.js +32 -32
- package/dist/index.js +72 -72
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1182,14 +1182,14 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1182
1182
|
margin: 0 0.5rem;
|
|
1183
1183
|
`,Xg=no.default.div`
|
|
1184
1184
|
margin: 30px 0;
|
|
1185
|
-
`;var qu=require("ofetch"),Bn=require("react");var Qa="moonpay",ju="sdk_fiat_on_ramp_completed_with_status";async function Ku(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function
|
|
1185
|
+
`;var qu=require("ofetch"),Bn=require("react");var Qa="moonpay",ju="sdk_fiat_on_ramp_completed_with_status";async function Ku(e,t,o,r,n=!1){let i=o.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=o.uiConfig||{accentColor:r.accent,theme:r.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...o,...i,...a}})}async function e1(e,t){let o=t?cd:ld,r=t?pd:dd;return(0,qu.ofetch)(`${o}/transactions/ext/${e}`,{query:{apiKey:r}})}function Yu(e,t=!1){let[o,r]=(0,Bn.useState)(null),{createAnalyticsEvent:n}=R(),i=(0,Bn.useRef)(0);return(0,Bn.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[s]=await e1(e,t),l=s.status==="waitingAuthorization"&&s.paymentMethod==="credit_debit_card"?"pending":s.status;r(l),["failed","completed","awaitingAuthorization"].includes(l)&&(n(ju,{status:l,provider:Qa,paymentMethod:s.paymentMethod,cardPaymentType:s.cardPaymentType,currency:s.currency?.code,baseCurrencyAmount:s.baseCurrencyAmount,quoteCurrencyAmount:s.quoteCurrencyAmount,feeAmount:s.feeAmount,extraFeeAmount:s.extraFeeAmount,networkFeeAmount:s.networkFeeAmount}),clearInterval(a))}catch(s){s.response?.status!==404&&(i.current+=1),i.current>=3&&(r("serviceFailure"),n(ju,{status:"serviceFailure",provider:Qa}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),o}var yr=require("react/jsx-runtime"),Ju=()=>{let{app:e,data:t,navigate:o}=_(),{createAnalyticsEvent:r}=R(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,yr.jsxs)(yr.Fragment,{children:[(0,yr.jsx)(S,{title:"Fund account"},"header"),(0,yr.jsx)($u,{app:e,signedUrl:n,onContinue:()=>{r("sdk_fiat_on_ramp_started",{provider:Qa}),o("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,yr.jsx)(G,{protectedByPrivy:!0})]})};var Hn=require("@heroicons/react/24/solid"),Qu=require("react"),Gl=x(require("styled-components"));var ae=require("react/jsx-runtime"),Zu=()=>{let{app:e,data:t}=_(),{closePrivyModal:o}=R(),{externalTransactionId:r}=t?.fiatOnRampStatus,n=Yu(r||null,e.fiatOnRamp.useSandbox);return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)(S,{title:"Fund account"},"header"),(0,ae.jsx)(o1,{status:n,onClickCta:o}),(0,ae.jsx)(G,{protectedByPrivy:!0})]})},t1=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,ae.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,ae.jsx)("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},o1=({status:e,onClickCta:t})=>{let{title:o,body:r,cta:n}=(0,Qu.useMemo)(()=>t1(e),[e]);return(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsxs)(s1,{children:[(0,ae.jsx)(i1,{status:e}),(0,ae.jsxs)(sr,{children:[(0,ae.jsx)("h3",{children:o}),(0,ae.jsx)(a1,{children:r})]})]}),n&&(0,ae.jsx)(B,{onClick:t,children:n})]})},r1=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",n1=e=>{switch(e){case"serviceFailure":case"failed":return Hn.XCircleIcon;case"completed":return Hn.CheckCircleIcon;case"waitingAuthorization":return()=>(0,ae.jsx)(Hn.ArrowsRightLeftIcon,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},i1=({status:e})=>{if(!e||e==="pending"){let r="var(--privy-color-foreground-4)";return(0,ae.jsxs)("div",{style:{position:"relative"},children:[(0,ae.jsx)(ho,{color:r,style:{position:"absolute"}}),(0,ae.jsx)(xl,{color:r}),(0,ae.jsx)(Ja,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=n1(e),o=r1(e);return(0,ae.jsx)("div",{style:{borderColor:o,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,ae.jsx)(t,{width:"4rem",height:"4rem",color:o})})},a1=Gl.default.p`
|
|
1186
1186
|
font-size: 1rem;
|
|
1187
1187
|
color: var(--privy-color-foreground-3);
|
|
1188
1188
|
margin-bottom: 1rem;
|
|
1189
1189
|
display: flex;
|
|
1190
1190
|
flex-direction: column;
|
|
1191
1191
|
gap: 1rem;
|
|
1192
|
-
`,
|
|
1192
|
+
`,s1=Gl.default.div`
|
|
1193
1193
|
display: flex;
|
|
1194
1194
|
flex-direction: column;
|
|
1195
1195
|
align-items: center;
|
|
@@ -1197,7 +1197,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1197
1197
|
margin-left: 1.75rem;
|
|
1198
1198
|
margin-right: 1.75rem;
|
|
1199
1199
|
padding: 2rem 0;
|
|
1200
|
-
`;var Xu=require("@heroicons/react/24/outline"),em=x(require("styled-components"));var Tt=require("react/jsx-runtime"),tm=()=>{let{closePrivyModal:e}=R();return(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(S,{},"header"),(0,Tt.jsx)(
|
|
1200
|
+
`;var Xu=require("@heroicons/react/24/outline"),em=x(require("styled-components"));var Tt=require("react/jsx-runtime"),tm=()=>{let{closePrivyModal:e}=R();return(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(S,{},"header"),(0,Tt.jsx)(l1,{children:(0,Tt.jsx)(Xu.ArrowTopRightOnSquareIcon,{style:{width:32,height:32}})}),(0,Tt.jsx)(go,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Tt.jsx)(yo,{children:(0,Tt.jsx)(B,{onClick:()=>e(),children:"Close"})}),(0,Tt.jsx)(Z,{}),(0,Tt.jsx)(G,{protectedByPrivy:!0})]})},l1=em.default.div`
|
|
1201
1201
|
border-radius: 50%;
|
|
1202
1202
|
height: 68px;
|
|
1203
1203
|
width: 68px;
|
|
@@ -1218,7 +1218,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1218
1218
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1219
1219
|
height: 12px;
|
|
1220
1220
|
}
|
|
1221
|
-
`,Xa=({children:e})=>(0,es.jsxs)(
|
|
1221
|
+
`,Xa=({children:e})=>(0,es.jsxs)(c1,{children:[(0,es.jsx)(om,{style:{width:"16px",height:"16px"}}),e]}),c1=Za.default.div`
|
|
1222
1222
|
display: flex;
|
|
1223
1223
|
justify-content: flex-start;
|
|
1224
1224
|
justify-items: center;
|
|
@@ -1236,15 +1236,15 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1236
1236
|
margin-bottom: auto;
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
`;var pe=require("react/jsx-runtime"),
|
|
1239
|
+
`;var pe=require("react/jsx-runtime"),d1=()=>{let{navigate:e}=_(),t="https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en";return nm.isFirefox&&(t="https://addons.mozilla.org/en-US/firefox/addon/phantom-app/"),(0,pe.jsxs)(p1,{children:[(0,pe.jsx)(hi,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,pe.jsx)(Bo,{children:(0,pe.jsx)(po,{style:{width:"152px",height:"152px"}})}),(0,pe.jsxs)(rm,{children:[(0,pe.jsx)(Xa,{children:(0,pe.jsxs)("div",{children:[(0,pe.jsx)("span",{children:"Install the "}),(0,pe.jsx)("a",{href:t,target:"_blank",children:"Phantom browser extension"})]})}),(0,pe.jsx)(Vl,{}),(0,pe.jsx)(Xa,{children:"Set up your first wallet"}),(0,pe.jsx)(Vl,{}),(0,pe.jsx)(Xa,{children:"Store your recovery phrase in a safe place!"})]}),(0,pe.jsx)(La,{onClick:()=>e("LANDING"),children:"Done! I have my wallet"})]})},am=()=>{let{navigateBack:e}=_();return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{backFn:e},"header"),(0,pe.jsx)(Q,{}),(0,pe.jsx)(d1,{}),(0,pe.jsx)(Z,{}),(0,pe.jsxs)(ee,{children:[(0,pe.jsx)("span",{children:"Still not sure? "}),(0,pe.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},p1=(0,im.default)(Bo)`
|
|
1240
1240
|
gap: 30px;
|
|
1241
1241
|
|
|
1242
1242
|
> :first-child > svg {
|
|
1243
1243
|
margin-top: 20px;
|
|
1244
1244
|
}
|
|
1245
|
-
`;var Sm=x(require("@heroicons/react/24/outline/EnvelopeIcon")),_m=x(require("@heroicons/react/24/outline/PhoneIcon")),km=x(require("@heroicons/react/24/outline/UserCircleIcon")),Si=require("react"),Am=x(require("styled-components"));var jo=require("react/jsx-runtime"),sm=({...e})=>(0,jo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,jo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,jo.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,jo.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,jo.jsx)("defs",{children:(0,jo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,jo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var cm=x(require("@heroicons/react/24/outline/EnvelopeIcon")),dm=require("react");var lm=require("@heroicons/react/24/outline"),Gn=require("react"),ts=x(require("styled-components"));var Dt=require("react/jsx-runtime"),os=(0,Gn.forwardRef)((e,t)=>{let[o,r]=(0,Gn.useState)(""),[n,i]=(0,Gn.useState)(!1),[a,s]=(0,Gn.useState)(null),{initLoginWithEmail:l}=R(),{navigate:c}=_(),m=ke(),h=gd(o),w=n,v=n||!h||m.enabled&&m.status==="error",T=()=>{i(!0),l(o).then(()=>{c("AWAITING_PASSWORDLESS_CODE")}).catch(y=>{y?.status===422?s(y.message):y?.privyErrorCode==="allowlist_rejected"?c("ALLOWLIST_REJECTION_SCREEN"):(console.error(y),s("Issue submitting email")),i(!1)})};return(0,Dt.jsxs)(Dt.Fragment,{children:[(0,Dt.jsxs)(
|
|
1245
|
+
`;var Sm=x(require("@heroicons/react/24/outline/EnvelopeIcon")),_m=x(require("@heroicons/react/24/outline/PhoneIcon")),km=x(require("@heroicons/react/24/outline/UserCircleIcon")),Si=require("react"),Am=x(require("styled-components"));var jo=require("react/jsx-runtime"),sm=({...e})=>(0,jo.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,jo.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,jo.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,jo.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,jo.jsx)("defs",{children:(0,jo.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,jo.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var cm=x(require("@heroicons/react/24/outline/EnvelopeIcon")),dm=require("react");var lm=require("@heroicons/react/24/outline"),Gn=require("react"),ts=x(require("styled-components"));var Dt=require("react/jsx-runtime"),os=(0,Gn.forwardRef)((e,t)=>{let[o,r]=(0,Gn.useState)(""),[n,i]=(0,Gn.useState)(!1),[a,s]=(0,Gn.useState)(null),{initLoginWithEmail:l}=R(),{navigate:c}=_(),m=ke(),h=gd(o),w=n,v=n||!h||m.enabled&&m.status==="error",T=()=>{i(!0),l(o).then(()=>{c("AWAITING_PASSWORDLESS_CODE")}).catch(y=>{y?.status===422?s(y.message):y?.privyErrorCode==="allowlist_rejected"?c("ALLOWLIST_REJECTION_SCREEN"):(console.error(y),s("Issue submitting email")),i(!1)})};return(0,Dt.jsxs)(Dt.Fragment,{children:[(0,Dt.jsxs)(u1,{children:[(0,Dt.jsxs)(m1,{children:[(0,Dt.jsx)(lm.EnvelopeIcon,{}),(0,Dt.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:y=>r(y.target.value),onKeyUp:y=>{y.key==="Enter"&&T()},value:o,autoComplete:"email"}),e.stacked?null:(0,Dt.jsx)(Na,{isSubmitting:w,onClick:T,disabled:v,children:"Submit"})]}),a&&(0,Dt.jsx)(f1,{children:a})]}),e.stacked?(0,Dt.jsx)(B,{loadingText:null,loading:w,disabled:v,onClick:T,children:"Submit"}):null]})}),u1=ts.default.div`
|
|
1246
1246
|
width: 100%;
|
|
1247
|
-
`,
|
|
1247
|
+
`,m1=ts.default.label`
|
|
1248
1248
|
display: block;
|
|
1249
1249
|
position: relative;
|
|
1250
1250
|
width: 100%;
|
|
@@ -1302,7 +1302,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1302
1302
|
&& > input::placeholder {
|
|
1303
1303
|
color: var(--privy-color-foreground-3);
|
|
1304
1304
|
}
|
|
1305
|
-
`,
|
|
1305
|
+
`,f1=ts.default.div`
|
|
1306
1306
|
font-size: 13px;
|
|
1307
1307
|
color: var(--privy-color-error);
|
|
1308
1308
|
text-align: left;
|
|
@@ -1312,9 +1312,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1312
1312
|
> a {
|
|
1313
1313
|
text-decoration: underline;
|
|
1314
1314
|
}
|
|
1315
|
-
`;var Eo=require("react/jsx-runtime"),pm=({isEditable:e,setIsEditable:t})=>{let o=(0,dm.useRef)(null);return(0,Eo.jsxs)(Eo.Fragment,{children:[(0,Eo.jsx)(Go,{if:!e,children:(0,Eo.jsx)(os,{ref:o})}),(0,Eo.jsx)(Go,{if:e,children:(0,Eo.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Eo.jsx)(cm.default,{})," Continue with Email"]})})]})};var gm=x(require("@heroicons/react/24/outline/PhoneIcon")),vm=require("react");var Gr=require("react"),is=x(require("styled-components"));var um=x(require("libphonenumber-js/examples.mobile.json")),xt=require("libphonenumber-js/min"),ns=require("react/jsx-runtime");var Ei=(e,t)=>(0,xt.isPossiblePhoneNumber)(String(e),t),rs=(e,t)=>`+${(0,xt.getCountryCallingCode)(t)} ${e}`,mm=e=>`*${e.replaceAll("-","").slice(-4)}`,fm=e=>new xt.AsYouType(e),
|
|
1315
|
+
`;var Eo=require("react/jsx-runtime"),pm=({isEditable:e,setIsEditable:t})=>{let o=(0,dm.useRef)(null);return(0,Eo.jsxs)(Eo.Fragment,{children:[(0,Eo.jsx)(Go,{if:!e,children:(0,Eo.jsx)(os,{ref:o})}),(0,Eo.jsx)(Go,{if:e,children:(0,Eo.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Eo.jsx)(cm.default,{})," Continue with Email"]})})]})};var gm=x(require("@heroicons/react/24/outline/PhoneIcon")),vm=require("react");var Gr=require("react"),is=x(require("styled-components"));var um=x(require("libphonenumber-js/examples.mobile.json")),xt=require("libphonenumber-js/min"),ns=require("react/jsx-runtime");var Ei=(e,t)=>(0,xt.isPossiblePhoneNumber)(String(e),t),rs=(e,t)=>`+${(0,xt.getCountryCallingCode)(t)} ${e}`,mm=e=>`*${e.replaceAll("-","").slice(-4)}`,fm=e=>new xt.AsYouType(e),h1=(0,xt.getCountries)().map(e=>({code:e,callCode:(0,xt.getCountryCallingCode)(e)})),hm=e=>(0,xt.getExampleNumber)(e,um.default)?.formatNational(),ym=({value:e,onChange:t})=>(0,ns.jsx)("select",{value:e,onChange:t,children:h1.map(o=>(0,ns.jsxs)("option",{value:o.code,children:[o.code," +",o.callCode]},o.code))});var Ut=require("react/jsx-runtime"),zn=(0,Gr.forwardRef)((e,t)=>{let{navigate:o,app:r}=_(),n=ke(),[i,a]=(0,Gr.useState)(""),[s,l]=(0,Gr.useState)(r?.intl.defaultCountry??"US"),[c,m]=(0,Gr.useState)(!1),[h,w]=(0,Gr.useState)(null),v=Ei(i,s),T=fm(s),y=hm(s),E=(0,xt.getCountryCallingCode)(s),b=c,M=c||!v||n.enabled&&n.status==="error",L=E.length,O=I=>{let F=I.target.value;l(F),a(""),e.onChange&&e.onChange({rawPhoneNumber:i,qualifiedPhoneNumber:rs(i,F),countryCode:F,isValid:Ei(i,s)})},W=I=>{try{let F=I.replace(/\D/g,""),Y=i.replace(/\D/g,""),$=F===Y?I:T.input(I);a($),e.onChange&&e.onChange({rawPhoneNumber:$,qualifiedPhoneNumber:rs(I,s),countryCode:s,isValid:Ei(I,s)})}catch(F){console.error("Error processing phone number:",F)}},A=async()=>{let I=n.status==="success"?n.token:void 0;m(!0);try{let F=rs(i,s);await e.onSubmit({rawPhoneNumber:i,qualifiedPhoneNumber:F,countryCode:s,isValid:Ei(i,s),captchaToken:I})}catch(F){let Y=F;Y?.status===422||F.type==="twilio_verification_failed"?w(Y.message):Y?.privyErrorCode==="allowlist_rejected"?o("ALLOWLIST_REJECTION_SCREEN"):(console.error(F),w("Issue submitting phone number"))}finally{m(!1)}};return(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsxs)(y1,{children:[(0,Ut.jsxs)(g1,{callingCodeLength:L,children:[(0,Ut.jsx)(ym,{value:s,onChange:O}),(0,Ut.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:y,onChange:I=>{W(I.target.value)},onKeyUp:I=>{I.key==="Enter"&&A()},value:i,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,Ut.jsx)(Na,{isSubmitting:b,onClick:A,disabled:M,children:"Submit"}):null]}),h&&(0,Ut.jsx)(v1,{children:h})]}),e.stacked&&!e.noIncludeSubmitButton?(0,Ut.jsx)(B,{loading:b,loadingText:null,onClick:A,disabled:M,children:"Submit"}):null]})}),y1=is.default.div`
|
|
1316
1316
|
width: 100%;
|
|
1317
|
-
`,
|
|
1317
|
+
`,g1=is.default.label`
|
|
1318
1318
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
1319
1319
|
--phone-input-extra-padding-left: calc(12px + calc(3 * ${e=>e.callingCodeLength}px));
|
|
1320
1320
|
display: block;
|
|
@@ -1400,7 +1400,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1400
1400
|
&& > input::placeholder {
|
|
1401
1401
|
color: var(--privy-color-foreground-3);
|
|
1402
1402
|
}
|
|
1403
|
-
`,
|
|
1403
|
+
`,v1=is.default.div`
|
|
1404
1404
|
font-size: 13px;
|
|
1405
1405
|
color: var(--privy-color-error);
|
|
1406
1406
|
text-align: left;
|
|
@@ -1410,13 +1410,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1410
1410
|
> a {
|
|
1411
1411
|
text-decoration: underline;
|
|
1412
1412
|
}
|
|
1413
|
-
`;var Po=require("react/jsx-runtime"),wm=({isEditable:e,setIsEditable:t})=>{let o=(0,vm.useRef)(null),{navigate:r}=_(),{initLoginWithSms:n}=R();async function i({qualifiedPhoneNumber:a}){await n(a),r("AWAITING_PASSWORDLESS_CODE")}return(0,Po.jsxs)(Po.Fragment,{children:[(0,Po.jsx)(Go,{if:!e,children:(0,Po.jsx)(zn,{ref:o,onSubmit:i})}),(0,Po.jsx)(Go,{if:e,children:(0,Po.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Po.jsx)(gm.default,{})," Continue with SMS"]})})]})};var ql=require("react"),Cm=x(require("styled-components"));var Pi=require("react/jsx-runtime"),as=({style:e,...t})=>(0,Pi.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,Pi.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,Pi.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var gr=require("react/jsx-runtime"),ss=({style:e,...t})=>(0,gr.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,gr.jsx)("g",{clipPath:"url(#clip0)",children:(0,gr.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,gr.jsx)("defs",{children:(0,gr.jsx)("clipPath",{id:"clip0",children:(0,gr.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var $l=require("react/jsx-runtime"),ls=({style:e,...t})=>(0,$l.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,$l.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});var zr=require("react/jsx-runtime"),cs=({style:e,...t})=>(0,zr.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,zr.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,zr.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,zr.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,zr.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var Ti=require("react/jsx-runtime");function ds({style:e,...t}){return(0,Ti.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,Ti.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Ti.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Ti.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var Vn=require("react/jsx-runtime");function ps(e){return(0,Vn.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,Vn.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,Vn.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,Vn.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"currentColor"})]})}var jl=require("react/jsx-runtime"),us=({style:e,...t})=>(0,jl.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,jl.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156 ",fill:"currentColor"})});var St=require("react/jsx-runtime"),
|
|
1413
|
+
`;var Po=require("react/jsx-runtime"),wm=({isEditable:e,setIsEditable:t})=>{let o=(0,vm.useRef)(null),{navigate:r}=_(),{initLoginWithSms:n}=R();async function i({qualifiedPhoneNumber:a}){await n(a),r("AWAITING_PASSWORDLESS_CODE")}return(0,Po.jsxs)(Po.Fragment,{children:[(0,Po.jsx)(Go,{if:!e,children:(0,Po.jsx)(zn,{ref:o,onSubmit:i})}),(0,Po.jsx)(Go,{if:e,children:(0,Po.jsxs)(We,{onClick:()=>{t(),setTimeout(()=>{o.current?.focus()},0)},children:[(0,Po.jsx)(gm.default,{})," Continue with SMS"]})})]})};var ql=require("react"),Cm=x(require("styled-components"));var Pi=require("react/jsx-runtime"),as=({style:e,...t})=>(0,Pi.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 24 24",style:{height:"24px",...e},...t,children:[(0,Pi.jsx)("path",{d:"M17.0722 11.6888C17.0471 8.90571 19.3263 7.56847 19.429 7.50274C18.1466 5.60938 16.153 5.35154 15.4417 5.3212C13.7461 5.14678 12.1306 6.32982 11.269 6.32982C10.4074 6.32982 9.08004 5.34648 7.67246 5.37429C5.82158 5.40209 4.11595 6.45874 3.16171 8.13218C1.24068 11.4942 2.6708 16.4817 4.54423 19.2143C5.46091 20.549 6.55041 22.0531 7.98554 21.9975C9.36803 21.9419 9.88905 21.095 11.5571 21.095C13.2251 21.095 13.696 21.9975 15.1537 21.9697C16.6389 21.9393 17.5806 20.6046 18.4897 19.2648C19.5392 17.7153 19.9725 16.2137 19.9975 16.1354C19.965 16.1228 17.1022 15.0155 17.0722 11.6888Z",fill:"currentColor"}),(0,Pi.jsx)("path",{d:"M14.3295 3.51373C15.0909 2.58347 15.6043 1.28921 15.4641 0C14.3671 0.0455014 13.0396 0.738135 12.2532 1.66838C11.5494 2.48994 10.9307 3.80695 11.0986 5.07089C12.3183 5.16694 13.5681 4.44145 14.3295 3.51373Z",fill:"currentColor"})]});var gr=require("react/jsx-runtime"),ss=({style:e,...t})=>(0,gr.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 71 55",style:{height:"24px",...e},...t,children:[(0,gr.jsx)("g",{clipPath:"url(#clip0)",children:(0,gr.jsx)("path",{d:"M60.1045 4.8978C55.5792 2.8214 50.7265 1.2916 45.6527 0.41542C45.5603 0.39851 45.468 0.440769 45.4204 0.525289C44.7963 1.6353 44.105 3.0834 43.6209 4.2216C38.1637 3.4046 32.7345 3.4046 27.3892 4.2216C26.905 3.0581 26.1886 1.6353 25.5617 0.525289C25.5141 0.443589 25.4218 0.40133 25.3294 0.41542C20.2584 1.2888 15.4057 2.8186 10.8776 4.8978C10.8384 4.9147 10.8048 4.9429 10.7825 4.9795C1.57795 18.7309 -0.943561 32.1443 0.293408 45.3914C0.299005 45.4562 0.335386 45.5182 0.385761 45.5576C6.45866 50.0174 12.3413 52.7249 18.1147 54.5195C18.2071 54.5477 18.305 54.5139 18.3638 54.4378C19.7295 52.5728 20.9469 50.6063 21.9907 48.5383C22.0523 48.4172 21.9935 48.2735 21.8676 48.2256C19.9366 47.4931 18.0979 46.6 16.3292 45.5858C16.1893 45.5041 16.1781 45.304 16.3068 45.2082C16.679 44.9293 17.0513 44.6391 17.4067 44.3461C17.471 44.2926 17.5606 44.2813 17.6362 44.3151C29.2558 49.6202 41.8354 49.6202 53.3179 44.3151C53.3935 44.2785 53.4831 44.2898 53.5502 44.3433C53.9057 44.6363 54.2779 44.9293 54.6529 45.2082C54.7816 45.304 54.7732 45.5041 54.6333 45.5858C52.8646 46.6197 51.0259 47.4931 49.0921 48.2228C48.9662 48.2707 48.9102 48.4172 48.9718 48.5383C50.038 50.6034 51.2554 52.5699 52.5959 54.435C52.6519 54.5139 52.7526 54.5477 52.845 54.5195C58.6464 52.7249 64.529 50.0174 70.6019 45.5576C70.6551 45.5182 70.6887 45.459 70.6943 45.3942C72.1747 30.0791 68.2147 16.7757 60.1968 4.9823C60.1772 4.9429 60.1437 4.9147 60.1045 4.8978ZM23.7259 37.3253C20.2276 37.3253 17.3451 34.1136 17.3451 30.1693C17.3451 26.225 20.1717 23.0133 23.7259 23.0133C27.308 23.0133 30.1626 26.2532 30.1066 30.1693C30.1066 34.1136 27.28 37.3253 23.7259 37.3253ZM47.3178 37.3253C43.8196 37.3253 40.9371 34.1136 40.9371 30.1693C40.9371 26.225 43.7636 23.0133 47.3178 23.0133C50.9 23.0133 53.7545 26.2532 53.6986 30.1693C53.6986 34.1136 50.9 37.3253 47.3178 37.3253Z",fill:"#5865F2"})}),(0,gr.jsx)("defs",{children:(0,gr.jsx)("clipPath",{id:"clip0",children:(0,gr.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var $l=require("react/jsx-runtime"),ls=({style:e,...t})=>(0,$l.jsx)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"24",y:"24",viewBox:"0 0 98 96",style:{height:"24px",...e},...t,children:(0,$l.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"currentColor"})});var zr=require("react/jsx-runtime"),cs=({style:e,...t})=>(0,zr.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,zr.jsx)("path",{d:"M22.56 12.25C22.56 11.47 22.49 10.72 22.36 10H12V14.255H17.92C17.665 15.63 16.89 16.795 15.725 17.575V20.335H19.28C21.36 18.42 22.56 15.6 22.56 12.25Z",fill:"#4285F4"}),(0,zr.jsx)("path",{d:"M12 23C14.97 23 17.46 22.015 19.28 20.335L15.725 17.575C14.74 18.235 13.48 18.625 12 18.625C9.13504 18.625 6.71004 16.69 5.84504 14.09H2.17004V16.94C3.98004 20.535 7.70004 23 12 23Z",fill:"#34A853"}),(0,zr.jsx)("path",{d:"M5.845 14.09C5.625 13.43 5.5 12.725 5.5 12C5.5 11.275 5.625 10.57 5.845 9.91V7.06H2.17C1.4 8.59286 0.999321 10.2846 1 12C1 13.775 1.425 15.455 2.17 16.94L5.845 14.09Z",fill:"#FBBC05"}),(0,zr.jsx)("path",{d:"M12 5.375C13.615 5.375 15.065 5.93 16.205 7.02L19.36 3.865C17.455 2.09 14.965 1 12 1C7.70004 1 3.98004 3.465 2.17004 7.06L5.84504 9.91C6.71004 7.31 9.13504 5.375 12 5.375Z",fill:"#EA4335"})]});var Ti=require("react/jsx-runtime");function ds({style:e,...t}){return(0,Ti.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,Ti.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,Ti.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,Ti.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var Vn=require("react/jsx-runtime");function ps(e){return(0,Vn.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,Vn.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,Vn.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,Vn.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"currentColor"})]})}var jl=require("react/jsx-runtime"),us=({style:e,...t})=>(0,jl.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,jl.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156 ",fill:"currentColor"})});var St=require("react/jsx-runtime"),w1={apple:{logo:(0,St.jsx)(as,{}),displayName:"Apple"},discord:{logo:(0,St.jsx)(ss,{}),displayName:"Discord"},github:{logo:(0,St.jsx)(ls,{}),displayName:"GitHub"},google:{logo:(0,St.jsx)(cs,{}),displayName:"Google"},linkedin:{logo:(0,St.jsx)(ds,{}),displayName:"LinkedIn"},twitter:{logo:(0,St.jsx)(us,{}),displayName:"Twitter"},tiktok:{logo:(0,St.jsx)(ps,{}),displayName:"TikTok"}},vr=({provider:e})=>{let[t,o]=(0,ql.useState)(!1),[r,n]=(0,ql.useState)(!1),{status:i}=ke(),{initLoginWithOAuth:a}=R(),{displayName:s,logo:l}=w1[e];return(0,St.jsxs)(C1,{onClick:async()=>{o(!0),n(!1);try{await a(e)}catch(h){console.error(h),n(!0),setTimeout(()=>{n(!1)},1e3)}finally{o(!1)}},disabled:t||i==="error"||r,children:[l,(0,St.jsx)("span",{children:s}),t?(0,St.jsx)(Uo,{}):(0,St.jsx)("span",{})]})},C1=(0,Cm.default)(We)`
|
|
1414
1414
|
span:last-child {
|
|
1415
1415
|
margin-left: auto;
|
|
1416
1416
|
}
|
|
1417
|
-
`;var bm=x(require("@heroicons/react/24/outline/ChevronRightIcon")),Em=x(require("@heroicons/react/24/outline/WalletIcon"));var $n=require("react/jsx-runtime"),Pm=({onClick:e,text:t})=>(0,$n.jsxs)(We,{onClick:e,children:[(0,$n.jsx)(Em.default,{}),(0,$n.jsx)(Ga,{children:t}),(0,$n.jsx)(bm.default,{})]});var Tm=x(require("@heroicons/react/24/outline/ChevronRightIcon"));var xi=require("react/jsx-runtime"),xm=({onClick:e,text:t,icon:o})=>(0,xi.jsxs)(We,{onClick:e,children:[o,(0,xi.jsx)(Ga,{children:t}),(0,xi.jsx)(Tm.default,{})]});var q=require("react/jsx-runtime"),Rm=()=>{let{closePrivyModal:e,connectors:t}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=_(),{email:n,sms:i,google:a,twitter:s,discord:l,github:c,tiktok:m,linkedin:h,apple:w,wallet:v}=o?.loginMethods??{},T=o?.appearance.loginGroupPriority||"web2-first",y=o?.appearance.hideDirectWeb2Inputs,[E,b]=(0,Si.useState)("default"),[M,L]=(0,Si.useState)(n?"email":"sms");(0,Si.useEffect)(()=>{L(n?"email":"sms")},[n]);let O=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{b("default")},150)};r.current=O;let W=[n&&(0,q.jsx)(pm,{isEditable:M==="email",setIsEditable:()=>{L("email")}}),i&&(0,q.jsx)(wm,{isEditable:M==="sms",setIsEditable:()=>{L("sms")}})].filter(Boolean),A=[a&&(0,q.jsx)(vr,{provider:"google"}),s&&(0,q.jsx)(vr,{provider:"twitter"}),l&&(0,q.jsx)(vr,{provider:"discord"}),c&&(0,q.jsx)(vr,{provider:"github"}),m&&(0,q.jsx)(vr,{provider:"tiktok"}),h&&(0,q.jsx)(vr,{provider:"linkedin"}),w&&(0,q.jsx)(vr,{provider:"apple"})].filter(Boolean),I=Rl(o?.appearance.walletList??[],t,!1),F=E==="default"?void 0:()=>{b("default")},Y=
|
|
1417
|
+
`;var bm=x(require("@heroicons/react/24/outline/ChevronRightIcon")),Em=x(require("@heroicons/react/24/outline/WalletIcon"));var $n=require("react/jsx-runtime"),Pm=({onClick:e,text:t})=>(0,$n.jsxs)(We,{onClick:e,children:[(0,$n.jsx)(Em.default,{}),(0,$n.jsx)(Ga,{children:t}),(0,$n.jsx)(bm.default,{})]});var Tm=x(require("@heroicons/react/24/outline/ChevronRightIcon"));var xi=require("react/jsx-runtime"),xm=({onClick:e,text:t,icon:o})=>(0,xi.jsxs)(We,{onClick:e,children:[o,(0,xi.jsx)(Ga,{children:t}),(0,xi.jsx)(Tm.default,{})]});var q=require("react/jsx-runtime"),Rm=()=>{let{closePrivyModal:e,connectors:t}=R(),{app:o,onUserCloseViaDialogOrKeybindRef:r}=_(),{email:n,sms:i,google:a,twitter:s,discord:l,github:c,tiktok:m,linkedin:h,apple:w,wallet:v}=o?.loginMethods??{},T=o?.appearance.loginGroupPriority||"web2-first",y=o?.appearance.hideDirectWeb2Inputs,[E,b]=(0,Si.useState)("default"),[M,L]=(0,Si.useState)(n?"email":"sms");(0,Si.useEffect)(()=>{L(n?"email":"sms")},[n]);let O=()=>{e({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{b("default")},150)};r.current=O;let W=[n&&(0,q.jsx)(pm,{isEditable:M==="email",setIsEditable:()=>{L("email")}}),i&&(0,q.jsx)(wm,{isEditable:M==="sms",setIsEditable:()=>{L("sms")}})].filter(Boolean),A=[a&&(0,q.jsx)(vr,{provider:"google"}),s&&(0,q.jsx)(vr,{provider:"twitter"}),l&&(0,q.jsx)(vr,{provider:"discord"}),c&&(0,q.jsx)(vr,{provider:"github"}),m&&(0,q.jsx)(vr,{provider:"tiktok"}),h&&(0,q.jsx)(vr,{provider:"linkedin"}),w&&(0,q.jsx)(vr,{provider:"apple"})].filter(Boolean),I=Rl(o?.appearance.walletList??[],t,!1),F=E==="default"?void 0:()=>{b("default")},Y=E1({priority:T,email:n,sms:i,social:A}),$=P1({priority:T,email:n,sms:i,social:A}),k=T1({priority:T,email:n,sms:i,social:A}),X=(0,q.jsx)(Pm,{text:k,onClick:()=>b("web3-overflow")}),be=(0,q.jsx)(xm,{text:Y,icon:$,onClick:()=>b("web2-overflow")}),Le=y?0:1;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(S,{title:"Log in or Sign Up",onClose:O,backFn:F}),E==="default"&&(0,q.jsx)(b1,{}),(0,q.jsxs)(kp,{style:{overflow:"hidden",padding:2},children:[(0,q.jsx)(bo,{}),(0,q.jsxs)(cr,{children:[E==="default"&&T==="web2-first"&&(0,q.jsxs)(q.Fragment,{children:[...W,...A.length+W.length>4?A.slice(0,3-W.length):A,W.length+A.length>4&&be,v&&X]}),E==="default"&&T==="web3-first"&&(0,q.jsxs)(q.Fragment,{children:[v&&(0,q.jsxs)(q.Fragment,{children:[...I.length>4?I.slice(0,3):I,I.length>4&&X]}),W.length+A.length>Le&&be,W.length+A.length===Le&&W.length?W[0]:null,W.length+A.length===Le&&A.length?A[0]:null]}),E==="web2-overflow"&&(0,q.jsxs)(q.Fragment,{children:[...T==="web3-first"?W:[],...A]}),...E==="web3-overflow"?I:[]]})]}),o&&(0,q.jsx)(Fa,{app:o}),(0,q.jsx)(G,{protectedByPrivy:!0})]})},b1=(0,Am.default)(za)`
|
|
1418
1418
|
margin-bottom: 16px;
|
|
1419
|
-
`,
|
|
1419
|
+
`,E1=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"?"Other socials":t&&o&&r.length>0||t&&r.length>0?"Log in with email or socials":o&&r.length>0?"Log in with sms or socials":t&&o?"Continue with email or sms":t?"Continue with email":o?"Continue with sms":"Log in with a social account",P1=({priority:e,email:t,sms:o,social:r})=>e==="web2-first"||r.length>0?(0,q.jsx)(km.default,{}):t&&o?(0,q.jsx)(sm,{}):t?(0,q.jsx)(Sm.default,{}):o?(0,q.jsx)(_m.default,{}):null,T1=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Im=require("@heroicons/react/24/outline");var ht=require("react/jsx-runtime"),Wm=()=>{let{app:e}=_();return(0,ht.jsxs)(ht.Fragment,{children:[(0,ht.jsx)(S,{},"header"),(0,ht.jsx)(Q,{}),(0,ht.jsx)(Ie,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,ht.jsx)(Im.EnvelopeIcon,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,ht.jsxs)(yo,{children:[(0,ht.jsx)(bo,{}),(0,ht.jsx)(os,{stacked:!0})]}),(0,ht.jsx)(Z,{}),(0,ht.jsx)(G,{protectedByPrivy:!0})]})};var Mm=require("@heroicons/react/24/outline");var yt=require("react/jsx-runtime"),Lm=()=>{let{app:e,navigate:t}=_(),{initLoginWithSms:o}=R();async function r({qualifiedPhoneNumber:n}){await o(n),t("AWAITING_PASSWORDLESS_CODE")}return(0,yt.jsxs)(yt.Fragment,{children:[(0,yt.jsx)(S,{},"header"),(0,yt.jsx)(Q,{}),(0,yt.jsx)(Ie,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,yt.jsx)(Mm.PhoneIcon,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,yt.jsxs)(yo,{children:[(0,yt.jsx)(bo,{}),(0,yt.jsx)(zn,{stacked:!0,onSubmit:r})]}),(0,yt.jsx)(Z,{}),(0,yt.jsx)(G,{protectedByPrivy:!0})]})};var io=require("react/jsx-runtime"),Nm=()=>{let{linkingHint:e}=R(),{app:t}=_(),o=e?`Select the wallet with ${or(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,io.jsxs)(io.Fragment,{children:[(0,io.jsx)(S,{},"header"),(0,io.jsx)(go,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),(0,io.jsx)(bo,{}),(0,io.jsx)(cr,{children:(0,io.jsx)(xn,{connectOnly:!1})}),(0,io.jsx)(G,{protectedByPrivy:!0})]})};var _i=require("react/jsx-runtime"),Om=({style:e,...t})=>(0,_i.jsxs)("svg",{width:"164",height:"164",viewBox:"0 0 164 164",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:[(0,_i.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,_i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var gt=require("react/jsx-runtime"),Dm=()=>{let{closePrivyModal:e}=R(),{navigate:t}=_();return(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsx)(S,{},"header"),(0,gt.jsx)(Q,{}),(0,gt.jsx)(Om,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,gt.jsx)(go,{title:"Could not connect with wallet",description:"Please check that Phantom multichain is enabled and try again.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,gt.jsxs)(yo,{children:[(0,gt.jsx)(B,{onClick:()=>t("LANDING"),children:"Try again"}),(0,gt.jsx)(Fo,{onClick:()=>e(),children:"Cancel"})]}),(0,gt.jsx)(Z,{}),(0,gt.jsx)(G,{protectedByPrivy:!0})]})};var rc=require("@heroicons/react/20/solid"),Ko=require("@heroicons/react/24/outline"),xo=require("@heroicons/react/24/solid"),bs=require("@heroicons/react/24/solid"),Es=require("@heroicons/react/24/solid"),kt=require("react");var Fm=require("react"),Bm=x(require("styled-components"));var Kl=require("react/jsx-runtime"),ms=({style:e,color:t,...o})=>(0,Kl.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...o,children:(0,Kl.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var fs=require("react/jsx-runtime"),Um=({color:e,...t})=>(0,fs.jsx)("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 115.77 122.88",xmlSpace:"preserve",...t,children:(0,fs.jsx)("g",{children:(0,fs.jsx)("path",{fill:e||"currentColor",className:"st0",d:"M89.62,13.96v7.73h12.19h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02v0.02 v73.27v0.01h-0.02c-0.01,3.84-1.57,7.33-4.1,9.86c-2.51,2.5-5.98,4.06-9.82,4.07v0.02h-0.02h-61.7H40.1v-0.02 c-3.84-0.01-7.34-1.57-9.86-4.1c-2.5-2.51-4.06-5.98-4.07-9.82h-0.02v-0.02V92.51H13.96h-0.01v-0.02c-3.84-0.01-7.34-1.57-9.86-4.1 c-2.5-2.51-4.06-5.98-4.07-9.82H0v-0.02V13.96v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07V0h0.02h61.7 h0.01v0.02c3.85,0.01,7.34,1.57,9.86,4.1c2.5,2.51,4.06,5.98,4.07,9.82h0.02V13.96L89.62,13.96z M79.04,21.69v-7.73v-0.02h0.02 c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v64.59v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h12.19V35.65 v-0.01h0.02c0.01-3.85,1.58-7.34,4.1-9.86c2.51-2.5,5.98-4.06,9.82-4.07v-0.02h0.02H79.04L79.04,21.69z M105.18,108.92V35.65v-0.02 h0.02c0-0.91-0.39-1.75-1.01-2.37c-0.61-0.61-1.46-1-2.37-1v0.02h-0.01h-61.7h-0.02v-0.02c-0.91,0-1.75,0.39-2.37,1.01 c-0.61,0.61-1,1.46-1,2.37h0.02v0.01v73.27v0.02h-0.02c0,0.91,0.39,1.75,1.01,2.37c0.61,0.61,1.46,1,2.37,1v-0.02h0.01h61.7h0.02 v0.02c0.91,0,1.75-0.39,2.37-1.01c0.61-0.61,1-1.46,1-2.37h-0.02V108.92L105.18,108.92z"})})});var ki=require("react/jsx-runtime"),Hm=e=>{let[t,o]=(0,Fm.useState)(!1);return(0,ki.jsxs)(x1,{onClick:()=>{o(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>o(!1),1500)},justCopied:t,children:[t?(0,ki.jsx)(ms,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,ki.jsx)(Um,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},x1=Bm.default.button`
|
|
1420
1420
|
display: flex;
|
|
1421
1421
|
align-items: center;
|
|
1422
1422
|
gap: 6px;
|
|
@@ -1454,7 +1454,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1454
1454
|
width: 14px;
|
|
1455
1455
|
height: 14px;
|
|
1456
1456
|
}
|
|
1457
|
-
`;var ys=require("react"),$m=require("react-device-detect"),Jl=x(require("styled-components"));var Vr=require("@headlessui/react"),hs=x(require("react")),$r=x(require("styled-components")),qo=require("react/jsx-runtime"),Gm=({children:e,open:t,onClick:o,...r})=>(0,qo.jsx)(Vr.Transition,{show:t,as:hs.default.Fragment,children:(0,qo.jsxs)(Vr.Dialog,{onClose:o,...r,as:
|
|
1457
|
+
`;var ys=require("react"),$m=require("react-device-detect"),Jl=x(require("styled-components"));var Vr=require("@headlessui/react"),hs=x(require("react")),$r=x(require("styled-components")),qo=require("react/jsx-runtime"),Gm=({children:e,open:t,onClick:o,...r})=>(0,qo.jsx)(Vr.Transition,{show:t,as:hs.default.Fragment,children:(0,qo.jsxs)(Vr.Dialog,{onClose:o,...r,as:_1,children:[(0,qo.jsx)(Vr.Transition.Child,{as:hs.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,qo.jsx)(S1,{"aria-hidden":"true"})}),(0,qo.jsx)(k1,{children:(0,qo.jsx)(Vr.Transition.Child,{as:hs.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,qo.jsx)(Vr.Dialog.Panel,{as:A1,children:e})})})]})}),jn=$r.default.div`
|
|
1458
1458
|
display: flex;
|
|
1459
1459
|
flex-direction: column;
|
|
1460
1460
|
text-align: center;
|
|
@@ -1477,7 +1477,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1477
1477
|
box-shadow: 0px 8px 36px rgba(55, 65, 81, 0.15);
|
|
1478
1478
|
border-radius: var(--privy-border-radius-lg);
|
|
1479
1479
|
}
|
|
1480
|
-
`,
|
|
1480
|
+
`,S1=$r.default.div`
|
|
1481
1481
|
position: fixed;
|
|
1482
1482
|
inset: 0;
|
|
1483
1483
|
|
|
@@ -1490,10 +1490,10 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1490
1490
|
backdrop-filter: unset;
|
|
1491
1491
|
-webkit-backdrop-filter: unset;
|
|
1492
1492
|
}
|
|
1493
|
-
`,
|
|
1493
|
+
`,_1=$r.default.div`
|
|
1494
1494
|
position: relative;
|
|
1495
1495
|
z-index: 999999;
|
|
1496
|
-
`,
|
|
1496
|
+
`,k1=$r.default.div`
|
|
1497
1497
|
position: fixed;
|
|
1498
1498
|
inset: 0;
|
|
1499
1499
|
display: flex;
|
|
@@ -1501,7 +1501,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1501
1501
|
justify-content: center;
|
|
1502
1502
|
width: 100vw;
|
|
1503
1503
|
min-height: 100vh;
|
|
1504
|
-
`,
|
|
1504
|
+
`,A1=$r.default.div`
|
|
1505
1505
|
// reset some default dialog styles
|
|
1506
1506
|
padding: 0;
|
|
1507
1507
|
background: transparent;
|
|
@@ -1554,7 +1554,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1554
1554
|
align-items: center;
|
|
1555
1555
|
justify-content: center;
|
|
1556
1556
|
height: 100%;
|
|
1557
|
-
`;var To=require("react/jsx-runtime"),Ai=6,
|
|
1557
|
+
`;var To=require("react/jsx-runtime"),Ai=6,R1=new Array(Ai).fill("");function I1(e){return e.replace(/\s+/g,"")}function Yl(e){return/^[0-9]{1}$/.test(e)}function Vm(e){return e.length===Ai&&e.every(Yl)}function W1(e,t){return e.reduce((o,r)=>o+Number(t(r)),0)}var qn=({onChange:e,disabled:t,errorReasonOverride:o,success:r})=>{let[n,i]=(0,ys.useState)(R1),[a,s]=(0,ys.useState)(null),[l,c]=(0,ys.useState)(null),m=async T=>{T.preventDefault();let y=I1(T.currentTarget.value);if(y==="")return;let E=W1(n,Yl),b=y.split(""),M=!b.every(Yl),L=b.length+E>Ai;if(M){s("Passcode can only be numbers"),c(1);return}if(L){s("Passcode must be exactly 6 numbers"),c(1);return}s(null),c(null);let O=Number(T.currentTarget.name?.charAt(4)),W=[...y||[""]].slice(0,Ai-O),A=[...n.slice(0,O),...W,...n.slice(O+W.length)];i(A);let I=W.length,F=Math.min(Math.max(O+I,0),Ai-1);if(document.querySelector(`input[name=pin-${F}]`)?.focus(),Vm(A))try{await e(A.join("")),document.querySelector(`input[name=pin-${F}]`)?.blur()}catch($){c(1),s($.message)}else try{await e(null)}catch($){c(1),s($.message)}},h=T=>{l===1&&(s(null),c(null));let y=[...n.slice(0,T),"",...n.slice(T+1)];i(y),T>0&&document.querySelector(`input[name=pin-${T-1}]`)?.focus(),Vm(y)?e(y.join("")):e(null)},v=r?"success":!!(o||a)?"fail":"";return(0,To.jsx)(To.Fragment,{children:(0,To.jsxs)(M1,{children:[(0,To.jsx)("div",{children:n.map((T,y)=>(0,To.jsx)("input",{name:`pin-${y}`,type:"text",value:n[y],onChange:m,onKeyUp:E=>{E.key==="Backspace"&&h(y)},inputMode:"numeric",autoFocus:y===0,pattern:"[0-9]",className:v,autoComplete:$m.isMobile?"one-time-code":"off",disabled:t},y))}),(0,To.jsx)("div",{children:(0,To.jsx)(L1,{fail:!!o||!!a,children:o||a})})]})})},M1=Jl.default.div`
|
|
1558
1558
|
display: flex;
|
|
1559
1559
|
flex-direction: column;
|
|
1560
1560
|
width: 100%;
|
|
@@ -1625,7 +1625,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1625
1625
|
transform: translate(1px, 0px);
|
|
1626
1626
|
}
|
|
1627
1627
|
}
|
|
1628
|
-
`,
|
|
1628
|
+
`,L1=Jl.default.div`
|
|
1629
1629
|
line-height: 20px;
|
|
1630
1630
|
font-size: 13px;
|
|
1631
1631
|
display: flex;
|
|
@@ -1633,7 +1633,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1633
1633
|
width: 100%;
|
|
1634
1634
|
|
|
1635
1635
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
1636
|
-
`;var jm=require("react");function jr(){let{promptMfa:e,init:t,submit:o,cancel:r}=(0,jm.useContext)(Re);return{promptMfa:e,init:t,submit:o,cancel:r}}var qm=require("react");function Kn(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenroll:n,enrollInMfa:i}=(0,qm.useContext)(Re);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}var Km=x(require("styled-components")),Ri=require("react/jsx-runtime"),Ym=e=>(0,Ri.jsxs)(
|
|
1636
|
+
`;var jm=require("react");function jr(){let{promptMfa:e,init:t,submit:o,cancel:r}=(0,jm.useContext)(Re);return{promptMfa:e,init:t,submit:o,cancel:r}}var qm=require("react");function Kn(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenroll:n,enrollInMfa:i}=(0,qm.useContext)(Re);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:r,unenrollWithSms:()=>n("sms"),unenrollWithTotp:()=>n("totp"),showMfaEnrollmentModal:()=>i(!0),closeMfaEnrollmentModal:()=>i(!1)}}var Km=x(require("styled-components")),Ri=require("react/jsx-runtime"),Ym=e=>(0,Ri.jsxs)(N1,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,Ri.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,Ri.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),N1=Km.default.svg`
|
|
1637
1637
|
height: 90px;
|
|
1638
1638
|
width: 90px;
|
|
1639
1639
|
|
|
@@ -1644,7 +1644,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1644
1644
|
> path {
|
|
1645
1645
|
fill: white;
|
|
1646
1646
|
}
|
|
1647
|
-
`;var of=require("@heroicons/react/24/solid");var Zm=x(require("qrcode")),Xm=x(require("react")),ef=x(require("styled-components"));var Ql=require("react/jsx-runtime"),Jm=()=>(0,Ql.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Ql.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var ue=require("react/jsx-runtime"),_t=7,Zl=(e,t,o,r,n)=>{for(let i=t;i<t+r;i++)for(let a=o;a<o+n;a++){let s=e?.[a];s&&s[i]&&(s[i]=0)}return e},
|
|
1647
|
+
`;var of=require("@heroicons/react/24/solid");var Zm=x(require("qrcode")),Xm=x(require("react")),ef=x(require("styled-components"));var Ql=require("react/jsx-runtime"),Jm=()=>(0,Ql.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Ql.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var ue=require("react/jsx-runtime"),_t=7,Zl=(e,t,o,r,n)=>{for(let i=t;i<t+r;i++)for(let a=o;a<o+n;a++){let s=e?.[a];s&&s[i]&&(s[i]=0)}return e},O1=e=>{let t=Zm.default.create(e,{errorCorrectionLevel:"high"}).modules,o=vd(Array.from(t.data),t.size);return o=Zl(o,0,0,_t,_t),o=Zl(o,o.length-_t,0,_t,_t),o=Zl(o,0,o.length-_t,_t,_t),o},D1=({x:e,y:t,cellSize:o,bgColor:r,fgColor:n})=>(0,ue.jsx)(ue.Fragment,{children:[0,1,2].map(i=>(0,ue.jsx)("circle",{r:o*(_t-i*2)/2,cx:e+o*_t/2,cy:t+o*_t/2,fill:i%2!==0?r:n},`finder-${e}-${t}-${i}`))}),U1=({cellSize:e,matrixSize:t,bgColor:o,fgColor:r})=>{let n=[[0,0],[(t-_t)*e,0],[0,(t-_t)*e]];return(0,ue.jsx)(ue.Fragment,{children:n.map(([i,a])=>(0,ue.jsx)(D1,{x:i,y:a,cellSize:e,bgColor:o,fgColor:r},`finder-${i}-${a}`))})},F1=({matrix:e,cellSize:t,color:o})=>(0,ue.jsx)(ue.Fragment,{children:e.map((r,n)=>r.map((i,a)=>i?(0,ue.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:o},`circle-${n}-${a}`):(0,ue.jsx)(Xm.default.Fragment,{},`circle-${n}-${a}`)))}),Qm=(e,t)=>e-e%t,B1=({outputSize:e,cellSize:t,element:o,size:r,padding:n,bgColor:i})=>{if(!o)return(0,ue.jsx)(ue.Fragment,{});let a=r||40,s=n||4,l=o,c=e/2-a/2-s;return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)("rect",{x:Qm(c,t),y:Qm(c,t),width:a+s*2+(c%t?t+.5:.5),height:a+s*2+(c%t?t+.5:.5),fill:i}),(0,ue.jsx)(l,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},H1=e=>{let t=e.outputSize,o=O1(e.url),r=t/o.length;return(0,ue.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,ue.jsx)(F1,{matrix:o,cellSize:r,color:e.fgColor}),(0,ue.jsx)(U1,{cellSize:r,matrixSize:o.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,ue.jsx)(B1,{outputSize:e.outputSize,cellSize:r,element:e.logo?.element,bgColor:e.bgColor})]})},G1=ef.default.div`
|
|
1648
1648
|
display: flex;
|
|
1649
1649
|
justify-content: center;
|
|
1650
1650
|
align-items: center;
|
|
@@ -1659,7 +1659,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1659
1659
|
border-color: ${e=>e.fgColor};
|
|
1660
1660
|
border-radius: var(--privy-border-radius-md);
|
|
1661
1661
|
}
|
|
1662
|
-
`,tf=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return(0,ue.jsx)(
|
|
1662
|
+
`,tf=e=>{let t=e.bgColor||"#FFFFFF",o=e.fgColor||"#000000",r=e.size||160;return(0,ue.jsx)(G1,{size:r,bgColor:t,fgColor:o,children:(0,ue.jsx)(H1,{url:e.url,logo:{element:e.squareLogoElement??Jm},outputSize:r,bgColor:t,fgColor:o})})};var nf=require("react/jsx-runtime");var rf=({size:e,authUrl:t})=>(0,nf.jsx)(tf,{url:t,squareLogoElement:of.ShieldCheckIcon,size:e,fgColor:"#1F1F1F"});var De=x(require("styled-components")),Xe=De.default.div`
|
|
1663
1663
|
display: flex;
|
|
1664
1664
|
flex-direction: column;
|
|
1665
1665
|
align-items: center;
|
|
@@ -1831,7 +1831,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1831
1831
|
width: auto !important;
|
|
1832
1832
|
color: white;
|
|
1833
1833
|
}
|
|
1834
|
-
`;var u=require("react/jsx-runtime"),lf=()=>{let{user:e,enrollInMfa:t}=V(),[o,r]=(0,kt.useState)(!1),[n,i]=(0,kt.useState)(null),[a,s]=(0,kt.useState)(null),{unenrollWithSms:l,unenrollWithTotp:c}=Kn(),{app:m,ready:h,data:w,onUserCloseViaDialogOrKeybindRef:v}=_(),{closePrivyModal:T}=R(),{promptMfa:y}=jr(),E=()=>{T({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{s(null),i(null)},500)};v.current=E;let b=e?.mfaMethods.includes("sms"),M=!!e?.phone,L=e?.mfaMethods.includes("totp"),O=b||L;(0,kt.useEffect)(()=>{O&&r(!0)},[O]);function W(){s(null),i(null)}function A(){r(!1)}async function I(k){await y(),i(k)}if(!h||!e||!m)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(Ym,{})}),(0,u.jsx)(wr,{children:(0,u.jsx)(ho,{})}),(0,u.jsx)(ee,{})]});async function F(){s(null);try{await l()}catch{s(null)}}async function Y(){s(null);try{await c()}catch{s(null)}}if(a==="sms")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:W,onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.PhoneIcon,{})})}),(0,u.jsx)(et,{children:"Remove SMS verification?"}),(0,u.jsxs)(je,{children:["MFA adds an extra layer of security to your ",m?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{warn:!0,onClick:F,children:"Remove SMS for MFA"})}),(0,u.jsx)(ee,{})]});if(a==="totp")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:W,onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.DevicePhoneMobileIcon,{})})}),(0,u.jsx)(et,{children:"Remove Authenticator App verification?"}),(0,u.jsxs)(je,{children:["MFA adds an extra layer of security to your ",m?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{warn:!0,onClick:Y,children:"Remove Authenticator App for MFA"})}),(0,u.jsx)(ee,{})]});if(w.mfaEnrollmentFlow.mfaMethods.length===0&&!O)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(bs.ShieldCheckIcon,{})})}),(0,u.jsx)(et,{children:"Add more security"}),(0,u.jsxs)(je,{children:[m?.name," does not have any verification methods enabled."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{onClick:E,children:"Close"})}),(0,u.jsx)(ee,{})]});let $=!O&&!o;if($)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(bs.ShieldCheckIcon,{})})}),(0,u.jsx)(et,{children:"Transaction Protection"}),(0,u.jsx)(je,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,u.jsxs)(af,{children:[(0,u.jsxs)(ec,{children:[(0,u.jsx)(Xl,{children:(0,u.jsx)(Es.CheckBadgeIcon,{})}),"Enable 2-Step verification for your ",m?.name," wallet."]}),(0,u.jsxs)(ec,{children:[(0,u.jsx)(Xl,{children:(0,u.jsx)(Es.IdentificationIcon,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,u.jsxs)(Cr,{children:[(0,u.jsx)(B,{onClick:()=>r(!0),children:"Continue"}),(0,u.jsx)(Fo,{onClick:E,children:"Not now"})]}),(0,u.jsx)(ee,{})]});switch(n){case"sms":return(0,u.jsx)(
|
|
1834
|
+
`;var u=require("react/jsx-runtime"),lf=()=>{let{user:e,enrollInMfa:t}=V(),[o,r]=(0,kt.useState)(!1),[n,i]=(0,kt.useState)(null),[a,s]=(0,kt.useState)(null),{unenrollWithSms:l,unenrollWithTotp:c}=Kn(),{app:m,ready:h,data:w,onUserCloseViaDialogOrKeybindRef:v}=_(),{closePrivyModal:T}=R(),{promptMfa:y}=jr(),E=()=>{T({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{s(null),i(null)},500)};v.current=E;let b=e?.mfaMethods.includes("sms"),M=!!e?.phone,L=e?.mfaMethods.includes("totp"),O=b||L;(0,kt.useEffect)(()=>{O&&r(!0)},[O]);function W(){s(null),i(null)}function A(){r(!1)}async function I(k){await y(),i(k)}if(!h||!e||!m)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(Ym,{})}),(0,u.jsx)(wr,{children:(0,u.jsx)(ho,{})}),(0,u.jsx)(ee,{})]});async function F(){s(null);try{await l()}catch{s(null)}}async function Y(){s(null);try{await c()}catch{s(null)}}if(a==="sms")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:W,onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.PhoneIcon,{})})}),(0,u.jsx)(et,{children:"Remove SMS verification?"}),(0,u.jsxs)(je,{children:["MFA adds an extra layer of security to your ",m?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{warn:!0,onClick:F,children:"Remove SMS for MFA"})}),(0,u.jsx)(ee,{})]});if(a==="totp")return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:W,onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.DevicePhoneMobileIcon,{})})}),(0,u.jsx)(et,{children:"Remove Authenticator App verification?"}),(0,u.jsxs)(je,{children:["MFA adds an extra layer of security to your ",m?.name," account. Make sure you have other methods to secure your account."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{warn:!0,onClick:Y,children:"Remove Authenticator App for MFA"})}),(0,u.jsx)(ee,{})]});if(w.mfaEnrollmentFlow.mfaMethods.length===0&&!O)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(bs.ShieldCheckIcon,{})})}),(0,u.jsx)(et,{children:"Add more security"}),(0,u.jsxs)(je,{children:[m?.name," does not have any verification methods enabled."]}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{onClick:E,children:"Close"})}),(0,u.jsx)(ee,{})]});let $=!O&&!o;if($)return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(bs.ShieldCheckIcon,{})})}),(0,u.jsx)(et,{children:"Transaction Protection"}),(0,u.jsx)(je,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,u.jsxs)(af,{children:[(0,u.jsxs)(ec,{children:[(0,u.jsx)(Xl,{children:(0,u.jsx)(Es.CheckBadgeIcon,{})}),"Enable 2-Step verification for your ",m?.name," wallet."]}),(0,u.jsxs)(ec,{children:[(0,u.jsx)(Xl,{children:(0,u.jsx)(Es.IdentificationIcon,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,u.jsxs)(Cr,{children:[(0,u.jsx)(B,{onClick:()=>r(!0),children:"Continue"}),(0,u.jsx)(Fo,{onClick:E,children:"Not now"})]}),(0,u.jsx)(ee,{})]});switch(n){case"sms":return(0,u.jsx)(z1,{onComplete:E,onReset:W,onClose:E});case"totp":return(0,u.jsx)(V1,{onComplete:E,onClose:E,onReset:W});default:return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:$?A:void 0,onClose:E},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(bs.ShieldCheckIcon,{})})}),(0,u.jsx)(et,{children:"Choose a verification method"}),O?(0,u.jsx)(je,{children:"To add or delete verification methods, verification is required."}):(0,u.jsx)(je,{children:"How would you like to verify your identity? You can change this later."}),(0,u.jsxs)(gs,{children:[(w.mfaEnrollmentFlow.mfaMethods.includes("totp")||L)&&(0,u.jsxs)(vs,{children:[(0,u.jsx)(We,{disabled:L,onClick:()=>I("totp"),children:(0,u.jsxs)(Cs,{children:[(0,u.jsxs)(ws,{children:[(0,u.jsx)(Ko.DevicePhoneMobileIcon,{}),"Authenticator App"]}),L?(0,u.jsxs)(Yn,{children:[(0,u.jsx)(rc.CheckIcon,{}),"Added"]}):(0,u.jsx)(Yn,{children:"Recommended"})]})}),L&&(0,u.jsx)(tc,{id:"remove",onClick:()=>s("totp"),children:(0,u.jsx)(Ko.TrashIcon,{})})]},"totp"),(w.mfaEnrollmentFlow.mfaMethods.includes("sms")||b)&&(0,u.jsxs)(vs,{children:[(0,u.jsx)(We,{disabled:b||M,onClick:()=>I("sms"),children:(0,u.jsxs)(Cs,{children:[(0,u.jsxs)(ws,{children:[(0,u.jsx)(Ko.PhoneIcon,{}),"SMS"]}),b&&(0,u.jsxs)(Yn,{children:[(0,u.jsx)(rc.CheckIcon,{}),"Added"]}),M&&(0,u.jsx)(Yn,{children:"Disabled"})]})}),b&&(0,u.jsx)(tc,{id:"remove",onClick:()=>s("sms"),children:(0,u.jsx)(Ko.TrashIcon,{})})]},"sms"),(0,u.jsx)(vs,{children:(0,u.jsx)(We,{disabled:!0,children:(0,u.jsxs)(Cs,{children:[(0,u.jsxs)(ws,{children:[(0,u.jsx)(Ko.FingerPrintIcon,{}),"Passkey"]}),(0,u.jsx)(Yn,{isAccent:!0,children:"Coming soon"})]})})},"passkey")]}),(0,u.jsx)(ee,{})]})}},z1=({onComplete:e,onReset:t,onClose:o})=>{let[r,n]=(0,kt.useState)(""),[i,a]=(0,kt.useState)(!1),[s,l]=(0,kt.useState)("enroll"),{initEnrollmentWithSms:c,submitEnrollmentWithSms:m}=Kn(),{app:h,data:w}=_();function v(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function T({qualifiedPhoneNumber:b}){await c({phoneNumber:b}),n(b),l("verify")}async function y(b){try{if(!b)return;await m({phoneNumber:r,mfaCode:b}),a(!0)}catch(M){throw Ol(M)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dr(M)?new Error("The code you entered is not valid"):Or(M)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Dl(M)?new Error("Verification canceled"):new Error("Unknown error")}}function E(){s==="verify"?l("enroll"):t()}return s==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:t,onClose:o},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.PhoneIcon,{})})}),(0,u.jsx)(et,{children:"Set up SMS verification"}),(0,u.jsx)(je,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,u.jsxs)(wr,{children:[(0,u.jsx)(zn,{onSubmit:T}),(0,u.jsxs)(sf,{children:["By providing your mobile number, you agree to receive text messages from ",h?.name,". Some carrier charges may apply"]})]}),(0,u.jsx)(ee,{})]}):i?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:v},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{status:"success",children:(0,u.jsx)(xo.CheckCircleIcon,{})})}),(0,u.jsx)(et,{children:"SMS verification added"}),(0,u.jsx)(je,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{onClick:v,children:"Done"})}),(0,u.jsx)(ee,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:E,onClose:o},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.PhoneIcon,{})})}),(0,u.jsx)(et,{children:"Enter enrollment code"}),(0,u.jsxs)(wr,{children:[(0,u.jsx)(qn,{onChange:y}),(0,u.jsxs)(je,{children:["To continue, enter the 6-digit code sent to ",(0,u.jsx)("strong",{children:mm(r)})]})]}),(0,u.jsx)(ee,{})]})},V1=({onComplete:e,onClose:t,onReset:o})=>{let[r,n]=(0,kt.useState)("enroll"),[i,a]=(0,kt.useState)(null),[s,l]=(0,kt.useState)(!1),{initEnrollmentWithTotp:c,submitEnrollmentWithTotp:m}=Kn(),{data:h}=_();(0,kt.useEffect)(()=>{a(null),c().then(E=>{a(E)}).catch(()=>{a(null),o()})},[]);function w(){h?.mfaEnrollmentFlow?.onSuccess(),e()}function v(){n("verify")}async function T(E){try{if(!E)return;await m({mfaCode:E}),l(!0)}catch(b){throw Ol(b)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):Dr(b)?new Error("The code you entered is not valid"):Or(b)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Dl(b)?new Error("Verification canceled"):new Error("Unknown error")}}function y(){r==="verify"?n("enroll"):o()}return r==="enroll"?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:o,onClose:t},"header"),(0,u.jsx)(et,{children:"Scan QR code"}),(0,u.jsx)(je,{children:"Open your authenticator app and scan the QR code to continue."}),(0,u.jsx)(yp,{children:i?.authUrl?(0,u.jsx)(rf,{authUrl:i.authUrl,size:200}):(0,u.jsx)(ho,{})}),(0,u.jsxs)(Cr,{children:[(0,u.jsx)(Bo,{children:i?.secret&&(0,u.jsx)(Hm,{itemName:"secret",text:i.secret})}),(0,u.jsx)(B,{onClick:v,children:"Continue"})]}),(0,u.jsx)(ee,{})]}):s?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{onClose:w},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{status:"success",children:(0,u.jsx)(xo.CheckCircleIcon,{})})}),(0,u.jsx)(et,{children:"Authenticator app verification added"}),(0,u.jsx)(je,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,u.jsx)(Cr,{children:(0,u.jsx)(B,{onClick:w,children:"Done"})}),(0,u.jsx)(ee,{})]}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(S,{backFn:y,onClose:t},"header"),(0,u.jsx)(Xe,{children:(0,u.jsx)(st,{children:(0,u.jsx)(xo.DevicePhoneMobileIcon,{})})}),(0,u.jsx)(et,{children:"Enter enrollment code"}),(0,u.jsx)(wr,{children:(0,u.jsx)(qn,{onChange:T})}),(0,u.jsxs)(je,{children:["To continue, enter the 6-digit code generated from your ",(0,u.jsx)("strong",{children:"authenticator app"})]}),(0,u.jsx)(ee,{})]})};var Vs=require("@heroicons/react/24/outline"),$s=require("@heroicons/react/24/solid"),Bf=require("@heroicons/react/24/solid"),oi=require("react");var Uf=require("@ethersproject/providers"),Kr=require("react"),Ff=x(require("styled-components"));var dc=x(require("styled-components"));var nc=x(require("styled-components")),Ii=require("react/jsx-runtime"),Ps=({label:e,children:t,valueStyles:o})=>(0,Ii.jsxs)($1,{children:[(0,Ii.jsx)("div",{children:e}),(0,Ii.jsx)(j1,{style:{...o},children:t})]}),$1=nc.default.div`
|
|
1835
1835
|
display: flex;
|
|
1836
1836
|
align-items: center;
|
|
1837
1837
|
justify-content: space-between;
|
|
@@ -1846,7 +1846,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1846
1846
|
color: var(--privy-color-foreground-2);
|
|
1847
1847
|
text-align: right;
|
|
1848
1848
|
}
|
|
1849
|
-
`,
|
|
1849
|
+
`,j1=nc.default.div`
|
|
1850
1850
|
font-size: 14px;
|
|
1851
1851
|
line-height: 100%;
|
|
1852
1852
|
display: flex;
|
|
@@ -1855,19 +1855,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1855
1855
|
border-radius: var(--privy-border-radius-full);
|
|
1856
1856
|
background-color: var(--privy-color-background-2);
|
|
1857
1857
|
padding: 4px 8px;
|
|
1858
|
-
`;var Mi=x(require("styled-components"));var ic=require("@ethersproject/bignumber"),ac=require("@ethersproject/units");var Wi=(e,t)=>{let o=(t*parseFloat((0,ac.formatEther)(e))).toFixed(2);return o!=="0.00"?`$${o}`:"<$0.01"},So=(e,t,o=6,r=!1)=>{let i=parseFloat((0,ac.formatEther)(e)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return r?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},sc=e=>e.map(Se).reduce((t,o)=>t.add(o),ic.BigNumber.from(0)).toHexString(),cf=(e,t)=>{let{chains:o}=R(),r=`https://etherscan.io/address/${t}`,n=`${Ed(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},Se=e=>ic.BigNumber.from(e);var _o=require("react/jsx-runtime"),df=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=sc(e),n=t?Wi(r,t):void 0,i=So(r,o);return(0,_o.jsx)(pf,{children:n||i})},lc=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=sc(e),n=t?Wi(r,t):void 0,i=So(r,o);return(0,_o.jsx)(pf,{children:n?(0,_o.jsxs)(_o.Fragment,{children:[(0,_o.jsx)(
|
|
1858
|
+
`;var Mi=x(require("styled-components"));var ic=require("@ethersproject/bignumber"),ac=require("@ethersproject/units");var Wi=(e,t)=>{let o=(t*parseFloat((0,ac.formatEther)(e))).toFixed(2);return o!=="0.00"?`$${o}`:"<$0.01"},So=(e,t,o=6,r=!1)=>{let i=parseFloat((0,ac.formatEther)(e)).toFixed(o).replace(/0+$/,"").replace(/\.$/,"");return r?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},sc=e=>e.map(Se).reduce((t,o)=>t.add(o),ic.BigNumber.from(0)).toHexString(),cf=(e,t)=>{let{chains:o}=R(),r=`https://etherscan.io/address/${t}`,n=`${Ed(e,o)}/address/${t}`;if(!n)return r;try{new URL(n)}catch{return r}return n},Se=e=>ic.BigNumber.from(e);var _o=require("react/jsx-runtime"),df=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=sc(e),n=t?Wi(r,t):void 0,i=So(r,o);return(0,_o.jsx)(pf,{children:n||i})},lc=({weiQuantities:e,tokenPrice:t,tokenSymbol:o})=>{let r=sc(e),n=t?Wi(r,t):void 0,i=So(r,o);return(0,_o.jsx)(pf,{children:n?(0,_o.jsxs)(_o.Fragment,{children:[(0,_o.jsx)(q1,{children:"USD"}),n==="<$0.01"?(0,_o.jsxs)(Y1,{children:[(0,_o.jsx)(K1,{children:"<"}),"$0.01"]}):n]}):i})},pf=Mi.default.span`
|
|
1859
1859
|
font-size: 14px;
|
|
1860
1860
|
line-height: 140%;
|
|
1861
1861
|
display: flex;
|
|
1862
1862
|
gap: 4px;
|
|
1863
1863
|
align-items: center;
|
|
1864
|
-
`,
|
|
1864
|
+
`,q1=Mi.default.span`
|
|
1865
1865
|
font-size: 12px;
|
|
1866
1866
|
line-height: 12px;
|
|
1867
1867
|
color: var(--privy-color-foreground-3);
|
|
1868
|
-
`,
|
|
1868
|
+
`,K1=Mi.default.span`
|
|
1869
1869
|
font-size: 10px;
|
|
1870
|
-
`,
|
|
1870
|
+
`,Y1=Mi.default.span`
|
|
1871
1871
|
display: flex;
|
|
1872
1872
|
align-items: center;
|
|
1873
1873
|
`;var Ts=x(require("styled-components"));var vt=require("react/jsx-runtime"),uf=({gas:e,tokenPrice:t,tokenSymbol:o})=>(0,vt.jsxs)(_l,{style:{paddingBottom:"12px"},children:[(0,vt.jsxs)(ff,{children:[(0,vt.jsx)(yf,{children:"Est. Fees"}),(0,vt.jsx)("div",{children:(0,vt.jsx)(lc,{weiQuantities:[e],tokenPrice:t,tokenSymbol:o})})]}),t&&(0,vt.jsx)(hf,{children:`${So(e,o)}`})]}),mf=({transactionData:e,gas:t,tokenPrice:o,tokenSymbol:r})=>{let n=Se(e.value||0).add(Se(t)).toHexString();return(0,vt.jsxs)(_l,{children:[(0,vt.jsxs)(ff,{children:[(0,vt.jsx)(yf,{children:"Total (including fees)"}),(0,vt.jsx)("div",{children:(0,vt.jsx)(lc,{weiQuantities:[e.value||0,t],tokenPrice:o,tokenSymbol:r})})]}),o&&(0,vt.jsx)(hf,{children:So(n,r)})]})},ff=Ts.default.div`
|
|
@@ -1889,19 +1889,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1889
1889
|
font-size: 14px;
|
|
1890
1890
|
line-height: 22.4px;
|
|
1891
1891
|
font-weight: 400;
|
|
1892
|
-
`;var gf=require("@heroicons/react/24/outline"),ko=require("react"),Yo=x(require("styled-components"));var xs=require("react"),Jn=(0,xs.createContext)(void 0);var Li=(0,xs.createContext)(void 0);var qe=require("react/jsx-runtime"),vf=({defaultValue:e,children:t})=>{let[o,r]=(0,ko.useState)(e||null),n=i=>{r(o===i?null:i)};return(0,qe.jsx)(Jn.Provider,{value:{activePanel:o,togglePanel:n},children:(0,qe.jsx)(
|
|
1892
|
+
`;var gf=require("@heroicons/react/24/outline"),ko=require("react"),Yo=x(require("styled-components"));var xs=require("react"),Jn=(0,xs.createContext)(void 0);var Li=(0,xs.createContext)(void 0);var qe=require("react/jsx-runtime"),vf=({defaultValue:e,children:t})=>{let[o,r]=(0,ko.useState)(e||null),n=i=>{r(o===i?null:i)};return(0,qe.jsx)(Jn.Provider,{value:{activePanel:o,togglePanel:n},children:(0,qe.jsx)(J1,{children:t})})},wf=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=(0,ko.useContext)(Jn),n=o===e;return(0,qe.jsx)(Li.Provider,{value:{onToggle:()=>r(e),value:e},children:(0,qe.jsx)(ev,{isActive:n,"data-open":n,children:t})})},Cf=({children:e})=>{let{activePanel:t}=(0,ko.useContext)(Jn),{onToggle:o,value:r}=(0,ko.useContext)(Li),n=t===r;return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsxs)(Q1,{onClick:o,"data-open":n,children:[(0,qe.jsx)(X1,{children:e}),(0,qe.jsx)(ov,{isactive:n,children:(0,qe.jsx)(gf.ChevronDownIcon,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,qe.jsx)(Z1,{})]})},bf=({children:e})=>{let{activePanel:t}=(0,ko.useContext)(Jn),{value:o}=(0,ko.useContext)(Li);return(0,qe.jsx)(tv,{"data-open":t===o,children:(0,qe.jsx)(Pf,{children:e})})},Ef=({children:e})=>{let{activePanel:t}=(0,ko.useContext)(Jn),{value:o}=(0,ko.useContext)(Li);return(0,qe.jsx)(Pf,{children:typeof e=="function"?e({isActive:t===o}):e})},J1=Yo.default.div`
|
|
1893
1893
|
display: flex;
|
|
1894
1894
|
flex-direction: column;
|
|
1895
1895
|
width: 100%;
|
|
1896
1896
|
gap: 8px;
|
|
1897
|
-
`,
|
|
1897
|
+
`,Q1=Yo.default.div`
|
|
1898
1898
|
display: flex;
|
|
1899
1899
|
justify-content: space-between;
|
|
1900
1900
|
align-items: center;
|
|
1901
1901
|
width: 100%;
|
|
1902
1902
|
cursor: pointer;
|
|
1903
1903
|
padding-bottom: 8px;
|
|
1904
|
-
`,
|
|
1904
|
+
`,Z1=Yo.default.div`
|
|
1905
1905
|
width: 100%;
|
|
1906
1906
|
|
|
1907
1907
|
&& {
|
|
@@ -1909,13 +1909,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1909
1909
|
border-color: var(--privy-color-foreground-4);
|
|
1910
1910
|
}
|
|
1911
1911
|
padding-bottom: 12px;
|
|
1912
|
-
`,
|
|
1912
|
+
`,X1=Yo.default.div`
|
|
1913
1913
|
font-size: 14px;
|
|
1914
1914
|
font-weight: 500;
|
|
1915
1915
|
line-height: 19.6px;
|
|
1916
1916
|
width: 100%;
|
|
1917
1917
|
padding-right: 8px;
|
|
1918
|
-
`,
|
|
1918
|
+
`,ev=Yo.default.div`
|
|
1919
1919
|
display: flex;
|
|
1920
1920
|
flex-direction: column;
|
|
1921
1921
|
width: 100%;
|
|
@@ -1927,7 +1927,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1927
1927
|
border-color: var(--privy-color-foreground-4);
|
|
1928
1928
|
border-radius: var(--privy-border-radius-md);
|
|
1929
1929
|
}
|
|
1930
|
-
`,
|
|
1930
|
+
`,tv=Yo.default.div`
|
|
1931
1931
|
position: relative;
|
|
1932
1932
|
overflow: hidden;
|
|
1933
1933
|
transition: max-height 25ms ease-out;
|
|
@@ -1945,32 +1945,32 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1945
1945
|
gap: 12px;
|
|
1946
1946
|
flex: 1 1 auto;
|
|
1947
1947
|
min-height: 1px;
|
|
1948
|
-
`,
|
|
1948
|
+
`,ov=Yo.default.div`
|
|
1949
1949
|
transform: ${e=>e.isactive?"rotate(180deg)":"rotate(0deg)"};
|
|
1950
|
-
`;var Tf=x(require("styled-components"));var xf=require("react/jsx-runtime"),cc=({walletAddress:e,chainId:t=No})=>(0,xf.jsx)(
|
|
1950
|
+
`;var Tf=x(require("styled-components"));var xf=require("react/jsx-runtime"),cc=({walletAddress:e,chainId:t=No})=>(0,xf.jsx)(rv,{href:cf(t,e),target:"_blank",children:or(e)}),rv=Tf.default.a`
|
|
1951
1951
|
&:hover {
|
|
1952
1952
|
text-decoration: underline;
|
|
1953
1953
|
}
|
|
1954
|
-
`;var Ue=require("react/jsx-runtime"),Qn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i,tokenSymbol:a})=>{let s=o?.value||0;return(0,Ue.jsx)(vf,{children:(0,Ue.jsxs)(wf,{value:"details",children:[(0,Ue.jsx)(Cf,{children:(0,Ue.jsxs)(
|
|
1954
|
+
`;var Ue=require("react/jsx-runtime"),Qn=({from:e,to:t,txn:o,transactionInfo:r,tokenPrice:n,gas:i,tokenSymbol:a})=>{let s=o?.value||0;return(0,Ue.jsx)(vf,{children:(0,Ue.jsxs)(wf,{value:"details",children:[(0,Ue.jsx)(Cf,{children:(0,Ue.jsxs)(nv,{children:[(0,Ue.jsx)("div",{children:r?.title||r?.actionDescription||"Details"}),(0,Ue.jsx)(iv,{children:(0,Ue.jsx)(df,{weiQuantities:[s],tokenPrice:n,tokenSymbol:a})})]})}),(0,Ue.jsxs)(bf,{children:[(0,Ue.jsx)(Ps,{label:"From",children:(0,Ue.jsx)(cc,{walletAddress:e,chainId:o.chainId||No})}),(0,Ue.jsx)(Ps,{label:"To",children:(0,Ue.jsx)(cc,{walletAddress:t,chainId:o.chainId||No})}),r&&r.action&&(0,Ue.jsx)(Ps,{label:"Action",children:r.action}),i&&(0,Ue.jsx)(uf,{transactionData:o,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,Ue.jsx)(Ef,{children:({isActive:l})=>(0,Ue.jsx)(mf,{transactionData:o,displayFee:l,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},nv=dc.default.div`
|
|
1955
1955
|
display: flex;
|
|
1956
1956
|
flex-direction: row;
|
|
1957
1957
|
justify-content: space-between;
|
|
1958
|
-
`,
|
|
1958
|
+
`,iv=dc.default.div`
|
|
1959
1959
|
flex-shrink: 0;
|
|
1960
1960
|
padding-left: 8px;
|
|
1961
|
-
`;var Zn=x(require("styled-components")),br=require("react/jsx-runtime"),pc=({description:e,contractInfo:t})=>(0,br.jsxs)(
|
|
1961
|
+
`;var Zn=x(require("styled-components")),br=require("react/jsx-runtime"),pc=({description:e,contractInfo:t})=>(0,br.jsxs)(av,{children:[t.imgUrl&&(0,br.jsx)(sv,{size:t.imgSize||"sm",src:t.imgUrl,alt:t.imgAltText||`${t.name} image`}),t.url&&(0,br.jsx)(lv,{children:(0,br.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",children:t.url.replace(/^(https?:\/\/)(www\.)?/,"")})}),t.name&&(0,br.jsx)(cv,{children:t.name}),(0,br.jsx)(dv,{children:e||t.actionText})]}),av=Zn.default.div`
|
|
1962
1962
|
display: flex;
|
|
1963
1963
|
flex-direction: column;
|
|
1964
1964
|
align-items: center;
|
|
1965
1965
|
margin-bottom: 8px;
|
|
1966
|
-
`,
|
|
1966
|
+
`,sv=Zn.default.img`
|
|
1967
1967
|
&& {
|
|
1968
1968
|
height: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1969
1969
|
width: ${e=>e.size==="sm"?"65px":"140px"};
|
|
1970
1970
|
border-radius: 16px;
|
|
1971
1971
|
margin-bottom: 12px;
|
|
1972
1972
|
}
|
|
1973
|
-
`,
|
|
1973
|
+
`,lv=Zn.default.div`
|
|
1974
1974
|
font-size: 12px;
|
|
1975
1975
|
line-height: 12px;
|
|
1976
1976
|
padding: 7px;
|
|
@@ -1983,7 +1983,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1983
1983
|
text-decoration: underline;
|
|
1984
1984
|
}
|
|
1985
1985
|
}
|
|
1986
|
-
`,
|
|
1986
|
+
`,cv=Zn.default.div`
|
|
1987
1987
|
font-size: 18px;
|
|
1988
1988
|
line-height: 18px;
|
|
1989
1989
|
font-weight: 500;
|
|
@@ -1991,7 +1991,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1991
1991
|
white-space: nowrap;
|
|
1992
1992
|
max-width: 275px;
|
|
1993
1993
|
text-overflow: ellipsis;
|
|
1994
|
-
`,
|
|
1994
|
+
`,dv=Zn.default.div`
|
|
1995
1995
|
font-size: 16px;
|
|
1996
1996
|
line-height: 140%;
|
|
1997
1997
|
font-weight: 400;
|
|
@@ -1999,7 +1999,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1999
1999
|
overflow: hidden;
|
|
2000
2000
|
max-width: 275px;
|
|
2001
2001
|
text-overflow: ellipsis;
|
|
2002
|
-
`;var Sf=require("@heroicons/react/24/outline"),Ss=x(require("styled-components"));var qr=require("react/jsx-runtime"),_f=({address:e,txn:t,balance:o,hasFunds:r})=>{let n=!!o,{nativeTokenSymbolForChainId:i}=R(),a=i(t.chainId)||"ETH";return(0,qr.jsxs)(
|
|
2002
|
+
`;var Sf=require("@heroicons/react/24/outline"),Ss=x(require("styled-components"));var qr=require("react/jsx-runtime"),_f=({address:e,txn:t,balance:o,hasFunds:r})=>{let n=!!o,{nativeTokenSymbolForChainId:i}=R(),a=i(t.chainId)||"ETH";return(0,qr.jsxs)(pv,{children:[(0,qr.jsxs)(uv,{children:[(0,qr.jsx)(Sf.WalletIcon,{strokeWidth:"2",width:"16px",height:"16px"}),(0,qr.jsx)("div",{children:or(e)})]}),(0,qr.jsxs)(mv,{displayBalanceColor:n,hasFunds:r,children:[o?So(o,a,6,!0):0," available"]})]})},pv=Ss.default.div`
|
|
2003
2003
|
display: flex;
|
|
2004
2004
|
flex-direction: row;
|
|
2005
2005
|
justify-content: space-between;
|
|
@@ -2012,12 +2012,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2012
2012
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2013
2013
|
border-radius: var(--privy-border-radius-md);
|
|
2014
2014
|
}
|
|
2015
|
-
`,
|
|
2015
|
+
`,uv=Ss.default.div`
|
|
2016
2016
|
display: flex;
|
|
2017
2017
|
flex-direction: row;
|
|
2018
2018
|
align-items: center;
|
|
2019
2019
|
gap: 8px;
|
|
2020
|
-
`,
|
|
2020
|
+
`,mv=Ss.default.div`
|
|
2021
2021
|
display: flex;
|
|
2022
2022
|
align-items: center;
|
|
2023
2023
|
justify-content: center;
|
|
@@ -2027,7 +2027,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2027
2027
|
background-color: var(--privy-color-background-2);
|
|
2028
2028
|
padding: 5px 8px;
|
|
2029
2029
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2030
|
-
`;var Ni=x(require("styled-components"));var Ft=require("react/jsx-runtime"),Af=({description:e,txn:t,tokenSymbol:o,tokenPrice:r})=>{let n=t.value||0,i=r?Wi(n,r):void 0,a=So(n,o);return(0,Ft.jsxs)(
|
|
2030
|
+
`;var Ni=x(require("styled-components"));var Ft=require("react/jsx-runtime"),Af=({description:e,txn:t,tokenSymbol:o,tokenPrice:r})=>{let n=t.value||0,i=r?Wi(n,r):void 0,a=So(n,o);return(0,Ft.jsxs)(fv,{children:[i?(0,Ft.jsxs)(Ft.Fragment,{children:[(0,Ft.jsx)(kf,{children:i}),(0,Ft.jsx)(hv,{children:a})]}):(0,Ft.jsx)(Ft.Fragment,{children:(0,Ft.jsx)(kf,{children:a})}),(0,Ft.jsx)(yv,{children:e})]})},fv=Ni.default.div`
|
|
2031
2031
|
display: flex;
|
|
2032
2032
|
flex-direction: column;
|
|
2033
2033
|
align-items: center;
|
|
@@ -2038,24 +2038,24 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2038
2038
|
line-height: 48px;
|
|
2039
2039
|
margin: 8px auto;
|
|
2040
2040
|
}
|
|
2041
|
-
`,
|
|
2041
|
+
`,hv=Ni.default.p`
|
|
2042
2042
|
margin-bottom: 12px;
|
|
2043
2043
|
&& {
|
|
2044
2044
|
font-size: 17px;
|
|
2045
2045
|
line-height: 17px;
|
|
2046
2046
|
color: var(--privy-color-foreground-3);
|
|
2047
2047
|
}
|
|
2048
|
-
`,
|
|
2048
|
+
`,yv=Ni.default.div`
|
|
2049
2049
|
font-size: 16px;
|
|
2050
2050
|
line-height: 22.4px;
|
|
2051
2051
|
font-weight: 400;
|
|
2052
2052
|
overflow: hidden;
|
|
2053
2053
|
max-width: 275px;
|
|
2054
2054
|
text-overflow: ellipsis;
|
|
2055
|
-
`;var Mf=require("@ethersproject/abstract-signer"),Bt=require("@ethersproject/bignumber"),Lf=require("@ethersproject/contracts"),v1=require("@ethersproject/providers"),Nf=require("@ethersproject/transactions");var _s={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var ks={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var As={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Rs={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var Is={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Ws={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var Ms={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Ls={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Ns={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Os={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Ds={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Us={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var mc=require("@ethersproject/units"),Rf=require("ofetch");var Oi={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Di={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var If=[Oi.id,Di.id],uc=e=>({maxPriorityFee:(0,mc.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,mc.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),g1=e=>({safeLow:uc(e.safeLow),standard:uc(e.standard),fast:uc(e.fast)}),Wf=async e=>{let t="";switch(e){case Oi.id:t="https://gasstation.polygon.technology/v2";break;case Di.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return g1(await(0,Rf.ofetch)(t))};function Jo(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function w1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Jo(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=Jo(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Jo(e.gasPrice)),e.value!==void 0&&(t.value=Jo(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Jo(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Jo(e.maxPriorityFeePerGas)),t}function C1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Se(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Se(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Se(e.gasPrice)),e.value!==void 0&&(t.value=Se(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Se(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Se(e.maxPriorityFeePerGas)),t}async function Xn(e,t,o){t.chainId=Number(t.chainId),Df(t);let r=new Mf.VoidSigner(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),If.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Wf(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}if(b1(t.chainId)&&!t.maxFeePerGas)try{let{lastBaseFeePerGas:i}=await r.getFeeData();if(i){let a=i.mul(Bt.BigNumber.from(120)).div(Bt.BigNumber.from(100));t.maxFeePerGas=Jo(a),t.maxPriorityFeePerGas=Jo(Bt.BigNumber.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(fc(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas)&&!t.gasPrice)try{if(t.type=2,!t.maxPriorityFeePerGas){let i=await o.send("eth_maxPriorityFeePerGas",[]);t.maxPriorityFeePerGas=i}if(t.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),t.maxPriorityFeePerGas>=t.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!t.maxFeePerGas){let{lastBaseFeePerGas:i}=await r.getFeeData();if(!i)throw new Error("Unable to fetch baseFee for last block.");let l=Bt.BigNumber.from(i).mul(Bt.BigNumber.from(126)).div(Bt.BigNumber.from(100)).add(Bt.BigNumber.from(t.maxPriorityFeePerGas));t.maxFeePerGas=Jo(l)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}E1(t.chainId)&&t.type!=0&&((t.type==1||t.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),t.type===void 0&&(t.type=0));let n=await r.populateTransaction({to:t.to,from:t.from,nonce:t.nonce,gasLimit:t.gasLimit,gasPrice:t.gasPrice,data:t.data,value:t.value,chainId:t.chainId,type:t.type,accessList:t.accessList,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});return w1(n)}async function Fs(e,t,o,r,n){r=Object.assign({chainId:No},r),Df(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data;return await n.sendTransaction(a)}async function Of(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(Se(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}function fc(e){return[Rs.id,Is.id,Ws.id,Ms.id,Ls.id,Ns.id,Os.id,Us.id,Ds.id].includes(e)}function b1(e){return[_s.id,ks.id,As.id].includes(e)}function E1(e){return[56,97].includes(e)}async function hc(e,t){if(!e.chainId||e.chainId&&!fc(e.chainId))return Bt.BigNumber.from(0);let o=Bt.BigNumber.from(0);try{let r=new Lf.Contract(ud,md,t),n=C1(e),i=(0,Nf.serialize)(n);o=await r.getL1Fee(i)}catch{}return o}async function Bs(e,t){delete e.from;let o=Bt.BigNumber.from(0),r=Bt.BigNumber.from(0);if(e.gasLimit?o=Se(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Se(e.maxFeePerGas);else{let i=await t.getFeeData();i.maxFeePerGas&&(r=i.maxFeePerGas)}else if(e.type==0||e.type==1)if(e.gasPrice)r=Se(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Se(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&fc(e.chainId))try{let i=await hc(e,t);n=n.add(i)}catch{}return n}function Df(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!P1(r))throw new Error(`Transaction request property '${o}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function P1(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&T1(e);return t||o||r}function T1(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Hs(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var ei=require("react");var Gs=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=R(),[n,i]=(0,ei.useState)(!0),[a,s]=(0,ei.useState)(void 0),[l,c]=(0,ei.useState)(void 0);return(0,ei.useEffect)(()=>{let m=e.chainId||No,h=r.find(v=>v.id===Number(m));if(!h)throw new j(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let v=await o(h);v?c(v):s(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(v){s(v)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:l,isTokenPriceLoading:n,tokenPriceError:a}};var zs=require("react"),yc=(0,zs.createContext)({wallets:[],ready:!1});function ti(){return(0,zs.useContext)(yc)}var gc=require("react/jsx-runtime"),vc=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:o}=ti(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=R(),[s,l]=(0,Kr.useState)(e),{tokenPrice:c}=Gs(s),[m,h]=(0,Kr.useState)(null),w=a(e.chainId)||"ETH",v=(0,Kr.useMemo)(()=>o.find(T=>T.walletClientType==="privy"),[o]);return(0,Kr.useEffect)(()=>{async function T(){if(!await t()||!r||!v)return s;let E=new Uf.StaticJsonRpcProvider(Kt(s.chainId,i,n)),b=await Bs(s,E);return h(Se(b.toBigInt()).toHexString()),Xn(v.address,s,E)}T().then(y=>{l(y)})},[r]),v?(0,gc.jsx)(x1,{children:(0,gc.jsx)(Qn,{from:v.address,to:s.to,txn:s,gas:m??void 0,tokenPrice:c,tokenSymbol:w})}):null},x1=Ff.default.div`
|
|
2055
|
+
`;var Mf=require("@ethersproject/abstract-signer"),Bt=require("@ethersproject/bignumber"),Lf=require("@ethersproject/contracts"),vv=require("@ethersproject/providers"),Nf=require("@ethersproject/transactions");var _s={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}};var ks={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var As={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var Rs={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var Is={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var Ws={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var Ms={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}};var Ls={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var Ns={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var Os={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var Ds={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var Us={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var mc=require("@ethersproject/units"),Rf=require("ofetch");var Oi={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}};var Di={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://matic-mumbai.chainstacklabs.com"]},public:{http:["https://matic-mumbai.chainstacklabs.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},testnet:!0};var If=[Oi.id,Di.id],uc=e=>({maxPriorityFee:(0,mc.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,mc.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),gv=e=>({safeLow:uc(e.safeLow),standard:uc(e.standard),fast:uc(e.fast)}),Wf=async e=>{let t="";switch(e){case Oi.id:t="https://gasstation.polygon.technology/v2";break;case Di.id:t="https://gasstation-testnet.polygon.technology/v2";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return gv(await(0,Rf.ofetch)(t))};function Jo(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function wv(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Jo(e.nonce)),e.gasLimit!==void 0&&(t.gasLimit=Jo(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Jo(e.gasPrice)),e.value!==void 0&&(t.value=Jo(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Jo(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Jo(e.maxPriorityFeePerGas)),t}function Cv(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Se(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Se(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Se(e.gasPrice)),e.value!==void 0&&(t.value=Se(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Se(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Se(e.maxPriorityFeePerGas)),t}async function Xn(e,t,o){t.chainId=Number(t.chainId),Df(t);let r=new Mf.VoidSigner(e,o);if(t.gas&&(t.gasLimit=t.gas,delete t.gas),If.includes(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas))try{let{standard:i}=await Wf(t.chainId);t.maxPriorityFeePerGas||(t.maxPriorityFeePerGas=i.maxPriorityFee),t.maxFeePerGas||(t.maxFeePerGas=i.maxFee)}catch(i){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${i}.`)}if(bv(t.chainId)&&!t.maxFeePerGas)try{let{lastBaseFeePerGas:i}=await r.getFeeData();if(i){let a=i.mul(Bt.BigNumber.from(120)).div(Bt.BigNumber.from(100));t.maxFeePerGas=Jo(a),t.maxPriorityFeePerGas=Jo(Bt.BigNumber.from(0))}}catch(i){throw new Error(`Failed to set gas price for Arbitrum transaction: ${i}.`)}if(fc(t.chainId)&&(!t.maxPriorityFeePerGas||!t.maxFeePerGas)&&!t.gasPrice)try{if(t.type=2,!t.maxPriorityFeePerGas){let i=await o.send("eth_maxPriorityFeePerGas",[]);t.maxPriorityFeePerGas=i}if(t.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),t.maxPriorityFeePerGas>=t.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!t.maxFeePerGas){let{lastBaseFeePerGas:i}=await r.getFeeData();if(!i)throw new Error("Unable to fetch baseFee for last block.");let l=Bt.BigNumber.from(i).mul(Bt.BigNumber.from(126)).div(Bt.BigNumber.from(100)).add(Bt.BigNumber.from(t.maxPriorityFeePerGas));t.maxFeePerGas=Jo(l)}}catch(i){throw new Error(`Failed to set gas price for OP stack transaction: ${i}.`)}Ev(t.chainId)&&t.type!=0&&((t.type==1||t.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),t.type===void 0&&(t.type=0));let n=await r.populateTransaction({to:t.to,from:t.from,nonce:t.nonce,gasLimit:t.gasLimit,gasPrice:t.gasPrice,data:t.data,value:t.value,chainId:t.chainId,type:t.type,accessList:t.accessList,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});return wv(n)}async function Fs(e,t,o,r,n){r=Object.assign({chainId:No},r),Df(r);let a=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data;return await n.sendTransaction(a)}async function Of(e,t,o){let r=await o.getBalance(e),n=t.value||0,i=r.sub(Se(n)),a=!i.isNegative()&&!i.isZero();return{balance:r,hasSufficientFunds:a}}function fc(e){return[Rs.id,Is.id,Ws.id,Ms.id,Ls.id,Ns.id,Os.id,Us.id,Ds.id].includes(e)}function bv(e){return[_s.id,ks.id,As.id].includes(e)}function Ev(e){return[56,97].includes(e)}async function hc(e,t){if(!e.chainId||e.chainId&&!fc(e.chainId))return Bt.BigNumber.from(0);let o=Bt.BigNumber.from(0);try{let r=new Lf.Contract(ud,md,t),n=Cv(e),i=(0,Nf.serialize)(n);o=await r.getL1Fee(i)}catch{}return o}async function Bs(e,t){delete e.from;let o=Bt.BigNumber.from(0),r=Bt.BigNumber.from(0);if(e.gasLimit?o=Se(e.gasLimit):o=await t.estimateGas(e),e.type==2)if(e.maxFeePerGas)r=Se(e.maxFeePerGas);else{let i=await t.getFeeData();i.maxFeePerGas&&(r=i.maxFeePerGas)}else if(e.type==0||e.type==1)if(e.gasPrice)r=Se(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}else if(e.gasPrice)r=Se(e.gasPrice);else{let i=await t.getFeeData();i.gasPrice&&(r=i.gasPrice)}let n=o.mul(r);if(e.chainId&&fc(e.chainId))try{let i=await hc(e,t);n=n.add(i)}catch{}return n}function Df(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!Pv(r))throw new Error(`Transaction request property '${o}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function Pv(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&Tv(e);return t||o||r}function Tv(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Hs(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var ei=require("react");var Gs=e=>{let{showFiatPrices:t,getUsdTokenPrice:o,chains:r}=R(),[n,i]=(0,ei.useState)(!0),[a,s]=(0,ei.useState)(void 0),[l,c]=(0,ei.useState)(void 0);return(0,ei.useEffect)(()=>{let m=e.chainId||No,h=r.find(v=>v.id===Number(m));if(!h)throw new j(`Unsupported chain: ${m}`);(async()=>{if(!t){i(!1);return}try{i(!0);let v=await o(h);v?c(v):s(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(v){s(v)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:l,isTokenPriceLoading:n,tokenPriceError:a}};var zs=require("react"),yc=(0,zs.createContext)({wallets:[],ready:!1});function ti(){return(0,zs.useContext)(yc)}var gc=require("react/jsx-runtime"),vc=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:o}=ti(),{walletProxy:r,rpcConfig:n,chains:i,nativeTokenSymbolForChainId:a}=R(),[s,l]=(0,Kr.useState)(e),{tokenPrice:c}=Gs(s),[m,h]=(0,Kr.useState)(null),w=a(e.chainId)||"ETH",v=(0,Kr.useMemo)(()=>o.find(T=>T.walletClientType==="privy"),[o]);return(0,Kr.useEffect)(()=>{async function T(){if(!await t()||!r||!v)return s;let E=new Uf.StaticJsonRpcProvider(Kt(s.chainId,i,n)),b=await Bs(s,E);return h(Se(b.toBigInt()).toHexString()),Xn(v.address,s,E)}T().then(y=>{l(y)})},[r]),v?(0,gc.jsx)(xv,{children:(0,gc.jsx)(Qn,{from:v.address,to:s.to,txn:s,gas:m??void 0,tokenPrice:c,tokenSymbol:w})}):null},xv=Ff.default.div`
|
|
2056
2056
|
width: 100%;
|
|
2057
2057
|
padding: 1rem 0;
|
|
2058
|
-
`;var H=require("react/jsx-runtime"),wc=({open:e,onClose:t})=>{let{user:o}=V(),[r,n]=(0,oi.useState)(null),{init:i,cancel:a}=jr();(0,oi.useEffect)(()=>{e&&o?.mfaMethods&&o.mfaMethods.length>0?s(o.mfaMethods[0]):n(null)},[o?.mfaMethods,e]);async function s(c){try{n(c),await i(c)}catch(m){console.error(m)}}let l=()=>{n(null),a(),t()};return!e||!o?null:r?(0,H.jsx)(
|
|
2058
|
+
`;var H=require("react/jsx-runtime"),wc=({open:e,onClose:t})=>{let{user:o}=V(),[r,n]=(0,oi.useState)(null),{init:i,cancel:a}=jr();(0,oi.useEffect)(()=>{e&&o?.mfaMethods&&o.mfaMethods.length>0?s(o.mfaMethods[0]):n(null)},[o?.mfaMethods,e]);async function s(c){try{n(c),await i(c)}catch(m){console.error(m)}}let l=()=>{n(null),a(),t()};return!e||!o?null:r?(0,H.jsx)(Sv,{selectedMethod:r,onClose:l,onBack:o.mfaMethods.length>1?()=>n(null):void 0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{onClose:l},"header"),(0,H.jsx)(Xe,{children:(0,H.jsx)(st,{children:(0,H.jsx)(Bf.ShieldCheckIcon,{})})}),(0,H.jsx)(et,{children:"Verify your identity"}),(0,H.jsx)(je,{children:"Choose a verification method"}),(0,H.jsxs)(gs,{children:[o.mfaMethods.includes("totp")&&(0,H.jsxs)(We,{onClick:()=>s("totp"),children:[(0,H.jsx)(Vs.DevicePhoneMobileIcon,{}),"Authenticator App"]},"totp"),o.mfaMethods.includes("sms")&&(0,H.jsxs)(We,{onClick:()=>s("sms"),children:[(0,H.jsx)(Vs.PhoneIcon,{}),"SMS"]},"sms")]}),(0,H.jsx)(ee,{})]})},Sv=({selectedMethod:e,onClose:t,onBack:o})=>{let{app:r}=_(),{pendingTransaction:n}=R(),[i,a]=(0,oi.useState)(!1),[s,l]=(0,oi.useState)(!1),{submit:c}=jr();async function m(h){try{if(!h)return;await c(e,h),l(!0),a(!1),t()}catch(w){throw $a(w)?(a(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Dr(w)?(a(!1),new Error("The code you entered is not valid")):Or(w)?(a(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(a(!1),new Error("Unknown error"))}}switch(e){case"sms":return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{onClose:t},"header"),(0,H.jsx)(Xe,{children:(0,H.jsx)(st,{children:(0,H.jsx)($s.PhoneIcon,{})})}),(0,H.jsx)(et,{children:"Enter verification code"}),(0,H.jsxs)(wr,{children:[(0,H.jsx)(qn,{success:s,disabled:i,onChange:m}),(0,H.jsxs)(je,{children:["To continue, please enter the 6-digit code sent to your ",(0,H.jsx)("strong",{children:"mobile device"})]}),n&&(0,H.jsx)(vc,{pendingTransaction:n})]}),o&&(0,H.jsx)(oc,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),(0,H.jsx)(Fo,{onClick:t,children:"Not now"}),(0,H.jsx)(ee,{})]});case"totp":return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{onClose:t},"header"),(0,H.jsx)(Xe,{children:(0,H.jsx)(st,{children:(0,H.jsx)($s.DevicePhoneMobileIcon,{})})}),(0,H.jsx)(et,{children:"Enter verification code"}),(0,H.jsxs)(wr,{children:[(0,H.jsx)(qn,{success:s,disabled:i,onChange:m}),(0,H.jsxs)(je,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,H.jsx)("strong",{children:"authenticator app"})]}),n&&(0,H.jsx)(vc,{pendingTransaction:n})]}),o&&(0,H.jsx)(oc,{theme:r?.appearance.palette.colorScheme,onClick:o,children:"Choose another method"}),(0,H.jsx)(Fo,{onClick:t,children:"Not now"}),(0,H.jsx)(ee,{})]});default:return null}};var ri=require("react"),bc=x(require("styled-components"));function Cc(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ke=require("react/jsx-runtime"),Hf={google:{name:"Google",component:cs},discord:{name:"Discord",component:ss},github:{name:"Github",component:ls},linkedin:{name:"LinkedIn",component:ds},twitter:{name:"Twitter",component:us},tiktok:{name:"Tiktok",component:ps},apple:{name:"Apple",component:as}},js=()=>{let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),jt.del(nn),window.history.pushState({},"",e)},Gf=()=>{let{ready:e,user:t,authenticated:o}=V(),{app:r,setModalData:n,navigate:i,resetNavigation:a}=_(),{getAuthMeta:s,initLoginWithOAuth:l,loginWithOAuth:c,updateWallets:m,setReadyToTrue:h,closePrivyModal:w}=R(),[v,T]=(0,ri.useState)(!1),[y,E]=(0,ri.useState)(void 0),b=s()?.provider||"google",M=Hf[b].name,L=Hf[b].component,O=r?.render.inDialog?Et:0;(0,ri.useEffect)(()=>{c(b).then(()=>{js(),T(!0)}).catch(I=>{let F={retryable:!1,message:"Authentication failed"};if(I?.privyErrorCode==="allowlist_rejected"){E(void 0),a(),i("ALLOWLIST_REJECTION_SCREEN"),js();return}else I?.privyErrorCode==="linked_to_another_user"?F.detail="This account has already been linked to another user.":I?.privyErrorCode==="invalid_credentials"?(F.retryable=!0,F.detail="Something went wrong. Try again."):I.privyErrorCode==="oauth_user_denied"&&(F.detail=`Retry and check ${Cc(b)} to finish connecting your account.`,F.retryable=!0);js(),E(F)}).finally(()=>{h()})},[]),(0,ri.useEffect)(()=>{if(e&&o&&v&&t)if(er(t,r?.embeddedWallets?.createOnLogin)){let F=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:Y=>console.error(Y),callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},O);return()=>clearTimeout(F)}else{let F=setTimeout(w,O);return m(),()=>clearTimeout(F)}},[e,o,v,t]);let W=v?`Successfully connected with ${M}`:y?y.message:`Verifying connection to ${M}`,A="";return v?A="You\u2019re good to go!":y?A=y.detail:A="Just a few moments more",(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(S,{}),(0,Ke.jsx)(Q,{}),(0,Ke.jsxs)(_v,{children:[(0,Ke.jsx)(kv,{children:(0,Ke.jsxs)("div",{children:[(0,Ke.jsx)(Ia,{success:v,fail:!!y}),(0,Ke.jsx)(L,{style:{width:"38px",height:"38px"}})]})}),(0,Ke.jsxs)(sr,{children:[(0,Ke.jsx)("h3",{children:W}),(0,Ke.jsx)("p",{children:A})]}),y&&y?.retryable?(0,Ke.jsx)(La,{onClick:()=>{js(),l(b),E(void 0)},disabled:!v&&!y?.retryable,children:"Retry"}):null]}),(0,Ke.jsx)(ee,{})]})},_v=bc.default.div`
|
|
2059
2059
|
display: flex;
|
|
2060
2060
|
flex-direction: column;
|
|
2061
2061
|
align-items: center;
|
|
@@ -2063,7 +2063,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2063
2063
|
margin-left: 27px;
|
|
2064
2064
|
margin-right: 27px;
|
|
2065
2065
|
gap: 24px;
|
|
2066
|
-
`,
|
|
2066
|
+
`,kv=bc.default.div`
|
|
2067
2067
|
display: flex;
|
|
2068
2068
|
flex-direction: column;
|
|
2069
2069
|
justify-content: center;
|
|
@@ -2086,55 +2086,55 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2086
2086
|
left: -19px;
|
|
2087
2087
|
top: -19px;
|
|
2088
2088
|
}
|
|
2089
|
-
`;var Ui=require("react"),$f=x(require("styled-components"));var zf=require("react-device-detect");var Vf=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!tr()&&zf.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};var lt=require("react/jsx-runtime"),jf=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=(0,Ui.useState)(""),[i,a]=(0,Ui.useState)(!1);(0,Ui.useEffect)(()=>{t&&o&&e().then(n)},[t,o]);let s=Vf(r,!i),l={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(l.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(l.title="Still here?",l.description="You may need to install the Phantom mobile app.",l.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(S,{},"header"),(0,lt.jsx)(Q,{}),(0,lt.jsx)(go,{title:l.title,description:l.description}),(0,lt.jsxs)(yo,{children:[(0,lt.jsx)(
|
|
2089
|
+
`;var Ui=require("react"),$f=x(require("styled-components"));var zf=require("react-device-detect");var Vf=(e,t)=>{let o=new URL(window.location.href),r=encodeURIComponent(o.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!tr()&&zf.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};var lt=require("react/jsx-runtime"),jf=()=>{let{forkSession:e,ready:t,authenticated:o}=V(),[r,n]=(0,Ui.useState)(""),[i,a]=(0,Ui.useState)(!1);(0,Ui.useEffect)(()=>{t&&o&&e().then(n)},[t,o]);let s=Vf(r,!i),l={title:"Redirecting to Phantom Mobile Wallet",description:"We'll take you to the Phantom Mobile Wallet app to continue your login experience.",footnote:""};return t&&(l.description="For the best experience, we'll automatically log you into the Phantom Mobile Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),i&&(l.title="Still here?",l.description="You may need to install the Phantom mobile app.",l.footnote="Once you're done, you can return here or connect via Phantom's in-app browser."),(0,lt.jsxs)(lt.Fragment,{children:[(0,lt.jsx)(S,{},"header"),(0,lt.jsx)(Q,{}),(0,lt.jsx)(go,{title:l.title,description:l.description}),(0,lt.jsxs)(yo,{children:[(0,lt.jsx)(Av,{children:(0,lt.jsx)(po,{style:{width:"72px",height:"72px"}})}),(0,lt.jsx)(Ma,{href:s,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!s,children:i?"Go to App Store":"Continue"}),l.footnote?(0,lt.jsx)("p",{children:l.footnote}):null]}),(0,lt.jsx)(Z,{}),(0,lt.jsx)(G,{protectedByPrivy:!0})]})},Av=(0,$f.default)(Bo)`
|
|
2090
2090
|
margin: 16px auto;
|
|
2091
|
-
`;var Qf=require("@ethersproject/providers"),Me=require("react"),Yr=x(require("styled-components"));function qf(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var qs=require("@ethersproject/bignumber"),Kf=x(require("styled-components"));var Ao=require("react/jsx-runtime"),
|
|
2091
|
+
`;var Qf=require("@ethersproject/providers"),Me=require("react"),Yr=x(require("styled-components"));function qf(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var qs=require("@ethersproject/bignumber"),Kf=x(require("styled-components"));var Ao=require("react/jsx-runtime"),Rv=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let o=qs.BigNumber.from(e.gasUsed),r=qs.BigNumber.from(e.effectiveGasPrice),n=o.mul(r);if(t){let i=qs.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},Yf=({txn:e,receipt:t,transactionInfo:o,onClose:r,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a})=>(0,Ao.jsxs)(Ao.Fragment,{children:[(0,Ao.jsx)(S,{onClose:r}),(0,Ao.jsx)(hi,{title:"Transaction complete!",description:"You're all set."}),(0,Ao.jsx)(Qn,{tokenPrice:n,from:t.from,to:t.to,gas:Rv(t,a),txn:e,transactionInfo:o,tokenSymbol:i}),(0,Ao.jsx)(Iv,{loading:!1,onClick:r,children:"All Done"}),(0,Ao.jsx)(ee,{})]}),Iv=(0,Kf.default)(B)`
|
|
2092
2092
|
&& {
|
|
2093
2093
|
margin-top: 24px;
|
|
2094
2094
|
}
|
|
2095
2095
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2096
|
-
`;var se=require("react/jsx-runtime");var
|
|
2096
|
+
`;var se=require("react/jsx-runtime");var Wv=({txn:e,txnFamily:t,uiOptions:o,tokenSymbol:r,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(o.transactionInfo?.contractInfo)return(0,se.jsx)(pc,{contractInfo:o.transactionInfo.contractInfo,description:o.description});if(o.senderInfo)return(0,se.jsx)(pc,{contractInfo:o.senderInfo,description:o.description||o.senderInfo.actionText})}return(0,se.jsx)(se.Fragment,{children:(0,se.jsx)(Af,{description:o.description||o.transactionInfo?.description||"",txn:e,tokenSymbol:r,tokenPrice:n})})},Zf=()=>{let{authenticated:e,getAccessToken:t}=V(),{wallets:o}=ti(),{walletProxy:r,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:s,nativeTokenSymbolForChainId:l}=R(),{app:c,navigate:m,data:h,onUserCloseViaDialogOrKeybindRef:w,setModalData:v}=_(),{transactionRequest:T,onSuccess:y,onFailure:E,uiOptions:b,fundWalletConfig:M}=h.sendTransaction,[L,O]=(0,Me.useState)(null),[W,A]=(0,Me.useState)(null),[I,F]=(0,Me.useState)(""),[Y,$]=(0,Me.useState)(),[k,X]=(0,Me.useState)(!1),be=()=>{F(""),$(void 0)},Le=(dt,Ye,pt)=>{F(dt),$(new rt(new co(Ye??dt,pt??ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[U,tt]=(0,Me.useState)(!1),[Be,Ee]=(0,Me.useState)(!0),[zt,ct]=(0,Me.useState)(null),[me,He]=(0,Me.useState)(T),{tokenPrice:Mo,isTokenPriceLoading:Qr}=Gs(me),J=l(T.chainId)||"ETH",[At,Sr]=(0,Me.useState)(null),[Zr,Xr]=(0,Me.useState)(null),[Gi,zi]=(0,Me.useState)(!0);(0,Me.useEffect)(()=>{e||(m("LANDING"),E(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let ot=(0,Me.useMemo)(()=>o.find(dt=>dt.walletClientType==="privy"),[o]),ye=async()=>{if(!ot)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:dt,externalTransactionId:Ye}=await i(ot.address,{config:M?.config||{}});v({fiatOnRampPrompt:{signedUrl:dt},fiatOnRampStatus:{externalTransactionId:Ye}}),m("FIAT_ON_RAMP_PROMPT_SCREEN")},Vt=(0,Me.useMemo)(()=>new Qf.StaticJsonRpcProvider(Kt(me.chainId,s,a)),[me.chainId,a]);(0,Me.useEffect)(()=>{let dt=()=>{Ee(!1),Le("Wallet has insufficient funds for this transaction."),c?.fiatOnRamp.enabled&&X(!0)};async function Ye(){let pt=me;if(!(!await t()||!r||!ot)){try{pt=await Xn(ot.address,me,Vt),He(pt)}catch($t){Jp($t)?dt():Le("There was an error preparing your transaction. Please try again.",$t.reason)}try{let $t=await Bs(pt,Vt);Sr(Se($t.toBigInt()).toHexString());let tn=await hc(me,Vt);Xr(Se(tn.toBigInt()).toHexString())}catch{Sr(null)}try{let{balance:$t,hasSufficientFunds:tn}=await Of(ot.address,pt,Vt);ct($t.toHexString()),tn||dt()}catch($t){console.warn(`Failed to fetch wallet balance with error: ${$t}`)}zi(!1)}}Ye()},[r]);let Vi=qf(me),Ge=Vi==="SEND"?`Send ${J}`:"Review transaction",Lo={modalTitle:b.header||b.modalTitle||Ge,buttonText:b.buttonText||"Submit"},en=()=>{U||(W?y(W):E(Y||new rt(new co("The user rejected the request",ut.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return w.current=en,Mo===void 0&&Qr||Gi?(0,se.jsxs)(se.Fragment,{children:[b.transactionInfo?.contractInfo?.imgUrl&&(0,se.jsx)(wa,{src:b.transactionInfo?.contractInfo?.imgUrl}),(0,se.jsx)(S,{title:Lo.modalTitle,onClose:en}),(0,se.jsx)(Jf,{children:(0,se.jsx)(Rn,{})})]}):L!==null?(0,se.jsx)(Yf,{txn:me,onClose:en,receipt:L,transactionInfo:b.transactionInfo,tokenPrice:Mo,tokenSymbol:J,l1GasEstimate:Zr}):(0,se.jsxs)(se.Fragment,{children:[(0,se.jsx)(S,{title:Lo.modalTitle,onClose:en}),(0,se.jsxs)(Jf,{children:[(0,se.jsxs)(Ov,{children:[(0,se.jsx)(Wv,{txn:me,txnFamily:Vi,uiOptions:b,tokenSymbol:J,tokenPrice:Mo}),ot?(0,se.jsx)(Qn,{from:ot.address,to:me.to,txn:me,transactionInfo:b.transactionInfo,gas:At||void 0,tokenPrice:Mo,tokenSymbol:J}):null]}),(0,se.jsxs)(Dv,{children:[(0,se.jsx)(Mv,{children:I}),(0,se.jsx)(_f,{txn:me,address:ot?.address??"",hasFunds:Be,balance:zt}),(0,se.jsxs)(Lv,{children:[k&&(0,se.jsx)(B,{onClick:ye,children:"Add Funds"}),(0,se.jsx)(Nv,{disabled:U||!Be,loading:!r||U,loadingText:U?"Submitting (may take a few minutes)...":"Loading...",onClick:async()=>{tt(!0);let dt=await t();if(dt&&!U&&ot)try{let Ye=await Fs(dt,ot.address,r,me,Vt);A(Ye);let pt=await Ye.wait();O(Hs(pt)),be()}catch(Ye){let pt="There was an error processing your transaction. Please contact support.";console.warn({transaction:me,error:Ye}),Le(pt,Ye.reason)}finally{tt(!1)}},children:Lo.buttonText})]})]})]})]})},Jf=Yr.default.div`
|
|
2097
2097
|
display: flex;
|
|
2098
2098
|
flex-direction: column;
|
|
2099
2099
|
justify-content: space-between;
|
|
2100
2100
|
flex-grow: 1;
|
|
2101
2101
|
padding-bottom: 16px;
|
|
2102
|
-
`,
|
|
2102
|
+
`,Mv=Yr.default.div`
|
|
2103
2103
|
font-size: 13px;
|
|
2104
2104
|
color: var(--privy-color-error);
|
|
2105
2105
|
width: 100%;
|
|
2106
2106
|
margin-top: 16px;
|
|
2107
|
-
`,
|
|
2107
|
+
`,Lv=Yr.default.div`
|
|
2108
2108
|
display: flex;
|
|
2109
2109
|
direction: row;
|
|
2110
2110
|
justify-content: space-between;
|
|
2111
2111
|
align-items: center;
|
|
2112
2112
|
gap: 8px;
|
|
2113
|
-
`,
|
|
2113
|
+
`,Nv=(0,Yr.default)(B)`
|
|
2114
2114
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2115
|
-
`,
|
|
2115
|
+
`,Ov=Yr.default.div`
|
|
2116
2116
|
height: 100%;
|
|
2117
2117
|
display: flex;
|
|
2118
2118
|
flex-direction: column;
|
|
2119
2119
|
justify-content: space-evenly;
|
|
2120
2120
|
flex-grow: 1;
|
|
2121
|
-
`,
|
|
2121
|
+
`,Dv=Yr.default.div`
|
|
2122
2122
|
display: flex;
|
|
2123
2123
|
flex-direction: column;
|
|
2124
2124
|
gap: 8px;
|
|
2125
|
-
`;var Xf=require("@ethersproject/bytes"),eh=require("@ethersproject/strings"),Er=require("react"),Ro=x(require("styled-components"));var Fe=require("react/jsx-runtime"),
|
|
2125
|
+
`;var Xf=require("@ethersproject/bytes"),eh=require("@ethersproject/strings"),Er=require("react"),Ro=x(require("styled-components"));var Fe=require("react/jsx-runtime"),Uv=e=>{if(!(0,Xf.isHexString)(e))return e;try{return(0,eh.toUtf8String)(e)}catch{return e}},th=()=>{let{authenticated:e}=V(),{initializeWalletProxy:t,closePrivyModal:o}=R(),{navigate:r,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,s]=(0,Er.useState)(!0),[l,c]=(0,Er.useState)(""),[m,h]=(0,Er.useState)(),[w,v]=(0,Er.useState)(null),T=w!==null;(0,Er.useEffect)(()=>{e||r("LANDING")},[e]),(0,Er.useEffect)(()=>{t(sn).then(A=>{s(!1),A||(c("An error has occurred, please try again."),h(new rt(new co(l,ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{message:y,confirmAndSignMessage:E,onSuccess:b,onFailure:M,uiOptions:L}=n.signMessage,O={title:L.title||"Sign message",description:L.description||"Signing this message will not cost you any fees.",buttonText:L.buttonText||"Sign and continue"},W=A=>{A?b(A):M(m||new rt(new co("The user rejected the request.",ut.E4001_USER_REJECTED_REQUEST.eipCode))),o({shouldCallAuthOnSuccess:!1}),v(null),c(""),h(void 0)};return i.current=()=>{W(w)},(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(S,{onClose:()=>W(w)}),(0,Fe.jsx)(Q,{}),(0,Fe.jsxs)(Fv,{children:[(0,Fe.jsx)(Bv,{children:O.title}),(0,Fe.jsx)(Hv,{children:O.description}),(0,Fe.jsx)(Gv,{children:Uv(y)}),(0,Fe.jsx)(zv,{fail:!0,children:l}),(0,Fe.jsx)($v,{success:T,loading:a,disabled:T,onClick:async()=>{try{let A=await E();v(A),c(""),setTimeout(()=>{W(A)},Et)}catch{c("An error has occurred, please try again."),h(new rt(new co(l,ut.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:T?(0,Fe.jsxs)(Vv,{children:[(0,Fe.jsx)(ms,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,Fe.jsx)("span",{children:"Success"})]}):O.buttonText})]}),(0,Fe.jsx)(Z,{}),(0,Fe.jsx)(G,{protectedByPrivy:!0})]})},Fv=Ro.default.div`
|
|
2126
2126
|
display: flex;
|
|
2127
2127
|
flex-direction: column;
|
|
2128
2128
|
align-items: center;
|
|
2129
2129
|
justify-content: center;
|
|
2130
|
-
`,
|
|
2130
|
+
`,Bv=Ro.default.span`
|
|
2131
2131
|
color: var(--privy-color-foreground);
|
|
2132
2132
|
text-align: center;
|
|
2133
2133
|
font-size: 1.125rem;
|
|
2134
2134
|
font-weight: 500;
|
|
2135
2135
|
line-height: 1.25rem; /* 111.111% */
|
|
2136
2136
|
text-align: center;
|
|
2137
|
-
`,
|
|
2137
|
+
`,Hv=Ro.default.span`
|
|
2138
2138
|
margin-top: 4px;
|
|
2139
2139
|
color: var(--privy-color-foreground);
|
|
2140
2140
|
text-align: center;
|
|
@@ -2144,7 +2144,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2144
2144
|
font-weight: 400;
|
|
2145
2145
|
line-height: 20px; /* 142.857% */
|
|
2146
2146
|
letter-spacing: -0.008px;
|
|
2147
|
-
`,
|
|
2147
|
+
`,Gv=Ro.default.div`
|
|
2148
2148
|
margin-top: 1.5rem;
|
|
2149
2149
|
background-color: var(--privy-color-background-2);
|
|
2150
2150
|
border-radius: var(--privy-border-radius-md);
|
|
@@ -2162,7 +2162,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2162
2162
|
&::-webkit-scrollbar {
|
|
2163
2163
|
display: none; /* Safari and Chrome */
|
|
2164
2164
|
}
|
|
2165
|
-
`,
|
|
2165
|
+
`,zv=Ro.default.div`
|
|
2166
2166
|
line-height: 20px;
|
|
2167
2167
|
height: 20px;
|
|
2168
2168
|
font-size: 13px;
|
|
@@ -2172,11 +2172,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2172
2172
|
width: 100%;
|
|
2173
2173
|
margin-top: 16px;
|
|
2174
2174
|
margin-bottom: 4px;
|
|
2175
|
-
`,
|
|
2175
|
+
`,Vv=Ro.default.span`
|
|
2176
2176
|
display: flex;
|
|
2177
2177
|
align-items: center;
|
|
2178
2178
|
gap: 8px;
|
|
2179
|
-
`,$
|
|
2179
|
+
`,$v=(0,Ro.default)(B)`
|
|
2180
2180
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2181
2181
|
|
|
2182
2182
|
${e=>e.success&&Ro.css`
|
|
@@ -2185,7 +2185,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2185
2185
|
color: #ffffff;
|
|
2186
2186
|
}
|
|
2187
2187
|
`}
|
|
2188
|
-
`;var Ks=x(require("styled-components"));var
|
|
2188
|
+
`;var Ks=x(require("styled-components"));var jv=`
|
|
2189
2189
|
*,
|
|
2190
2190
|
::before,
|
|
2191
2191
|
::after {
|
|
@@ -2415,7 +2415,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2415
2415
|
[hidden] {
|
|
2416
2416
|
display: none;
|
|
2417
2417
|
}
|
|
2418
|
-
`,oh=
|
|
2418
|
+
`,oh=jv;var rh=Ks.createGlobalStyle`
|
|
2419
2419
|
:root {
|
|
2420
2420
|
// Borders
|
|
2421
2421
|
--privy-border-radius-sm: 6px;
|
|
@@ -2509,4 +2509,4 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2509
2509
|
opacity: 1;
|
|
2510
2510
|
}
|
|
2511
2511
|
}
|
|
2512
|
-
`;var ih=require("@marsidev/react-turnstile"),Ys=require("react");var Ec=require("react/jsx-runtime"),Fi=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,ref:a}=ke(),[,s]=(0,Ys.useMemo)(()=>o?.split("t:")||[],[o]);if((0,Ys.useEffect)(()=>a.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Ec.jsx)("div",{className:"hidden h-0 w-0",children:(0,Ec.jsx)(ih.Turnstile,{...e,ref:a,siteKey:s,options:{action:r,size:"invisible"},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed")},onSuccess:l=>{e.onSuccess?.(l),i(l)},onExpire:()=>{e.onExpire?.();try{a.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var ge=require("react/jsx-runtime"),q1={["LANDING"]:Rm,["AWAITING_PASSWORDLESS_CODE"]:Tp,["AWAITING_CONNECTION"]:Vp,["AWAITING_CONNECT_ONLY_CONNECTION"]:qp,["PHANTOM_INTERSTITIAL_SCREEN"]:jf,["LOGIN_FAILED_SCREEN"]:Dm,["AWAITING_OAUTH_SCREEN"]:Gf,["ALLOWLIST_REJECTION_SCREEN"]:fp,["INSTALL_PHANTOM_SCREEN"]:am,["LINK_EMAIL_SCREEN"]:Wm,["LINK_PHONE_SCREEN"]:Lm,["LINK_WALLET_SCREEN"]:Nm,["CONNECT_ONLY_LANDING_SCREEN"]:Fp,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Mp,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Du,["EMBEDDED_WALLET_CREATED_SCREEN"]:ru,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:eu,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Vu,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:lu,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:th,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Zf,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ju,["FIAT_ON_RAMP_STATUS_SCREEN"]:Zu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Gu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Uu,["MFA_ENROLLMENT_FLOW_SCREEN"]:lf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:tm},K1=["LANDING","AWAITING_CONNECTION","LINK_EMAIL_SCREEN","LINK_PHONE_SCREEN","LINK_WALLET_SCREEN","MFA_ENROLLMENT_FLOW_SCREEN"],Y1=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=V(),{headless:n}=R(),{ready:i,currentScreen:a}=_(),{status:s,reset:l}=ke(),c=(0,Pr.useRef)(null),m=np(c);(0,Pr.useEffect)(()=>{["success","error"].includes(s),r&&!n&&l()},[r]);let h=a&&K1.includes(a)&&!n;if((!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,ge.jsxs)(jn,{children:[h?(0,ge.jsx)(Fi,{}):null,(0,ge.jsx)(S,{}),(0,ge.jsx)(Q,{}),(0,ge.jsx)(zm,{children:(0,ge.jsx)(ho,{})}),(0,ge.jsx)(Z,{}),(0,ge.jsx)(ee,{})]});if(!a&&e)return(0,ge.jsx)(jn,{style:{height:m},children:(0,ge.jsx)("div",{ref:c,children:(0,ge.jsx)(wc,{open:e,onClose:t})})});if(!a)return null;let w=q1[a];return(0,ge.jsxs)(jn,{style:{height:m},children:[h?(0,ge.jsx)(Fi,{}):null,(0,ge.jsxs)("div",{ref:c,children:[(0,ge.jsx)(Go,{if:!!e,children:(0,ge.jsx)(w,{})}),(0,ge.jsx)(Go,{if:!e,children:(0,ge.jsx)(wc,{open:e,onClose:t})})]})]})},J1=()=>{let{closePrivyModal:e}=R(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,Pr.useCallback)(()=>{if(t?.current)t.current(),t.current=null;else return e({shouldCallAuthOnSuccess:!1})},[e])}},sh=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:o}=J1(),[r,n]=(0,Pr.useState)(!1);Aa({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,ge.jsx)(nh,{children:(0,ge.jsx)(Y1,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,s=t?.render.inDialog?(0,ge.jsx)(Gm,{open:a,id:"privy-dialog",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let l=document.getElementById(t.render.inParentNodeId);if(l)return ah.default.createPortal(s,l)}return s};var Ht={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:id,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Q1=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),Z1=e=>Q1.has(e),X1=(e,t,o)=>o.indexOf(e)===t,lh=({input:e})=>e?e.filter(Z1).filter(X1):Ht.appearance.walletList;var ch={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var dh={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var ph={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var uh={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var mh={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var fh={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var hh={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var yh={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var gh={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var vh={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Js={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var wh={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Ch={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var ni=[_s,ks,As,hh,Ch,Js,Ms,Ls,Ns,Oi,Di,ph,uh,mh,fh,Rs,Is,Ws,gh,vh,ch,dh,Os,Us,Ds,yh,wh],T8=new Set(ni.map(e=>e.id));var xr=x(require("tinycolor2")),bh="#FFFFFF",ew="#000000",tw=bh,ow="#1E1E1D";function rw(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Tr(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,xr.default)({...e.toHsl(),l:o})}function Eh({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=bh,blackHex:a=ew}){let s;switch(e){case"light":s=tw;break;case"dark":s=ow;break;default:s=e;break}let l=(0,xr.default)(s),c=(0,xr.default)(t),m=(0,xr.default)(o),h=(0,xr.default)(r),w=(0,xr.default)(n),v=rw(l.getLuminance()),T=Tr(l,v==="light"?-.04:.11),y=Tr(l,v==="light"?-.88:.87),E=Tr(l,v==="light"?-.77:.75),b=Tr(l,v==="light"?-.43:.45).desaturate(v==="light"?60:20),M=Tr(l,v==="light"?-.08:.25).desaturate(v==="light"?60:20),L=Tr(c,.15),O=Tr(c,-.06),W=(0,xr.default)(c.getLuminance()>.5?a:i),A=Tr(m,-.16);return{colorScheme:v,background:l.toHslString(),background2:T.toHslString(),foreground:y.toHslString(),foreground2:E.toHslString(),foreground3:b.toHslString(),foreground4:M.toHslString(),accent:c.toHslString(),accentLight:L.toHslString(),accentDark:O.toHslString(),foregroundAccent:W.toHslString(),success:m.toHslString(),successDark:A.toHslString(),error:w.toHslString(),warn:h.toHslString()}}function Qs(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(Y=>o.includes(Y)),n,i,a,s,l,c,m,h,w,v;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),a=t.loginMethods.includes("wallet"),s=r?.includes("google"),l=r?.includes("twitter"),c=r?.includes("discord"),m=r?.includes("tiktok"),w=r?.includes("github"),h=r?.includes("linkedin"),v=r?.includes("apple")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,s=e.googleOAuth,l=e.twitterOAuth,c=e.discordOAuth,w=e.githubOAuth,m=e.tiktokOAuth,h=e.linkedinOAuth,v=e.appleOAuth);let T=[n,i].filter(Boolean),y=[s,l,c,w,m,h,v].filter(Boolean),E=[a].filter(Boolean);if(T.length+y.length+E.length===0)throw new Error("You must enable at least one login method");let b=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;b&&E.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),b=!1):!b&&y.length+T.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),b=!0);let M=lh({isWalletLoginEnabled:a,input:t?.appearance?.walletList});if(t?.embeddedWallets?.waitForTransactionConfirmation===!1&&t.embeddedWallets.noPromptOnSignature!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you also enable `config.embeddedWallets.noPromptOnSignature`");let L=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:W}=nw(t?.additionalChains,t?.supportedChains,t?.defaultChain),A=!!t?.defaultChain||!!t?.supportedChains,I=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Eh({backgroundTheme:t?.appearance?.theme??Ht.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ht.appearance.accentColor}),loginGroupPriority:b?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M},loginMethods:{wallet:a,email:n,sms:i,google:s,twitter:l,discord:c,github:w,tiktok:m,linkedin:h,apple:v},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ht.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ht.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ht.rpcConfig.rpcTimeouts},chains:O,defaultChain:W,intl:{defaultCountry:L},shouldSwitchChainOnConnect:A,captchaEnabled:e.captchaEnabled??Ht.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...I?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:I?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ht.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Ht._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ht._render.inParentNodeId}}}function Ph(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:o,additionalChains:r,supportedChains:n,defaultChain:i,...a}=e;return{...a,...r?{additionalChains:r.map(l=>l.id)}:void 0,...n?{supportedChains:n.map(l=>l.id)}:void 0,...i?{defaultChain:i.id}:void 0,...o?{...o,...o.logo&&typeof o.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function nw(e,t,o){let r;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");r=t.map(a=>ni.find(l=>l.id===a.id)??a)}else r=ni.concat(e??[]);let n=t?r[0]:Js,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}var Xs=require("react");var Zs=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;case"privy:mfa:verify":return r;case"privy:mfa:init-enrollment":return r;case"privy:mfa:submit-enrollment":return r;case"privy:mfa:unenroll":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Jr(e,t,o,r,n,i=!1){let a=i,s=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Ve("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((w,v)=>{o.current={resolve:w,reject:v};let T=1e3*60*5;setTimeout(()=>{let y=new Ve("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(y),v(y)},T)});return await e(h)}return await e()},l=4,c=null;for(let m=0;m<l;m++)try{c=await s(m),r.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),h}if(c===null){let m=new Ve("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(m),m}return c}var xh=require("react/jsx-runtime"),iw=function(e){return()=>`id-${e++}`}(0);function aw(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Io(e){return e.error!==void 0}var ao=new Zs,Pc=new Map,sw=(e,t)=>typeof t=="bigint"?t.toString():t,lw=(e,t)=>`${e}${JSON.stringify(t,sw)}`;function Wo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=lw(e,t);if(e==="privy:wallet:create"){let a=Pc.get(n);if(a)return a}let i=new Promise((a,s)=>{let l=iw();ao.enqueue(l,{resolve:a,reject:s}),r.postMessage({id:l,event:e,data:t},"*")}).finally(()=>{Pc.delete(n)});return Pc.set(n,i),i}function cw(e){switch(e.event){case"privy:iframe:ready":let t=ao.dequeue(e.event,e.id);return Io(e)?t.reject(new Ve(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=ao.dequeue(e.event,e.id);return Io(e)?o.reject(new Ve(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=ao.dequeue(e.event,e.id);return Io(e)?r.reject(new Ve(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=ao.dequeue(e.event,e.id);return Io(e)?n.reject(new Ve(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=ao.dequeue(e.event,e.id);return Io(e)?i.reject(new Ve(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=ao.dequeue(e.event,e.id);return Io(e)?a.reject(new Ve(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let s=ao.dequeue(e.event,e.id);return Io(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}case"privy:mfa:submit-enrollment":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}case"privy:mfa:unenroll":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Th(e){let t=(0,Xs.useRef)(null),o=sp();return(0,Xs.useEffect)(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&aw(c.data)&&cw(c.data)}let i={create(c){return Wo("privy:wallet:create",c,r)},connect(c){return Wo("privy:wallet:connect",c,r)},recover(c){return Jr(m=>Wo("privy:wallet:recover",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return Jr(m=>Wo("privy:wallet:rpc",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return Jr(m=>Wo("privy:wallet:set-recovery-password",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return Jr(m=>Wo("privy:mfa:verify",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return Jr(m=>Wo("privy:mfa:init-enrollment",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return Wo("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return Jr(m=>Wo("privy:mfa:unenroll",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),s=(...c)=>{console.warn("Privy iframe failed to load: ",...c),e.onLoadFailed()},l=new AbortController;return Cd(()=>Wo("privy:iframe:ready",{},r),{abortSignal:l.signal}).then(a,s),()=>{window.removeEventListener("message",n),l.abort()}},[t.current,e.mfaMethods]),(0,xh.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:ca(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}var el=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set when initialzing authentication.");try{let t=td();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Mfa flow has no API instance");if(!this.meta.smsCode)throw new C("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set prior to calling authenticate.");try{let t=od(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return qt(o)}catch(t){throw fe(t)}}};var Gt=require("react/jsx-runtime"),Hi;function dw(e){return typeof e=="string"&&e.length===25}function ze(){if(!Hi){let e=re.get(kr);return Promise.resolve(e||null)}return Hi.getAccessToken()}var _h,Sd=(e,t)=>_h(e,t),kh,_d=(e,t)=>kh(e,t),Ah,kd=()=>Ah(),pw=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;re.put(ci,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Rh=({config:e,...t})=>{if(!dw(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");Hi||(Hi=new Cn({appId:t.appId,apiUrl:t.apiUrl||oa}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Gt.jsx)(uw,{...t,config:o,client:Hi})},uw=e=>{let t=e.client,[o,r]=(0,z.useState)(!1),[n,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(!1),[l,c]=(0,z.useState)(null),[m,h]=(0,z.useState)(!1),[w,v]=(0,z.useState)([]),T=(0,z.useRef)(w),[y,E]=(0,z.useState)(!1),[b,M]=(0,z.useState)(null),[L,O]=(0,z.useState)(!1),[W,A]=(0,z.useState)({status:"disconnected",connectError:null,connector:null,connectRetry:P}),[I,F]=(0,z.useState)(null),[Y,$]=(0,z.useState)(null),[k,X]=(0,z.useState)(null),[be,Le]=(0,z.useState)({showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""}),[U,tt]=(0,z.useState)(()=>{let p=Ph(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",p),Qs(be,e.config)}),[Be,Ee]=(0,z.useState)(!0),[zt,ct]=(0,z.useState)({}),[me,He]=(0,z.useState)(null),[Mo,Qr]=(0,z.useState)(null),[J,At]=(0,z.useState)(!1),[Sr,Zr]=(0,z.useState)(!1),Xr=(0,z.useRef)(null),Gi=(0,z.useRef)(null),[zi,ot]=(0,z.useState)(null),ye=(0,z.useRef)(ip);t.onStoreToken=p=>{p&&we(ye,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{we(ye,"accessToken","onAccessTokenRemoved")};let Vt=(0,z.useRef)(),Vi=(0,z.useCallback)(p=>{let d=t.connectors?.walletsReady||!1;return a&&l?.linkedAccounts?.some(g=>g.type==="wallet"&&g.walletClientType==="privy")?d&&p?.some(g=>g?.walletClientType==="privy"):d},[a,l?.linkedAccounts,t?.connectors?.walletsReady]),Ge=p=>{M(p),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:p})},Lo=p=>{U.embeddedWallets.createOnLogin!=="off"&&Ee(!0),Ge(p)};(0,z.useEffect)(()=>{if(!k||!l){t.connectors?.removeEmbeddedWalletConnector();return}let p=l?.linkedAccounts.filter(d=>d.type==="wallet"&&d.walletClient==="privy");if(p&&p.length>0){let d=p[0].address;t.connectors?.addEmbeddedWalletConnector(k,d,U.defaultChain)}},[k,l]),(0,z.useEffect)(()=>{k&&Mo?.(k)},[k]),(0,z.useEffect)(()=>{(async()=>{if(!U.customAuth?.enabled)return;Ee(!0);let{getCustomAccessToken:d,isLoading:f}=U.customAuth;if(!(!n||f))try{let g=await d();if(!g){await ai.logout();return}if(a)return;t.startAuthFlow(new rn(g));let{user:N,isNewUser:ne}=await t.authenticate();N||await ai.logout(),c(N||null),E(ne||!1),s(!0),Zr(!0)}catch(g){console.warn(g),a&&await ai.logout()}})()},[U.customAuth?.enabled,U.customAuth?.getCustomAccessToken,U.customAuth?.isLoading,n,a]),(0,z.useEffect)(()=>{Sr&&k&&l&&er(l,e.config?.embeddedWallets?.createOnLogin)&&(Zr(!1),_c(l,sn).catch(console.error))},[Sr&&k&&l]),(0,z.useEffect)(()=>{async function p(){let d=await t.getServerConfig();Le(d);let f=Qs(d,e.config);tt(f),d.customApiUrl&&t.updateApiUrl(d.customApiUrl);let g=en();pw();let N=(0,Sh.createStore)();F(N),t.initializeConnectorManager(f.walletConnectCloudProjectId,f.rpcConfig,f.chains,f.defaultChain,N,f.appearance.walletList),await t.connectors?.initialize();let ne=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(s(!!ne),ne&&we(ye,"login","onComplete",ne,!1,!0,null),c(ne)),g||Ne.setReadyToTrue(),g&&ne&&h(!0),$t()}n||p()},[t,me,n]),(0,z.useEffect)(()=>{let p=Qs(be,e.config);tt(p)},[e.config,be]);let en=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_oauth_code"),f=p.get("privy_oauth_state"),g=p.get("privy_oauth_provider");return d&&f&&g?(t.startAuthFlow(new Xo(g,d,f)),Lo("AWAITING_OAUTH_SCREEN"),!0):!1},dt=async(p,d,f)=>{let g=await t.connectors?.createWalletConnector(p,d)||null;Ye(g,d,f)};async function Ye(p,d,f){if(!p)return A({status:"disconnected",connectError:new j("Unable to connect to wallet."),connector:null,connectRetry:P}),f?.(null);p instanceof mo&&d&&p.resetConnection(d),A({connector:p,status:"connecting",connectError:null,connectRetry:()=>Ye(p,d,f)});try{let g=await p.connect({showPrompt:!0});if(U.shouldSwitchChainOnConnect&&!U.chains.find(N=>N.id===Number(g?.chainId))&&!(g?.connectorType==="wallet_connect_v2"&&g?.walletClientType==="metamask")){A(N=>({...N,connector:p,status:"switching_to_supported_chain",connectError:null,connectRetry:P}));try{await g?.switchChain(U.defaultChain.id),g&&(g.chainId=ln(Wr(U.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${U.defaultChain.id}`)}}return A(N=>({...N,status:"connected",connectError:null,connectRetry:P})),g&&!L&&we(ye,"connectWallet","onSuccess",g),f?.(g)}catch(g){return g instanceof wt?(console.warn(g.cause?g.cause:g.message),L||we(ye,"connectWallet","onError",g.privyErrorCode||"generic_connect_wallet_error")):(console.warn(g),L||we(ye,"connectWallet","onError","unknown_connect_wallet_error")),A(N=>({...N,status:"disconnected",connectError:g})),f?.(null)}}async function pt(){return new Promise(async(p,d)=>{ot({resolve:p,reject:d});let f=1e3*30;setTimeout(()=>{if(!zi)return;let g=new C("Timed out waiting for Captcha");d(g)},f)})}let $i=async p=>{if(p===null)return;let d=new Rr(p);t.startAuthFlow(d)},$t=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),f=p.get("privy_wallet_client");if(!d||!f)return;if(f==="phantom"&&!tr()&&Lo("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Ge("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),dt(d,f,$i)};(0,z.useEffect)(()=>{n&&a&&l===null&&t.getAuthenticatedUser().then(c)},[n,a,l,t]);let tn=()=>{if(!a)throw new C("User must be authenticated before linking a wallet.");h(!0),Ge("LINK_WALLET_SCREEN")},$h=p=>{if(!a||!l)return!1;for(let d of l.linkedAccounts)if(d.type==="wallet"&&d.address===p.address)return!0;return!1},jh=async p=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;A(f=>({...f,connector:d,status:"connected",connectError:null,connectRetry:P})),await $i(p),Lo("AWAITING_CONNECTION")},qh=async(p,d)=>{Vt.current="siwe",await Ye(p,d,$i)},Sc=async(p,d)=>{if(!U.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:f,externalTransactionId:g}=await Ku(t,p,d?.config??{},U.appearance.palette,U.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:g}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},ji=()=>{v(p=>{let d=t.connectors?.wallets.map(f=>({...f,linked:$h(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");jh(f)},fund:async g=>{let{signedUrl:N,externalTransactionId:ne}=await Sc(f.address,g);ct({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:ne}}),Ge("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let g=await t.unlinkWallet(f.address);c(g)}}))||[];return At(Vi(d)),pa(p,d)?p:d})};(0,z.useEffect)(()=>{ji()},[l?.linkedAccounts,a,n]),(0,z.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");ji(),t.connectors.on("walletsUpdated",ji)}},[n]);let Kh=()=>{Ge(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,z.useEffect)(()=>{if(!w[0])return;let p=w[0],d=T.current.find(g=>g.address===p.address),f=l?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===p.address);if(!d&&f){let g=Object.assign({},l);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(g)}T.current=w},[w]);let _c=async(p,d)=>{if(ve(p))throw we(ye,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[g,N]=await Promise.all([Ne.initializeWalletProxy(d),ze()]);if(!g&&e.config?.customAuth?.enabled)throw we(ye,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!g||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((ne,Pe)=>{Ee(!0),ct({createWallet:{onSuccess:Rt=>{we(ye,"createWallet","onSuccess",Rt),ne(Rt)},onFailure:Rt=>{we(ye,"createWallet","onError","unknown_embedded_wallet_error"),Pe(Rt)},callAuthOnSuccessOnClose:!1}}),Ge("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await g.create({accessToken:N});let ne=await Ne.refreshUser(),Pe=ve(ne);if(!Pe)throw we(ye,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return we(ye,"createWallet","onSuccess",Pe),Pe}},Yh=p=>{if(!U.chains.map(d=>d.id).includes(p))throw new j(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},kc=(p,d,f)=>new Promise(async(g,N)=>{if(!a||!l){N(new Error("User must be authenticated before signing with a Privy wallet"));return}let ne=ve(l);if(!ne){N(new Error("Must have a Privy wallet before signing"));return}Ee(!0);let Pe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,on=p.chainId?Number(p.chainId):Pe.chainId;Yh(on);let Rt=Object.assign({},p,{chainId:on}),si=async()=>{let Qo=await ze();if(!Qo||!k){N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Ne.recoverEmbeddedWallet()){N(new Error("Unable to connect to wallet"));return}let Rc=new ii.StaticJsonRpcProvider(Kt(Rt.chainId,U.chains,U.rpcConfig)),Qh=await Xn(ne.address,Rt,Rc),Zh=await Fs(Qo,ne.address,k,Qh,Rc);g(Zh)}catch(qi){N(qi)}};if(U.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),si();else{let Qo={transactionRequest:Rt,onSuccess:g,onFailure:N,uiOptions:d||{},fundWalletConfig:f},qi={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:N};ct({connectWallet:qi,sendTransaction:Qo}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ac(){return new Promise(async(p,d)=>{let f=await ze();if(!f||!k)throw new Error("Must have valid access token to enroll in MFA");try{await k.verifyMfa({accessToken:f}),p()}catch(g){d(g)}})}let ai={ready:n,authenticated:a,user:l,walletConnectors:t.connectors||null,connectWallet:Kh,linkWallet:tn,linkEmail:()=>{if(!a)throw new C("User must be authenticated before linking an email address.");if(l?.email)throw new C("User already has an email linked to their account.");h(!0),Ge("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new C("User must be authenticated before linking a phone number.");if(l?.phone)throw new C("User already has a phone number linked to their account.");h(!0),Ge("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new C("User must be authenticated before linking a Google account.");if(l?.google)throw new C("User already has a Google account linked to their account.");await Ne.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new C("User must be authenticated before linking a Twitter account.");if(l?.twitter)throw new C("User already has a Twitter account linked to their account.");await Ne.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new C("User must be authenticated before linking a Discord account.");if(l?.discord)throw new C("User already has a Discord account linked to their account.");await Ne.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new C("User must be authenticated before linking a GitHub account.");if(l?.github)throw new C("User already has a Github account linked to their account.");await Ne.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new C("User must be authenticated before linking a TikTok account.");if(l?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Ne.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new C("User must be authenticated before linking a LinkedIn account.");if(l?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Ne.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new C("User must be authenticated before linking an Apple account.");await Ne.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(p=>{He(()=>p)}),He(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}O(!0),Lo("LANDING")},logout:async()=>{await t.logout(),c(null),s(!1),M(null),we(ye,"logout","onSuccess"),h(!1),r(!1),re.del(di)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!l||!l.wallet)return new he;let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new he:d.proxyProvider},getEthersProvider:()=>{if(!l||!l.wallet)return new ii.Web3Provider(new Jt(new he));let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new ii.Web3Provider(new Jt(new he)):new ii.Web3Provider(new Jt(d.proxyProvider))},getWeb3jsProvider:()=>{if(!l||!l.wallet)return new nr(new he);let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new nr(new he):new nr(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},setActiveWallet:async p=>{let d=w.find(g=>(0,Bi.getAddress)(g.address)===(0,Bi.getAddress)(p)),f=l?.linkedAccounts.find(g=>g.type==="wallet"&&(0,Bi.getAddress)(g.address)===(0,Bi.getAddress)(p));if(!d||!await d.isConnected())$(p),tn();else if(!d.linked)d.loginOrLink();else{let g=Object.assign({},l);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(g)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!l)throw we(ye,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return _c(l,15e3)},setWalletPassword:()=>new Promise(async(p,d)=>{if(!a||!l){d(new Error("User must be authenticated before adding password to Privy wallet"));return}let f=ve(l);if(!f||!k){d(new Error("Must have a Privy wallet to add a password"));return}if(f.recoveryMethod==="user-passcode"){d(new Error("Cannot set password. Embedded wallet already has a password."));return}await Ac(),Ee(!0);let g={onSuccess:p,onFailure:d,callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:d};ct({setWalletPassword:g,connectWallet:N}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(p,d)=>new Promise(async(f,g)=>{if(!a||!l){g(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=ve(l);if(!N){g(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){g(new Error("Message must be a non-empty string"));return}Ee(!0);let ne=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Pe=await ze();if(!k||!Pe)throw new Error("Unable to connect to wallet");if(!await Ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:Rt}=await k.rpc({accessToken:Pe,address:N.address,request:{method:"personal_sign",params:[p,N.address]}}),si=Rt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address}),si};if(U.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Pe=await ne();f(Pe)}catch(Pe){g(Pe??new rt("Unable to sign message"))}}else{let Rt={message:p,confirmAndSignMessage:ne,onSuccess:Qo=>{f(Qo)},onFailure:Qo=>{g(Qo)},uiOptions:d||{}},si={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:g};ct({signMessage:Rt,connectWallet:si}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,f)=>{let N=await(await kc(p,d,f)).wait();return Hs(N)},exportWallet:()=>new Promise(async(p,d)=>{if(!a||!l){d(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=ve(l);if(!f){d(new Error("Must have a Privy wallet before exporting"));return}Ee(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},N=await ze();if(!N||!k){d(new Error("Must have valid access token to enroll in MFA"));return}if(!k){d(new Error("Must have a Privy wallet before exporting"));return}try{try{await k.connect({accessToken:N,address:f.address}),await k.verifyMfa({accessToken:N})}catch(Pe){if(Nr(Pe)&&f.recoveryMethod==="privy")await k.recover({accessToken:N,address:f.address});else throw Pe}}catch(Pe){d(Pe);return}let ne={appId:e.appId,origin:t.apiUrl,onSuccess:p,onFailure:d};ct({keyExport:ne,connectWallet:g}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ac,async init(p){let d;switch(p){case"sms":d=new el("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}t.startMfaFlow(d),await d.init()},async submit(p,d){switch(p){case"totp":case"sms":Xr.current?.resolve({mfaMethod:p,mfaCode:d}),await new Promise((f,g)=>{Gi.current={resolve:f,reject:g}});break;default:throw Xr.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${p}`)}},cancel(){Xr.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,f)=>{if(!p){Ne.closePrivyModal(),d();return}U.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ct({mfaEnrollmentFlow:{mfaMethods:U.mfa.methods,onSuccess:d,onFailure:f}}),Ge("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await ze();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");let d=await k.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async unenroll(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to remove MFA");await k.unenrollMfa({method:p,accessToken:d});let f=await t.getAuthenticatedUser();c(f)},loginWithCode(p){return Ne.loginWithCode(p)},initLoginWithEmail(p){return Ne.initLoginWithEmail(p)},initLoginWithSms(p){return Ne.initLoginWithSms(p)},isModalOpen:o};_h=ai.signMessage,kh=async(...p)=>{let d=await kc(...p);return U.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let Ne=(()=>({headless:!!e.config?.headless,isNewUserThisSession:y,isLinking:m,linkingHint:Y,pendingTransaction:null,walletConnectionStatus:W,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:U.rpcConfig,chains:U.chains,showFiatPrices:U.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:p=>U.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(k)return k;let d=new Promise(N=>{Qr(()=>ne=>N(ne))}),f=new Promise(N=>setTimeout(()=>N(null),p)),g=await Promise.race([d,f]);return Qr(null),g},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0})=>{let d=n&&a&&l;p.shouldCallAuthOnSuccess&&d?(we(ye,"login","onComplete",l,y,!1,Vt.current??null),e.onSuccess?.(l,y)):L&&we(ye,"login","onError","exited_auth_flow"),$(null),O(!1),h(!1),E(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},connectWallet:Ye,initLoginWithWallet:qh,loginWithWallet:async()=>{if(!n)throw new li;if(!(t.authFlow instanceof Rr))throw new C("Must initialize SIWE flow first.");let p,d;if(a)p=await t.link();else try{({user:p,isNewUser:d}=await t.authenticate())}catch(f){throw we(ye,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(p||l||null),E(d||!1),s(!0)},initLoginWithOAuth:async p=>{if(!fd()){Lo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let d=new Xo(p),f;U.captchaEnabled&&(f=await pt(),ot(null)),f&&d.addCaptchaToken(f),t.startAuthFlow(d);let g=await t.authFlow.getAuthorizationUrl();g&&g.url&&window.location.assign(g.url)},loginWithOAuth:async p=>{if(!(t.authFlow instanceof Xo))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=jt.get(nn),f=t.authFlow.meta.stateCode;if(d!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p,storedStateCode:d??"",returnedStateCode:f??""}),new C("Unexpected auth flow. This may be a phishing attempt.");let g,N;if(a)g=await t.link();else try{({user:g,isNewUser:N}=await t.authenticate()),Vt.current=p}catch(ne){throw we(ye,"login","onError",ne.privyErrorCode||"unknown_auth_error"),ne}c(g),E(N||!1),s(!0)},initLoginWithEmail:async p=>{let d;U.captchaEnabled&&(d=await pt(),ot(null));let f=new _r(p,d);t.startAuthFlow(f);try{Vt.current="email",await f.sendCodeEmail()}catch(g){throw we(ye,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}},initLoginWithSms:async p=>{let d;U.captchaEnabled&&(d=await pt(),ot(null));let f=new Ir(p,d);t.startAuthFlow(f);try{Vt.current="sms",await f.sendSmsCode()}catch(g){throw we(ye,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(!n)throw new li;if(t.authFlow instanceof _r)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof Ir)t.authFlow.meta.smsCode=p.trim();else throw new C("Must initialize a passwordless code flow first");let d,f;a?d=await t.link():{user:d,isNewUser:f}=await t.authenticate(),c(d||l||null),E(f||!1),s(!0)},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:k,createAnalyticsEvent:(p,d,f)=>t.createAnalyticsEvent(p,d,f),getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedWallet:async()=>new Promise(async(p,d)=>{let f=l?.linkedAccounts.find(N=>N.type==="wallet"&&N.walletClientType==="privy"),g=await ze();if(!g||!k||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Ee(!0);try{await k.connect({accessToken:g,address:f.address}),p(!0)}catch(N){Nr(N)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await k.recover({address:f.address,accessToken:g})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),p(!0)):Nr(N)?(ct({recoverWallet:{privyWallet:f,onFailure:d,onSuccess:()=>p(!0)}}),Ge("EMBEDDED_WALLET_RECOVERY_SCREEN")):d(N)}}),getFiatOnRampConfig:Sc,setReadyToTrue:()=>{i(!0),me?.()},updateWallets:()=>ji()}))();Ah=Ne.recoverEmbeddedWallet;let Jh=(0,z.useMemo)(()=>({wallets:w,ready:J}),[w,J]);return(0,Gt.jsx)(Re.Provider,{value:ai,children:(0,Gt.jsx)(Tl.Provider,{value:ye,children:(0,Gt.jsx)(yc.Provider,{value:Jh,children:(0,Gt.jsxs)(op,{...U,tokenPromise:zi,children:[e.children,(0,Gt.jsxs)(Pl.Provider,{value:Ne,children:[(0,Gt.jsx)(rh,{theme:{...U.appearance.palette||{}}}),(0,Gt.jsx)(Ld,{appConfig:U,data:zt,setModalData:ct,setInitialScreen:M,initialScreen:b,authenticated:a,children:(0,Gt.jsx)(sh,{open:o})}),Be&&be.id?(0,Gt.jsx)(Th,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:l?.mfaMethods,mfaPromise:Xr,mfaSubmitPromise:Gi,onLoad:X,onLoadFailed:()=>null}):null]})]})})})})};var Ih=require("react");function Wh(e){let{login:t}=(0,Ih.useContext)(Re);return Wt("login",e),{login:t}}var Mh=require("react");function Lh(e){let{logout:t}=(0,Mh.useContext)(Re);return Wt("logout",e),{logout:t}}var Tc=require("react");var Nh=()=>{let e=ke(),{initLoginWithEmail:t,loginWithCode:o}=V(),r=(0,Tc.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Tc.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Mr(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var xc=require("react");var Oh=()=>{let e=ke(),{initLoginWithSms:t,loginWithCode:o}=V(),r=(0,xc.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,xc.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Mr(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var Dh=require("react");function Uh(e){let{connectWallet:t}=(0,Dh.useContext)(Re);return Wt("connectWallet",e),{connectWallet:t}}var Fh=require("react");function Bh(e){let{createWallet:t}=(0,Fh.useContext)(Re);return Wt("createWallet",e),{createWallet:t}}var Hh=require("react");var Gh=()=>{let{isModalOpen:e}=(0,Hh.useContext)(Re);return{isOpen:e}};var zh=require("react");function Vh(e){let{getAccessToken:t}=(0,zh.useContext)(Re);return Wt("accessToken",e),{getAccessToken:t}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useLogin,useLoginWithEmail,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useToken,useWallets});
|
|
2512
|
+
`;var ih=require("@marsidev/react-turnstile"),Ys=require("react");var Ec=require("react/jsx-runtime"),Fi=e=>{let{enabled:t,siteKey:o,appId:r,setError:n,setToken:i,ref:a}=ke(),[,s]=(0,Ys.useMemo)(()=>o?.split("t:")||[],[o]);if((0,Ys.useEffect)(()=>a.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,Ec.jsx)("div",{className:"hidden h-0 w-0",children:(0,Ec.jsx)(ih.Turnstile,{...e,ref:a,siteKey:s,options:{action:r,size:"invisible"},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed")},onSuccess:l=>{e.onSuccess?.(l),i(l)},onExpire:()=>{e.onExpire?.();try{a.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var ge=require("react/jsx-runtime"),qv={["LANDING"]:Rm,["AWAITING_PASSWORDLESS_CODE"]:Tp,["AWAITING_CONNECTION"]:Vp,["AWAITING_CONNECT_ONLY_CONNECTION"]:qp,["PHANTOM_INTERSTITIAL_SCREEN"]:jf,["LOGIN_FAILED_SCREEN"]:Dm,["AWAITING_OAUTH_SCREEN"]:Gf,["ALLOWLIST_REJECTION_SCREEN"]:fp,["INSTALL_PHANTOM_SCREEN"]:am,["LINK_EMAIL_SCREEN"]:Wm,["LINK_PHONE_SCREEN"]:Lm,["LINK_WALLET_SCREEN"]:Nm,["CONNECT_ONLY_LANDING_SCREEN"]:Fp,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Mp,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:Du,["EMBEDDED_WALLET_CREATED_SCREEN"]:ru,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:eu,["EMBEDDED_WALLET_RECOVERY_SCREEN"]:Vu,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:lu,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:th,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:Zf,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ju,["FIAT_ON_RAMP_STATUS_SCREEN"]:Zu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:Gu,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Uu,["MFA_ENROLLMENT_FLOW_SCREEN"]:lf,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:tm},Kv=["LANDING","AWAITING_CONNECTION","LINK_EMAIL_SCREEN","LINK_PHONE_SCREEN","LINK_WALLET_SCREEN","MFA_ENROLLMENT_FLOW_SCREEN"],Yv=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:o,isModalOpen:r}=V(),{headless:n}=R(),{ready:i,currentScreen:a}=_(),{status:s,reset:l}=ke(),c=(0,Pr.useRef)(null),m=np(c);(0,Pr.useEffect)(()=>{["success","error"].includes(s),r&&!n&&l()},[r]);let h=a&&Kv.includes(a)&&!n;if((!o||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,ge.jsxs)(jn,{children:[h?(0,ge.jsx)(Fi,{}):null,(0,ge.jsx)(S,{}),(0,ge.jsx)(Q,{}),(0,ge.jsx)(zm,{children:(0,ge.jsx)(ho,{})}),(0,ge.jsx)(Z,{}),(0,ge.jsx)(ee,{})]});if(!a&&e)return(0,ge.jsx)(jn,{style:{height:m},children:(0,ge.jsx)("div",{ref:c,children:(0,ge.jsx)(wc,{open:e,onClose:t})})});if(!a)return null;let w=qv[a];return(0,ge.jsxs)(jn,{style:{height:m},children:[h?(0,ge.jsx)(Fi,{}):null,(0,ge.jsxs)("div",{ref:c,children:[(0,ge.jsx)(Go,{if:!!e,children:(0,ge.jsx)(w,{})}),(0,ge.jsx)(Go,{if:!e,children:(0,ge.jsx)(wc,{open:e,onClose:t})})]})]})},Jv=()=>{let{closePrivyModal:e}=R(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,Pr.useCallback)(()=>{if(t?.current)t.current(),t.current=null;else return e({shouldCallAuthOnSuccess:!1})},[e])}},sh=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:o}=Jv(),[r,n]=(0,Pr.useState)(!1);Aa({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,ge.jsx)(nh,{children:(0,ge.jsx)(Yv,{isMfaVerifying:r,onMfaVerificationComplete:()=>n(!1)})}),a=e||r,s=t?.render.inDialog?(0,ge.jsx)(Gm,{open:a,id:"privy-dialog",onClick:()=>o(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let l=document.getElementById(t.render.inParentNodeId);if(l)return ah.default.createPortal(s,l)}return s};var Ht={appearance:{theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:id,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var Qv=new Set(["metamask","coinbase_wallet","rainbow","zerion","phantom","wallet_connect","detected_wallets"]),Zv=e=>Qv.has(e),Xv=(e,t,o)=>o.indexOf(e)===t,lh=({input:e})=>e?e.filter(Zv).filter(Xv):Ht.appearance.walletList;var ch={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var dh={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var ph={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var uh={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var mh={id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}};var fh={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var hh={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},testnet:!0};var yh={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var gh={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var vh={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var Js={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}};var wh={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Ch={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var ni=[_s,ks,As,hh,Ch,Js,Ms,Ls,Ns,Oi,Di,ph,uh,mh,fh,Rs,Is,Ws,gh,vh,ch,dh,Os,Us,Ds,yh,wh],T8=new Set(ni.map(e=>e.id));var xr=x(require("tinycolor2")),bh="#FFFFFF",ew="#000000",tw=bh,ow="#1E1E1D";function rw(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function Tr(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,xr.default)({...e.toHsl(),l:o})}function Eh({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",warnHex:r="#FFB74D",errorHex:n="#EC6351",whiteHex:i=bh,blackHex:a=ew}){let s;switch(e){case"light":s=tw;break;case"dark":s=ow;break;default:s=e;break}let l=(0,xr.default)(s),c=(0,xr.default)(t),m=(0,xr.default)(o),h=(0,xr.default)(r),w=(0,xr.default)(n),v=rw(l.getLuminance()),T=Tr(l,v==="light"?-.04:.11),y=Tr(l,v==="light"?-.88:.87),E=Tr(l,v==="light"?-.77:.75),b=Tr(l,v==="light"?-.43:.45).desaturate(v==="light"?60:20),M=Tr(l,v==="light"?-.08:.25).desaturate(v==="light"?60:20),L=Tr(c,.15),O=Tr(c,-.06),W=(0,xr.default)(c.getLuminance()>.5?a:i),A=Tr(m,-.16);return{colorScheme:v,background:l.toHslString(),background2:T.toHslString(),foreground:y.toHslString(),foreground2:E.toHslString(),foreground3:b.toHslString(),foreground4:M.toHslString(),accent:c.toHslString(),accentLight:L.toHslString(),accentDark:O.toHslString(),foregroundAccent:W.toHslString(),success:m.toHslString(),successDark:A.toHslString(),error:w.toHslString(),warn:h.toHslString()}}function Qs(e,t){let o=["google","twitter","discord","tiktok","linkedin","github","apple"],r=t?.loginMethods?.filter(Y=>o.includes(Y)),n,i,a,s,l,c,m,h,w,v;t?.loginMethods?(n=t.loginMethods.includes("email"),i=t.loginMethods.includes("sms"),a=t.loginMethods.includes("wallet"),s=r?.includes("google"),l=r?.includes("twitter"),c=r?.includes("discord"),m=r?.includes("tiktok"),w=r?.includes("github"),h=r?.includes("linkedin"),v=r?.includes("apple")):(n=e.emailAuth,i=e.smsAuth,a=e.walletAuth,s=e.googleOAuth,l=e.twitterOAuth,c=e.discordOAuth,w=e.githubOAuth,m=e.tiktokOAuth,h=e.linkedinOAuth,v=e.appleOAuth);let T=[n,i].filter(Boolean),y=[s,l,c,w,m,h,v].filter(Boolean),E=[a].filter(Boolean);if(T.length+y.length+E.length===0)throw new Error("You must enable at least one login method");let b=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;b&&E.length===0?(console.warn("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),b=!1):!b&&y.length+T.length===0&&(console.warn("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),b=!0);let M=lh({isWalletLoginEnabled:a,input:t?.appearance?.walletList});if(t?.embeddedWallets?.waitForTransactionConfirmation===!1&&t.embeddedWallets.noPromptOnSignature!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you also enable `config.embeddedWallets.noPromptOnSignature`");let L=t?.intl?.defaultCountry??"US",{chains:O,defaultChain:W}=nw(t?.additionalChains,t?.supportedChains,t?.defaultChain),A=!!t?.defaultChain||!!t?.supportedChains,I=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1;return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,palette:Eh({backgroundTheme:t?.appearance?.theme??Ht.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Ht.appearance.accentColor}),loginGroupPriority:b?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:M},loginMethods:{wallet:a,email:n,sms:i,google:s,twitter:l,discord:c,github:w,tiktok:m,linkedin:h,apple:v},legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Ht.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Ht.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Ht.rpcConfig.rpcTimeouts},chains:O,defaultChain:W,intl:{defaultCountry:L},shouldSwitchChainOnConnect:A,captchaEnabled:e.captchaEnabled??Ht.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...I?{createOnLogin:"all-users",requireUserPasswordOnCreate:!1,noPromptOnSignature:!0}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...t?.embeddedWallets},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:I?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Ht.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},render:{inDialog:t?._render?.inDialog??Ht._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Ht._render.inParentNodeId}}}function Ph(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:o,additionalChains:r,supportedChains:n,defaultChain:i,...a}=e;return{...a,...r?{additionalChains:r.map(l=>l.id)}:void 0,...n?{supportedChains:n.map(l=>l.id)}:void 0,...i?{defaultChain:i.id}:void 0,...o?{...o,...o.logo&&typeof o.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function nw(e,t,o){let r;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");r=t.map(a=>ni.find(l=>l.id===a.id)??a)}else r=ni.concat(e??[]);let n=t?r[0]:Js,i=o??n;if(!r.find(a=>a.id===i.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}var Xs=require("react");var Zs=class{constructor(){this.callbacks={}}enqueue(t,o){this.callbacks[t]=o}dequeue(t,o){let r=this.callbacks[o];if(!r)throw new Error(`cannot dequeue ${t} event: no event found for id ${o}`);switch(delete this.callbacks[o],t){case"privy:iframe:ready":return r;case"privy:wallet:create":return r;case"privy:wallet:connect":return r;case"privy:wallet:recover":return r;case"privy:wallet:rpc":return r;case"privy:wallet:set-recovery-password":return r;case"privy:mfa:verify":return r;case"privy:mfa:init-enrollment":return r;case"privy:mfa:submit-enrollment":return r;case"privy:mfa:unenroll":return r;default:throw new Error(`invalid wallet event type ${t}`)}}};async function Jr(e,t,o,r,n,i=!1){let a=i,s=async m=>{if(a&&t&&t.length>0){m===(i?0:1)?n("configureMfa","onMfaRequired",t):r.current?.reject(new Ve("missing_or_invalid_mfa","MFA verification failed, retry."));let h=await new Promise((w,v)=>{o.current={resolve:w,reject:v};let T=1e3*60*5;setTimeout(()=>{let y=new Ve("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(y),v(y)},T)});return await e(h)}return await e()},l=4,c=null;for(let m=0;m<l;m++)try{c=await s(m),r.current?.resolve(void 0);break}catch(h){if(h.type==="missing_or_invalid_mfa")a=!0;else throw r.current?.resolve(void 0),h}if(c===null){let m=new Ve("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(m),m}return c}var xh=require("react/jsx-runtime"),iw=function(e){return()=>`id-${e++}`}(0);function aw(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Io(e){return e.error!==void 0}var ao=new Zs,Pc=new Map,sw=(e,t)=>typeof t=="bigint"?t.toString():t,lw=(e,t)=>`${e}${JSON.stringify(t,sw)}`;function Wo(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");let n=lw(e,t);if(e==="privy:wallet:create"){let a=Pc.get(n);if(a)return a}let i=new Promise((a,s)=>{let l=iw();ao.enqueue(l,{resolve:a,reject:s}),r.postMessage({id:l,event:e,data:t},"*")}).finally(()=>{Pc.delete(n)});return Pc.set(n,i),i}function cw(e){switch(e.event){case"privy:iframe:ready":let t=ao.dequeue(e.event,e.id);return Io(e)?t.reject(new Ve(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=ao.dequeue(e.event,e.id);return Io(e)?o.reject(new Ve(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=ao.dequeue(e.event,e.id);return Io(e)?r.reject(new Ve(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=ao.dequeue(e.event,e.id);return Io(e)?n.reject(new Ve(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=ao.dequeue(e.event,e.id);return Io(e)?i.reject(new Ve(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=ao.dequeue(e.event,e.id);return Io(e)?a.reject(new Ve(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let s=ao.dequeue(e.event,e.id);return Io(e)?s.reject(new Ve(e.error.type,e.error.message)):s.resolve(e.data);case"privy:mfa:init-enrollment":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}case"privy:mfa:submit-enrollment":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}case"privy:mfa:unenroll":{let l=ao.dequeue(e.event,e.id);return Io(e)?l.reject(new Ve(e.error.type,e.error.message)):l.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function Th(e){let t=(0,Xs.useRef)(null),o=sp();return(0,Xs.useEffect)(()=>{let r=t.current;if(!r)return;function n(c){c&&c.origin===e.origin&&aw(c.data)&&cw(c.data)}let i={create(c){return Wo("privy:wallet:create",c,r)},connect(c){return Wo("privy:wallet:connect",c,r)},recover(c){return Jr(m=>Wo("privy:wallet:recover",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(c){return Jr(m=>Wo("privy:wallet:rpc",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(c){return Jr(m=>Wo("privy:wallet:set-recovery-password",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(c){return Jr(m=>Wo("privy:mfa:verify",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(c){return Jr(m=>Wo("privy:mfa:init-enrollment",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(c){return Wo("privy:mfa:submit-enrollment",c,r)},unenrollMfa(c){return Jr(m=>Wo("privy:mfa:unenroll",{...c,...m},r),e.mfaMethods,e.mfaPromise,e.mfaSubmitPromise,o,!0)}};window.addEventListener("message",n);let a=()=>e.onLoad(i),s=(...c)=>{console.warn("Privy iframe failed to load: ",...c),e.onLoadFailed()},l=new AbortController;return Cd(()=>Wo("privy:iframe:ready",{},r),{abortSignal:l.signal}).then(a,s),()=>{window.removeEventListener("message",n),l.abort()}},[t.current,e.mfaMethods]),(0,xh.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:ca(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}var el=class{constructor(t,o){this.meta={action:t,phoneNumber:o}}async init(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Auth flow has no API instance");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set when initialzing authentication.");try{let t=td();await this.api.post(t,{action:this.meta.action,phoneNumber:this.meta.phoneNumber})}catch(t){throw fe(t)}}async authenticate(){if(!this.meta.action)throw new C("action required");if(!this.api)throw new C("Mfa flow has no API instance");if(!this.meta.smsCode)throw new C("sms code must be set prior to calling authenticate.");if(this.meta.action==="enroll"&&!this.meta.phoneNumber)throw new C("phone number must be set prior to calling authenticate.");try{let t=od(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return qt(o)}catch(t){throw fe(t)}}};var Gt=require("react/jsx-runtime"),Hi;function dw(e){return typeof e=="string"&&e.length===25}function ze(){if(!Hi){let e=re.get(kr);return Promise.resolve(e||null)}return Hi.getAccessToken()}var _h,Sd=(e,t)=>_h(e,t),kh,_d=(e,t)=>kh(e,t),Ah,kd=()=>Ah(),pw=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;re.put(ci,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},Rh=({config:e,...t})=>{if(!dw(t.appId))throw new C("Cannot initialize the Privy provider with an invalid Privy app ID");Hi||(Hi=new Cn({appId:t.appId,apiUrl:t.apiUrl||oa}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&o.embeddedWallets?.createOnLogin===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Gt.jsx)(uw,{...t,config:o,client:Hi})},uw=e=>{let t=e.client,[o,r]=(0,z.useState)(!1),[n,i]=(0,z.useState)(!1),[a,s]=(0,z.useState)(!1),[l,c]=(0,z.useState)(null),[m,h]=(0,z.useState)(!1),[w,v]=(0,z.useState)([]),T=(0,z.useRef)(w),[y,E]=(0,z.useState)(!1),[b,M]=(0,z.useState)(null),[L,O]=(0,z.useState)(!1),[W,A]=(0,z.useState)({status:"disconnected",connectError:null,connector:null,connectRetry:P}),[I,F]=(0,z.useState)(null),[Y,$]=(0,z.useState)(null),[k,X]=(0,z.useState)(null),[be,Le]=(0,z.useState)({showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""}),[U,tt]=(0,z.useState)(()=>{let p=Ph(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",p),Qs(be,e.config)}),[Be,Ee]=(0,z.useState)(!0),[zt,ct]=(0,z.useState)({}),[me,He]=(0,z.useState)(null),[Mo,Qr]=(0,z.useState)(null),[J,At]=(0,z.useState)(!1),[Sr,Zr]=(0,z.useState)(!1),Xr=(0,z.useRef)(null),Gi=(0,z.useRef)(null),[zi,ot]=(0,z.useState)(null),ye=(0,z.useRef)(ip);t.onStoreToken=p=>{p&&we(ye,"accessToken","onAccessTokenGranted",p)},t.onDeleteToken=()=>{we(ye,"accessToken","onAccessTokenRemoved")};let Vt=(0,z.useRef)(),Vi=(0,z.useCallback)(p=>{let d=t.connectors?.walletsReady||!1;return a&&l?.linkedAccounts?.some(g=>g.type==="wallet"&&g.walletClientType==="privy")?d&&p?.some(g=>g?.walletClientType==="privy"):d},[a,l?.linkedAccounts,t?.connectors?.walletsReady]),Ge=p=>{M(p),setTimeout(()=>{r(!0)},15),t.createAnalyticsEvent("modal_open",{initialScreen:p})},Lo=p=>{U.embeddedWallets.createOnLogin!=="off"&&Ee(!0),Ge(p)};(0,z.useEffect)(()=>{if(!k||!l){t.connectors?.removeEmbeddedWalletConnector();return}let p=l?.linkedAccounts.filter(d=>d.type==="wallet"&&d.walletClient==="privy");if(p&&p.length>0){let d=p[0].address;t.connectors?.addEmbeddedWalletConnector(k,d,U.defaultChain)}},[k,l]),(0,z.useEffect)(()=>{k&&Mo?.(k)},[k]),(0,z.useEffect)(()=>{(async()=>{if(!U.customAuth?.enabled)return;Ee(!0);let{getCustomAccessToken:d,isLoading:f}=U.customAuth;if(!(!n||f))try{let g=await d();if(!g){await ai.logout();return}if(a)return;t.startAuthFlow(new rn(g));let{user:N,isNewUser:ne}=await t.authenticate();N||await ai.logout(),c(N||null),E(ne||!1),s(!0),Zr(!0)}catch(g){console.warn(g),a&&await ai.logout()}})()},[U.customAuth?.enabled,U.customAuth?.getCustomAccessToken,U.customAuth?.isLoading,n,a]),(0,z.useEffect)(()=>{Sr&&k&&l&&er(l,e.config?.embeddedWallets?.createOnLogin)&&(Zr(!1),_c(l,sn).catch(console.error))},[Sr&&k&&l]),(0,z.useEffect)(()=>{async function p(){let d=await t.getServerConfig();Le(d);let f=Qs(d,e.config);tt(f),d.customApiUrl&&t.updateApiUrl(d.customApiUrl);let g=en();pw();let N=(0,Sh.createStore)();F(N),t.initializeConnectorManager(f.walletConnectCloudProjectId,f.rpcConfig,f.chains,f.defaultChain,N,f.appearance.walletList),await t.connectors?.initialize();let ne=await t.getAuthenticatedUser();e.config?.customAuth?.enabled||(s(!!ne),ne&&we(ye,"login","onComplete",ne,!1,!0,null),c(ne)),g||Ne.setReadyToTrue(),g&&ne&&h(!0),$t()}n||p()},[t,me,n]),(0,z.useEffect)(()=>{let p=Qs(be,e.config);tt(p)},[e.config,be]);let en=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_oauth_code"),f=p.get("privy_oauth_state"),g=p.get("privy_oauth_provider");return d&&f&&g?(t.startAuthFlow(new Xo(g,d,f)),Lo("AWAITING_OAUTH_SCREEN"),!0):!1},dt=async(p,d,f)=>{let g=await t.connectors?.createWalletConnector(p,d)||null;Ye(g,d,f)};async function Ye(p,d,f){if(!p)return A({status:"disconnected",connectError:new j("Unable to connect to wallet."),connector:null,connectRetry:P}),f?.(null);p instanceof mo&&d&&p.resetConnection(d),A({connector:p,status:"connecting",connectError:null,connectRetry:()=>Ye(p,d,f)});try{let g=await p.connect({showPrompt:!0});if(U.shouldSwitchChainOnConnect&&!U.chains.find(N=>N.id===Number(g?.chainId))&&!(g?.connectorType==="wallet_connect_v2"&&g?.walletClientType==="metamask")){A(N=>({...N,connector:p,status:"switching_to_supported_chain",connectError:null,connectRetry:P}));try{await g?.switchChain(U.defaultChain.id),g&&(g.chainId=ln(Wr(U.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${U.defaultChain.id}`)}}return A(N=>({...N,status:"connected",connectError:null,connectRetry:P})),g&&!L&&we(ye,"connectWallet","onSuccess",g),f?.(g)}catch(g){return g instanceof wt?(console.warn(g.cause?g.cause:g.message),L||we(ye,"connectWallet","onError",g.privyErrorCode||"generic_connect_wallet_error")):(console.warn(g),L||we(ye,"connectWallet","onError","unknown_connect_wallet_error")),A(N=>({...N,status:"disconnected",connectError:g})),f?.(null)}}async function pt(){return new Promise(async(p,d)=>{ot({resolve:p,reject:d});let f=1e3*30;setTimeout(()=>{if(!zi)return;let g=new C("Timed out waiting for Captcha");d(g)},f)})}let $i=async p=>{if(p===null)return;let d=new Rr(p);t.startAuthFlow(d)},$t=()=>{let p=new URLSearchParams(window.location.search),d=p.get("privy_connector"),f=p.get("privy_wallet_client");if(!d||!f)return;if(f==="phantom"&&!tr()&&Lo("LOGIN_FAILED_SCREEN"),!t.connectors)throw new C("Connector not initialized");Ge("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),dt(d,f,$i)};(0,z.useEffect)(()=>{n&&a&&l===null&&t.getAuthenticatedUser().then(c)},[n,a,l,t]);let tn=()=>{if(!a)throw new C("User must be authenticated before linking a wallet.");h(!0),Ge("LINK_WALLET_SCREEN")},$h=p=>{if(!a||!l)return!1;for(let d of l.linkedAccounts)if(d.type==="wallet"&&d.address===p.address)return!0;return!1},jh=async p=>{if(!t.connectors)throw new C("Connector not initialized");let d=t.connectors.findWalletConnector(p.connectorType,p.walletClientType)||null;A(f=>({...f,connector:d,status:"connected",connectError:null,connectRetry:P})),await $i(p),Lo("AWAITING_CONNECTION")},qh=async(p,d)=>{Vt.current="siwe",await Ye(p,d,$i)},Sc=async(p,d)=>{if(!U.fiatOnRamp.enabled)throw new C("Fiat on-ramp is not enabled");if(!d||!d.provider||d.provider==="moonpay"){let{signedUrl:f,externalTransactionId:g}=await Ku(t,p,d?.config??{},U.appearance.palette,U.fiatOnRamp.useSandbox);return{signedUrl:f,externalTransactionId:g}}else throw new C("Unsupported fund provider. Currently supported option is `moonpay`.")},ji=()=>{v(p=>{let d=t.connectors?.wallets.map(f=>({...f,linked:$h(f),loginOrLink:async()=>{if(!await f.isConnected())throw new C("Wallet is not connected");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot link or login with embedded wallet");jh(f)},fund:async g=>{let{signedUrl:N,externalTransactionId:ne}=await Sc(f.address,g);ct({fiatOnRampPrompt:{signedUrl:N},fiatOnRampStatus:{externalTransactionId:ne}}),Ge("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new C("User is not authenticated.");if(f.connectorType==="embedded"&&f.walletClientType==="privy")throw new C("Cannot unlink an embedded wallet");let g=await t.unlinkWallet(f.address);c(g)}}))||[];return At(Vi(d)),pa(p,d)?p:d})};(0,z.useEffect)(()=>{ji()},[l?.linkedAccounts,a,n]),(0,z.useEffect)(()=>{if(n){if(!t.connectors)throw new C("Connector not initialized");ji(),t.connectors.on("walletsUpdated",ji)}},[n]);let Kh=()=>{Ge(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,z.useEffect)(()=>{if(!w[0])return;let p=w[0],d=T.current.find(g=>g.address===p.address),f=l?.linkedAccounts.find(g=>g.type==="wallet"&&g.address===p.address);if(!d&&f){let g=Object.assign({},l);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(g)}T.current=w},[w]);let _c=async(p,d)=>{if(ve(p))throw we(ye,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[g,N]=await Promise.all([Ne.initializeWalletProxy(d),ze()]);if(!g&&e.config?.customAuth?.enabled)throw we(ye,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!g||!N||e.config?.embeddedWallets?.requireUserPasswordOnCreate)return new Promise((ne,Pe)=>{Ee(!0),ct({createWallet:{onSuccess:Rt=>{we(ye,"createWallet","onSuccess",Rt),ne(Rt)},onFailure:Rt=>{we(ye,"createWallet","onError","unknown_embedded_wallet_error"),Pe(Rt)},callAuthOnSuccessOnClose:!1}}),Ge("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await g.create({accessToken:N});let ne=await Ne.refreshUser(),Pe=ve(ne);if(!Pe)throw we(ye,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return we(ye,"createWallet","onSuccess",Pe),Pe}},Yh=p=>{if(!U.chains.map(d=>d.id).includes(p))throw new j(`Chain ID ${p} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},kc=(p,d,f)=>new Promise(async(g,N)=>{if(!a||!l){N(new Error("User must be authenticated before signing with a Privy wallet"));return}let ne=ve(l);if(!ne){N(new Error("Must have a Privy wallet before signing"));return}Ee(!0);let Pe=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,on=p.chainId?Number(p.chainId):Pe.chainId;Yh(on);let Rt=Object.assign({},p,{chainId:on}),si=async()=>{let Qo=await ze();if(!Qo||!k){N(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Ne.recoverEmbeddedWallet()){N(new Error("Unable to connect to wallet"));return}let Rc=new ii.StaticJsonRpcProvider(Kt(Rt.chainId,U.chains,U.rpcConfig)),Qh=await Xn(ne.address,Rt,Rc),Zh=await Fs(Qo,ne.address,k,Qh,Rc);g(Zh)}catch(qi){N(qi)}};if(U.embeddedWallets.noPromptOnSignature)d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),si();else{let Qo={transactionRequest:Rt,onSuccess:g,onFailure:N,uiOptions:d||{},fundWalletConfig:f},qi={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:N};ct({connectWallet:qi,sendTransaction:Qo}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ac(){return new Promise(async(p,d)=>{let f=await ze();if(!f||!k)throw new Error("Must have valid access token to enroll in MFA");try{await k.verifyMfa({accessToken:f}),p()}catch(g){d(g)}})}let ai={ready:n,authenticated:a,user:l,walletConnectors:t.connectors||null,connectWallet:Kh,linkWallet:tn,linkEmail:()=>{if(!a)throw new C("User must be authenticated before linking an email address.");if(l?.email)throw new C("User already has an email linked to their account.");h(!0),Ge("LINK_EMAIL_SCREEN")},linkPhone:()=>{if(!a)throw new C("User must be authenticated before linking a phone number.");if(l?.phone)throw new C("User already has a phone number linked to their account.");h(!0),Ge("LINK_PHONE_SCREEN")},linkGoogle:async()=>{if(!a)throw new C("User must be authenticated before linking a Google account.");if(l?.google)throw new C("User already has a Google account linked to their account.");await Ne.initLoginWithOAuth("google")},linkTwitter:async()=>{if(!a)throw new C("User must be authenticated before linking a Twitter account.");if(l?.twitter)throw new C("User already has a Twitter account linked to their account.");await Ne.initLoginWithOAuth("twitter")},linkDiscord:async()=>{if(!a)throw new C("User must be authenticated before linking a Discord account.");if(l?.discord)throw new C("User already has a Discord account linked to their account.");await Ne.initLoginWithOAuth("discord")},linkGithub:async()=>{if(!a)throw new C("User must be authenticated before linking a GitHub account.");if(l?.github)throw new C("User already has a Github account linked to their account.");await Ne.initLoginWithOAuth("github")},linkTiktok:async()=>{if(!a)throw new C("User must be authenticated before linking a TikTok account.");if(l?.tiktok)throw new C("User already has a Tiktok account linked to their account.");await Ne.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{if(!a)throw new C("User must be authenticated before linking a LinkedIn account.");if(l?.linkedin)throw new C("User already has a LinkedIn account linked to their account.");await Ne.initLoginWithOAuth("linkedin")},linkApple:async()=>{if(!a)throw new C("User must be authenticated before linking an Apple account.");await Ne.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(p=>{He(()=>p)}),He(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}O(!0),Lo("LANDING")},logout:async()=>{await t.logout(),c(null),s(!1),M(null),we(ye,"logout","onSuccess"),h(!1),r(!1),re.del(di)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!l||!l.wallet)return new he;let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new he:d.proxyProvider},getEthersProvider:()=>{if(!l||!l.wallet)return new ii.Web3Provider(new Jt(new he));let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new ii.Web3Provider(new Jt(new he)):new ii.Web3Provider(new Jt(d.proxyProvider))},getWeb3jsProvider:()=>{if(!l||!l.wallet)return new nr(new he);let p=w.find(f=>l.wallet&&f.address===l.wallet.address),d=t.connectors?.walletConnectors.find(f=>f.wallets.find(g=>g.address===p?.address));return!p||!d?new nr(new he):new nr(d.proxyProvider)},unlinkWallet:async p=>{let d=await t.unlinkWallet(p);return c(d),d},unlinkEmail:async p=>{let d=await t.unlinkEmail(p);return c(d),d},unlinkPhone:async p=>{let d=await t.unlinkPhone(p);return c(d),d},unlinkGoogle:async p=>{let d=await t.unlinkOAuth("google",p);return c(d),d},unlinkTwitter:async p=>{let d=await t.unlinkOAuth("twitter",p);return c(d),d},unlinkDiscord:async p=>{let d=await t.unlinkOAuth("discord",p);return c(d),d},unlinkGithub:async p=>{let d=await t.unlinkOAuth("github",p);return c(d),d},unlinkTiktok:async p=>{let d=await t.unlinkOAuth("tiktok",p);return c(d),d},unlinkLinkedIn:async p=>{let d=await t.unlinkOAuth("linkedin",p);return c(d),d},unlinkApple:async p=>{let d=await t.unlinkOAuth("apple",p);return c(d),d},setActiveWallet:async p=>{let d=w.find(g=>(0,Bi.getAddress)(g.address)===(0,Bi.getAddress)(p)),f=l?.linkedAccounts.find(g=>g.type==="wallet"&&(0,Bi.getAddress)(g.address)===(0,Bi.getAddress)(p));if(!d||!await d.isConnected())$(p),tn();else if(!d.linked)d.loginOrLink();else{let g=Object.assign({},l);g.wallet=f&&{address:f.address,chainType:f.chainType,chainId:f.chainId,walletClient:f.walletClient,walletClientType:f.walletClientType,connectorType:f.connectorType},c(g)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!l)throw we(ye,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return _c(l,15e3)},setWalletPassword:()=>new Promise(async(p,d)=>{if(!a||!l){d(new Error("User must be authenticated before adding password to Privy wallet"));return}let f=ve(l);if(!f||!k){d(new Error("Must have a Privy wallet to add a password"));return}if(f.recoveryMethod==="user-passcode"){d(new Error("Cannot set password. Embedded wallet already has a password."));return}await Ac(),Ee(!0);let g={onSuccess:p,onFailure:d,callAuthOnSuccessOnClose:!1},N={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:d};ct({setWalletPassword:g,connectWallet:N}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}),signMessage:(p,d)=>new Promise(async(f,g)=>{if(!a||!l){g(new Error("User must be authenticated before signing with a Privy wallet"));return}let N=ve(l);if(!N){g(new Error("Must have a Privy wallet before signing"));return}if(typeof p!="string"||p.length<1){g(new Error("Message must be a non-empty string"));return}Ee(!0);let ne=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let Pe=await ze();if(!k||!Pe)throw new Error("Unable to connect to wallet");if(!await Ne.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent("embedded_wallet_sign_message_started",{walletAddress:N.address});let{response:Rt}=await k.rpc({accessToken:Pe,address:N.address,request:{method:"personal_sign",params:[p,N.address]}}),si=Rt.data;return t.createAnalyticsEvent("embedded_wallet_sign_message_completed",{walletAddress:N.address}),si};if(U.embeddedWallets.noPromptOnSignature){d&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let Pe=await ne();f(Pe)}catch(Pe){g(Pe??new rt("Unable to sign message"))}}else{let Rt={message:p,confirmAndSignMessage:ne,onSuccess:Qo=>{f(Qo)},onFailure:Qo=>{g(Qo)},uiOptions:d||{}},si={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:g};ct({signMessage:Rt,connectWallet:si}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(p,d,f)=>{let N=await(await kc(p,d,f)).wait();return Hs(N)},exportWallet:()=>new Promise(async(p,d)=>{if(!a||!l){d(new Error("User must be authenticated before exporting their Privy wallet"));return}let f=ve(l);if(!f){d(new Error("Must have a Privy wallet before exporting"));return}Ee(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},N=await ze();if(!N||!k){d(new Error("Must have valid access token to enroll in MFA"));return}if(!k){d(new Error("Must have a Privy wallet before exporting"));return}try{try{await k.connect({accessToken:N,address:f.address}),await k.verifyMfa({accessToken:N})}catch(Pe){if(Nr(Pe)&&f.recoveryMethod==="privy")await k.recover({accessToken:N,address:f.address});else throw Pe}}catch(Pe){d(Pe);return}let ne={appId:e.appId,origin:t.apiUrl,onSuccess:p,onFailure:d};ct({keyExport:ne,connectWallet:g}),Ge("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ac,async init(p){let d;switch(p){case"sms":d=new el("verify");break;case"totp":return;default:throw new Error(`Unsupported MFA method: ${p}`)}t.startMfaFlow(d),await d.init()},async submit(p,d){switch(p){case"totp":case"sms":Xr.current?.resolve({mfaMethod:p,mfaCode:d}),await new Promise((f,g)=>{Gi.current={resolve:f,reject:g}});break;default:throw Xr.current?.reject(new C("Unsupported MFA method")),new C(`Unsupported MFA method: ${p}`)}},cancel(){Xr.current?.reject(new C("MFA canceled"))},async initEnrollmentWithSms(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.initEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber})},enrollInMfa(p){return new Promise((d,f)=>{if(!p){Ne.closePrivyModal(),d();return}U.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ct({mfaEnrollmentFlow:{mfaMethods:U.mfa.methods,onSuccess:d,onFailure:f}}),Ge("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let p=await ze();if(!p||!k)throw new Error("Must have valid access token to enroll in MFA");let d=await k.initEnrollMfa({method:"totp",accessToken:p});return{secret:d.secret,authUrl:d.authUrl}},async submitEnrollmentWithSms(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"sms",accessToken:d,phoneNumber:p.phoneNumber,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async submitEnrollmentWithTotp(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to enroll in MFA");await k.submitEnrollMfa({method:"totp",accessToken:d,code:p.mfaCode});let f=await t.getAuthenticatedUser();c(f)},async unenroll(p){let d=await ze();if(!d||!k)throw new Error("Must have valid access token to remove MFA");await k.unenrollMfa({method:p,accessToken:d});let f=await t.getAuthenticatedUser();c(f)},loginWithCode(p){return Ne.loginWithCode(p)},initLoginWithEmail(p){return Ne.initLoginWithEmail(p)},initLoginWithSms(p){return Ne.initLoginWithSms(p)},isModalOpen:o};_h=ai.signMessage,kh=async(...p)=>{let d=await kc(...p);return U.embeddedWallets.waitForTransactionConfirmation&&await d.wait(),d};let Ne=(()=>({headless:!!e.config?.headless,isNewUserThisSession:y,isLinking:m,linkingHint:Y,pendingTransaction:null,walletConnectionStatus:W,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:U.rpcConfig,chains:U.chains,showFiatPrices:U.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:p=>U.chains.find(d=>d.id===Number(p))?.nativeCurrency.symbol,initializeWalletProxy:async p=>{if(k)return k;let d=new Promise(N=>{Qr(()=>ne=>N(ne))}),f=new Promise(N=>setTimeout(()=>N(null),p)),g=await Promise.race([d,f]);return Qr(null),g},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(p={shouldCallAuthOnSuccess:!0})=>{let d=n&&a&&l;p.shouldCallAuthOnSuccess&&d?(we(ye,"login","onComplete",l,y,!1,Vt.current??null),e.onSuccess?.(l,y)):L&&we(ye,"login","onError","exited_auth_flow"),$(null),O(!1),h(!1),E(!1),r(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent("modal_closed")},connectWallet:Ye,initLoginWithWallet:qh,loginWithWallet:async()=>{if(!n)throw new li;if(!(t.authFlow instanceof Rr))throw new C("Must initialize SIWE flow first.");let p,d;if(a)p=await t.link();else try{({user:p,isNewUser:d}=await t.authenticate())}catch(f){throw we(ye,"login","onError",f.privyErrorCode||"generic_connect_wallet_error"),f}c(p||l||null),E(d||!1),s(!0)},initLoginWithOAuth:async p=>{if(!fd()){Lo("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}let d=new Xo(p),f;U.captchaEnabled&&(f=await pt(),ot(null)),f&&d.addCaptchaToken(f),t.startAuthFlow(d);let g=await t.authFlow.getAuthorizationUrl();g&&g.url&&window.location.assign(g.url)},loginWithOAuth:async p=>{if(!(t.authFlow instanceof Xo))throw new C("Must initialize OAuth flow before calling loginWithOAuth");let d=jt.get(nn),f=t.authFlow.meta.stateCode;if(d!==f)throw t.createAnalyticsEvent("possible_phishing_attempt",{provider:p,storedStateCode:d??"",returnedStateCode:f??""}),new C("Unexpected auth flow. This may be a phishing attempt.");let g,N;if(a)g=await t.link();else try{({user:g,isNewUser:N}=await t.authenticate()),Vt.current=p}catch(ne){throw we(ye,"login","onError",ne.privyErrorCode||"unknown_auth_error"),ne}c(g),E(N||!1),s(!0)},initLoginWithEmail:async p=>{let d;U.captchaEnabled&&(d=await pt(),ot(null));let f=new _r(p,d);t.startAuthFlow(f);try{Vt.current="email",await f.sendCodeEmail()}catch(g){throw we(ye,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}},initLoginWithSms:async p=>{let d;U.captchaEnabled&&(d=await pt(),ot(null));let f=new Ir(p,d);t.startAuthFlow(f);try{Vt.current="sms",await f.sendSmsCode()}catch(g){throw we(ye,"login","onError",g.privyErrorCode||"unknown_auth_error"),g}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async p=>{if(!n)throw new li;if(t.authFlow instanceof _r)t.authFlow.meta.emailCode=p.trim();else if(t.authFlow instanceof Ir)t.authFlow.meta.smsCode=p.trim();else throw new C("Must initialize a passwordless code flow first");let d,f;a?d=await t.link():{user:d,isNewUser:f}=await t.authenticate(),c(d||l||null),E(f||!1),s(!0)},refreshUser:async()=>{let p=await t.getAuthenticatedUser();return c(p),p},walletProxy:k,createAnalyticsEvent:(p,d,f)=>t.createAnalyticsEvent(p,d,f),getUsdTokenPrice:p=>t.getUsdTokenPrice(p),recoverEmbeddedWallet:async()=>new Promise(async(p,d)=>{let f=l?.linkedAccounts.find(N=>N.type==="wallet"&&N.walletClientType==="privy"),g=await ze();if(!g||!k||!f){d(new Error("Must have valid access token and Privy wallet to recover wallet"));return}Ee(!0);try{await k.connect({accessToken:g,address:f.address}),p(!0)}catch(N){Nr(N)&&f.recoveryMethod==="privy"?(t.createAnalyticsEvent("embedded_wallet_pinless_recovery_started",{walletAddress:f.address}),(await k.recover({address:f.address,accessToken:g})).address||d(new Error("Unable to recover wallet")),t.createAnalyticsEvent("embedded_wallet_recovery_completed",{walletAddress:f.address}),p(!0)):Nr(N)?(ct({recoverWallet:{privyWallet:f,onFailure:d,onSuccess:()=>p(!0)}}),Ge("EMBEDDED_WALLET_RECOVERY_SCREEN")):d(N)}}),getFiatOnRampConfig:Sc,setReadyToTrue:()=>{i(!0),me?.()},updateWallets:()=>ji()}))();Ah=Ne.recoverEmbeddedWallet;let Jh=(0,z.useMemo)(()=>({wallets:w,ready:J}),[w,J]);return(0,Gt.jsx)(Re.Provider,{value:ai,children:(0,Gt.jsx)(Tl.Provider,{value:ye,children:(0,Gt.jsx)(yc.Provider,{value:Jh,children:(0,Gt.jsxs)(op,{...U,tokenPromise:zi,children:[e.children,(0,Gt.jsxs)(Pl.Provider,{value:Ne,children:[(0,Gt.jsx)(rh,{theme:{...U.appearance.palette||{}}}),(0,Gt.jsx)(Ld,{appConfig:U,data:zt,setModalData:ct,setInitialScreen:M,initialScreen:b,authenticated:a,children:(0,Gt.jsx)(sh,{open:o})}),Be&&be.id?(0,Gt.jsx)(Th,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:l?.mfaMethods,mfaPromise:Xr,mfaSubmitPromise:Gi,onLoad:X,onLoadFailed:()=>null}):null]})]})})})})};var Ih=require("react");function Wh(e){let{login:t}=(0,Ih.useContext)(Re);return Wt("login",e),{login:t}}var Mh=require("react");function Lh(e){let{logout:t}=(0,Mh.useContext)(Re);return Wt("logout",e),{logout:t}}var Tc=require("react");var Nh=()=>{let e=ke(),{initLoginWithEmail:t,loginWithCode:o}=V(),r=(0,Tc.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,Tc.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Mr(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var xc=require("react");var Oh=()=>{let e=ke(),{initLoginWithSms:t,loginWithCode:o}=V(),r=(0,xc.useCallback)(async({phoneNumber:i})=>{if(!i)throw new Error("SMS required to send OTP code");return e.status==="disabled",t(i)},[t]),n=(0,xc.useCallback)(async({code:i})=>{if(e.enabled&&e.status!=="success")throw new Mr(e.error,null,"captcha_failure");return o(i)},[o,e.status]);return{sendCode:r,loginWithCode:n}};var Dh=require("react");function Uh(e){let{connectWallet:t}=(0,Dh.useContext)(Re);return Wt("connectWallet",e),{connectWallet:t}}var Fh=require("react");function Bh(e){let{createWallet:t}=(0,Fh.useContext)(Re);return Wt("createWallet",e),{createWallet:t}}var Hh=require("react");var Gh=()=>{let{isModalOpen:e}=(0,Hh.useContext)(Re);return{isOpen:e}};var zh=require("react");function Vh(e){let{getAccessToken:t}=(0,zh.useContext)(Re);return Wt("accessToken",e),{getAccessToken:t}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useLogin,useLoginWithEmail,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useToken,useWallets});
|