"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const addDays = require("./addDays.cjs");
const addMonths = require("./addMonths.cjs");
const constructFrom = require("./constructFrom.cjs");
const toDate = require("./toDate.cjs");
function add(date, duration, options) {
  const {
    years = 0,
    months = 0,
    weeks = 0,
    days = 0,
    hours = 0,
    minutes = 0,
    seconds = 0
  } = duration;
  const _date = toDate.toDate(date);
  const dateWithMonths = months || years ? addMonths.addMonths(_date, months + years * 12) : _date;
  const dateWithDays = days || weeks ? addDays.addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
  const minutesToAdd = minutes + hours * 60;
  const secondsToAdd = seconds + minutesToAdd * 60;
  const msToAdd = secondsToAdd * 1e3;
  return constructFrom.constructFrom(date, +dateWithDays + msToAdd);
}
exports.add = add;
exports.default = add;
//# sourceMappingURL=add.cjs.map
