"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const bTween_es = require("../../../../../../b-tween@0.3.3/node_modules/b-tween/dist/b-tween.es.js");
const dayjs = require("../_util/dayjs.js");
const is = require("../_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 bTween_es({
      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.dayjs();
  var y = today.year();
  var m = today.month();
  var d = today.date();
  if (is.isDayjs(time)) {
    var returnTime = time;
    returnTime = dayjs.methods.set(returnTime, "year", y);
    returnTime = dayjs.methods.set(returnTime, "month", m);
    returnTime = dayjs.methods.set(returnTime, "date", d);
    return returnTime;
  }
  return time;
}
exports.getColumnsFromFormat = getColumnsFromFormat;
exports.getFormatTime = getFormatTime;
exports.scrollTo = scrollTo;
//# sourceMappingURL=util.js.map
