1import{ed as e,eg as t,et as i,dL as o,g7 as r,el as s,dK as a,eh as n,dF as c,g8 as l,er as d,dD as u,em as h,dE as p,fv as m,dG as g,g9 as w,fw as v,f4 as f}from"./index-Dmu6oiBK.js";import{n as b,r as y,c as x,o as C}from"./index-Db_8aMAm.js";import{O as $}from"./index-DYQ8SFqd.js";import{e as P}from"./index-B0GOxqA6.js";import"./index-BjF55wNR.js";import{C as E}from"./ConstantsUtil-CIcJJEv2.js";import"./index-CD0x6Ed2.js";import"./index-CcPZX0PV.js";import"./index-CR5XaI11.js";import"./ref-CAGCpV7J.js";import"./index-COv1IDkU.js";import"./index-C6zU9ehV.js";const L=e` 2 :host { 3 margin-top: ${({spacing:e})=>e[1]}; 4 } 5 wui-separator { 6 margin: ${({spacing:e})=>e[3]} calc(${({spacing:e})=>e[3]} * -1) 7 ${({spacing:e})=>e[2]} calc(${({spacing:e})=>e[3]} * -1); 8 width: calc(100% + ${({spacing:e})=>e[3]} * 2); 9 } 10`;var S=function(e,t,i,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};let k=class extends t{constructor(){super(),this.unsubscribe=[],this.tabIdx=void 0,this.connectors=i.state.connectors,this.authConnector=this.connectors.find(e=>"AUTH"===e.type),this.remoteFeatures=o.state.remoteFeatures,this.isPwaLoading=!1,this.hasExceededUsageLimit=r.state.plan.hasExceededUsageLimit,this.unsubscribe.push(i.subscribeKey("connectors",e=>{this.connectors=e,this.authConnector=this.connectors.find(e=>"AUTH"===e.type)}),o.subscribeKey("remoteFeatures",e=>this.remoteFeatures=e))}connectedCallback(){super.connectedCallback(),this.handlePwaFrameLoad()}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var e;let t=(null==(e=this.remoteFeatures)?void 0:e.socials)||[];const i=Boolean(this.authConnector),o=null==t?void 0:t.length,r="ConnectSocials"===s.state.view;return i&&o||r?(r&&!o&&(t=a.DEFAULT_SOCIALS),n` <wui-flex flexDirection="column" gap="2"> 11 ${t.map(e=>n`<wui-list-social 12 @click=${()=>{this.onSocialClick(e)}} 13 data-testid=${`social-selector-${e}`} 14 name=${e} 15 logo=${e} 16 ?disabled=${this.isPwaLoading} 17 ></wui-list-social>`)} 18 </wui-flex>`):null}async onSocialClick(e){this.hasExceededUsageLimit?s.push("UsageExceeded"):e&&await P(e)}async handlePwaFrameLoad(){var e;if(c.isPWA()){this.isPwaLoading=!0;try{(null==(e=this.authConnector)?void 0:e.provider)instanceof l&&await this.authConnector.provider.init()}catch(t){d.open({displayMessage:"Error loading embedded wallet in PWA",debugMessage:t.message},"error")}finally{this.isPwaLoading=!1}}}};k.styles=L,S([b()],k.prototype,"tabIdx",void 0),S([y()],k.prototype,"connectors",void 0),S([y()],k.prototype,"authConnector",void 0),S([y()],k.prototype,"remoteFeatures",void 0),S([y()],k.prototype,"isPwaLoading",void 0),S([y()],k.prototype,"hasExceededUsageLimit",void 0),k=S([x("w3m-social-login-list")],k);const O=e` 19 wui-flex { 20 max-height: clamp(360px, 540px, 80vh); 21 overflow: scroll; 22 scrollbar-width: none; 23 transition: opacity ${({durations:e})=>e.md} 24 ${({easings:e})=>e["ease-out-power-1"]}; 25 will-change: opacity; 26 } 27 28 wui-flex::-webkit-scrollbar {
29 display: none; 30 } 31 32 wui-flex.disabled { 33 opacity: 0.3; 34 pointer-events: none; 35 user-select: none; 36 } 37`;var I=function(e,t,i,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};let R=class extends t{constructor(){super(),this.unsubscribe=[],this.checked=$.state.isLegalCheckboxChecked,this.unsubscribe.push($.subscribeKey("isLegalCheckboxChecked",e=>{this.checked=e}))}disconnectedCallback(){this.unsubscribe.forEach(e=>e())}render(){var e;const{termsConditionsUrl:t,privacyPolicyUrl:i}=o.state,r=null==(e=o.state.features)?void 0:e.legalCheckbox,s=Boolean(t||i)&&Boolean(r)&&!this.checked,a=s?-1:void 0;return n` 38 <w3m-legal-checkbox></w3m-legal-checkbox> 39 <wui-flex 40 flexDirection="column" 41 .padding=${["0","3","3","3"]} 42 gap="01" 43 class=${C(s?"disabled":void 0)} 44 > 45 <w3m-social-login-list tabIdx=${C(a)}></w3m-social-login-list> 46 </wui-flex> 47 `}};R.styles=O,I([y()],R.prototype,"checked",void 0),R=I([x("w3m-connect-socials-view")],R);const A=e` 48 wui-logo { 49 width: 80px; 50 height: 80px; 51 border-radius: ${({borderRadius:e})=>e[8]}; 52 } 53 @keyframes shake { 54 0% { 55 transform: translateX(0); 56 } 57 25% { 58 transform: translateX(3px); 59 } 60 50% { 61 transform: translateX(-3px); 62 } 63 75% { 64 transform: translateX(3px); 65 } 66 100% { 67 transform: translateX(0); 68 } 69 } 70 wui-flex:first-child:not(:only-child) { 71 position: relative; 72 } 73 wui-loading-thumbnail { 74 position: absolute; 75 } 76 wui-icon-box { 77 position: absolute; 78 right: calc(${({spacing:e})=>e[1]} * -1); 79 bottom: calc(${({spacing:e})=>e[1]} * -1); 80 opacity: 0; 81 transform: scale(0.5); 82 transition: all ${({easings:e})=>e["ease-out-power-2"]} 83 ${({durations:e})=>e.lg}; 84 } 85 wui-text[align='center'] { 86 width: 100%; 87 padding: 0px ${({spacing:e})=>e[4]}; 88 } 89 [data-error='true'] wui-icon-box { 90 opacity: 1; 91 transform: scale(1); 92 } 93 [data-error='true'] > wui-flex:first-child { 94 animation: shake 250ms ${({easings:e})=>e["ease-out-power-2"]} both; 95 } 96 .capitalize { 97 text-transform: capitalize; 98 } 99`;var U=function(e,t,i,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};let T=class extends t{constructor(){var e,t,r;super(),this.unsubscribe=[],this.socialProvider=null==(e=u.getAccountData())?void 0:e.socialProvider,this.socialWindow=null==(t=u.getAccountData())?void 0:t.socialWindow,this.error=!1,this.connecting=!1,this.message="Connect in the provider window",this.remoteFeatures=o.state.remoteFeatures,this.address=null==(r=u.getAccountData())?void 0:r.address,this.connectionsByNamespace=h.getConnections(u.state.activeChain),this.hasMultipleConnections=this.connectionsByNamespace.length>0,this.authConnector=i.getAuthConnector(),this.handleSocialConnection=async e=>{var t;if(null==(t=e.data)?void 0:t.resultUri)if(e.origin===E.SECURE_SITE_ORIGIN){window.removeEventListener("message",this.handleSocialConnection,!1);try{if(this.authConnector&&!this.connecting){this.connecting=!0;const t=this.parseURLError(e.data.resultUri);if(t)return void this.handleSocialError(t);this.closeSocialWindow(),this.updateMessage();const i=e.data.resultUri;this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}}),await h.connectExternal({id:this.authConnector.id,type:this.authConnector.type,socialUri:i},this.authConnector.chain),this.socialProvider&&(m.setConnectedSocialProvider(this.socialProvider),p.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}))}}catch(i){this.error=!0,this.updateMessage(),this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:c.parseError(i)}})}}else s.goBack(),g.showError("Untrusted Origin"),this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:"Untrusted Origin"}})};w.EmbeddedWalletAbortController.signal.addEventListener("abort",()=>{this.closeSocialWindow()}),this.unsubscribe.push(u.subscribeChainProp("accountState",e=>{var t;if(e&&(this.socialProvider=e.socialProvider,e.socialWindow&&(this.socialWindow=e.socialWindow),e.address)){const i=null==(t=this.remoteFeatures)?void 0:t.multiWallet;e.address!==this.address&&(this.hasMultipleConnections&&i?(s.replace("ProfileWallets"),g.showSuccess("New Wallet Added"),this.address=e.address):(v.state.open||o.state.enableEmbedded)&&v.close())}}),o.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e})),this.authConnector&&this.connectSocial()}
99disconnectedCallback(){this.unsubscribe.forEach(e=>e()),window.removeEventListener("message",this.handleSocialConnection,!1);u.state.activeCaipAddress||!this.socialProvider||this.connecting||p.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}}),this.closeSocialWindow()}render(){return n` 100 <wui-flex 101 data-error=${C(this.error)} 102 flexDirection="column" 103 alignItems="center" 104 .padding=${["10","5","5","5"]} 105 gap="6" 106 > 107 <wui-flex justifyContent="center" alignItems="center"> 108 <wui-logo logo=${C(this.socialProvider)}></wui-logo> 109 ${this.error?null:this.loaderTemplate()} 110 <wui-icon-box color="error" icon="close" size="sm"></wui-icon-box> 111 </wui-flex> 112 <wui-flex flexDirection="column" alignItems="center" gap="2"> 113 <wui-text align="center" variant="lg-medium" color="primary" 114 >Log in with 115 <span class="capitalize">${this.socialProvider??"Social"}</span></wui-text 116 > 117 <wui-text align="center" variant="lg-regular" color=${this.error?"error":"secondary"} 118 >${this.message}</wui-text 119 ></wui-flex 120 > 121 </wui-flex> 122 `}loaderTemplate(){const e=f.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return n`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}parseURLError(e){try{const t="error=",i=e.indexOf(t);if(-1===i)return null;return e.substring(i+t.length)}catch{return null}}connectSocial(){const e=setInterval(()=>{var t;(null==(t=this.socialWindow)?void 0:t.closed)&&(this.connecting||"ConnectingSocial"!==s.state.view||s.goBack(),clearInterval(e))},1e3);window.addEventListener("message",this.handleSocialConnection,!1)}updateMessage(){this.error?this.message="Something went wrong":this.connecting?this.message="Retrieving user data":this.message="Connect in the provider window"}handleSocialError(e){this.error=!0,this.updateMessage(),this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:e}}),this.closeSocialWindow()}closeSocialWindow(){this.socialWindow&&(this.socialWindow.close(),u.setAccountProp("socialWindow",void 0,u.state.activeChain))}};T.styles=A,U([y()],T.prototype,"socialProvider",void 0),U([y()],T.prototype,"socialWindow",void 0),U([y()],T.prototype,"error",void 0),U([y()],T.prototype,"connecting",void 0),U([y()],T.prototype,"message",void 0),U([y()],T.prototype,"remoteFeatures",void 0),T=U([x("w3m-connecting-social-view")],T);const j=e` 123 wui-shimmer { 124 width: 100%; 125 aspect-ratio: 1 / 1; 126 border-radius: ${({borderRadius:e})=>e[4]}; 127 } 128 129 wui-qr-code { 130 opacity: 0; 131 animation-duration: ${({durations:e})=>e.xl}; 132 animation-timing-function: ${({easings:e})=>e["ease-out-power-2"]}; 133 animation-name: fade-in; 134 animation-fill-mode: forwards; 135 } 136 137 wui-logo { 138 width: 80px; 139 height: 80px; 140 border-radius: ${({borderRadius:e})=>e[8]}; 141 } 142 143 wui-flex:first-child:not(:only-child) { 144 position: relative; 145 } 146 147 wui-loading-thumbnail { 148 position: absolute; 149 } 150 151 wui-icon-box { 152 position: absolute; 153 right: calc(${({spacing:e})=>e[1]} * -1); 154 bottom: calc(${({spacing:e})=>e[1]} * -1); 155 opacity: 0; 156 transform: scale(0.5); 157 transition: 158 opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, 159 transform ${({durations:e})=>e.lg} 160 ${({easings:e})=>e["ease-out-power-2"]}; 161 will-change: opacity, transform; 162 } 163 164 @keyframes fade-in { 165 from { 166 opacity: 0; 167 } 168 to { 169 opacity: 1; 170 } 171 } 172`;var _=function(e,t,i,o){var r,s=arguments.length,a=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(s<3?r(a):s>3?r(t,i,a):r(t,i))||a);return s>3&&a&&Object.defineProperty(t,i,a),a};let F=class extends t{constructor(){var e,t;super(),this.unsubscribe=[],this.timeout=void 0,this.socialProvider=null==(e=u.getAccountData())?void 0:e.socialProvider,this.uri=null==(t=u.getAccountData())?void 0:t.farcasterUrl,this.ready=!1,this.loading=!1,this.remoteFeatures=o.state.remoteFeatures,this.authConnector=i.getAuthConnector(),this.forceUpdate=()=>{this.requestUpdate()},this.unsubscribe.push(u.subscribeChainProp("accountState",e=>{this.socialProvider=null==e?void 0:e.socialProvider,this.uri=null==e?void 0:e.farcasterUrl,this.connectFarcaster()}),o.subscribeKey("remoteFeatures",e=>{this.remoteFeatures=e})),window.addEventListener("resize",this.forceUpdate)}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.timeout),window.removeEventListener("resize",this.forceUpdate);!u.state.activeCaipAddress&&this.socialProvider&&(this.uri||this.loading)&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_CANCELED",properties:{provider:this.socialProvider}})}render(){return this.onRenderProxy(),n`${this.platformTemplate()}`}platformTemplate(){return c.isMobile()?n`${this.mobileTemplate()}`:n`${this.desktopTemplate()}`}desktopTemplate(){return this.loading?n`${this.loadingTemplate()}`:n`${this.qrTemplate()}`}qrTemplate(){return n` <wui-flex 173 flexDirection="column" 174 alignItems="center" 175 .padding=${["0","5","5","5"]} 176 gap="5" 177 > 178 <wui-shimmer width="100%"> ${this.qrCodeTemplate()} </wui-shimmer> 179 180 <wui-text variant="lg-medium" color="primary"> Scan this QR Code with your phone </wui-text> 181 ${this.copyTemplate()} 182 </wui-flex>`}loadingTemplate(){return n` 183 <wui-flex 184 flexDirection="column" 185 alignItems="center" 186 .padding=${["5","5","5","5"]} 187 gap="5" 188 > 189 <wui-flex justifyContent="center" alignItems="center"> 190 <wui-logo logo="farcaster"></wui-logo> 191 ${this.loaderTemplate()} 192 <wui-icon-box color="error" icon="close" size="sm"></wui-icon-box> 193 </wui-flex> 194 <wui-flex flexDirection="column" alignItems="center" gap="2"> 195 <wui-text align="center" variant="md-medium" color="primary"> 196 Loading user data 197 </wui-text> 198 <wui-text align="center" variant="sm-regular" color="secondary"> 199 Please wait a moment while we load your data. 200 </wui-text> 201 </wui-flex> 202 </wui-flex> 203 `}mobileTemplate(){return n` <wui-flex 204 flexDirection="column" 205 alignItems="center" 206 .padding=${["10","5","5","5"]} 207 gap="5" 208 > 209 <wui-flex justifyContent="center" alignItems="center"> 210 <wui-logo logo="farcaster"></wui-logo> 211 ${this.loaderTemplate()} 212 <wui-icon-box 213 color="error" 214 icon="close" 215 size="sm" 216 ></wui-icon-box> 217 </wui-flex> 218 <wui-flex flexDirection="column" alignItems="center" gap="2"> 219 <wui-text align="center" variant="md-medium" color="primary" 220 >
220Continue in Farcaster</span></wui-text 221 > 222 <wui-text align="center" variant="sm-regular" color="secondary" 223 >Accept connection request in the app</wui-text 224 ></wui-flex 225 > 226 ${this.mobileLinkTemplate()} 227 </wui-flex>`}loaderTemplate(){const e=f.state.themeVariables["--w3m-border-radius-master"],t=e?parseInt(e.replace("px",""),10):4;return n`<wui-loading-thumbnail radius=${9*t}></wui-loading-thumbnail>`}async connectFarcaster(){var e,t;if(this.authConnector)try{await(null==(e=this.authConnector)?void 0:e.provider.connectFarcaster()),this.socialProvider&&(m.setConnectedSocialProvider(this.socialProvider),p.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:this.socialProvider}})),this.loading=!0;const i=h.getConnections(this.authConnector.chain).length>0;await h.connectExternal(this.authConnector,this.authConnector.chain);const o=null==(t=this.remoteFeatures)?void 0:t.multiWallet;this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:this.socialProvider}}),this.loading=!1,i&&o?(s.replace("ProfileWallets"),g.showSuccess("New Wallet Added")):v.close()}catch(i){this.socialProvider&&p.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:this.socialProvider,message:c.parseError(i)}}),s.goBack(),g.showError(i)}}mobileLinkTemplate(){return n`<wui-button 228 size="md" 229 ?loading=${this.loading} 230 ?disabled=${!this.uri||this.loading} 231 @click=${()=>{this.uri&&c.openHref(this.uri,"_blank")}} 232 > 233 Open farcaster</wui-button 234 >`}onRenderProxy(){!this.ready&&this.uri&&(this.timeout=setTimeout(()=>{this.ready=!0},200))}qrCodeTemplate(){if(!this.uri||!this.ready)return null;const e=this.getBoundingClientRect().width-40,t=f.state.themeVariables["--apkt-qr-color"]??f.state.themeVariables["--w3m-qr-color"];return n` <wui-qr-code 235 size=${e} 236 theme=${f.state.themeMode} 237 uri=${this.uri} 238 ?farcaster=${!0} 239 data-testid="wui-qr-code" 240 color=${C(t)} 241 ></wui-qr-code>`}copyTemplate(){const e=!this.uri||!this.ready;return n`<wui-button 242 .disabled=${e} 243 @click=${this.onCopyUri} 244 variant="neutral-secondary" 245 size="sm" 246 data-testid="copy-wc2-uri" 247 > 248 <wui-icon size="sm" color="default" slot="iconRight" name="copy"></wui-icon> 249 Copy link 250 </wui-button>`}onCopyUri(){try{this.uri&&(c.copyToClopboard(this.uri),g.showSuccess("Link copied"))}catch{g.showError("Failed to copy")}}};F.styles=j,_([y()],F.prototype,"socialProvider",void 0),_([y()],F.prototype,"uri",void 0),_([y()],F.prototype,"ready",void 0),_([y()],F.prototype,"loading",void 0),_([y()],F.prototype,"remoteFeatures",void 0),F=_([x("w3m-connecting-farcaster-view")],F);export{R as W3mConnectSocialsView,F as W3mConnectingFarcasterView,T as W3mConnectingSocialView};
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.