import{h}from"@stencil/core";import{__}from"@wordpress/i18n";export class ScPaymentMethod{constructor(){this.paymentMethod=void 0,this.full=void 0,this.externalLink=void 0,this.externalLinkTooltipText=void 0}renderBankAccountType(t){return"checking"===t?__("Checking","surecart"):"savings"===t?__("Savings","surecart"):void 0}renderExternalLink(){return!!this.externalLink&&h("sc-tooltip",{text:this.externalLinkTooltipText,type:"text"},h("sc-button",{style:{color:"var(--sc-color-gray-500)"},type:"text",size:"small",href:this.externalLink,target:"_blank"},h("sc-icon",{name:"external-link",style:{fontSize:"16px"}})))}render(){var t,e,n,i,o,l,a,s,r,d,p,c,m,u,y,v,x,g,f,k;if(null===(e=null===(t=this.paymentMethod)||void 0===t?void 0:t.bank_account)||void 0===e?void 0:e.id){const t=null===(n=this.paymentMethod)||void 0===n?void 0:n.bank_account;return h("div",{class:"payment-method",part:"bank"},h("span",null,this.renderBankAccountType(null==t?void 0:t.account_type)),"**** ",null==t?void 0:t.last4,this.renderExternalLink())}if(null===(o=null===(i=null==this?void 0:this.paymentMethod)||void 0===i?void 0:i.payment_instrument)||void 0===o?void 0:o.instrument_type){const t=null===(a=null===(l=null==this?void 0:this.paymentMethod)||void 0===l?void 0:l.payment_instrument)||void 0===a?void 0:a.instrument_type;return(null===(s=null==this?void 0:this.paymentMethod)||void 0===s?void 0:s.payment_method_name)?h("div",{class:"payment-method",part:"instrument"},h("div",{class:"payment-method-icon"},h("sc-icon",{style:{fontSize:"36px","--height":"0.63em"},name:t})),h("span",null,null===(r=null==this?void 0:this.paymentMethod)||void 0===r?void 0:r.payment_method_name),this.renderExternalLink()):"paypal"===t?h("div",{class:"payment-method",part:"instrument"},h("sc-icon",{style:{fontSize:"56px",lineHeight:"1",height:"28px"},name:"paypal"})):h("div",{class:"payment-method",part:"instrument"},h("sc-tag",{exportparts:"base:payment_instrument",type:"info",pill:!0},h("span",{style:{textTransform:"capitalize"}},t," ")),this.renderExternalLink())}return(null===(p=null===(d=this.paymentMethod)||void 0===d?void 0:d.card)||void 0===p?void 0:p.brand)?h("div",{class:"payment-method",part:"card"},h("sc-cc-logo",{style:{fontSize:"36px"},brand:null===(m=null===(c=this.paymentMethod)||void 0===c?void 0:c.card)||void 0===m?void 0:m.brand}),h("sc-text",{style:{whiteSpace:"nowrap",paddingRight:"6px"}},"**** ",null===(y=null===(u=this.paymentMethod)||void 0===u?void 0:u.card)||void 0===y?void 0:y.last4),this.renderExternalLink()):(null===(x=null===(v=this.paymentMethod)||void 0===v?void 0:v.paypal_account)||void 0===x?void 0:x.id)?h("div",{class:"payment-method",part:"base",style:{gap:"var(--sc-spacing-small)"}},h("sc-icon",{style:{fontSize:"56px",lineHeight:"1",height:"28px"},name:"paypal"}),this.full&&h("sc-text",{style:{"--font-size":"var(--sc-font-size-small)"},truncate:!0},null===(f=null===(g=this.paymentMethod)||void 0===g?void 0:g.paypal_account)||void 0===f?void 0:f.email),this.renderExternalLink()):null===(k=null==this?void 0:this.paymentMethod)||void 0===k?void 0:k.processor_type}static get is(){return"sc-payment-method"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-payment-method.css"]}}static get styleUrls(){return{$:["sc-payment-method.css"]}}static get properties(){return{paymentMethod:{type:"unknown",mutable:!1,complexType:{original:"PaymentMethod",resolved:"PaymentMethod",references:{PaymentMethod:{location:"import",path:"../../../types",id:"src/types.ts::PaymentMethod"}}},required:!1,optional:!1,docs:{tags:[],text:""}},full:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"full",reflect:!1},externalLink:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"external-link",reflect:!1},externalLinkTooltipText:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:""},attribute:"external-link-tooltip-text",reflect:!1}}}}