import{e as h}from"./AppLayout-3f61dc0d.js";const a={props:["name","previousValue","placeholder","allowedChars","maxLength"],data(){return{chars:this.allowedChars&&this.maxLength?new RegExp(`^[${this.allowedChars}]{0,${this.maxLength}}$`,"g"):"",exclude:new RegExp(`[^${this.allowedChars}]`,"g"),length:this.maxLength?new RegExp(`^.{0,${this.maxLength}}$`,"g"):"",tooltip:window.tooltips?window.tooltips[this.name]:""}},created(){h.on("clear",()=>{this.query=""}),this.validate()},methods:{validate(){this.chars!==""&&this.length!==""&&(!this.allowedChars==null&&!this.chars.test(this.query)&&(this.query=this.query.replace(this.exclude,"")),!this.maxLength==null&&!this.length.test(this.query)&&(this.query=this.query.substr(0,this.maxLength)),this.$emit("change",this.query))},showTooltip(t){var e=$(t.target).next(".tooltip"),s=e.hasClass("hidden");$(".tooltip").attr("class","tooltip hidden"),s&&$(t.target).next(".tooltip").toggleClass("hidden")}}};export{a as s};