import l from "./index-classCallCheck.js";
import p from "./index-createClass.js";
import m from "./index-assertThisInitialized.js";
import h from "./index-inherits.js";
import M from "./index-createSuper.js";
import u from "./index-defineProperty.js";
import { mapValue as i, parseNDigits as v, parseNumericPattern as w } from "./index-utils12.js";
import { Parser as b } from "./index-Parser4.js";
import { numericPatterns as x } from "./index-constants4.js";
var I = /* @__PURE__ */ (function(c) {
  h(n, c);
  var s = M(n);
  function n() {
    var o;
    l(this, n);
    for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++)
      e[t] = arguments[t];
    return o = s.call.apply(s, [this].concat(e)), u(m(o), "incompatibleTokens", ["Y", "R", "q", "Q", "L", "w", "I", "D", "i", "e", "c", "t", "T"]), u(m(o), "priority", 110), o;
  }
  return p(n, [{
    key: "parse",
    value: function(r, e, t) {
      var a = function(f) {
        return f - 1;
      };
      switch (e) {
        // 1, 2, ..., 12
        case "M":
          return i(w(x.month, r), a);
        // 01, 02, ..., 12
        case "MM":
          return i(v(2, r), a);
        // 1st, 2nd, ..., 12th
        case "Mo":
          return i(t.ordinalNumber(r, {
            unit: "month"
          }), a);
        // Jan, Feb, ..., Dec
        case "MMM":
          return t.month(r, {
            width: "abbreviated",
            context: "formatting"
          }) || t.month(r, {
            width: "narrow",
            context: "formatting"
          });
        // J, F, ..., D
        case "MMMMM":
          return t.month(r, {
            width: "narrow",
            context: "formatting"
          });
        // January, February, ..., December
        case "MMMM":
        default:
          return t.month(r, {
            width: "wide",
            context: "formatting"
          }) || t.month(r, {
            width: "abbreviated",
            context: "formatting"
          }) || t.month(r, {
            width: "narrow",
            context: "formatting"
          });
      }
    }
  }, {
    key: "validate",
    value: function(r, e) {
      return e >= 0 && e <= 11;
    }
  }, {
    key: "set",
    value: function(r, e, t) {
      return r.setUTCMonth(t, 1), r.setUTCHours(0, 0, 0, 0), r;
    }
  }]), n;
})(b);
export {
  I as MonthParser
};
