import{yb as v}from"./chunk-YSQLW2JA.js";import{Aa as e,Ba as c,G as m,Id as g,J as d,Te as y,_a as x,bb as I,dd as T,ha as h,l as a,mg as C,wa as u,ya as f}from"./chunk-SKPDQO4E.js";var L=`<div class="input-group">
  <!-- Input area -->
  <input #filterInput class="form-control form-control-sm w-100" type="text" id="{{inputId}}" [disabled]="disabled"
    [(ngModel)]="filterText" placeholder="{{placeholder | translate}}" (keyup)="onKeyUp($event)"
    (paste)="onPaste($event)" [ngClass]="{'is-invalid': isInvalid}">
  <!-- Tooltip message -->
  <div class="invalid-feedback" *ngIf="tooltipCode">
    {{tooltipCode | translate:tooltipData}}
  </div>
</div>`;var b="";var N=function(l,t,n,o){var r=arguments.length,i=r<3?t:o===null?o=Object.getOwnPropertyDescriptor(t,n):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,t,n,o);else for(var p=l.length-1;p>=0;p--)(s=l[p])&&(i=(r<3?s(i):r>3?s(t,n,i):s(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i},_=class extends v{minLength;maxLength;placeholder;required;initialText;disabled;tooltipAtTop;onlyNumber=!1;entryCompleted=new h;input;keyPress=new a;inputId="filter-input-"+g();filterText;tooltipCode;tooltipData;constructor(){super()}get isInvalid(){let t=!1;return this.tooltipCode="",this.filterText?(this.minLength!==void 0&&this.minLength!==null&&this.filterText.trim().length<this.minLength&&(t=!0,this.tooltipCode="VALIDATION.MIN_LENGTH",this.tooltipData={min:this.minLength}),this.maxLength!==void 0&&this.maxLength!==null&&this.filterText.trim().length>this.maxLength&&(t=!0,this.tooltipCode="VALIDATION.MAX_LENGTH",this.tooltipData={max:this.maxLength})):this.required===!0&&(t=!0,this.tooltipCode="VALIDATION.REQUIRED"),t}ngOnInit(){this.placeholder=this.placeholder||"COMMON.FILTER",this.filterText=this.initialText||""}ngAfterViewInit(){this.keyPress.pipe(m(800),d()).subscribe(t=>{this.isInvalid?this.entryCompleted.emit(null):this.entryCompleted.emit(this.filterText.trim())})}onKeyUp(t){this.keyPress.next(t)}onPaste(t){let o=(t.clipboardData||window.clipboardData).getData("text");this.isInvalid?this.entryCompleted.emit(null):this.entryCompleted.emit(o.trim())}resetText(){this.filterText="",this.input&&this.input.nativeElement&&this.input.nativeElement.blur()}setText(t){this.filterText=t}getText(){return this.isInvalid?null:this.filterText.trim()}static ctorParameters=()=>[];static propDecorators={minLength:[{type:e}],maxLength:[{type:e}],placeholder:[{type:e}],required:[{type:e}],initialText:[{type:e}],disabled:[{type:e}],tooltipAtTop:[{type:e}],onlyNumber:[{type:e}],entryCompleted:[{type:c}],input:[{type:u,args:["filterInput",{static:!0}]}]}};_=N([f({selector:"armon-filter-input",template:L,standalone:!0,imports:[y,C,x,I,T],styles:[b]})],_);export{_ as a};
