import{j as t,r as e,k as i,l as o,m as r,C as n,S as s,J as a,T as c,t as l,W as u,R as d,a as w}from"./p-BxEPsDRj.js";import{n as p,c as h,U as f,r as m}from"./p-CrMmJdZ6.js";import{o as b}from"./p-zNe_7rLp.js";import"./p-CbOrugAV.js";import"./p-Clzrp4MO.js";import"./p-BId5WtRC.js";import"buffer";import"events";import"ox";import"viem";import"viem/chains";var g=t`
  button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: ${({spacing:t})=>t[4]};
    background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
    border-radius: ${({borderRadius:t})=>t[3]};
    border: none;
    padding: ${({spacing:t})=>t[3]};
    transition: background-color ${({durations:t})=>t["lg"]}
      ${({easings:t})=>t["ease-out-power-2"]};
    will-change: background-color;
  }

  /* -- Hover & Active states ----------------------------------------------------------- */
  button:hover:enabled,
  button:active:enabled {
    background-color: ${({tokens:t})=>t.theme.foregroundSecondary};
  }

  wui-text {
    flex: 1;
    color: ${({tokens:t})=>t.theme.textSecondary};
  }

  wui-flex {
    width: auto;
    display: flex;
    align-items: center;
    gap: ${({spacing:t})=>t["01"]};
  }

  wui-icon {
    color: ${({tokens:t})=>t.theme.iconDefault};
  }

  .network-icon {
    position: relative;
    width: 20px;
    height: 20px;
    border-radius: ${({borderRadius:t})=>t[4]};
    overflow: hidden;
    margin-left: -8px;
  }

  .network-icon:first-child {
    margin-left: 0px;
  }

  .network-icon:after {
    position: absolute;
    inset: 0;
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    border-radius: ${({borderRadius:t})=>t[4]};
    box-shadow: inset 0 0 0 1px ${({tokens:t})=>t.core.glass010};
  }
`;var k=undefined&&undefined.__decorate||function(t,e,i,o){var r=arguments.length,n=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,s;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)if(s=t[a])n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n;return r>3&&n&&Object.defineProperty(e,i,n),n};let v=class t extends o{constructor(){super(...arguments);this.networkImages=[""];this.text=""}render(){return r`
      <button>
        <wui-text variant="md-regular" color="inherit">${this.text}</wui-text>
        <wui-flex>
          ${this.networksTemplate()}
          <wui-icon name="chevronRight" size="sm" color="inherit"></wui-icon>
        </wui-flex>
      </button>
    `}networksTemplate(){const t=this.networkImages.slice(0,5);return r` <wui-flex class="networks">
      ${t?.map((t=>r` <wui-flex class="network-icon"> <wui-image src=${t}></wui-image> </wui-flex>`))}
    </wui-flex>`}};v.styles=[e,i,g];k([p({type:Array})],v.prototype,"networkImages",void 0);k([p()],v.prototype,"text",void 0);v=k([h("wui-compatible-network")],v);var x=t`
  wui-compatible-network {
    margin-top: ${({spacing:t})=>t["4"]};
    width: 100%;
  }

  wui-qr-code {
    width: unset !important;
    height: unset !important;
  }

  wui-icon {
    align-items: normal;
  }
`;var $=undefined&&undefined.__decorate||function(t,e,i,o){var r=arguments.length,n=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,s;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")n=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)if(s=t[a])n=(r<3?s(n):r>3?s(e,i,n):s(e,i))||n;return r>3&&n&&Object.defineProperty(e,i,n),n};let y=class t extends o{constructor(){super();this.unsubscribe=[];this.address=n.getAccountData()?.address;this.profileName=n.getAccountData()?.profileName;this.network=n.state.activeCaipNetwork;this.unsubscribe.push(...[n.subscribeChainProp("accountState",(t=>{if(t){this.address=t.address;this.profileName=t.profileName}else{s.showError("Account not found")}}))],n.subscribeKey("activeCaipNetwork",(t=>{if(t?.id){this.network=t}})))}disconnectedCallback(){this.unsubscribe.forEach((t=>t()))}render(){if(!this.address){throw new Error("w3m-wallet-receive-view: No account provided")}const t=a.getNetworkImage(this.network);return r` <wui-flex
      flexDirection="column"
      .padding=${["0","4","4","4"]}
      alignItems="center"
    >
      <wui-chip-button
        data-testid="receive-address-copy-button"
        @click=${this.onCopyClick.bind(this)}
        text=${f.getTruncateString({string:this.profileName||this.address||"",charsStart:this.profileName?18:4,charsEnd:this.profileName?0:4,truncate:this.profileName?"end":"middle"})}
        icon="copy"
        size="sm"
        imageSrc=${t?t:""}
        variant="gray"
      ></wui-chip-button>
      <wui-flex
        flexDirection="column"
        .padding=${["4","0","0","0"]}
        alignItems="center"
        gap="4"
      >
        <wui-qr-code
          size=${232}
          theme=${c.state.themeMode}
          uri=${this.address}
          ?arenaClear=${true}
          color=${b(c.state.themeVariables["--apkt-qr-color"]??c.state.themeVariables["--w3m-qr-color"])}
          data-testid="wui-qr-code"
        ></wui-qr-code>
        <wui-text variant="lg-regular" color="primary" align="center">
          Copy your address or scan this QR code
        </wui-text>
        <wui-button @click=${this.onCopyClick.bind(this)} size="sm" variant="neutral-secondary">
          <wui-icon slot="iconLeft" size="sm" color="inherit" name="copy"></wui-icon>
          <wui-text variant="md-regular" color="inherit">Copy address</wui-text>
        </wui-button>
      </wui-flex>
      ${this.networkTemplate()}
    </wui-flex>`}networkTemplate(){const t=n.getAllRequestedCaipNetworks();const e=n.checkIfSmartAccountEnabled();const i=n.state.activeCaipNetwork;const o=t.filter((t=>t?.chainNamespace===i?.chainNamespace));if(l(i?.chainNamespace)===u.ACCOUNT_TYPES.SMART_ACCOUNT&&e){if(!i){return null}return r`<wui-compatible-network
        @click=${this.onReceiveClick.bind(this)}
        text="Only receive assets on this network"
        .networkImages=${[a.getNetworkImage(i)??""]}
      ></wui-compatible-network>`}const s=o?.filter((t=>t?.assets?.imageId))?.slice(0,5);const c=s.map(a.getNetworkImage).filter(Boolean);return r`<wui-compatible-network
      @click=${this.onReceiveClick.bind(this)}
      text="Only receive assets on these networks"
      .networkImages=${c}
    ></wui-compatible-network>`}onReceiveClick(){d.push("WalletCompatibleNetworks")}onCopyClick(){try{if(this.address){w.copyToClopboard(this.address);s.showSuccess("Address copied")}}catch{s.showError("Failed to copy")}}};y.styles=x;$([m()],y.prototype,"address",void 0);$([m()],y.prototype,"profileName",void 0);$([m()],y.prototype,"network",void 0);y=$([h("w3m-wallet-receive-view")],y);export{y as W3mWalletReceiveView};
//# sourceMappingURL=p-BInbBnkU.js.map