import{r as n,h as t,f as e,a as i}from"./p-cf6005f1.js";import{E as s}from"./p-9d530225.js";import{s as a,r as o}from"./p-847c40d2.js";var c;(function(n){n["SIGN_TRANSACTION"]="SIGN_TRANSACTION";n["NEXT_PAGE"]="NEXT_PAGE";n["PREV_PAGE"]="PREV_PAGE";n["CLOSE"]="CLOSE";n["DATA_UPDATE"]="DATA_UPDATE"})(c||(c={}));const r="*{margin:0;padding:0;box-sizing:border-box}.transaction-header-container{display:flex;flex-direction:column}.loading-spinner{display:flex;justify-content:center;align-items:center;min-height:350px}";const l=r;const d={FungibleESDT:"token-component",SemiFungibleESDT:"fungible-component",NonFungibleESDT:"fungible-component"};const h=class{constructor(t){n(this,t);this.eventBus=new s;this.data={commonData:{egldLabel:"",feeLimit:"",feeInFiatLimit:"",transactionsCount:0,currentIndex:0},tokenTransaction:null,nftTransaction:null,sftTransaction:null}}async getEventBus(){return this.eventBus}onDataChange(n){for(const t in n){if(Object.prototype.hasOwnProperty.call(a,t)){a[t]=n[t]}}a.isWaitingForSignature=false;a.isLoading=false}componentWillLoad(){a.onSign=()=>{a.isWaitingForSignature=true;this.eventBus.publish(c.SIGN_TRANSACTION)}}render(){const{commonData:n,isLoading:e}=a;const{tokenType:i,currentIndex:s,transactionsCount:o}=n;const c=d[i];return t("generic-modal",{key:"8a5f8ec8c062fb6d1e99965dbbff6332000bad57",onClose:()=>this.close(),modalTitle:"Sign transaction",modalSubtitle:`Transaction ${s+1} of ${o}`,body:e?t("div",{class:"loading-spinner"},t("generic-spinner",null)):t(c,null)})}async nextPage(){this.eventBus.publish(c.NEXT_PAGE)}async prevPage(){this.eventBus.publish(c.PREV_PAGE)}close(n={isUserClick:true}){o();if(n.isUserClick){this.eventBus.publish(c.CLOSE)}if(this.hostElement&&this.hostElement.parentNode){this.hostElement.parentNode.removeChild(this.hostElement)}}dataUpdate(n){this.data=Object.assign({},n);e(this)}componentDidLoad(){this.eventBus.subscribe(c.DATA_UPDATE,this.dataUpdate.bind(this))}disconnectedCallback(){o();this.eventBus.unsubscribe(c.DATA_UPDATE,this.dataUpdate.bind(this))}get hostElement(){return i(this)}static get watchers(){return{data:["onDataChange"]}}};h.style=l;export{h as sign_transactions_modal};
//# sourceMappingURL=p-d82606f0.entry.js.map