import{r as i,d as t,h as r,H as o,c as e}from"./p-38dcedc4.js";import{g as n}from"./p-202e7480.js";import{a,r as s,f as d}from"./p-5a5a5c96.js";import{c as l,h}from"./p-7840618d.js";const c=class{constructor(r){i(this,r),this.ionStyle=t(this,"ionStyle",7),this.ionFocus=t(this,"ionFocus",7),this.ionBlur=t(this,"ionBlur",7),this.inputId="ion-rb-"+p++,this.radioGroup=null,this.checked=!1,this.buttonTabindex=-1,this.name=this.inputId,this.disabled=!1,this.updateState=()=>{this.radioGroup&&(this.checked=this.radioGroup.value===this.value)},this.onFocus=()=>{this.ionFocus.emit()},this.onBlur=()=>{this.ionBlur.emit()}}async setFocus(i){i.stopPropagation(),i.preventDefault(),this.el.focus()}async setButtonTabindex(i){this.buttonTabindex=i}connectedCallback(){void 0===this.value&&(this.value=this.inputId);const i=this.radioGroup=this.el.closest("ion-radio-group");i&&(this.updateState(),a(i,"ionChange",this.updateState))}disconnectedCallback(){const i=this.radioGroup;i&&(s(i,"ionChange",this.updateState),this.radioGroup=null)}componentWillLoad(){this.emitStyle()}emitStyle(){this.ionStyle.emit({"radio-checked":this.checked,"interactive-disabled":this.disabled})}render(){const{inputId:i,disabled:t,checked:e,color:a,el:s,buttonTabindex:c}=this,p=n(this),{label:b,labelId:g,labelText:m}=d(s,i);return r(o,{"aria-checked":`${e}`,"aria-hidden":t?"true":null,"aria-labelledby":b?g:null,role:"radio",tabindex:c,onFocus:this.onFocus,onBlur:this.onBlur,class:l(a,{[p]:!0,"in-item":h("ion-item",s),interactive:!0,"radio-checked":e,"radio-disabled":t})},r("div",{class:"radio-icon",part:"container"},r("div",{class:"radio-inner",part:"mark"}),r("div",{class:"radio-ripple"})),r("label",{htmlFor:i},m),r("input",{type:"radio",checked:e,disabled:t,tabindex:"-1",id:i}))}get el(){return e(this)}static get watchers(){return{color:["emitStyle"],checked:["emitStyle"],disabled:["emitStyle"]}}};let p=0;c.style={ios:':host{--inner-border-radius:50%;display:inline-block;position:relative;box-sizing:border-box;user-select:none;z-index:2}:host(.radio-disabled){pointer-events:none}.radio-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{box-sizing:border-box}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host{--color-checked:var(--ion-color-primary, #3880ff);width:15px;height:24px}:host(.ion-color.radio-checked) .radio-inner{border-color:var(--ion-color-base)}.item-radio.item-ios ion-label{margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-radio.item-ios ion-label{margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}.radio-inner{width:33%;height:50%}:host(.radio-checked) .radio-inner{transform:rotate(45deg);border-width:2px;border-top-width:0;border-left-width:0;border-style:solid;border-color:var(--color-checked)}:host(.radio-disabled){opacity:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);left:-9px;top:-8px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:"";opacity:0.2}:host-context([dir=rtl]):host(.ion-focused) .radio-icon::after,:host-context([dir=rtl]).ion-focused .radio-icon::after{left:unset;right:unset;right:-9px}:host(.in-item){margin-left:10px;margin-right:11px;margin-top:8px;margin-bottom:8px;display:block;position:static}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.in-item){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:11px;margin-inline-end:11px}}:host(.in-item[slot=start]){margin-left:3px;margin-right:21px;margin-top:8px;margin-bottom:8px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.in-item[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:3px;margin-inline-start:3px;-webkit-margin-end:21px;margin-inline-end:21px}}',md:':host{--inner-border-radius:50%;display:inline-block;position:relative;box-sizing:border-box;user-select:none;z-index:2}:host(.radio-disabled){pointer-events:none}.radio-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%;contain:layout size style}.radio-icon,.radio-inner{box-sizing:border-box}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}:host(:focus){outline:none}:host{--color:var(--ion-color-step-400, #999999);--color-checked:var(--ion-color-primary, #3880ff);--border-width:2px;--border-style:solid;--border-radius:50%;width:20px;height:20px}:host(.ion-color) .radio-inner{background:var(--ion-color-base)}:host(.ion-color.radio-checked) .radio-icon{border-color:var(--ion-color-base)}.radio-icon{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;border-radius:var(--border-radius);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--color)}.radio-inner{border-radius:var(--inner-border-radius);width:calc(50% + var(--border-width));height:calc(50% + var(--border-width));transform:scale3d(0, 0, 0);transition:transform 280ms cubic-bezier(0.4, 0, 0.2, 1);background:var(--color-checked)}:host(.radio-checked) .radio-icon{border-color:var(--color-checked)}:host(.radio-checked) .radio-inner{transform:scale3d(1, 1, 1)}:host(.radio-disabled){opacity:0.3}:host(.ion-focused) .radio-icon::after{border-radius:var(--inner-border-radius);left:-12px;top:-12px;display:block;position:absolute;width:36px;height:36px;background:var(--ion-color-primary-tint, #4c8dff);content:"";opacity:0.2}:host-context([dir=rtl]):host(.ion-focused) .radio-icon::after,:host-context([dir=rtl]).ion-focused .radio-icon::after{left:unset;right:unset;right:-12px}:host(.in-item){margin-left:0;margin-right:0;margin-top:9px;margin-bottom:9px;display:block;position:static}:host(.in-item[slot=start]){margin-left:4px;margin-right:36px;margin-top:11px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.in-item[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:36px;margin-inline-end:36px}}'};const b=class{constructor(r){i(this,r),this.ionChange=t(this,"ionChange",7),this.inputId="ion-rg-"+g++,this.labelId=`${this.inputId}-lbl`,this.allowEmptySelection=!1,this.name=this.inputId,this.setRadioTabindex=i=>{const t=this.getRadios(),r=t.find((i=>!i.disabled)),o=t.find((t=>t.value===i&&!t.disabled));if(!r&&!o)return;const e=o||r;for(const i of t)i.setButtonTabindex(i===e?0:-1)},this.onClick=i=>{i.preventDefault();const t=i.target&&i.target.closest("ion-radio");if(t){const i=t.value;i!==this.value?this.value=i:this.allowEmptySelection&&(this.value=void 0)}}}valueChanged(i){this.setRadioTabindex(i),this.ionChange.emit({value:i})}componentDidLoad(){this.setRadioTabindex(this.value)}async connectedCallback(){const i=this.el.querySelector("ion-list-header")||this.el.querySelector("ion-item-divider");if(i){const t=this.label=i.querySelector("ion-label");t&&(this.labelId=t.id=this.name+"-lbl")}}getRadios(){return Array.from(this.el.querySelectorAll("ion-radio"))}onKeydown(i){const t=!!this.el.closest("ion-select-popover");if(i.target&&!this.el.contains(i.target))return;const r=Array.from(this.el.querySelectorAll("ion-radio")).filter((i=>!i.disabled));if(i.target&&r.includes(i.target)){const o=r.findIndex((t=>t===i.target)),e=r[o];let n;["ArrowDown","ArrowRight"].includes(i.code)&&(n=o===r.length-1?r[0]:r[o+1]),["ArrowUp","ArrowLeft"].includes(i.code)&&(n=0===o?r[r.length-1]:r[o-1]),n&&r.includes(n)&&(n.setFocus(i),t||(this.value=n.value)),["Space"].includes(i.code)&&(this.value=this.allowEmptySelection&&void 0!==this.value?void 0:e.value,i.preventDefault())}}render(){const{label:i,labelId:t}=this,e=n(this);return r(o,{role:"radiogroup","aria-labelledby":i?t:null,onClick:this.onClick,class:e})}get el(){return e(this)}static get watchers(){return{value:["valueChanged"]}}};let g=0;export{c as ion_radio,b as ion_radio_group}