{"version":3,"file":"validateSlider.mjs","sources":["../../../../../src/components/va-slider/validateSlider.ts"],"sourcesContent":["import { warn } from '../../utils/console'\nimport { toFloat, isDividable } from '../../utils/to-float'\n\nexport const validateSlider = (value: number | number[], step: number, min: number, max: number, range: boolean) => {\n  if ((Array.isArray(value) && !range) || (!Array.isArray(value) && range)) {\n    warn(`The type \"${Array.isArray(value) ? 'array' : typeof value}\" of prop \"model-value\" does not match prop \"range = ${range}\".`)\n  }\n\n  if (max < min) {\n    warn(`The maximum value (${max}) can not be less than the minimum value (${min}).`)\n  }\n\n  if (!isDividable(max - min, step)) {\n    warn(`Step ${step} is illegal. Slider is non-divisible (Min:Max ${min}:${max}).`)\n  }\n\n  const inRange = (v: number) => {\n    if (v < min) {\n      warn(`The value of the slider is ${v}, the minimum value is ${min}, the value of this slider can not be less than the minimum value`)\n    } else if (v > max) {\n      warn(`The value of the slider is ${v}, the maximum value is ${max}, the value of this slider can not be greater than the maximum value`)\n    }\n  }\n\n  if (Array.isArray(value)) {\n    value.map(inRange)\n  } else {\n    inRange(value)\n  }\n\n  return true\n}\n"],"names":[],"mappings":";;AAGO,MAAM,iBAAiB,CAAC,OAA0B,MAAc,KAAa,KAAa,UAAmB;AAC7G,MAAA,MAAM,QAAQ,KAAK,KAAK,CAAC,SAAW,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAQ;AACnE,SAAA,aAAa,MAAM,QAAQ,KAAK,IAAI,UAAU,OAAO,KAAK,wDAAwD,KAAK,IAAI;AAAA,EAClI;AAEA,MAAI,MAAM,KAAK;AACb,SAAK,sBAAsB,GAAG,6CAA6C,GAAG,IAAI;AAAA,EACpF;AAEA,MAAI,CAAC,YAAY,MAAM,KAAK,IAAI,GAAG;AACjC,SAAK,QAAQ,IAAI,iDAAiD,GAAG,IAAI,GAAG,IAAI;AAAA,EAClF;AAEM,QAAA,UAAU,CAAC,MAAc;AAC7B,QAAI,IAAI,KAAK;AACX,WAAK,8BAA8B,CAAC,0BAA0B,GAAG,mEAAmE;AAAA,IAAA,WAC3H,IAAI,KAAK;AAClB,WAAK,8BAA8B,CAAC,0BAA0B,GAAG,sEAAsE;AAAA,IACzI;AAAA,EAAA;AAGE,MAAA,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAM,IAAI,OAAO;AAAA,EAAA,OACZ;AACL,YAAQ,KAAK;AAAA,EACf;AAEO,SAAA;AACT;"}