import{ic as m,k7 as D,hq as l,hr as ue,hh as $,hi as U,hk as y,hl as c,hw as B,hj as he,fw as f,iR as L,jM as pe,ib as V,fp as J,fy as O,hy as M,fq as K,hm as me,fs as P,k8 as _,iS as fe,k9 as we,jG as be,fr as ge,hs as ye}from"./BC4hLSsA.js";import{c as g,n as u,r as d,U as re}from"./3Z1LeTmD.js";import{o as z}from"./DMVgneVN.js";import"./Cl7N4s_F.js";import"./BhF09lic.js";import{H as Q}from"./mp1cK3d-.js";import"./Jaeeh8gf.js";import"./DSghw-ck.js";import"./CpW-UKVx.js";import"./B9T8Av0b.js";import{S as ve}from"./DEHGKMvX.js";import"./wDRXYCg3.js";import"./CW2vKvSC.js";import"./Dmg8YACJ.js";const ae={isUnsupportedChainView(){return l.state.view==="UnsupportedChain"||l.state.view==="SwitchNetwork"&&l.state.history.includes("UnsupportedChain")},async safeClose(){if(this.isUnsupportedChainView()){m.shake();return}if(await D.isSIWXCloseDisabled()){m.shake();return}(l.state.view==="DataCapture"||l.state.view==="DataCaptureOtpConfirm")&&ue.disconnect(),m.close()}},xe=$` :host { display: block; border-radius: clamp(0px, ${({borderRadius:e})=>e[8]}, 44px); box-shadow: 0 0 0 1px ${({tokens:e})=>e.theme.foregroundPrimary}; background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; overflow: hidden; } `;var ke=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};let X=class extends y{render(){return c``}};X.styles=[U,xe];X=ke([g("wui-card")],X);const $e=$` :host { width: 100%; } :host > wui-flex { width: 100%; display: flex; align-items: center; justify-content: center; gap: ${({spacing:e})=>e[2]}; padding: ${({spacing:e})=>e[3]}; border-radius: ${({borderRadius:e})=>e[6]}; border: 1px solid ${({tokens:e})=>e.theme.borderPrimary}; box-sizing: border-box; background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; box-shadow: 0px 0px 16px 0px rgba(0, 0, 0, 0.25); color: ${({tokens:e})=>e.theme.textPrimary}; } :host > wui-flex[data-type='info'] { .icon-box { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; wui-icon { color: ${({tokens:e})=>e.theme.iconDefault}; } } } :host > wui-flex[data-type='success'] { .icon-box { background-color: ${({tokens:e})=>e.core.backgroundSuccess}; wui-icon { color: ${({tokens:e})=>e.core.borderSuccess}; } } } :host > wui-flex[data-type='warning'] { .icon-box { background-color: ${({tokens:e})=>e.core.backgroundWarning}; wui-icon { color: ${({tokens:e})=>e.core.borderWarning}; } } } :host > wui-flex[data-type='error'] { .icon-box { background-color: ${({tokens:e})=>e.core.backgroundError}; wui-icon { color: ${({tokens:e})=>e.core.borderError}; } } } wui-flex { width: 100%; } wui-text { word-break: break-word; flex: 1; } .close { cursor: pointer; color: ${({tokens:e})=>e.theme.iconDefault}; } .icon-box { height: 40px; width: 40px; border-radius: ${({borderRadius:e})=>e[2]}; background-color: var(--local-icon-bg-value); } `;var Y=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};const Ce={info:"info",success:"checkmark",warning:"warningCircle",error:"warning"};let I=class extends y{constructor(){super(...arguments),this.message="",this.type="info"}render(){return c` ${this.message} `}onClose(){B.close()}};I.styles=[U,$e];Y([u()],I.prototype,"message",void 0);Y([u()],I.prototype,"type",void 0);I=Y([g("wui-alertbar")],I);const Se=$` :host { display: block; position: absolute; top: ${({spacing:e})=>e[3]}; left: ${({spacing:e})=>e[4]}; right: ${({spacing:e})=>e[4]}; opacity: 0; pointer-events: none; } `;var ne=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};const We={info:{backgroundColor:"fg-350",iconColor:"fg-325",icon:"info"},success:{backgroundColor:"success-glass-reown-020",iconColor:"success-125",icon:"checkmark"},warning:{backgroundColor:"warning-glass-reown-020",iconColor:"warning-100",icon:"warningCircle"},error:{backgroundColor:"error-glass-reown-020",iconColor:"error-125",icon:"warning"}};let j=class extends y{constructor(){super(),this.unsubscribe=[],this.open=B.state.open,this.onOpen(!0),this.unsubscribe.push(B.subscribeKey("open",t=>{this.open=t,this.onOpen(!1)}))}disconnectedCallback(){this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:o}=B.state,r=We[o];return c` `}onOpen(t){this.open?(this.animate([{opacity:0,transform:"scale(0.85)"},{opacity:1,transform:"scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: auto"):t||(this.animate([{opacity:1,transform:"scale(1)"},{opacity:0,transform:"scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"}),this.style.cssText="pointer-events: none")}};j.styles=Se;ne([d()],j.prototype,"open",void 0);j=ne([g("w3m-alertbar")],j);const Ee=$` button { display: block; display: flex; align-items: center; padding: ${({spacing:e})=>e[1]}; transition: background-color ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; will-change: background-color; border-radius: ${({borderRadius:e})=>e[32]}; } wui-image { border-radius: 100%; } wui-text { padding-left: ${({spacing:e})=>e[1]}; } .left-icon-container, .right-icon-container { width: 24px; height: 24px; justify-content: center; align-items: center; } wui-icon { color: ${({tokens:e})=>e.theme.iconDefault}; } /* -- Sizes --------------------------------------------------- */ button[data-size='lg'] { height: 32px; } button[data-size='md'] { height: 28px; } button[data-size='sm'] { height: 24px; } button[data-size='lg'] wui-image { width: 24px; height: 24px; } button[data-size='md'] wui-image { width: 20px; height: 20px; } button[data-size='sm'] wui-image { width: 16px; height: 16px; } button[data-size='lg'] .left-icon-container { width: 24px; height: 24px; } button[data-size='md'] .left-icon-container { width: 20px; height: 20px; } button[data-size='sm'] .left-icon-container { width: 16px; height: 16px; } /* -- Variants --------------------------------------------------------- */ button[data-type='filled-dropdown'] { background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; } button[data-type='text-dropdown'] { background-color: transparent; } /* -- Focus states --------------------------------------------------- */ button:focus-visible:enabled { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; box-shadow: 0 0 0 4px ${({tokens:e})=>e.core.foregroundAccent040}; } /* -- Hover & Active states ----------------------------------------------------------- */ @media (hover: hover) and (pointer: fine) { button:hover:enabled, button:active:enabled { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; } } /* -- Disabled states --------------------------------------------------- */ button:disabled { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; opacity: 0.5; } `;var A=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};const Pe={lg:"lg-regular",md:"md-regular",sm:"sm-regular"},Ae={lg:"lg",md:"md",sm:"sm"};let k=class extends y{constructor(){super(...arguments),this.imageSrc="",this.text="",this.size="lg",this.type="text-dropdown",this.disabled=!1}render(){return c``}textTemplate(){const t=Pe[this.size];return this.text?c`${this.text}`:null}imageTemplate(){if(this.imageSrc)return c``;const t=Ae[this.size];return c` `}};k.styles=[U,he,Ee];A([u()],k.prototype,"imageSrc",void 0);A([u()],k.prototype,"text",void 0);A([u()],k.prototype,"size",void 0);A([u()],k.prototype,"type",void 0);A([u({type:Boolean})],k.prototype,"disabled",void 0);k=A([g("wui-select")],k);const Ne=$` :host { height: 60px; } :host > wui-flex { box-sizing: border-box; background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; } wui-text { background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; } wui-flex.w3m-header-title { transform: translateY(0); opacity: 1; } wui-flex.w3m-header-title[view-direction='prev'] { animation: slide-down-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, slide-down-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; animation-delay: 0ms, 200ms; } wui-flex.w3m-header-title[view-direction='next'] { animation: slide-up-out 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}, slide-up-in 120ms forwards ${({easings:e})=>e["ease-out-power-2"]}; animation-delay: 0ms, 200ms; } wui-icon-button[data-hidden='true'] { opacity: 0 !important; pointer-events: none; } @keyframes slide-up-out { from { transform: translateY(0px); opacity: 1; } to { transform: translateY(3px); opacity: 0; } } @keyframes slide-up-in { from { transform: translateY(-3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } @keyframes slide-down-out { from { transform: translateY(0px); opacity: 1; } to { transform: translateY(-3px); opacity: 0; } } @keyframes slide-down-in { from { transform: translateY(3px); opacity: 0; } to { transform: translateY(0); opacity: 1; } } `;var C=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};const Oe=["SmartSessionList"];function ee(){var n,s,h,p,W,E,T;const e=(s=(n=l.state.data)==null?void 0:n.connector)==null?void 0:s.name,t=(p=(h=l.state.data)==null?void 0:h.wallet)==null?void 0:p.name,o=(E=(W=l.state.data)==null?void 0:W.network)==null?void 0:E.name,r=t??e,a=M.getConnectors();return{Connect:`Connect ${a.length===1&&((T=a[0])==null?void 0:T.id)==="w3m-email"?"Email":""} Wallet`,Create:"Create Wallet",ChooseAccountName:void 0,Account:void 0,AccountSettings:void 0,AllWallets:"All Wallets",ApproveTransaction:"Approve Transaction",BuyInProgress:"Buy",ConnectingExternal:r??"Connect Wallet",ConnectingWalletConnect:r??"WalletConnect",ConnectingWalletConnectBasic:"WalletConnect",ConnectingSiwe:"Sign In",Convert:"Convert",ConvertSelectToken:"Select token",ConvertPreview:"Preview Convert",Downloads:r?`Get ${r}`:"Downloads",EmailLogin:"Email Login",EmailVerifyOtp:"Confirm Email",EmailVerifyDevice:"Register Device",GetWallet:"Get a Wallet",Networks:"Choose Network",OnRampProviders:"Choose Provider",OnRampActivity:"Activity",OnRampTokenSelect:"Select Token",OnRampFiatSelect:"Select Currency",Pay:"How you pay",ProfileWallets:"Wallets",SwitchNetwork:o??"Switch Network",Transactions:"Activity",UnsupportedChain:"Switch Network",UpgradeEmailWallet:"Upgrade Your Wallet",UpdateEmailWallet:"Edit Email",UpdateEmailPrimaryOtp:"Confirm Current Email",UpdateEmailSecondaryOtp:"Confirm New Email",WhatIsABuy:"What is Buy?",RegisterAccountName:"Choose Name",RegisterAccountNameSuccess:"",WalletReceive:"Receive",WalletCompatibleNetworks:"Compatible Networks",Swap:"Swap",SwapSelectToken:"Select Token",SwapPreview:"Preview Swap",WalletSend:"Send",WalletSendPreview:"Review Send",WalletSendSelectToken:"Select Token",WalletSendConfirmed:"Confirmed",WhatIsANetwork:"What is a network?",WhatIsAWallet:"What is a Wallet?",ConnectWallets:"Connect Wallet",ConnectSocials:"All Socials",ConnectingSocial:K.state.socialProvider?K.state.socialProvider.charAt(0).toUpperCase()+K.state.socialProvider.slice(1):"Connect Social",ConnectingMultiChain:"Select Chain",ConnectingFarcaster:"Farcaster",SwitchActiveChain:"Switch Chain",SmartSessionCreated:void 0,SmartSessionList:"Smart Sessions",SIWXSignMessage:"Sign In",PayLoading:"Payment in Progress",DataCapture:"Profile",DataCaptureOtpConfirm:"Confirm Email",FundWallet:"Fund Wallet",PayWithExchange:"Deposit from Exchange",PayWithExchangeSelectAsset:"Select Asset"}}let b=class extends y{constructor(){super(),this.unsubscribe=[],this.heading=ee()[l.state.view],this.network=f.state.activeCaipNetwork,this.networkImage=L.getNetworkImage(this.network),this.showBack=!1,this.prevHistoryLength=1,this.view=l.state.view,this.viewDirection="",this.unsubscribe.push(pe.subscribeNetworkImages(()=>{this.networkImage=L.getNetworkImage(this.network)}),l.subscribeKey("view",t=>{setTimeout(()=>{this.view=t,this.heading=ee()[t]},V.ANIMATION_DURATIONS.HeaderText),this.onViewChange(),this.onHistoryChange()}),f.subscribeKey("activeCaipNetwork",t=>{this.network=t,this.networkImage=L.getNetworkImage(this.network)}))}disconnectCallback(){this.unsubscribe.forEach(t=>t())}render(){return c` ${this.leftHeaderTemplate()} ${this.titleTemplate()} ${this.rightHeaderTemplate()} `}onWalletHelp(){J.sendEvent({type:"track",event:"CLICK_WALLET_HELP"}),l.push("WhatIsAWallet")}async onClose(){await ae.safeClose()}rightHeaderTemplate(){var o,r,a;const t=(a=(r=(o=O)==null?void 0:o.state)==null?void 0:r.features)==null?void 0:a.smartSessions;return l.state.view!=="Account"||!t?this.closeButtonTemplate():c` l.push("SmartSessionList")} data-testid="w3m-header-smart-sessions" > ${this.closeButtonTemplate()} `}closeButtonTemplate(){return c` `}titleTemplate(){const t=Oe.includes(this.view);return c` ${this.heading} ${t?c`Beta`:null} `}leftHeaderTemplate(){var p;const{view:t}=l.state,o=t==="Connect",r=O.state.enableEmbedded,a=t==="ApproveTransaction",i=t==="ConnectingSiwe",n=t==="Account",s=O.state.enableNetworkSwitch,h=a||i||o&&r;return n&&s?c``:this.showBack&&!h?c``:c``}onNetworks(){this.isAllowedNetworkSwitch()&&(J.sendEvent({type:"track",event:"CLICK_NETWORKS"}),l.push("Networks"))}isAllowedNetworkSwitch(){const t=f.getAllRequestedCaipNetworks(),o=t?t.length>1:!1,r=t==null?void 0:t.find(({id:a})=>{var i;return a===((i=this.network)==null?void 0:i.id)});return o||!r}onViewChange(){const{history:t}=l.state;let o=V.VIEW_DIRECTION.Next;t.length1&&!this.showBack&&o?(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!0,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"})):t.length<=1&&this.showBack&&o&&(await o.animate([{opacity:1},{opacity:0}],{duration:200,fill:"forwards",easing:"ease"}).finished,this.showBack=!1,o.animate([{opacity:0},{opacity:1}],{duration:200,fill:"forwards",easing:"ease"}))}onGoBack(){l.goBack()}};b.styles=Ne;C([d()],b.prototype,"heading",void 0);C([d()],b.prototype,"network",void 0);C([d()],b.prototype,"networkImage",void 0);C([d()],b.prototype,"showBack",void 0);C([d()],b.prototype,"prevHistoryLength",void 0);C([d()],b.prototype,"view",void 0);C([d()],b.prototype,"viewDirection",void 0);b=C([g("w3m-header")],b);const Ie=$` :host { display: flex; align-items: center; gap: ${({spacing:e})=>e[1]}; padding: ${({spacing:e})=>e[2]} ${({spacing:e})=>e[3]} ${({spacing:e})=>e[2]} ${({spacing:e})=>e[2]}; border-radius: ${({borderRadius:e})=>e[20]}; background-color: ${({tokens:e})=>e.theme.foregroundPrimary}; box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1), inset 0 0 0 1px ${({tokens:e})=>e.theme.borderPrimary}; max-width: 320px; } wui-icon-box { border-radius: ${({borderRadius:e})=>e.round} !important; overflow: hidden; } wui-loading-spinner { padding: ${({spacing:e})=>e[1]}; background-color: ${({tokens:e})=>e.core.foregroundAccent010}; border-radius: ${({borderRadius:e})=>e.round} !important; } `;var F=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};let R=class extends y{constructor(){super(...arguments),this.message="",this.variant="success"}render(){return c` ${this.templateIcon()} ${this.message} `}templateIcon(){const t={success:"success",error:"error",warning:"warning",info:"default"},o={success:"checkmark",error:"warning",warning:"warningCircle",info:"info"};return this.variant==="loading"?c``:c``}};R.styles=[U,Ie];F([u()],R.prototype,"message",void 0);F([u()],R.prototype,"variant",void 0);R=F([g("wui-snackbar")],R);const Re=me` :host { display: block; position: absolute; opacity: 0; pointer-events: none; top: 11px; left: 50%; width: max-content; } `;var se=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};let H=class extends y{constructor(){super(),this.unsubscribe=[],this.timeout=void 0,this.open=P.state.open,this.unsubscribe.push(P.subscribeKey("open",t=>{this.open=t,this.onOpen()}))}disconnectedCallback(){clearTimeout(this.timeout),this.unsubscribe.forEach(t=>t())}render(){const{message:t,variant:o}=P.state;return c` `}onOpen(){clearTimeout(this.timeout),this.open?(this.animate([{opacity:0,transform:"translateX(-50%) scale(0.85)"},{opacity:1,transform:"translateX(-50%) scale(1)"}],{duration:150,fill:"forwards",easing:"ease"}),this.timeout&&clearTimeout(this.timeout),P.state.autoClose&&(this.timeout=setTimeout(()=>P.hide(),2500))):this.animate([{opacity:1,transform:"translateX(-50%) scale(1)"},{opacity:0,transform:"translateX(-50%) scale(0.85)"}],{duration:150,fill:"forwards",easing:"ease"})}};H.styles=Re;se([d()],H.prototype,"open",void 0);H=se([g("w3m-snackbar")],H);const Te=$` :host { z-index: ${({tokens:e})=>e.core.zIndex}; display: block; backface-visibility: hidden; will-change: opacity; position: fixed; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; opacity: 0; background-color: ${({tokens:e})=>e.theme.overlay}; backdrop-filter: blur(0px); transition: opacity ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, backdrop-filter ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; will-change: opacity; } :host(.open) { opacity: 1; backdrop-filter: blur(8px); } :host(.appkit-modal) { position: relative; pointer-events: unset; background: none; width: 100%; opacity: 1; } wui-card { max-width: var(--apkt-modal-width); width: 100%; position: relative; outline: none; transform: translateY(4px); box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.05); transition: transform ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, border-radius ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}, background-color ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}, box-shadow ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-1"]}; will-change: border-radius, background-color, transform, box-shadow; background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; padding: ${({spacing:e})=>e[1]}; box-sizing: border-box; } :host(.open) wui-card { transform: translateY(0px); } wui-card::before { z-index: 1; pointer-events: none; content: ''; position: absolute; inset: 0; border-radius: clamp(0px, var(--apkt-borderRadius-8), 44px); transition: box-shadow ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}; transition-delay: ${({durations:e})=>e.md}; will-change: box-shadow; } :host([data-border='true']) wui-card::before { box-shadow: inset 0px 0px 0px 4px ${({tokens:e})=>e.theme.foregroundSecondary}; } :host([data-border='false']) wui-card::before { box-shadow: inset 0px 0px 0px 1px ${({tokens:e})=>e.theme.borderPrimaryDark}; } :host([data-border='true']) wui-card { animation: fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, card-background-border var(--apkt-duration-dynamic) ${({easings:e})=>e["ease-out-power-2"]}; animation-fill-mode: backwards, both; animation-delay: var(--apkt-duration-dynamic); } :host([data-border='false']) wui-card { animation: fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, card-background-default var(--apkt-duration-dynamic) ${({easings:e})=>e["ease-out-power-2"]}; animation-fill-mode: backwards, both; animation-delay: 0s; } :host(.appkit-modal) wui-card { max-width: var(--apkt-modal-width); } wui-card[shake='true'] { animation: fade-in ${({durations:e})=>e.lg} ${({easings:e})=>e["ease-out-power-2"]}, w3m-shake ${({durations:e})=>e.xl} ${({easings:e})=>e["ease-out-power-2"]}; } wui-flex { overflow-x: hidden; overflow-y: auto; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; } @media (max-height: 700px) and (min-width: 431px) { wui-flex { align-items: flex-start; } wui-card { margin: var(--apkt-spacing-6) 0px; } } @media (max-width: 430px) { wui-flex { align-items: flex-end; } wui-card { max-width: 100%; border-bottom-left-radius: var(--local-border-bottom-mobile-radius); border-bottom-right-radius: var(--local-border-bottom-mobile-radius); border-bottom: none; } wui-card[shake='true'] { animation: w3m-shake 0.5s ${({easings:e})=>e["ease-out-power-2"]}; } } @keyframes fade-in { 0% { transform: scale(0.99) translateY(4px); } 100% { transform: scale(1) translateY(0); } } @keyframes w3m-shake { 0% { transform: scale(1) rotate(0deg); } 20% { transform: scale(1) rotate(-1deg); } 40% { transform: scale(1) rotate(1.5deg); } 60% { transform: scale(1) rotate(-1.5deg); } 80% { transform: scale(1) rotate(1deg); } 100% { transform: scale(1) rotate(0deg); } } @keyframes card-background-border { from { background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; } to { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; } } @keyframes card-background-default { from { background-color: ${({tokens:e})=>e.theme.foregroundSecondary}; } to { background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; } } `;var S=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};const te="scroll-lock";class v extends y{constructor(){super(),this.unsubscribe=[],this.abortController=void 0,this.hasPrefetched=!1,this.enableEmbedded=O.state.enableEmbedded,this.open=m.state.open,this.caipAddress=f.state.activeCaipAddress,this.caipNetwork=f.state.activeCaipNetwork,this.shake=m.state.shake,this.filterByNamespace=M.state.filterByNamespace,this.initializeTheming(),_.prefetchAnalyticsConfig(),this.unsubscribe.push(m.subscribeKey("open",t=>t?this.onOpen():this.onClose()),m.subscribeKey("shake",t=>this.shake=t),f.subscribeKey("activeCaipNetwork",t=>this.onNewNetwork(t)),f.subscribeKey("activeCaipAddress",t=>this.onNewAddress(t)),O.subscribeKey("enableEmbedded",t=>this.enableEmbedded=t),M.subscribeKey("filterByNamespace",t=>{var o;this.filterByNamespace!==t&&!((o=f.getAccountData(t))!=null&&o.caipAddress)&&(_.fetchRecommendedWallets(),this.filterByNamespace=t)}),l.subscribeKey("view",()=>{this.dataset.border=Q.hasFooter()?"true":"false"}))}firstUpdated(){if(this.dataset.border=Q.hasFooter()?"true":"false",this.caipAddress){if(this.enableEmbedded){m.close(),this.prefetch();return}this.onNewAddress(this.caipAddress)}this.open&&this.onOpen(),this.enableEmbedded&&this.prefetch()}disconnectedCallback(){this.unsubscribe.forEach(t=>t()),this.onRemoveKeyboardListener()}render(){return this.style.cssText=` --local-border-bottom-mobile-radius: ${this.enableEmbedded?"clamp(0px, var(--apkt-borderRadius-8), 44px)":"0px"}; `,this.enableEmbedded?c`${this.contentTemplate()} `:this.open?c` ${this.contentTemplate()} `:null}contentTemplate(){return c` `}async onOverlayClick(t){t.target===t.currentTarget&&await this.handleClose()}async handleClose(){await ae.safeClose()}initializeTheming(){const{themeVariables:t,themeMode:o}=fe.state,r=re.getColorTheme(o);we(t,r)}onClose(){this.open=!1,this.classList.remove("open"),this.onScrollUnlock(),P.hide(),this.onRemoveKeyboardListener()}onOpen(){this.open=!0,this.classList.add("open"),this.onScrollLock(),this.onAddKeyboardListener()}onScrollLock(){const t=document.createElement("style");t.dataset.w3m=te,t.textContent=` body { touch-action: none; overflow: hidden; overscroll-behavior: contain; } w3m-modal { pointer-events: auto; } `,document.head.appendChild(t)}onScrollUnlock(){const t=document.head.querySelector(`style[data-w3m="${te}"]`);t&&t.remove()}onAddKeyboardListener(){var o;this.abortController=new AbortController;const t=(o=this.shadowRoot)==null?void 0:o.querySelector("wui-card");t==null||t.focus(),window.addEventListener("keydown",r=>{if(r.key==="Escape")this.handleClose();else if(r.key==="Tab"){const{tagName:a}=r.target;a&&!a.includes("W3M-")&&!a.includes("WUI-")&&(t==null||t.focus())}},this.abortController)}onRemoveKeyboardListener(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}async onNewAddress(t){const o=f.state.isSwitchingNamespace,r=l.state.view==="ProfileWallets";t?await this.onConnected({caipAddress:t,isSwitchingNamespace:o,isInProfileView:r}):!o&&!this.enableEmbedded&&!r&&m.close(),await D.initializeIfEnabled(t),this.caipAddress=t,f.setIsSwitchingNamespace(!1)}async onConnected(t){if(t.isInProfileView)return;const{chainNamespace:o,chainId:r,address:a}=be.parseCaipAddress(t.caipAddress),i=`${o}:${r}`,n=!ge.getPlainAddress(this.caipAddress),s=await D.getSessions({address:a,caipNetworkId:i}),h=D.getSIWX()?s.some(E=>E.data.accountAddress===a):!0,p=t.isSwitchingNamespace&&h&&!this.enableEmbedded,W=this.enableEmbedded&&n;p?l.goBack():W&&m.close()}onNewNetwork(t){var G,q,Z;const o=this.caipNetwork,r=(G=o==null?void 0:o.caipNetworkId)==null?void 0:G.toString(),a=o==null?void 0:o.chainNamespace,i=(q=t==null?void 0:t.caipNetworkId)==null?void 0:q.toString(),n=t==null?void 0:t.chainNamespace,s=r!==i,p=s&&!(a!==n),W=(o==null?void 0:o.name)===ye.UNSUPPORTED_NETWORK_NAME,E=l.state.view==="ConnectingExternal",T=l.state.view==="ProfileWallets",le=!((Z=f.getAccountData(t==null?void 0:t.chainNamespace))!=null&&Z.caipAddress),ce=l.state.view==="UnsupportedChain",de=m.state.open;let N=!1;this.enableEmbedded&&l.state.view==="SwitchNetwork"&&(N=!0),s&&ve.resetState(),de&&!E&&!T&&(le?s&&(N=!0):(ce||p&&!W)&&(N=!0)),N&&l.state.view!=="SIWXSignMessage"&&l.goBack(),this.caipNetwork=t}prefetch(){this.hasPrefetched||(_.prefetch(),_.fetchWalletsByPage({page:1}),this.hasPrefetched=!0)}}v.styles=Te;S([u({type:Boolean})],v.prototype,"enableEmbedded",void 0);S([d()],v.prototype,"open",void 0);S([d()],v.prototype,"caipAddress",void 0);S([d()],v.prototype,"caipNetwork",void 0);S([d()],v.prototype,"shake",void 0);S([d()],v.prototype,"filterByNamespace",void 0);let oe=class extends v{};oe=S([g("w3m-modal")],oe);let ie=class extends v{};ie=S([g("appkit-modal")],ie);const _e=$` :host { --local-duration-height: 0s; --local-duration: ${({durations:e})=>e.lg}; --local-transition: ${({easings:e})=>e["ease-out-power-2"]}; } .container { display: block; overflow: hidden; overflow: hidden; position: relative; height: var(--local-container-height); transition: height var(--local-duration-height) var(--local-transition); will-change: height, padding-bottom; } .page { position: absolute; top: 0; left: 0; right: 0; width: 100%; height: auto; width: inherit; box-sizing: border-box; display: flex; flex-direction: column; background-color: ${({tokens:e})=>e.theme.backgroundPrimary}; border-bottom-left-radius: var(--local-border-bottom-radius); border-bottom-right-radius: var(--local-border-bottom-radius); transition: border-bottom-left-radius var(--local-duration) var(--local-transition); } .footer { height: var(--apkt-footer-height); } div.page[view-direction^='prev-'] .page-content { animation: slide-left-out var(--local-duration) forwards var(--local-transition), slide-left-in var(--local-duration) forwards var(--local-transition); animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); } div.page[view-direction^='next-'] .page-content { animation: slide-right-out var(--local-duration) forwards var(--local-transition), slide-right-in var(--local-duration) forwards var(--local-transition); animation-delay: 0ms, var(--local-duration, ${({durations:e})=>e.lg}); } @keyframes slide-left-out { from { transform: translateX(0px) scale(1); opacity: 1; filter: blur(0px); } to { transform: translateX(8px) scale(0.99); opacity: 0; filter: blur(4px); } } @keyframes slide-left-in { from { transform: translateX(-8px) scale(0.99); opacity: 0; filter: blur(4px); } to { transform: translateX(0) translateY(0) scale(1); opacity: 1; filter: blur(0px); } } @keyframes slide-right-out { from { transform: translateX(0px) scale(1); opacity: 1; filter: blur(0px); } to { transform: translateX(-8px) scale(0.99); opacity: 0; filter: blur(4px); } } @keyframes slide-right-in { from { transform: translateX(8px) scale(0.99); opacity: 0; filter: blur(4px); } to { transform: translateX(0) translateY(0) scale(1); opacity: 1; filter: blur(0px); } } `;var x=function(e,t,o,r){var a=arguments.length,i=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,o):r,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,o,i):n(t,o))||i);return a>3&&i&&Object.defineProperty(t,o,i),i};let w=class extends y{constructor(){super(...arguments),this.resizeObserver=void 0,this.transitionDuration="0.15s",this.transitionFunction="",this.history="",this.view="",this.setView=void 0,this.viewDirection="",this.historyState="",this.previousHeight="0px"}updated(t){if(t.has("history")){const o=this.history;this.historyState!==""&&this.historyState!==o&&this.onViewChange(o)}t.has("transitionDuration")&&this.style.setProperty("--local-duration",this.transitionDuration),t.has("transitionFunction")&&this.style.setProperty("--local-transition",this.transitionFunction)}firstUpdated(){this.transitionFunction&&this.style.setProperty("--local-transition",this.transitionFunction),this.style.setProperty("--local-duration",this.transitionDuration),this.historyState=this.history,this.resizeObserver=new ResizeObserver(t=>{for(const o of t)if(o.target===this.getWrapper()){let r=o.contentRect.height;const a=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--apkt-footer-height")||"0");r=r+a,this.style.setProperty("--local-border-bottom-radius",a?"var(--apkt-borderRadius-5)":"0px"),this.style.setProperty("--local-container-height",`${r}px`),this.previousHeight!=="0px"&&this.style.setProperty("--local-duration-height",this.transitionDuration),this.previousHeight=`${r}px`}}),this.resizeObserver.observe(this.getWrapper())}disconnectedCallback(){const t=this.getWrapper();t&&this.resizeObserver&&this.resizeObserver.unobserve(t)}render(){return c`
`}onViewChange(t){const o=t.split(",").filter(Boolean),r=this.historyState.split(",").filter(Boolean),a=r.length,i=o.length,n=o[o.length-1]||"",s=re.cssDurationToNumber(this.transitionDuration);let h="";i>a?h="next":i{var p;this.historyState=t,(p=this.setView)==null||p.call(this,n)},s),setTimeout(()=>{this.viewDirection=""},s*2)}getWrapper(){var t;return(t=this.shadowRoot)==null?void 0:t.querySelector("div.page")}};w.styles=[_e];x([u({type:String})],w.prototype,"transitionDuration",void 0);x([u({type:String})],w.prototype,"transitionFunction",void 0);x([u({type:String})],w.prototype,"history",void 0);x([u({type:String})],w.prototype,"view",void 0);x([u({attribute:!1})],w.prototype,"setView",void 0);x([d()],w.prototype,"viewDirection",void 0);x([d()],w.prototype,"historyState",void 0);x([d()],w.prototype,"previousHeight",void 0);w=x([g("w3m-router-container")],w);export{ie as AppKitModal,oe as W3mModal,v as W3mModalBase,w as W3mRouterContainer};