var __extends=this&&this.__extends||function(){var t=function(r,e){t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)if(Object.prototype.hasOwnProperty.call(r,e))t[e]=r[e]};return t(r,e)};return function(r,e){if(typeof e!=="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");t(r,e);function n(){this.constructor=r}r.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}();import{r as registerInterceptor,I as InterceptorConfig,a as InterceptorHandler}from"./InterceptorHandler-6474bcf4.js";var ValidatorLength=function(t){__extends(r,t);function r(r,e){var n=t.call(this,"validatorLength")||this;n.min=r;n.max=e;return n}return r}(InterceptorConfig);ValidatorLength.id="validatorLength";var ValidatorLengthHandler=function(t){__extends(r,t);function r(r){var e=t.call(this)||this;e.config=r;return e}r.prototype.run=function(t,r,e,n){var a=this.config,i=a.max,o=a.min;if(!o&&!i){return{value:n}}if(typeof n==="string"||n instanceof String){return validateString(t,e,n,o,i)}else if(n instanceof Array){return validateArray(t,e,n,o,i)}return{value:n}};return r}(InterceptorHandler);function validateArray(t,r,e,n,a){if(n&&(!e||e.length<n)){return{error:t.strings.interceptors.validatorLength.messageMinItems.replace("{title}",r.errorTitle||r.title).replace("{min}",n),value:e}}if(a&&(e&&e.length>a)){return{error:t.strings.interceptors.validatorLength.messageMaxItems.replace("{title}",r.errorTitle||r.title).replace("{max}",a),value:e}}return{value:e}}function validateString(t,r,e,n,a){if(n&&(!e||e.length<n)){return{error:t.strings.interceptors.validatorLength.messageMinChars.replace("{title}",r.errorTitle||r.title).replace("{min}",n),value:e}}if(a&&(e&&e.length>a)){return{error:t.strings.interceptors.validatorLength.messageMaxChars.replace("{title}",r.errorTitle||r.title).replace("{max}",a),value:e}}return{value:e}}registerInterceptor(ValidatorLength.id,(function(t){return new ValidatorLengthHandler(t)}));export{ValidatorLength as V};