import Tween from "../../../../../../b-tween@0.3.3/node_modules/b-tween/dist/b-tween.es.js";
import { dayjs, methods } from "../_util/dayjs.js";
import { isDayjs } from "../_util/is.js";
function getColumnsFromFormat(format) {
  var units = ["H", "h", "m", "s", "a", "A"];
  var list = [];
  var use12Hours = false;
  units.forEach(function(unit) {
    if (format.indexOf(unit) !== -1) {
      list.push(unit);
      if (unit === "a" || unit === "A") {
        use12Hours = true;
      }
    }
  });
  return {
    list,
    use12Hours
  };
}
var scrollIds = /* @__PURE__ */ new Map();
function scrollTo(element, to, duration) {
  if (scrollIds.get(element)) {
    cancelAnimationFrame(scrollIds.get(element));
  }
  if (duration <= 0) {
    element.scrollTop = to;
  }
  scrollIds.set(element, requestAnimationFrame(function() {
    var tween = new Tween({
      from: { scrollTop: element.scrollTop },
      to: { scrollTop: to },
      duration,
      onUpdate: function(keys) {
        element.scrollTop = keys.scrollTop;
      },
      easing: "quartInOut"
    });
    tween.start();
  }));
}
function getFormatTime(time) {
  var today = dayjs();
  var y = today.year();
  var m = today.month();
  var d = today.date();
  if (isDayjs(time)) {
    var returnTime = time;
    returnTime = methods.set(returnTime, "year", y);
    returnTime = methods.set(returnTime, "month", m);
    returnTime = methods.set(returnTime, "date", d);
    return returnTime;
  }
  return time;
}
export {
  getColumnsFromFormat,
  getFormatTime,
  scrollTo
};
//# sourceMappingURL=util.js.map
