import { getDefaultOptions as W } from "./_lib/defaultOptions.js";
import { constructFrom as n } from "./constructFrom.js";
import { getWeekYear as u } from "./getWeekYear.js";
import { startOfWeek as D } from "./startOfWeek.js";
function g(r, e) {
  var f, s, c, k;
  const a = W(), l = (e == null ? void 0 : e.firstWeekContainsDate) ?? ((s = (f = e == null ? void 0 : e.locale) == null ? void 0 : f.options) == null ? void 0 : s.firstWeekContainsDate) ?? a.firstWeekContainsDate ?? ((k = (c = a.locale) == null ? void 0 : c.options) == null ? void 0 : k.firstWeekContainsDate) ?? 1, m = u(r, e), t = n((e == null ? void 0 : e.in) || r, 0);
  return t.setFullYear(m, 0, l), t.setHours(0, 0, 0, 0), D(t, e);
}
export {
  g as default,
  g as startOfWeekYear
};
