"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const Picker = require("../picker/Picker.js");
const format = require("../utils/format.js");
const basic = require("../utils/basic.js");
const props = require("../utils/props.js");
const sharedProps = basic.extend({}, Picker.pickerSharedProps, {
  modelValue: props.makeArrayProp(),
  filter: Function,
  formatter: {
    type: Function,
    default: (type, option) => option
  }
});
const pickerInheritKeys = Object.keys(Picker.pickerSharedProps);
function times(n, iteratee) {
  if (n < 0) {
    return [];
  }
  const result = Array(n);
  let index = -1;
  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}
const getMonthEndDay = (year, month) => 32 - new Date(year, month - 1, 32).getDate();
const genOptions = (min, max, type, formatter, filter, values) => {
  const options = times(max - min + 1, (index) => {
    const value = format.padZero(min + index);
    return formatter(type, {
      text: value,
      value
    });
  });
  return filter ? filter(type, options, values) : options;
};
const formatValueRange = (values, columns) => values.map((value, index) => {
  const column = columns[index];
  if (column.length) {
    const minValue = +column[0].value;
    const maxValue = +column[column.length - 1].value;
    return format.padZero(format.clamp(+value, minValue, maxValue));
  }
  return value;
});
exports.formatValueRange = formatValueRange;
exports.genOptions = genOptions;
exports.getMonthEndDay = getMonthEndDay;
exports.pickerInheritKeys = pickerInheritKeys;
exports.sharedProps = sharedProps;
exports.times = times;
