{"version":3,"names":["clamp","replaceArrayItemAtIndex","getSliderValue","valueInput","index","min","max","range","values","newValue","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY"],"sources":["get-slider-value.ts"],"sourcesContent":["import { clamp } from \"./clamp\";\nimport { replaceArrayItemAtIndex } from \"./replace-array-item-at-index\";\n\n/**\n * Resolves a candidate slider value for the thumb at `index`, clamping it\n * into `[min, max]` and — for range sliders — into the window bounded by the\n * thumb's immediate neighbours. The return type is scalar or array\n * depending on the `range` flag (matches the React source).\n */\nexport function getSliderValue(\n\tvalueInput: number,\n\tindex: number,\n\tmin: number,\n\tmax: number,\n\trange: boolean,\n\tvalues: readonly number[],\n): number | number[] {\n\tlet newValue: number | number[] = valueInput;\n\n\tnewValue = clamp(newValue, min, max);\n\n\tif (range) {\n\t\tnewValue = replaceArrayItemAtIndex(\n\t\t\tvalues,\n\t\t\tindex,\n\t\t\t// Bound the new value to the thumb's neighbours.\n\t\t\tclamp(\n\t\t\t\tnewValue,\n\t\t\t\tvalues[index - 1] || Number.NEGATIVE_INFINITY,\n\t\t\t\tvalues[index + 1] || Number.POSITIVE_INFINITY,\n\t\t\t),\n\t\t);\n\t}\n\n\treturn newValue;\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,SAAS;AAC/B,SAASC,uBAAuB,QAAQ,+BAA+B;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC7BC,UAAkB,EAClBC,KAAa,EACbC,GAAW,EACXC,GAAW,EACXC,KAAc,EACdC,MAAyB,EACL;EACpB,IAAIC,QAA2B,GAAGN,UAAU;EAE5CM,QAAQ,GAAGT,KAAK,CAACS,QAAQ,EAAEJ,GAAG,EAAEC,GAAG,CAAC;EAEpC,IAAIC,KAAK,EAAE;IACVE,QAAQ,GAAGR,uBAAuB,CACjCO,MAAM,EACNJ,KAAK;IACL;IACAJ,KAAK,CACJS,QAAQ,EACRD,MAAM,CAACJ,KAAK,GAAG,CAAC,CAAC,IAAIM,MAAM,CAACC,iBAAiB,EAC7CH,MAAM,CAACJ,KAAK,GAAG,CAAC,CAAC,IAAIM,MAAM,CAACE,iBAC7B,CACD,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB","ignoreList":[]}