import{r as o,h as i,H as e}from"./p-d00c3523.js";import{g as r}from"./p-8ad0c9b2.js";import{s as t}from"./p-4c71d020.js";import{g as n}from"./p-69e7783d.js";import"./p-6fd4985d.js";import"./p-6da8225a.js";let s=class{constructor(i){o(this,i),this.options=[]}onSelect(o){this.setChecked(o),this.callOptionHandler(o)}findOptionFromEvent(o){const{options:i}=this;return i.find((i=>i.value===o.target.value))}callOptionHandler(o){const i=this.findOptionFromEvent(o),e=this.getValues(o);i&&i.handler&&t(i.handler,e)}rbClick(o){this.callOptionHandler(o)}setChecked(o){const{multiple:i}=this,e=this.findOptionFromEvent(o);i&&e&&(e.checked=o.detail.checked)}getValues(o){const{multiple:i,options:e}=this;if(i)return e.filter((o=>o.checked)).map((o=>o.value));const r=this.findOptionFromEvent(o);return r?r.value:void 0}renderOptions(o){const{multiple:i}=this;switch(i){case!0:return this.renderCheckboxOptions(o);default:return this.renderRadioOptions(o)}}renderCheckboxOptions(o){return o.map((o=>i("ion-item",{class:n(o.cssClass)},i("ion-checkbox",{slot:"start",value:o.value,disabled:o.disabled,checked:o.checked}),i("ion-label",null,o.text))))}renderRadioOptions(o){const e=o.filter((o=>o.checked)).map((o=>o.value))[0];return i("ion-radio-group",{value:e},o.map((o=>i("ion-item",{class:n(o.cssClass)},i("ion-label",null,o.text),i("ion-radio",{value:o.value,disabled:o.disabled,onClick:o=>this.rbClick(o)})))))}render(){const{header:o,message:t,options:n,subHeader:s}=this,c=void 0!==s||void 0!==t;return i(e,{class:r(this)},i("ion-list",null,void 0!==o&&i("ion-list-header",null,o),c&&i("ion-item",null,i("ion-label",{class:"ion-text-wrap"},void 0!==s&&i("h3",null,s),void 0!==t&&i("p",null,t))),this.renderOptions(n)))}};s.style={ios:".sc-ion-select-popover-ios-h ion-list.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-ios,ion-label.sc-ion-select-popover-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}",md:".sc-ion-select-popover-md-h ion-list.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list-header.sc-ion-select-popover-md,ion-label.sc-ion-select-popover-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}ion-list.sc-ion-select-popover-md ion-radio.sc-ion-select-popover-md{opacity:0}ion-item.sc-ion-select-popover-md{--inner-border-width:0}.item-radio-checked.sc-ion-select-popover-md{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.08);--background-focused:var(--ion-color-primary, #3880ff);--background-focused-opacity:0.2;--background-hover:var(--ion-color-primary, #3880ff);--background-hover-opacity:0.12}.item-checkbox-checked.sc-ion-select-popover-md{--background-activated:var(--ion-item-color, var(--ion-text-color, #000));--background-focused:var(--ion-item-color, var(--ion-text-color, #000));--background-hover:var(--ion-item-color, var(--ion-text-color, #000));--color:var(--ion-color-primary, #3880ff)}"};export{s as ion_select_popover}