import{r as i,h as t,H as s}from"./p-a89095f5.js";const n=class{constructor(t){i(this,t),this.name="size",this.disabled=!1,this.required=!1,this.value=void 0,this.lines="full",this.label=void 0,this.labelPosition="stacked",this.unit="ft",this.unitOptions=[{name:"feet",label:"Feet",value:"ft"},{name:"inche",label:"Inches",value:"in"}],this.disableUnit=!1,this.totalInches=void 0}async onValue(i,t){if(`${i}`==`${t}`)return;const[s,n]=(this.value||0).toString().split("."),e=Math.round(12*parseFloat(`0.${n||0}`));this.totalInches=12*parseInt(s||"0")+e,"ft"===this.unit?(this.feetInputEl.value=s||0,this.inchesInputEl.value=e||0):(this.feetInputEl.value=0,this.inchesInputEl.value=this.totalInches||0)}async updateValue(){var i,t,s;this.totalInches="ft"===this.unit?12*parseInt((null===(i=this.feetInputEl)||void 0===i?void 0:i.value)||"0")+parseInt((null===(t=this.inchesInputEl)||void 0===t?void 0:t.value)||"0"):parseInt((null===(s=this.inchesInputEl)||void 0===s?void 0:s.value)||"0"),this.value=this.totalInches/12}async changeUnit(i){if(this.unit=i||"ft","ft"===this.unit){const[i,t]=(this.value||0).toString().split("."),s=Math.round(12*parseFloat(`0.${t||"0"}`));this.feetInputEl.value=parseInt(i||"0"),this.inchesInputEl.value=s||0}else this.feetInputEl.value=0,this.inchesInputEl.value=this.totalInches||0}render(){return t(s,null,t("ion-item",{style:{"--padding-start":"4px","--inner-padding-end":"0"},lines:this.lines},this.label&&t("ion-label",{position:this.labelPosition},this.label),t("ion-grid",{class:"ion-no-padding"},t("ion-row",{class:"ion-no-padding",style:{paddingTop:"8px"}},t("ion-col",{class:"ion-no-padding",style:{position:"relative",opacity:"ft"===this.unit?"1":"0",height:"ft"===this.unit?"auto":"0"},size:"ft"===this.unit?"6":"12"},t("ion-input",{ref:i=>this.feetInputEl=i,disabled:this.disabled,onIonChange:()=>this.updateValue(),type:"number",placeholder:this.unit,min:0}),t("small",{style:{opacity:"0.8",position:"absolute",top:"3px",right:"15px",pointerEvents:"none"}},"'")),t("ion-col",{class:"ion-no-padding",size:"ft"===this.unit?"6":"12",style:{position:"relative"}},t("ion-input",{onIonChange:()=>this.updateValue(),placeholder:"ft"===this.unit&&"in",ref:i=>this.inchesInputEl=i,disabled:this.disabled,type:"number",min:0,max:"ft"===this.unit&&11}),t("small",{style:{opacity:"0.8",position:"absolute",top:"3px",right:"15px",pointerEvents:"none"}},'"')))),t("ion-chip",{slot:"end",style:{margin:"0",float:"right"}},this.unit,t("ion-select",{style:{opacity:"0",display:"flex",width:"0",margin:"0",padding:"0"},onIonChange:i=>{var t;return this.changeUnit(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.value)},selectedText:this.unit,disabled:this.disableUnit,value:this.unit},(this.unitOptions||[]).map((i=>t("ion-select-option",{value:null==i?void 0:i.value},(null==i?void 0:i.label)||(null==i?void 0:i.name))))),t("ion-icon",{name:"chevron-down-circle"}))),t("ion-input",{name:this.name,value:this.value,style:{height:"0",width:"0",opacity:"0"},required:this.required}))}static get watchers(){return{value:["onValue"]}}};n.style="floodteam-input-measure ion-label{--padding-start:0;--padding-end:0}";export{n as floodteam_input_measure}