{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["export type TGetClampedNumArgs = Parameters<typeof getClampedNum>;\n\nexport type TGetClampedNumReturn = ReturnType<typeof getClampedNum>;\n\n/**\n * Restricts a number to an inclusive range.\n * @param {number} num Source number\n * @param {number} min Minimum value\n * @param {number} max Maximum value\n * @returns {number} Clamped number\n * @throws {TypeError} getClampedNum: arguments must be finite numbers\n * @throws {RangeError} getClampedNum: min must be less than or equal to max\n * @example\n * getClampedNum(12, 0, 10); // 10\n * @example\n * // Clamp upload progress to a valid percentage between 0 and 100\n * const progress = getClampedNum((uploadedBytes / totalBytes) * 100, 0, 100);\n */\nexport const getClampedNum = (num: number, min: number, max: number): number => {\n  if (![ num, min, max ].every((value) => typeof value === \"number\" && Number.isFinite(value))) {\n    throw new TypeError(\"getClampedNum: arguments must be finite numbers\");\n  }\n  if (min > max) {\n    throw new RangeError(\"getClampedNum: min must be less than or equal to max\");\n  }\n  return Math.min(Math.max(num, min), max);\n};\n"],"names":["getClampedNum","num","min","max","every","value","Number","isFinite","TypeError","RangeError","Math"],"mappings":"yDAkBO,MAAMA,cAAgB,CAACC,IAAaC,IAAaC,OACtD,IAAK,CAAEF,IAAKC,IAAKC,KAAMC,MAAOC,cAAiBA,QAAU,UAAYC,OAAOC,SAASF,QACnF,MAAM,IAAIG,UAAU,mDAEtB,GAAIN,IAAMC,IACR,MAAM,IAAIM,WAAW,wDAEvB,OAAOC,KAAKR,IAAIQ,KAAKP,IAAIF,IAAKC,KAAMC"}