import T from "./index-classCallCheck.js";
import y from "./index-createClass.js";
import m from "./index-assertThisInitialized.js";
import v from "./index-inherits.js";
import h from "./index-createSuper.js";
import c from "./index-defineProperty.js";
import { Parser as k } from "./index-Parser4.js";
import { mapValue as n, parseNDigits as f, normalizeTwoDigitYear as D } from "./index-utils12.js";
import g from "./index-getUTCWeekYear.js";
import p from "./index-startOfUTCWeek.js";
var I = /* @__PURE__ */ (function(Y) {
  v(o, Y);
  var u = h(o);
  function o() {
    var i;
    T(this, o);
    for (var r = arguments.length, e = new Array(r), a = 0; a < r; a++)
      e[a] = arguments[a];
    return i = u.call.apply(u, [this].concat(e)), c(m(i), "priority", 130), c(m(i), "incompatibleTokens", ["y", "R", "u", "Q", "q", "M", "L", "I", "d", "D", "i", "t", "T"]), i;
  }
  return y(o, [{
    key: "parse",
    value: function(r, e, a) {
      var t = function(s) {
        return {
          year: s,
          isTwoDigitYear: e === "YY"
        };
      };
      switch (e) {
        case "Y":
          return n(f(4, r), t);
        case "Yo":
          return n(a.ordinalNumber(r, {
            unit: "year"
          }), t);
        default:
          return n(f(e.length, r), t);
      }
    }
  }, {
    key: "validate",
    value: function(r, e) {
      return e.isTwoDigitYear || e.year > 0;
    }
  }, {
    key: "set",
    value: function(r, e, a, t) {
      var l = g(r, t);
      if (a.isTwoDigitYear) {
        var s = D(a.year, l);
        return r.setUTCFullYear(s, 0, t.firstWeekContainsDate), r.setUTCHours(0, 0, 0, 0), p(r, t);
      }
      var C = !("era" in e) || e.era === 1 ? a.year : 1 - a.year;
      return r.setUTCFullYear(C, 0, t.firstWeekContainsDate), r.setUTCHours(0, 0, 0, 0), p(r, t);
    }
  }]), o;
})(k);
export {
  I as LocalWeekYearParser
};
