"use strict";(self.webpackChunkdotcms_ui=self.webpackChunkdotcms_ui||[]).push([[4967],{54967:(l,a,e)=>{e.r(a),e.d(a,{dot_input_calendar:()=>n});var u=e(15861),i=e(55956),s=e(26184);const n=class{constructor(t){(0,i.r)(this,t),this._dotValueChange=(0,i.c)(this,"_dotValueChange",7),this._dotStatusChange=(0,i.c)(this,"_dotStatusChange",7),this.value="",this.name="",this.required=!1,this.disabled=!1,this.min="",this.max="",this.step="1",this.type="",this.status=void 0}reset(){var t=this;return(0,u.Z)(function*(){t.value="",t.status=(0,s.g)(t.isValid()),t.emitValueChange(),t.emitStatusChange()})()}componentWillLoad(){this.status=(0,s.g)(this.isValid()),this.emitStatusChange()}render(){return(0,i.h)("input",{class:(0,s.j)(this.status.dotValid),disabled:this.disabled||null,id:(0,s.k)(this.name),onBlur:()=>this.blurHandler(),onInput:t=>this.setValue(t),required:this.required||null,type:this.type,min:this.min,max:this.max,step:this.step,value:this.value})}isValid(){return this.isValueInRange()&&this.isRequired()}isRequired(){return!this.required||!!this.value}isValueInRange(){return this.isInMaxRange()&&this.isInMinRange()}isInMinRange(){return!this.min||this.value>=this.min}isInMaxRange(){return!this.max||this.value<=this.max}blurHandler(){this.status.dotTouched||(this.status=(0,s.u)(this.status,{dotTouched:!0}),this.emitStatusChange())}setValue(t){this.value=t.target.value.toString(),this.status=(0,s.u)(this.status,{dotTouched:!0,dotPristine:!1,dotValid:this.isValid()}),this.emitValueChange(),this.emitStatusChange()}emitStatusChange(){this._dotStatusChange.emit({name:this.name,status:this.status,isValidRange:this.isValueInRange()})}emitValueChange(){this._dotValueChange.emit({name:this.name,value:this.formattedValue()})}formattedValue(){return 5===this.value.length?`${this.value}:00`:this.value}get el(){return(0,i.g)(this)}};n.style="dot-input-calendar{display:flex}dot-input-calendar input{flex-grow:1}"}}]);