// src/components/Slider/helpers.ts
import { useCallback, useMemo } from "react";
function unwrapFirstValue(value) {
  if (Array.isArray(value)) {
    return value[0];
  }
  return value;
}
function wrapValue(value) {
  return value === void 0 ? void 0 : [value];
}
function useUnwrappedHandler(handler) {
  return useCallback(
    (value) => {
      handler?.(unwrapFirstValue(value));
    },
    [handler]
  );
}
function useWrappedValue(value) {
  return useMemo(() => wrapValue(value), [value]);
}
function numberFormatter(value, formatOptions, locale = navigator.languages?.[0] || "en-GB") {
  if (!formatOptions) {
    return value?.toString() || "";
  }
  return new Intl.NumberFormat(locale, formatOptions).format(+(value || 0));
}

export {
  unwrapFirstValue,
  wrapValue,
  useUnwrappedHandler,
  useWrappedValue,
  numberFormatter
};
//# sourceMappingURL=chunk-4SIR6D4L.js.map
