1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="361978dd-4d3d-4de4-96f7-fe64efc66fd2",e._sentryDebugIdIdentifier="sentry-dbid-361978dd-4d3d-4de4-96f7-fe64efc66fd2")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[429],{2143:(e,t,i)=>{i.d(t,{u:()=>d});var r=i(82327),a=i(20111),n=i(44982),o=i(80560),s=i(7791),l=i(28647),c=i(89952);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)})}}},20429:(e,t,i)=>{i.r(t),i.d(t,{W3mDataCaptureOtpConfirmView:()=>b,W3mDataCaptureView:()=>E,W3mEmailSuffixesWidget:()=>c,W3mRecentEmailsWidget:()=>h});var r=i(68678),a=i(84508),n=i(32938);let o=(0,r.AH)` 5 .email-sufixes { 6 display: flex; 7 flex-direction: row; 8 gap: var(--wui-spacing-3xs); 9 overflow-x: auto; 10 max-width: 100%; 11 margin-top: var(--wui-spacing-s); 12 margin-bottom: calc(-1 * var(--wui-spacing-m)); 13 padding-bottom: var(--wui-spacing-m); 14 margin-left: calc(-1 * var(--wui-spacing-m)); 15 margin-right: calc(-1 * var(--wui-spacing-m)); 16 padding-left: var(--wui-spacing-m); 17 padding-right: var(--wui-spacing-m); 18 19 &::-webkit-scrollbar { 20 display: none; 21 } 22 } 23`;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){return(0,r.qy)`<wui-button variant="neutral" size="sm" @click=${()=>{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}))}} 24 >${e}</wui-button 25 >`}};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)` 26 .recent-emails { 27 display: flex; 28 flex-direction: column; 29 padding: var(--wui-spacing-s) 0; 30 border-top: 1px solid var(--wui-color-gray-glass-005); 31 border-bottom: 1px solid var(--wui-color-gray-glass-005); 32 } 33 34 .recent-emails-heading { 35 margin-bottom: var(--wui-spacing-s); 36 } 37 38 .recent-emails-list-item { 39 --wui-color-gray-glass-002: transparent; 40 } 41`;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"> 42 <wui-text variant="micro-600" color="fg-200" class="recent-emails-heading" 43 >Recently used emails</wui-text 44 > 45 ${this.emails.map(this.item.bind(this))} 46 </div>`}item(e){return(0,r.qy)`<wui-list-item 47 @click=${()=>{this.dispatchEvent(new CustomEvent("select",{detail:e,bubbles:!0,composed:!0}))}} 48 ?chevron=${!0} 49 icon="mail" 50 iconVariant="overlay" 51 class="recent-emails-list-item" 52 > 53 <wui-text variant="paragraph-500" color="fg-100">${e}</wui-text> 54 </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(9528),g=i(97379),m=i(7791),f=i(75276),w=i(2143),y=i(52856),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 b=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 w.u||f.P.showError("ReownAuthentication is not initialized."),super.connectedCallback()}shouldSubmitOnOtpChange(){return this.otp.length===y.H.OTP_LENGTH}};v([(0,a.wk)()],b.prototype,"siwx",void 0),b=v([(0,n.EM)("w3m-data-capture-otp-confirm-view")],b);var x=i(82327);let $=(0,r.AH)` 55 .hero { 56 display: flex; 57 flex-direction: column; 58 align-items: center; 59 justify-content: center; 60 gap: var(--wui-spacing-3xs); 61 62 transition-property: margin, height; 63 transition-duration: var(--wui-duration-md); 64 transition-timing-function: var(--wui-ease-out-power-1); 65 margin-top: -100px; 66 67 &[data-state='loading'] { 68 margin-top: 0px; 69 } 70 71 position: relative; 72 &:after { 73 content: ''; 74 position: absolute; 75 bottom: 0; 76 height: 252px; 77 width: 360px; 78 background: radial-gradient( 79 96.11% 53.95% at 50% 51.28%, 80 transparent 0%, 81 color-mix(in srgb, var(--wui-color-bg-100) 5%, transparent) 49%, 82 color-mix(in srgb, var(--wui-color-bg-100) 65%, transparent) 99.43% 83 ); 84 } 85 } 86 87 .hero-main-icon { 88 width: 176px; 89 transition-property: background-color; 90 transition-duration: var(--wui-duration-lg); 91 transition-timing-function: var(--wui-ease-out-power-1); 92 93 &[data-state='loading'] { 94 width: 56px; 95 } 96 } 97 98 .hero-row { 99 display: flex; 100 flex-direction: row; 101 align-items: center; 102 justify-content: center; 103 gap: var(--wui-spacing-3xs); 104 flex-wrap: nowrap; 105 min-width: fit-content; 106 107 &:nth-child(1) { 108 transform: translateX(-30px); 109 } 110 111 &:nth-child(2) { 112 transform: translateX(30px); 113 } 114 115 &:nth-child(4) { 116 transform: translateX(40px); 117 } 118 119 transition-property: height; 120 transition-duration: var(--wui-duration-md); 121 transition-timing-function: var(--wui-ease-out-power-1); 122 height: 68px; 123 124 &[data-state='loading'] { 125 height: 0px; 126 } 127 } 128 129 .hero-row-icon { 130 opacity: 0.1; 131 transition-property: opacity; 132 transition-duration: var(--wui-duration-md); 133 transition-timing-function: var(--wui-ease-out-power-1); 134 135 &[data-state='loading'] { 136 opacity: 0; 137 } 138 } 139`;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 w.u||f.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)` 140 <wui-flex flexDirection="column" .padding=${["3xs","m","m","m"]} gap="l"> 141 ${this.hero()} ${this.paragraph()} ${this.emailInput()} ${this.recentEmailsWidget()} 142 ${this.footerActions()} 143 </wui-flex> 144 `}hero(){return(0,r.qy)` 145 <div class="hero" data-state=${this.loading?"loading":"default"}> 146 ${this.heroRow(["id","mail","wallet","x","solana","qrCode"])} 147 ${this.heroRow(["mail","farcaster","wallet","discord","mobile","qrCode"])} 148 <div class="hero-row"> 149 ${this.heroIcon("github")} ${this.heroIcon("bank")} 150 <wui-icon-box 151 size="xl" 152 iconSize="xxl" 153 iconColor=${this.loading?"fg-100":"accent-100"} 154 backgroundColor=${this.loading?"fg-100":"accent-100"} 155 icon=${this.loading?"id":"user"} 156 isOpaque 157 class="hero-main-icon" 158 data-state=${this.loading?"loading":"default"} 159 > 160 </wui-icon-box> 161 ${this.heroIcon("id")} ${this.heroIcon("card")} 162 </div> 163 ${this.heroRow(["google","id","github","verify","apple","mobile"])} 164 </div> 165 `}heroRow(e){return(0,r.qy)` 166 <div class="hero-row" data-state=${this.loading?"loading":"default"}> 167 ${e.map(this.heroIcon.bind(this))} 168 </div> 169 `}heroIcon(e){return(0,r.qy)` 170 <wui-icon-box 171 size="xl" 172 iconSize="xxl" 173 iconColor="fg-100" 174 backgroundColor="fg-100" 175 icon=${e} 176 data-state=${this.loading?"loading":"default"} 177 isOpaque 178 class="hero-row-icon" 179 > 180 </wui-icon-box> 181 `}paragraph(){return this.loading?(0,r.qy)` 182 <wui-text variant="paragraph-400" color="fg-200" align="center" 183 >We are verifying your account with email 184 <wui-text variant="paragraph-600" color="accent-100">${this.email}</wui-text> and address 185 <wui-text variant="paragraph-600" color="fg-100"> 186 ${n.Zv.getTruncateString({string:this.address,charsEnd:4,charsStart:4,truncate:"middle"})} </wui-text 187 >, please wait a moment.</wui-text 188 > 189 `:this.isRequired?(0,r.qy)` 190 <wui-text variant="paragraph-600" color="fg-100" align="center"> 191 ${this.appName} requires your email for authentication. 192 </wui-text> 193 `:(0,r.qy)` 194 <wui-flex flexDirection="column" gap="xs" alignItems="center"> 195 <wui-text variant="paragraph-600" color="fg-100" align="center" size> 196 ${this.appName} would like to collect your email. 197 </wui-text> 198 199 <wui-text variant="small-400" color="fg-200" align="center"> 200 Don't worry, it's optional—
200you can skip this step. 201 </wui-text> 202 </wui-flex> 203 `}emailInput(){if(this.loading)return null;let e=e=>{this.email=e.detail};return(0,r.qy)` 204 <wui-flex flexDirection="column"> 205 <wui-email-input 206 .value=${this.email} 207 .disabled=${this.loading} 208 @inputChange=${e} 209 @keydown=${e=>{"Enter"===e.key&&this.onSubmit()}} 210 ></wui-email-input> 211 212 <w3m-email-suffixes-widget 213 .email=${this.email} 214 @change=${e} 215 ></w3m-email-suffixes-widget> 216 </wui-flex> 217 `}recentEmailsWidget(){return 0===this.recentEmails.length||this.loading?null:(0,r.qy)` 218 <w3m-recent-emails-widget 219 .emails=${this.recentEmails} 220 @select=${e=>{this.email=e.detail,this.onSubmit()}} 221 ></w3m-recent-emails-widget> 222 `}footerActions(){return(0,r.qy)` 223 <wui-flex flexDirection="row" fullWidth gap="s"> 224 ${this.isRequired?null:(0,r.qy)`<wui-button 225 size="lg" 226 variant="neutral" 227 fullWidth 228 .disabled=${this.loading} 229 @click=${this.onSkip.bind(this)} 230 >Skip this step</wui-button 231 >`} 232 233 <wui-button 234 size="lg" 235 variant="main" 236 type="submit" 237 fullWidth 238 .disabled=${!this.email||!this.isValidEmail(this.email)} 239 .loading=${this.loading} 240 @click=${this.onSubmit.bind(this)} 241 > 242 Continue 243 </wui-button> 244 </wui-flex> 245 `}async onSubmit(){if(!(this.siwx instanceof w.u))return void f.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 f.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){f.P.showError("Failed to send email OTP"),this.loading=!1}}onSkip(){g.I.replace("SIWXSignMessage")}getRecentEmails(){let e=x.Ud.getItem(x.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);x.Ud.setItem(x.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)},52856:(e,t,i)=>{i.d(t,{H:()=>E});var r,a=i(68678),n=i(84508),o=i(97379),s=i(65141),l=i(31497),c=i(75276),u=i(32938);i(80537),i(18985),i(86626),i(88445);var d=i(15410),h=i(82059),p=i(41674),g=i(99138);let m=(0,g.AH)` 246 :host { 247 position: relative; 248 display: inline-block; 249 } 250 251 input { 252 width: 48px; 253 height: 48px; 254 background: ${({tokens:e})=>e.theme.foregroundPrimary}; 255 border-radius: ${({borderRadius:e})=>e[4]}; 256 border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; 257 font-family: ${({fontFamily:e})=>e.regular}; 258 font-size: ${({textSize:e})=>e.large}; 259 line-height: 18px; 260 letter-spacing: -0.16px; 261 text-align: center; 262 color: ${({tokens:e})=>e.theme.textPrimary}; 263 caret-color: ${({tokens:e})=>e.core.textAccentPrimary}; 264 transition: 265 background-color ${({durations:e})=>e.lg} 266 ${({easings:e})=>e["ease-out-power-2"]}, 267 border-color ${({durations:e})=>e.lg} 268 ${({easings:e})=>e["ease-out-power-2"]}, 269 box-shadow ${({durations:e})=>e.lg} 270 ${({easings:e})=>e["ease-out-power-2"]}; 271 will-change: background-color, border-color, box-shadow; 272 box-sizing: border-box; 273 -webkit-appearance: none; 274 -moz-appearance: textfield; 275 padding: ${({spacing:e})=>e[4]}; 276 } 277 278 input::-webkit-outer-spin-button, 279 input::-webkit-inner-spin-button { 280 -webkit-appearance: none; 281 margin: 0; 282 } 283 284 input[type='number'] { 285 -moz-appearance: textfield; 286 } 287 288 input:disabled {
289 cursor: not-allowed; 290 opacity: 0.5; 291 } 292 293 input:focus-visible:enabled { 294 background-color: transparent; 295 border: 1px solid ${({tokens:e})=>e.theme.borderSecondary}; 296 box-shadow: 0px 0px 0px 4px ${({tokens:e})=>e.core.foregroundAccent040}; 297 } 298`;var f=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 w=class extends a.WF{constructor(){super(...arguments),this.disabled=!1,this.value=""}render(){return(0,a.qy)`<input 299 type="number" 300 maxlength="1" 301 inputmode="numeric" 302 autofocus 303 ?disabled=${this.disabled} 304 value=${this.value} 305 /> `}};w.styles=[d.W5,d.fD,m],f([(0,n.MZ)({type:Boolean})],w.prototype,"disabled",void 0),f([(0,n.MZ)({type:String})],w.prototype,"value",void 0),w=f([(0,p.E)("wui-input-numeric")],w);let y=(0,a.AH)` 306 :host { 307 position: relative; 308 display: block; 309 } 310`;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 b=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");e&&(this.numerics=Array.from(e)),this.numerics[0]?.focus()}render(){return(0,a.qy)` 311 <wui-flex gap="1" data-testid="wui-otp-input"> 312 ${Array.from({length:this.length}).map((e,t)=>(0,a.qy)` 313 <wui-input-numeric 314 @input=${e=>this.handleInput(e,t)} 315 @click=${e=>this.selectInput(e)} 316 @keydown=${e=>this.handleKeyDown(e,t)} 317 .disabled=${!this.shouldInputBeEnabled(t)} 318 .value=${this.values[t]||""} 319 > 320 </wui-input-numeric> 321 `)} 322 </wui-flex> 323 `}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}))}};b.styles=[d.W5,y],v([(0,n.MZ)({type:Number})],b.prototype,"length",void 0),v([(0,n.MZ)({type:String})],b.prototype,"otp",void 0),v([(0,n.wk)()],b.prototype,"values",void 0),b=v([(0,p.E)("wui-otp")],b),i(18561);var x=i(2126);let $=(0,a.AH)` 324 wui-loading-spinner { 325 margin: 9px auto; 326 } 327 328 .email-display, 329 .email-display wui-text { 330 max-width: 100%; 331 } 332`;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=x.Q.getTimeToNextEmailLogin(),this.error="",this.otp="",this.email=o.I.state.data?.email,this.authConnector=s.a.getAuthConnector()}
332render(){if(!this.email)throw Error("w3m-email-otp-widget: No email provided");let e=!!this.timeoutTimeLeft,t=this.getFooterLabels(e);return(0,a.qy)` 333 <wui-flex 334 flexDirection="column" 335 alignItems="center" 336 .padding=${["4","0","4","0"]} 337 gap="4" 338 > 339 <wui-flex 340 class="email-display" 341 flexDirection="column" 342 alignItems="center" 343 .padding=${["0","5","0","5"]} 344 > 345 <wui-text variant="md-regular" color="primary" align="center"> 346 Enter the code we sent to 347 </wui-text> 348 <wui-text variant="md-medium" color="primary" lineClamp="1" align="center"> 349 ${this.email} 350 </wui-text> 351 </wui-flex> 352 353 <wui-text variant="sm-regular" color="secondary">The code expires in 20 minutes</wui-text> 354 355 ${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"> 356 <wui-otp 357 dissabled 358 length="6" 359 @inputChange=${this.onOtpInputChange.bind(this)} 360 .otp=${this.otp} 361 ></wui-otp> 362 ${this.error?(0,a.qy)` 363 <wui-text variant="sm-regular" align="center" color="error"> 364 ${this.error}. Try Again 365 </wui-text> 366 `:null} 367 </wui-flex>`} 368 369 <wui-flex alignItems="center" gap="2"> 370 <wui-text variant="sm-regular" color="secondary">${t.title}</wui-text> 371 <wui-link @click=${this.onResendCode.bind(this)} .disabled=${e}> 372 ${t.action} 373 </wui-link> 374 </wui-flex> 375 </wui-flex> 376 `}startOTPTimeout(){this.timeoutTimeLeft=x.Q.getTimeToNextEmailLogin(),this.OTPTimeout=setInterval(()=>{this.timeoutTimeLeft>0?this.timeoutTimeLeft=x.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)}}]);
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.