import{h}from"@stencil/core";import{state as selectedProcessor}from"../../../store/selected-processor/index";export class ScPaymentMethodChoice{constructor(){this.methodId=void 0,this.processorId=void 0,this.isManual=void 0,this.card=void 0}isSelected(){return this.methodId?(null==selectedProcessor?void 0:selectedProcessor.id)===this.processorId&&(null==selectedProcessor?void 0:selectedProcessor.method)==this.methodId:!(null==selectedProcessor?void 0:selectedProcessor.method)&&(null==selectedProcessor?void 0:selectedProcessor.id)===this.processorId}getAllOptions(){const e=this.el.closest("sc-payment")||this.el.parentElement;return e?[...e.querySelectorAll(this.el.tagName)]:[]}getSiblingItems(){return this.getAllOptions().filter((e=>e!==this.el))}hasOthers(){var e;return!!(null===(e=this.getSiblingItems())||void 0===e?void 0:e.length)}render(){const e=this.hasOthers()?"sc-toggle":"div";return h(e,{key:"56eaef03ea99ae08b743dbd5b64e954eda688f9b","show-control":!0,borderless:!0,open:this.isSelected(),onScShow:()=>{selectedProcessor.id=this.processorId,selectedProcessor.manual=!!this.isManual,selectedProcessor.method=this.methodId}},this.hasOthers()&&h("slot",{key:"81a1389709b3d3505e7428d250982e51810db2c6",name:"summary",slot:"summary"}),this.card&&!this.hasOthers()?h("sc-card",null,h("slot",null)):h("slot",null))}static get is(){return"sc-payment-method-choice"}static get encapsulation(){return"shadow"}static get originalStyleUrls(){return{$:["sc-payment-method-choice.css"]}}static get styleUrls(){return{$:["sc-payment-method-choice.css"]}}static get properties(){return{methodId:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"The method id"},attribute:"method-id",reflect:!0},processorId:{type:"string",mutable:!1,complexType:{original:"string",resolved:"string",references:{}},required:!1,optional:!1,docs:{tags:[],text:"The processor ID"},attribute:"processor-id",reflect:!1},isManual:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Is this a manual processor"},attribute:"is-manual",reflect:!1},card:{type:"boolean",mutable:!1,complexType:{original:"boolean",resolved:"boolean",references:{}},required:!1,optional:!1,docs:{tags:[],text:"Should we show this in a card?"},attribute:"card",reflect:!1}}}static get elementRef(){return"el"}}