import{r as t,c as s,h as e,H as a}from"./p-CV0Pyo1O.js";import{q as i,u as o,v as r,w as h,x as c,y as d}from"./p-CPKMvyV_.js";import{F as n}from"./p-B5gBiARs.js";import{F as l}from"./p-Ce_W43gc.js";import"./p-CZfYo5-1.js";import{f as p}from"./p-BXrbGZ_R.js";import"./p-HXpYMWUU.js";const f=class{constructor(e){t(this,e),this.formControlInput=s(this,"formControlInput",7),this.formControlBlur=s(this,"formControlBlur",7),this.isFocused=!1,this.defaultValue="0",this.formatRawValue=t=>t.replace(/\D/g,""),this.formatDisplayValue=t=>p(+t,void 0,!0),this.updateInput=t=>{const s=this.formControl.name,e=this.formatRawValue(t);this.formControl.value=this.formatDisplayValue(e),this.inputHandler(s,e),this.formControlInput.emit({name:s,value:e})}}handleDefaultValueChange(t){this.updateInput(t)}componentDidLoad(){this.updateInput(this.defaultValue)}get inputPart(){return this.errorText?i:this.disabled?o:this.isFocused?r:h}render(){return e(a,{key:"6b13b9d4871571ab80480c044b813f70db17a85b"},e("div",{key:"de33d4a9dc8c5b5048c8b95d9c860433cb488c7c",class:"form-group d-flex flex-column"},e("label",{key:"e243e257c45018233a948c880e4fb15676f1b776",part:c,class:"form-label",htmlFor:this.name},this.label),e(n,{key:"c490aa1db17d5a181666631cd95c509dbb32aece",name:this.name,helpText:this.helpText}),e("div",{key:"69dd679301294e3c6a31ce0b880ec291ee6cf23e",class:"input-group"},e("span",{key:"71ed3716a7ea67933950b2140db4552799968193",class:"input-group-text",part:d},"$"),e("input",{key:"a1ddad4f875b56fde2d1a0054dd2cfe0c3797e0d",ref:t=>this.formControl=t,id:this.name,name:this.name,onFocus:()=>this.isFocused=!0,onBlur:()=>{this.isFocused=!1,this.formControlBlur.emit()},onInput:t=>this.updateInput(t.target.value),onKeyDown:this.keyDownHandler,onPaste:this.keyDownHandler,maxLength:this.maxLength,part:this.inputPart,class:this.errorText?"form-control is-invalid":"form-control",type:"text",disabled:this.disabled})),e(l,{key:"6bce010df58a187981efcad682cdc54150422bd6",errorText:this.errorText,name:this.name})))}static get watchers(){return{defaultValue:["handleDefaultValueChange"]}}};export{f as form_control_monetary}