import{r as e,h as t,f as n,a as c}from"./p-879b0f88.js";import{L as s,a}from"./p-0d9caba2.js";import"./p-9d530225.js";const i=class{constructor(t){e(this,t);this.data={accountScreenData:null,confirmScreenData:null,connectScreenData:{}};this.selectedIndex=0}componentWillLoad(){this.ledgerConnectBase=new s(this.data)}async getEventBus(){return this.ledgerConnectBase.getEventBus()}render(){const{accountScreenData:e,confirmScreenData:n,connectScreenData:c}=this.data;if(e){return t("ledger-account-screen",{accountScreenData:e,selectedIndex:this.selectedIndex,onSelectAccount:e=>this.selectAccount(e.detail),onAccessWallet:()=>this.accessWallet(),onPrevPage:()=>this.prevPage(),onNextPage:()=>this.nextPage()})}if(n){return t("ledger-confirm-screen",{confirmScreenData:n})}return t("ledger-connect-screen",{connectScreenData:c,onConnect:()=>this.ledgerConnectBase.eventBus.publish(a.CONNECT_DEVICE)})}accessWallet(){this.ledgerConnectBase.accessWallet()}selectAccount(e){this.ledgerConnectBase.selectAccount(e);this.selectedIndex=this.ledgerConnectBase.selectedIndex}async nextPage(){this.ledgerConnectBase.nextPage()}async prevPage(){this.ledgerConnectBase.prevPage()}removeComponent(){var e;if((e=this.hostElement)===null||e===void 0?void 0:e.parentNode){this.hostElement.parentNode.removeChild(this.hostElement)}}componentDidLoad(){this.ledgerConnectBase.subscribeEventBus({closeFn:()=>this.removeComponent(),forceUpdateFn:()=>{this.data=this.ledgerConnectBase.data;n(this)}})}disconnectedCallback(){this.ledgerConnectBase.unsubscribeEventBus({closeFn:()=>this.removeComponent(),forceUpdateFn:()=>{this.data=this.ledgerConnectBase.data;n(this)}})}get hostElement(){return c(this)}};export{i as ledger_connect};
//# sourceMappingURL=p-08158188.entry.js.map