1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4678],{8491:(e,t,i)=>{i.d(t,{u:()=>d});var r=i(15405),a=i(57873),n=i(79561),o=i(45283),s=i(82376),l=i(89188),c=i(42846);class u{constructor(e){this.getNonce=e.getNonce}async createMessage(e){let t={accountAddress:e.accountAddress,chainId:e.chainId,version:"1",domain:"undefined"==typeof document?"Unknown Domain":document.location.host,uri:"undefined"==typeof document?"Unknown URI":document.location.href,resources:this.resources,nonce:await this.getNonce(e),issuedAt:this.stringifyDate(new Date),statement:void 0,expirationTime:void 0,notBefore:void 0};return Object.assign(t,{toString:()=>this.stringify(t)})}stringify(e){let t=this.getNetworkName(e.chainId);return[`${e.domain} wants you to sign in with your ${t} account:`,e.accountAddress,e.statement?` 2${e.statement} 3`:"",`URI: ${e.uri}`,`Version: ${e.version}`,`Chain ID: ${e.chainId}`,`Nonce: ${e.nonce}`,e.issuedAt&&`Issued At: ${e.issuedAt}`,e.expirationTime&&`Expiration Time: ${e.expirationTime}`,e.notBefore&&`Not Before: ${e.notBefore}`,e.requestId&&`Request ID: ${e.requestId}`,e.resources?.length&&e.resources.reduce((e,t)=>`${e} 4- ${t}`,"Resources:")].filter(e=>"string"==typeof e).join("\n").trim()}getNetworkName(e){let t=s.W.getAllRequestedCaipNetworks();return c.L.getNetworkNameByCaipNetworkId(t,e)}stringifyDate(e){return e.toISOString()}}class d{constructor(e={}){this.otpUuid=null,this.listeners={sessionChanged:[]},this.localAuthStorageKey=e.localAuthStorageKey||r.Ws.SIWX_AUTH_TOKEN,this.localNonceStorageKey=e.localNonceStorageKey||r.Ws.SIWX_NONCE_TOKEN,this.required=e.required??!0,this.messenger=new u({getNonce:this.getNonce.bind(this)})}async createMessage(e){return this.messenger.createMessage(e)}async addSession(e){let t=await this.request({method:"POST",key:"authenticate",body:{data:e.data,message:e.message,signature:e.signature,clientId:this.getClientId(),walletInfo:this.getWalletInfo()},headers:["nonce","otp"]});this.setStorageToken(t.token,this.localAuthStorageKey),this.emit("sessionChanged",e),this.setAppKitAccountUser(function(e){let t=e.split(".");if(3!==t.length)throw Error("Invalid token");let i=t[1];if("string"!=typeof i)throw Error("Invalid token");let r=i.replace(/-/gu,"+").replace(/_/gu,"/");return JSON.parse(atob(r.padEnd(r.length+(4-r.length%4)%4,"=")))}(t.token)),this.otpUuid=null}async getSessions(e,t){try{if(!this.getStorageToken(this.localAuthStorageKey))return[];let i=await this.request({method:"GET",key:"me",query:{},headers:["auth"]});if(!i)return[];let r=i.address.toLowerCase()===t.toLowerCase(),a=i.caip2Network===e;if(!r||!a)return[];let n={data:{accountAddress:i.address,chainId:i.caip2Network},message:"",signature:""};return this.emit("sessionChanged",n),this.setAppKitAccountUser(i),[n]}catch{return[]}}async revokeSession(e,t){return Promise.resolve(this.clearStorageTokens())}async setSessions(e){if(0===e.length)this.clearStorageTokens();else{let t=e.find(e=>e.data.chainId===(0,l.kg)()?.caipNetworkId)||e[0];await this.addSession(t)}}getRequired(){return this.required}async getSessionAccount(){if(!this.getStorageToken(this.localAuthStorageKey))throw Error("Not authenticated");return this.request({method:"GET",key:"me",body:void 0,query:{includeAppKitAccount:!0},headers:["auth"]})}async setSessionAccountMetadata(e=null){if(!this.getStorageToken(this.localAuthStorageKey))throw Error("Not authenticated");return this.request({method:"PUT",key:"account-metadata",body:{metadata:e},headers:["auth"]})}on(e,t){return this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter(e=>e!==t)}}removeAllListeners(){Object.keys(this.listeners).forEach(e=>{this.listeners[e]=[]})}async requestEmailOtp({email:e,account:t}){let i=await this.request({method:"POST",key:"otp",body:{email:e,account:t}});return this.otpUuid=i.uuid,this.messenger.resources=[`email:${e}`],i}confirmEmailOtp({code:e}){return this.request({method:"PUT",key:"otp",body:{code:e},headers:["otp"]})}async request({method:e,key:t,query:i,body:r,headers:n}){let{projectId:o,st:s,sv:l}=this.getSDKProperties(),c=new URL(`${a.o.W3M_API_URL}/auth/v1/${String(t)}`);c.searchParams.set("projectId",o),c.searchParams.set("st",s),c.searchParams.set("sv",l),i&&Object.entries(i).forEac
4h(([e,t])=>c.searchParams.set(e,String(t)));let u=await fetch(c,{method:e,body:r?JSON.stringify(r):void 0,headers:Array.isArray(n)?n.reduce((e,t)=>{switch(t){case"nonce":e["x-nonce-jwt"]=`Bearer ${this.getStorageToken(this.localNonceStorageKey)}`;break;case"auth":e.Authorization=`Bearer ${this.getStorageToken(this.localAuthStorageKey)}`;break;case"otp":this.otpUuid&&(e["x-otp"]=this.otpUuid)}return e},{}):void 0});if(!u.ok)throw Error(await u.text());return u.headers.get("content-type")?.includes("application/json")?u.json():null}getStorageToken(e){return r.Ud.getItem(e)}setStorageToken(e,t){r.Ud.setItem(t,e)}clearStorageTokens(){this.otpUuid=null,r.Ud.removeItem(this.localAuthStorageKey),r.Ud.removeItem(this.localNonceStorageKey),this.emit("sessionChanged",void 0)}async getNonce(){let{nonce:e,token:t}=await this.request({method:"GET",key:"nonce"});return this.setStorageToken(t,this.localNonceStorageKey),e}getClientId(){return o.T.state.clientId}getWalletInfo(){let e=s.W.getAccountData()?.connectedWalletInfo;if(!e)return;if("social"in e&&"identifier"in e)return{type:"social",social:e.social,identifier:e.identifier};let{name:t,icon:i}=e,r="unknown";switch(e.type){case"EXTERNAL":case"INJECTED":case"ANNOUNCED":r="extension";break;case"WALLET_CONNECT":r="walletconnect";break;default:r="unknown"}return{type:r,name:t,icon:i}}getSDKProperties(){return n.N._getSdkProperties()}emit(e,t){this.listeners[e].forEach(e=>e(t))}setAppKitAccountUser(e){let{email:t}=e;
4t&&Object.values(a.o.CHAIN).forEach(e=>{s.W.setAccountProp("user",{email:t},e)})}}},59980:(e,t,i)=>{i.d(t,{H:()=>E});var r,a=i(56059),n=i(81767),o=i(26274),s=i(32590),l=i(33432),c=i(82875),u=i(2076);i(6647),i(9266),i(73732),i(6077);var d=i(46756),h=i(55405),p=i(63412),g=i(91392);let m=(0,g.AH)` 5 :host { 6 position: relative; 7 display: inline-block; 8 } 9 10 input { 11 width: 48px; 12 height: 48px; 13 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 14 border-radius: ${({borderRadius:e})=>e[4]}; 15 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 16 font-family: ${({fontFamily:e})=>e.regular}; 17 font-size: ${({textSize:e})=>e.large}; 18 line-height: 18px; 19 letter-spacing: -0.16px; 20 text-align: center; 21 color: ${({tokens:e})=>e.theme.textPrimary}; 22 caret-color: ${({tokens:e})=>e.core.textAccentPrimary}; 23 transition: 24 background-color ${({durations:e})=>e.lg} 25 ${({easings:e})=>e["ease-out-power-2"]}, 26 border-color ${({durations:e})=>e.lg} 27 ${({easings:e})=>e["ease-out-power-2"]}, 28 box-shadow ${({durations:e})=>e.lg} 29 ${({easings:e})=>e["ease-out-power-2"]}; 30 will-change: background-color, border-color, box-shadow; 31 box-sizing: border-box; 32 -webkit-appearance: none; 33 -moz-appearance: textfield; 34 padding: ${({spacing:e})=>e[4]}; 35 } 36 37 input::-webkit-outer-spin-button, 38 input::-webkit-inner-spin-button { 39 -webkit-appearance: none; 40 margin: 0; 41 } 42 43 input[type='number'] { 44 -moz-appearance: textfield; 45 } 46 47 input:disabled { 48 cursor: not-allowed; 49 opacity: 0.5; 50 } 51 52 input:focus-visible:enabled { 53 background-color: transparent; 54 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 55 box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent040}; 56 } 57`;var w=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let f=class extends a.WF{constructor(){super(...arguments),this.disabled=!1,this.value=""}render(){return(0,a.qy)`<input 58 type="number" 59 maxlength="1" 60 inputmode="numeric" 61 autofocus 62 ?disabled=${this.disabled} 63 value=${this.value} 64 /> `}};f.styles=[d.W5,d.fD,m],w([(0,n.MZ)({type:Boolean})],f.prototype,"disabled",void 0),w([(0,n.MZ)({type:String})],f.prototype,"value",void 0),f=w([(0,p.E)("wui-input-numeric")],f);let y=(0,a.AH)` 65 :host { 66 position: relative; 67 display: block; 68 } 69`;var v=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let x=class extends a.WF{constructor(){super(...arguments),this.length=6,this.otp="",this.values=Array.from({length:this.length}).map(()=>""),this.numerics=[],this.shouldInputBeEnabled=e=>this.values.slice(0,e).every(e=>""!==e),this.handleKeyDown=(e,t)=>{let i=e.target,r=this.getInputElement(i);if(!r)return;["ArrowLeft","ArrowRight","Shift","Delete"].includes(e.key)&&e.preventDefault();let a=r.selectionStart;switch(e.key){case"ArrowLeft":a&&r.setSelectionRange(a+1,a+1),this.focusInputField("prev",t);break;case"ArrowRight":case"Shift":this.focusInputField("next",t);break;case"Delete":case"Backspace":""===r.value?this.focusInputField("prev",t):this.updateInput(r,t,"")}},this.focusInputField=(e,t)=>{if("next"===e){let e=t+1;if(!this.shouldInputBeEnabled(e))return;let i=this.numerics[e<this.length?e:t],r=i?this.getInputElement(i):void 0;r&&(r.disabled=!1,r.focus())}if("prev"===e){let e=t-1,i=this.numerics[e>-1?e:t],r=i?this.getInputElement(i):void 0;r&&r.focus()}}}firstUpdated(){this.otp&&(this.values=this.otp.split(""));let e=this.shadowRoot?.querySelectorAll("wui-input-numeric");
69e&&(this.numerics=Array.from(e)),this.numerics[0]?.focus()}render(){return(0,a.qy)` 70 <wui-flex gap="1" data-testid="wui-otp-input"> 71 ${Array.from({length:this.length}).map((e,t)=>(0,a.qy)` 72 <wui-input-numeric 73 @input=${e=>this.handleInput(e,t)} 74 @click=${e=>this.selectInput(e)} 75 @keydown=${e=>this.handleKeyDown(e,t)} 76 .disabled=${!this.shouldInputBeEnabled(t)} 77 .value=${this.values[t]||""} 78 > 79 </wui-input-numeric> 80 `)} 81 </wui-flex> 82 `}updateInput(e,t,i){let r=this.numerics[t],a=e||(r?this.getInputElement(r):void 0);a&&(a.value=i,this.values=this.values.map((e,r)=>r===t?i:e))}selectInput(e){let t=e.target;if(t){let e=this.getInputElement(t);e?.select()}}handleInput(e,t){let i=e.target,r=this.getInputElement(i);if(r){let i=r.value;"insertFromPaste"===e.inputType?this.handlePaste(r,i,t):h.Z.isNumber(i)&&e.data?(this.updateInput(r,t,e.data),this.focusInputField("next",t)):this.updateInput(r,t,"")}this.dispatchInputChangeEvent()}handlePaste(e,t,i){let r=t[0];if(r&&h.Z.isNumber(r)){this.updateInput(e,i,r);let a=t.substring(1);if(i+1<this.length&&a.length){let e=this.numerics[i+1],t=e?this.getInputElement(e):void 0;t&&this.handlePaste(t,a,i+1)}else this.focusInputField("next",i)}else this.updateInput(e,i,"")}getInputElement(e){return e.shadowRoot?.querySelector("input")?e.shadowRoot.querySelector("input"):null}dispatchInputChangeEvent(){let e=this.values.join("");this.dispatchEvent(new CustomEvent("inputChange",{detail:e,bubbles:!0,composed:!0}))}};x.styles=[d.W5,y],v([(0,n.MZ)({type:Number})],x.prototype,"length",void 0),v([(0,n.MZ)({type:String})],x.prototype,"otp",void 0),v([(0,n.wk)()],x.prototype,"values",void 0),x=v([(0,p.E)("wui-otp")],x),i(66803);var b=i(99347);let $=(0,a.AH)` 83 wui-loading-spinner { 84 margin: 9px auto; 85 } 86 87 .email-display, 88 .email-display wui-text { 89 max-width: 100%; 90 } 91`;var k=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let E=r=class extends a.WF{firstUpdated(){this.startOTPTimeout()}disconnectedCallback(){clearTimeout(this.OTPTimeout)}constructor(){super(),this.loading=!1,this.timeoutTimeLeft=b.Q.getTimeToNextEmailLogin(),this.error="",this.otp="",this.email=o.I.state.data?.email,this.authConnector=s.a.getAuthConnector()}render(){if(!this.email)throw Error("w3m-email-otp-widget: No email provided");let e=!!this.timeoutTimeLeft,t=this.getFooterLabels(e);return(0,a.qy)` 92 <wui-flex 93 flexDirection="column" 94 alignItems="center" 95 .padding=${["4","0","4","0"]} 96 gap="4" 97 > 98 <wui-flex 99 class="email-display" 100 flexDirection="column" 101 alignItems="center" 102 .padding=${["0","5","0","5"]} 103 > 104 <wui-text variant="md-regular" color="primary" align="center"> 105 Enter the code we sent to 106 </wui-text> 107 <wui-text variant="md-medium" color="primary" lineClamp="1" align="center"> 108 ${this.email} 109 </wui-text> 110 </wui-flex> 111 112 <wui-text variant="sm-regular" color="secondary">The code expires in 20 minutes</wui-text> 113 114 ${this.loading?(0,a.qy)`<wui-loading-spinner size="xl" color="accent-primary"></wui-loading-spinner>`:(0,a.qy)` <wui-flex flexDirection="column" alignItems="center" gap="2"> 115 <wui-otp 116 dissabled 117 length="6" 118 @inputChange=${this.onOtpInputChange.bind(this)} 119 .otp=${this.otp} 120 ></wui-otp> 121 ${this.error?(0,a.qy)` 122 <wui-text variant="sm-regular" align="center" color="error"> 123 ${this.error}. Try Again 124 </wui-text> 125 `:null} 126 </wui-flex>`} 127 128 <wui-flex alignItems="center" gap="2"> 129 <wui-text variant="sm-regular" color="secondary">${t.title}</wui-text> 130 <wui-link @click=${this.onResendCode.bind(this)} .disabled=${e}> 131 ${t.action} 132 </wui-link> 133 </wui-flex> 134 </wui-flex> 135 `}startOTPTimeout(){this.timeoutTimeLeft=b.Q.getTimeToNextEmailLogin(),this.OTPTimeout=setInterval(()=>{this.timeoutTimeLeft>0?this.timeoutTimeLeft=b.Q.getTimeToNextEmailLogin():clearInterval(this.OTPTimeout)},1e3)}async onOtpInputChange(e){try{!this.loading&&(this.otp=e.detail,this.shouldSubmitOnOtpChange()&&(this.loading=!0,await this.onOtpSubmit?.(this.otp)))}catch(e){this.error=l.w.parseError(e),this.loading=!1}}async onResendCode(){try{if(this.onOtpResend){if(!this.loading&&!this.timeoutTimeLeft){if(this.error="",this.otp="",!s.a.getAuthConnector()||!this.email)throw Error("w3m-email-otp-widget: Unable to resend email");this.loading=!0,await this.onOtpResend(this.email),this.startOTPTimeout(),c.P.showSuccess("Code email resent")}}else this.onStartOver&&this.onStartOver()}catch(e){c.P.showError(e)}finally{this.loading=!1}}getFooterLabels(e){return this.onStartOver?{title:"Something wrong?",action:`Try again ${e?`in ${this.timeoutTimeLeft}s`:""}`}:{title:"Didn't receive it?",action:`Resend ${e?`in ${this.timeoutTimeLeft}s`:"Code"}`}}shouldSubmitOnOtpChange(){return this.authConnector&&this.otp.length===r.OTP_LENGTH}};E.OTP_LENGTH=6,E.styles=$,k([(0,n.wk)()],E.prototype,"loading",void 0),k([(0,n.wk)()],E.prototype,"timeoutTimeLeft",void 0),k([(0,n.wk)()],E.prototype,"error",void 0),E=r=k([(0,u.EM)("w3m-email-otp-widget")],E)},64678:(e,t,i)=>{i.r(t),i.d(t,{W3mDataCaptureOtpConfirmView:()=>x,W3mDataCaptureView:()=>E,W3mEmailSuffixesWidget:()=>c,W3mRecentEmailsWidget:()=>h});var r=i(56059),a=i(81767),n=i(2076);let o=(0,r.AH)` 136 .email-sufixes { 137 display: flex; 138 flex-direction: row; 139 gap: var(--wui-spacing-3xs); 140 overflow-x: auto; 141 max-width: 100%; 142 margin-top: var(--wui-spacing-s); 143 margin-bottom: calc(-1 * var(--wui-spacing-m)); 144 padding-bottom: var(--wui-spacing-m); 145 margin-left: calc(-1 * var(--wui-spacing-m)); 146 margin-right: calc(-1 * var(--wui-spacing-m)); 147 padding-left: var(--wui-spacing-m); 148 padding-right: var(--wui-spacing-m); 149 150 &::-webkit-scrollbar {
151 display: none; 152 } 153 } 154`;var s=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let l=["@gmail.com","@outlook.com","@yahoo.com","@hotmail.com","@aol.com","@icloud.com","@zoho.com"],c=class extends r.WF{constructor(){super(...arguments),this.email=""}render(){let e=l.filter(this.filter.bind(this)).map(this.item.bind(this));return 0===e.length?null:(0,r.qy)`<div class="email-sufixes">${e}</div>`}filter(e){if(!this.email)return!1;let t=this.email.split("@");if(t.length<2)return!0;let i=t.pop();return e.includes(i)&&e!==`@${i}`}item(e){let t=()=>{let t=this.email.split("@");t.length>1&&t.pop();let i=t[0]+e;this.dispatchEvent(new CustomEvent("change",{detail:i,bubbles:!0,composed:!0}))};return(0,r.qy)`<wui-button variant="neutral" size="sm" @click=${t} 155 >${e}</wui-button 156 >`}};c.styles=[o],s([(0,a.MZ)()],c.prototype,"email",void 0),c=s([(0,n.EM)("w3m-email-suffixes-widget")],c);let u=(0,r.AH)` 157 .recent-emails { 158 display: flex; 159 flex-direction: column; 160 padding: var(--wui-spacing-s) 0; 161 border-top: 1px solid var(--wui-color-gray-glass-005); 162 border-bottom: 1px solid var(--wui-color-gray-glass-005); 163 } 164 165 .recent-emails-heading { 166 margin-bottom: var(--wui-spacing-s); 167 } 168 169 .recent-emails-list-item { 170 --wui-color-gray-glass-002: transparent; 171 } 172`;var d=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let h=class extends r.WF{constructor(){super(...arguments),this.emails=[]}render(){return 0===this.emails.length?null:(0,r.qy)`<div class="recent-emails"> 173 <wui-text variant="micro-600" color="fg-200" class="recent-emails-heading" 174 >Recently used emails</wui-text 175 > 176 ${this.emails.map(this.item.bind(this))} 177 </div>`}item(e){let t=()=>{this.dispatchEvent(new CustomEvent("select",{detail:e,bubbles:!0,composed:!0}))};return(0,r.qy)`<wui-list-item 178 @click=${t} 179 ?chevron=${!0} 180 icon="mail" 181 iconVariant="overlay" 182 class="recent-emails-list-item" 183 > 184 <wui-text variant="paragraph-500" color="fg-100">${e}</wui-text> 185 </wui-list-item>`}};h.styles=[u],d([(0,a.MZ)()],h.prototype,"emails",void 0),h=d([(0,n.EM)("w3m-recent-emails-widget")],h);var p=i(18627),g=i(26274),m=i(82376),w=i(82875),f=i(8491),y=i(59980),v=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let x=class extends y.H{constructor(){super(...arguments),this.siwx=p.H.state.siwx,this.onOtpSubmit=async e=>{await this.siwx.confirmEmailOtp({code:e}),g.I.replace("SIWXSignMessage")},this.onOtpResend=async e=>{let t=m.W.getAccountData();if(!t?.caipAddress)throw Error("No account data found");await this.siwx.requestEmailOtp({email:e,account:t.caipAddress})}}connectedCallback(){this.siwx&&this.siwx instanceof f.u||w.P.showError("ReownAuthentication is not initialized."),super.connectedCallback()}shouldSubmitOnOtpChange(){return this.otp.length===y.H.OTP_LENGTH}};v([(0,a.wk)()],x.prototype,"siwx",void 0),x=v([(0,n.EM)("w3m-data-capture-otp-confirm-view")],x);var b=i(15405);let $=(0,r.AH)` 186 .hero { 187 display: flex; 188 flex-direction: column; 189 align-items: center; 190 justify-content: center; 191 gap: var(--wui-spacing-3xs); 192 193 transition-property: margin, height; 194 transition-duration: var(--wui-duration-md); 195 transition-timing-function: var(--wui-ease-out-power-1); 196 margin-top: -100px; 197 198 &[data-state='loading'] { 199 margin-top: 0px; 200 } 201 202 position: relative; 203 &:after { 204 content: ''; 205 position: absolute; 206 bottom: 0; 207 height: 252px; 208 width: 360px; 209 background: radial-gradient( 210 96.11% 53.95% at 50% 51.28%, 211 transparent 0%, 212 color-mix(in srgb, var(--wui-color-bg-100) 5%, transparent) 49%, 213 color-mix(in srgb, var(--wui-color-bg-100) 65%, transparent) 99.43% 214 ); 215 } 216 } 217 218 .hero-main-icon { 219 width: 176px; 220 transition-property: background-color; 221 transition-duration: var(--wui-duration-lg); 222 transition-timing-function: var(--wui-ease-out-power-1); 223 224 &[data-state='loading'] { 225 width: 56px; 226 } 227 } 228 229 .hero-row { 230 display: flex; 231 flex-direction: row; 232 align-items: center; 233 justify-content: center; 234 gap: var(--wui-spacing-3xs); 235 flex-wrap: nowrap; 236 min-width: fit-content; 237 238 &:nth-child(1) { 239 transform: translateX(-30px); 240 } 241 242 &:nth-child(2) { 243 transform: translateX(30px); 244 } 245 246 &:nth-child(4) { 247 transform: translateX(40px); 248 } 249 250 transition-property: height; 251 transition-duration: var(--wui-duration-md); 252 transition-timing-function: var(--wui-ease-out-power-1); 253 height: 68px; 254 255 &[data-state='loading'] { 256 height: 0px; 257 } 258 } 259 260 .hero-row-icon { 261 opacity: 0.1; 262 transition-property: opacity; 263 transition-duration: var(--wui-duration-md); 264 transition-timing-function: var(--wui-ease-out-power-1); 265 266 &[data-state='loading'] { 267 opacity: 0; 268 } 269 } 270`;var k=function(e,t,i,r){var a,n=arguments.length,o=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(n<3?a(o):n>3?a(t,i,o):a(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o};let E=class extends r.WF{constructor(){super(...arguments),this.email=g.I.state.data?.email??m.W.getAccountData()?.user?.email??"",this.address=m.W.getAccountData()?.address??"",this.loading=!1,this.appName=p.H.state.metadata?.name??"AppKit",this.siwx=p.H.state.siwx,this.isRequired=Array.isArray(p.H.state.remoteFeatures?.emailCapture)&&p.H.state.remoteFeatures?.emailCapture.includes("required"),this.recentEmails=this.getRecentEmails()}connectedCallback(){this.siwx&&this.siwx instanceof f.u||w.P.showError("ReownAuthentication is not initialized. Please contact support."),super.connectedCallback()}firstUpdated(){this.loading=!1,this.recentEmails=this.getRecentEmails(),this.email&&this.onSubmit()}render(){return(0,r.qy)` 271 <wui-flex flexDirection="column" .padding=${["3xs","m","m","m"]} gap="l"> 272 ${this.hero()} ${this.paragraph()} ${this.emailInput()} ${this.recentEmailsWidget()} 273 ${this.footerActions()} 274 </wui-flex> 275 `}hero(){return(0,r.qy)` 276 <div class="hero" data-state=${this.loading?"loading":"default"}> 277 ${this.heroRow(["id","mail","wallet","x","solana","qrCode"])} 278 ${this.heroRow(["mail","farcaster","wallet","discord","mobile","qrCode"])} 279 <div class="hero-row"> 280 ${this.heroIcon("github")} ${this.heroIcon("bank")} 281 <wui-icon-box 282 size="xl" 283 iconSize="xxl" 284 iconColor=${this.loading?"fg-100":"accent-100"} 285 backgroundColor=${this.loading?"fg-100":"accent-100"} 286 icon=${this.loading?"id":"user"} 287 isOpaque 288 class="hero-main-icon" 289 data-state=${this.loading?"loading":"default"} 290 > 291 </wui-icon-box> 292 ${this.heroIcon("id")} ${this.heroIcon("card")} 293 </div> 294 ${this.heroRow(["google","id","github","verify","apple","mobile"])} 295 </div> 296 `}heroRow(e){return(0,r.qy)` 297 <div class="hero-row" data-state=${this.loading?"loading":"default"}> 298 ${e.map(this.heroIcon.bind(this))} 299 </div> 300 `}heroIcon(e){return(0,r.qy)` 301 <wui-icon-box 302 size="xl" 303 iconSize="xxl" 304 iconColor="fg-100" 305 backgroundColor="fg-100" 306 icon=${e} 307 data-state=${this.loading?"loading":"default"} 308 isOpaque 309 class="hero-row-icon" 310 > 311 </wui-icon-box> 312 `}paragraph(){return this.loading?(0,r.qy)` 313 <wui-text variant="paragraph-400" color="fg-200" align="center" 314 >We are verifying your account with email 315 <wui-text variant="paragraph-600" color="accent-100">${this.email}</wui-text> and address 316 <wui-text variant="paragraph-600" color="fg-100"> 317 ${n.Zv.getTruncateString({string:this.address,charsEnd:4,charsStart:4,truncate:"middle"})} </wui-text 318 >, please wait a moment.</wui-text 319 > 320 `:this.isRequired?(0,r.qy)` 321 <wui-text variant="paragraph-600" color="fg-100" align="center"> 322 ${this.appName} requires your email for authentication. 323 </wui-text> 324 `:(0,r.qy)` 325 <wui-flex flexDirection="column" gap="xs" alignItems="center"> 326 <wui-text variant="paragraph-600" color="fg-100" align="center" size> 327 ${this.appName} would like to collect your email. 328 </wui-text> 329 330 <wui-text variant="small-400" color="fg-200" align="center"> 331 Don't worry, it's optional—
331you can skip this step. 332 </wui-text> 333 </wui-flex> 334 `}emailInput(){if(this.loading)return null;let e=e=>{"Enter"===e.key&&this.onSubmit()},t=e=>{this.email=e.detail};return(0,r.qy)` 335 <wui-flex flexDirection="column"> 336 <wui-email-input 337 .value=${this.email} 338 .disabled=${this.loading} 339 @inputChange=${t} 340 @keydown=${e} 341 ></wui-email-input> 342 343 <w3m-email-suffixes-widget 344 .email=${this.email} 345 @change=${t} 346 ></w3m-email-suffixes-widget> 347 </wui-flex> 348 `}recentEmailsWidget(){if(0===this.recentEmails.length||this.loading)return null;let e=e=>{this.email=e.detail,this.onSubmit()};return(0,r.qy)` 349 <w3m-recent-emails-widget 350 .emails=${this.recentEmails} 351 @select=${e} 352 ></w3m-recent-emails-widget> 353 `}footerActions(){return(0,r.qy)` 354 <wui-flex flexDirection="row" fullWidth gap="s"> 355 ${this.isRequired?null:(0,r.qy)`<wui-button 356 size="lg" 357 variant="neutral" 358 fullWidth 359 .disabled=${this.loading} 360 @click=${this.onSkip.bind(this)} 361 >Skip this step</wui-button 362 >`} 363 364 <wui-button 365 size="lg" 366 variant="main" 367 type="submit" 368 fullWidth 369 .disabled=${!this.email||!this.isValidEmail(this.email)} 370 .loading=${this.loading} 371 @click=${this.onSubmit.bind(this)} 372 > 373 Continue 374 </wui-button> 375 </wui-flex> 376 `}async onSubmit(){if(!(this.siwx instanceof f.u))return void w.P.showError("ReownAuthentication is not initialized. Please contact support.");let e=m.W.getActiveCaipAddress();if(!e)throw Error("Account is not connected.");if(!this.isValidEmail(this.email))return void w.P.showError("Please provide a valid email.");try{this.loading=!0;let t=await this.siwx.requestEmailOtp({email:this.email,account:e});this.pushRecentEmail(this.email),null===t.uuid?g.I.replace("SIWXSignMessage"):g.I.replace("DataCaptureOtpConfirm",{email:this.email})}catch(e){w.P.showError("Failed to send email OTP"),this.loading=!1}}onSkip(){g.I.replace("SIWXSignMessage")}getRecentEmails(){let e=b.Ud.getItem(b.Ws.RECENT_EMAILS);return(e?e.split(","):[]).filter(this.isValidEmail.bind(this)).slice(0,3)}pushRecentEmail(e){let t=Array.from(new Set([e,...this.getRecentEmails()])).slice(0,3);b.Ud.setItem(b.Ws.RECENT_EMAILS,t.join(","))}isValidEmail(e){return/^\S+@\S+\.\S+$/u.test(e)}};E.styles=[$],k([(0,a.wk)()],E.prototype,"email",void 0),k([(0,a.wk)()],E.prototype,"address",void 0),k([(0,a.wk)()],E.prototype,"loading",void 0),k([(0,a.wk)()],E.prototype,"appName",void 0),k([(0,a.wk)()],E.prototype,"siwx",void 0),k([(0,a.wk)()],E.prototype,"isRequired",void 0),k([(0,a.wk)()],E.prototype,"recentEmails",void 0),E=k([(0,n.EM)("w3m-data-capture-view")],E)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.