@js-joda/core 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- //! @version @js-joda/core - 6.1.0
1
+ //! @version @js-joda/core - 6.2.0
2
2
  //! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
3
3
  //! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
4
4
  //! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
@@ -662,10 +662,15 @@ var Duration = function (_TemporalAmount) {
662
662
  if (divisor === 1) {
663
663
  return this;
664
664
  }
665
- var secs = MathUtil.intDiv(this._seconds, divisor);
666
- var secsMod = MathUtil.roundDown((this._seconds / divisor - secs) * LocalTime.NANOS_PER_SECOND);
667
- var nos = MathUtil.intDiv(this._nanos, divisor);
668
- nos = secsMod + nos;
665
+ var seconds = this._seconds;
666
+ var nanos = this._nanos;
667
+ if (seconds < 0 && nanos > 0) {
668
+ seconds += 1;
669
+ nanos -= LocalTime.NANOS_PER_SECOND;
670
+ }
671
+ var secs = MathUtil.intDiv(seconds, divisor);
672
+ var remainder = MathUtil.intMod(seconds, divisor);
673
+ var nos = MathUtil.intDiv(remainder * LocalTime.NANOS_PER_SECOND + nanos, divisor);
669
674
  return Duration.ofSeconds(secs, nos);
670
675
  };
671
676
  _proto.negated = function negated() {
@@ -2062,1411 +2067,1426 @@ var ChronoLocalDate = function (_Temporal) {
2062
2067
  return ChronoLocalDate;
2063
2068
  }(Temporal);
2064
2069
 
2065
- /*
2066
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2067
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2068
- */
2069
-
2070
- var StringUtil = function () {
2071
- function StringUtil() {}
2072
- StringUtil.startsWith = function startsWith(text, pattern) {
2073
- return text.indexOf(pattern) === 0;
2070
+ var IsoFields = {};
2071
+ var QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
2072
+ var Field = function (_TemporalField) {
2073
+ function Field() {
2074
+ return _TemporalField.apply(this, arguments) || this;
2075
+ }
2076
+ _inheritsLoose(Field, _TemporalField);
2077
+ var _proto = Field.prototype;
2078
+ _proto.isDateBased = function isDateBased() {
2079
+ return true;
2074
2080
  };
2075
- StringUtil.hashCode = function hashCode(text) {
2076
- var len = text.length;
2077
- if (len === 0) {
2078
- return 0;
2081
+ _proto.isTimeBased = function isTimeBased() {
2082
+ return false;
2083
+ };
2084
+ _proto._isIso = function _isIso() {
2085
+ return true;
2086
+ };
2087
+ Field._getWeekRangeByLocalDate = function _getWeekRangeByLocalDate(date) {
2088
+ var wby = Field._getWeekBasedYear(date);
2089
+ return ValueRange.of(1, Field._getWeekRangeByYear(wby));
2090
+ };
2091
+ Field._getWeekRangeByYear = function _getWeekRangeByYear(wby) {
2092
+ var date = LocalDate.of(wby, 1, 1);
2093
+ if (date.dayOfWeek() === DayOfWeek.THURSDAY || date.dayOfWeek() === DayOfWeek.WEDNESDAY && date.isLeapYear()) {
2094
+ return 53;
2079
2095
  }
2080
- var hash = 0;
2081
- for (var i = 0; i < len; i++) {
2082
- var chr = text.charCodeAt(i);
2083
- hash = (hash << 5) - hash + chr;
2084
- hash |= 0;
2096
+ return 52;
2097
+ };
2098
+ Field._getWeek = function _getWeek(date) {
2099
+ var dow0 = date.dayOfWeek().ordinal();
2100
+ var doy0 = date.dayOfYear() - 1;
2101
+ var doyThu0 = doy0 + (3 - dow0);
2102
+ var alignedWeek = MathUtil.intDiv(doyThu0, 7);
2103
+ var firstThuDoy0 = doyThu0 - alignedWeek * 7;
2104
+ var firstMonDoy0 = firstThuDoy0 - 3;
2105
+ if (firstMonDoy0 < -3) {
2106
+ firstMonDoy0 += 7;
2085
2107
  }
2086
- return MathUtil.smi(hash);
2108
+ if (doy0 < firstMonDoy0) {
2109
+ return Field._getWeekRangeByLocalDate(date.withDayOfYear(180).minusYears(1)).maximum();
2110
+ }
2111
+ var week = MathUtil.intDiv(doy0 - firstMonDoy0, 7) + 1;
2112
+ if (week === 53) {
2113
+ if ((firstMonDoy0 === -3 || firstMonDoy0 === -2 && date.isLeapYear()) === false) {
2114
+ week = 1;
2115
+ }
2116
+ }
2117
+ return week;
2087
2118
  };
2088
- return StringUtil;
2089
- }();
2090
-
2091
- /*
2092
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2093
- * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
2094
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2095
- */
2096
-
2097
- var ZoneId = function () {
2098
- function ZoneId() {}
2099
- ZoneId.systemDefault = function systemDefault() {
2100
- throw new DateTimeException('not supported operation');
2119
+ Field._getWeekBasedYear = function _getWeekBasedYear(date) {
2120
+ var year = date.year();
2121
+ var doy = date.dayOfYear();
2122
+ if (doy <= 3) {
2123
+ var dow = date.dayOfWeek().ordinal();
2124
+ if (doy - dow < -2) {
2125
+ year--;
2126
+ }
2127
+ } else if (doy >= 363) {
2128
+ var _dow = date.dayOfWeek().ordinal();
2129
+ doy = doy - 363 - (date.isLeapYear() ? 1 : 0);
2130
+ if (doy - _dow >= 0) {
2131
+ year++;
2132
+ }
2133
+ }
2134
+ return year;
2101
2135
  };
2102
- ZoneId.getAvailableZoneIds = function getAvailableZoneIds() {
2103
- throw new DateTimeException('not supported operation');
2136
+ _proto.displayName = function displayName() {
2137
+ return this.toString();
2104
2138
  };
2105
- ZoneId.of = function of(zoneId) {
2106
- throw new DateTimeException("not supported operation" + zoneId);
2139
+ _proto.resolve = function resolve() {
2140
+ return null;
2107
2141
  };
2108
- ZoneId.ofOffset = function ofOffset(prefix, offset) {
2109
- throw new DateTimeException("not supported operation" + prefix + offset);
2142
+ _proto.name = function name() {
2143
+ return this.toString();
2110
2144
  };
2111
- ZoneId.from = function from(temporal) {
2112
- throw new DateTimeException("not supported operation" + temporal);
2145
+ return Field;
2146
+ }(TemporalField);
2147
+ var DAY_OF_QUARTER_FIELD = function (_Field) {
2148
+ function DAY_OF_QUARTER_FIELD() {
2149
+ return _Field.apply(this, arguments) || this;
2150
+ }
2151
+ _inheritsLoose(DAY_OF_QUARTER_FIELD, _Field);
2152
+ var _proto2 = DAY_OF_QUARTER_FIELD.prototype;
2153
+ _proto2.toString = function toString() {
2154
+ return 'DayOfQuarter';
2113
2155
  };
2114
- var _proto = ZoneId.prototype;
2115
- _proto.id = function id() {
2116
- abstractMethodFail('ZoneId.id');
2156
+ _proto2.baseUnit = function baseUnit() {
2157
+ return ChronoUnit.DAYS;
2117
2158
  };
2118
- _proto.rules = function rules() {
2119
- abstractMethodFail('ZoneId.rules');
2159
+ _proto2.rangeUnit = function rangeUnit() {
2160
+ return QUARTER_YEARS;
2120
2161
  };
2121
- _proto.normalized = function normalized() {
2122
- var rules = this.rules();
2123
- if (rules.isFixedOffset()) {
2124
- return rules.offset(Instant.EPOCH);
2125
- }
2126
- return this;
2162
+ _proto2.range = function range() {
2163
+ return ValueRange.of(1, 90, 92);
2127
2164
  };
2128
- _proto.equals = function equals(other) {
2129
- if (this === other) {
2130
- return true;
2165
+ _proto2.isSupportedBy = function isSupportedBy(temporal) {
2166
+ return temporal.isSupported(ChronoField.DAY_OF_YEAR) && temporal.isSupported(ChronoField.MONTH_OF_YEAR) && temporal.isSupported(ChronoField.YEAR) && this._isIso(temporal);
2167
+ };
2168
+ _proto2.rangeRefinedBy = function rangeRefinedBy(temporal) {
2169
+ if (temporal.isSupported(this) === false) {
2170
+ throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
2131
2171
  }
2132
- if (other instanceof ZoneId) {
2133
- return this.id() === other.id();
2172
+ var qoy = temporal.getLong(QUARTER_OF_YEAR);
2173
+ if (qoy === 1) {
2174
+ var year = temporal.getLong(ChronoField.YEAR);
2175
+ return IsoChronology.isLeapYear(year) ? ValueRange.of(1, 91) : ValueRange.of(1, 90);
2176
+ } else if (qoy === 2) {
2177
+ return ValueRange.of(1, 91);
2178
+ } else if (qoy === 3 || qoy === 4) {
2179
+ return ValueRange.of(1, 92);
2134
2180
  }
2135
- return false;
2136
- };
2137
- _proto.hashCode = function hashCode() {
2138
- return StringUtil.hashCode(this.id());
2139
- };
2140
- _proto.toString = function toString() {
2141
- return this.id();
2142
- };
2143
- _proto.toJSON = function toJSON() {
2144
- return this.toString();
2181
+ return this.range();
2145
2182
  };
2146
- return ZoneId;
2147
- }();
2148
-
2149
- var ZoneRules = function () {
2150
- function ZoneRules() {}
2151
- ZoneRules.of = function of(offset) {
2152
- requireNonNull(offset, 'offset');
2153
- return new Fixed(offset);
2183
+ _proto2.getFrom = function getFrom(temporal) {
2184
+ if (temporal.isSupported(this) === false) {
2185
+ throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
2186
+ }
2187
+ var doy = temporal.get(ChronoField.DAY_OF_YEAR);
2188
+ var moy = temporal.get(ChronoField.MONTH_OF_YEAR);
2189
+ var year = temporal.getLong(ChronoField.YEAR);
2190
+ return doy - QUARTER_DAYS[MathUtil.intDiv(moy - 1, 3) + (IsoChronology.isLeapYear(year) ? 4 : 0)];
2154
2191
  };
2155
- var _proto = ZoneRules.prototype;
2156
- _proto.isFixedOffset = function isFixedOffset() {
2157
- abstractMethodFail('ZoneRules.isFixedOffset');
2192
+ _proto2.adjustInto = function adjustInto(temporal, newValue) {
2193
+ var curValue = this.getFrom(temporal);
2194
+ this.range().checkValidValue(newValue, this);
2195
+ return temporal.with(ChronoField.DAY_OF_YEAR, temporal.getLong(ChronoField.DAY_OF_YEAR) + (newValue - curValue));
2158
2196
  };
2159
- _proto.offset = function offset(instantOrLocalDateTime) {
2160
- if (instantOrLocalDateTime instanceof Instant) {
2161
- return this.offsetOfInstant(instantOrLocalDateTime);
2197
+ _proto2.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
2198
+ var yearLong = fieldValues.get(ChronoField.YEAR);
2199
+ var qoyLong = fieldValues.get(QUARTER_OF_YEAR);
2200
+ if (yearLong == null || qoyLong == null) {
2201
+ return null;
2202
+ }
2203
+ var y = ChronoField.YEAR.checkValidIntValue(yearLong);
2204
+ var doq = fieldValues.get(DAY_OF_QUARTER);
2205
+ var date;
2206
+ if (resolverStyle === ResolverStyle.LENIENT) {
2207
+ var qoy = qoyLong;
2208
+ date = LocalDate.of(y, 1, 1);
2209
+ date = date.plusMonths(MathUtil.safeMultiply(MathUtil.safeSubtract(qoy, 1), 3));
2210
+ date = date.plusDays(MathUtil.safeSubtract(doq, 1));
2162
2211
  } else {
2163
- return this.offsetOfLocalDateTime(instantOrLocalDateTime);
2212
+ var _qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);
2213
+ if (resolverStyle === ResolverStyle.STRICT) {
2214
+ var max = 92;
2215
+ if (_qoy === 1) {
2216
+ max = IsoChronology.isLeapYear(y) ? 91 : 90;
2217
+ } else if (_qoy === 2) {
2218
+ max = 91;
2219
+ }
2220
+ ValueRange.of(1, max).checkValidValue(doq, this);
2221
+ } else {
2222
+ this.range().checkValidValue(doq, this);
2223
+ }
2224
+ date = LocalDate.of(y, (_qoy - 1) * 3 + 1, 1).plusDays(doq - 1);
2164
2225
  }
2226
+ fieldValues.remove(this);
2227
+ fieldValues.remove(ChronoField.YEAR);
2228
+ fieldValues.remove(QUARTER_OF_YEAR);
2229
+ return date;
2165
2230
  };
2166
- _proto.offsetOfInstant = function offsetOfInstant(instant) {
2167
- abstractMethodFail('ZoneRules.offsetInstant');
2231
+ return DAY_OF_QUARTER_FIELD;
2232
+ }(Field);
2233
+ var QUARTER_OF_YEAR_FIELD = function (_Field2) {
2234
+ function QUARTER_OF_YEAR_FIELD() {
2235
+ return _Field2.apply(this, arguments) || this;
2236
+ }
2237
+ _inheritsLoose(QUARTER_OF_YEAR_FIELD, _Field2);
2238
+ var _proto3 = QUARTER_OF_YEAR_FIELD.prototype;
2239
+ _proto3.toString = function toString() {
2240
+ return 'QuarterOfYear';
2168
2241
  };
2169
- _proto.offsetOfEpochMilli = function offsetOfEpochMilli(epochMilli) {
2170
- abstractMethodFail('ZoneRules.offsetOfEpochMilli');
2242
+ _proto3.baseUnit = function baseUnit() {
2243
+ return QUARTER_YEARS;
2171
2244
  };
2172
- _proto.offsetOfLocalDateTime = function offsetOfLocalDateTime(localDateTime) {
2173
- abstractMethodFail('ZoneRules.offsetLocalDateTime');
2245
+ _proto3.rangeUnit = function rangeUnit() {
2246
+ return ChronoUnit.YEARS;
2174
2247
  };
2175
- _proto.validOffsets = function validOffsets(localDateTime) {
2176
- abstractMethodFail('ZoneRules.validOffsets');
2248
+ _proto3.range = function range() {
2249
+ return ValueRange.of(1, 4);
2177
2250
  };
2178
- _proto.transition = function transition(localDateTime) {
2179
- abstractMethodFail('ZoneRules.transition');
2251
+ _proto3.isSupportedBy = function isSupportedBy(temporal) {
2252
+ return temporal.isSupported(ChronoField.MONTH_OF_YEAR) && this._isIso(temporal);
2180
2253
  };
2181
- _proto.standardOffset = function standardOffset(instant) {
2182
- abstractMethodFail('ZoneRules.standardOffset');
2254
+ _proto3.rangeRefinedBy = function rangeRefinedBy(temporal) {
2255
+ return this.range();
2183
2256
  };
2184
- _proto.daylightSavings = function daylightSavings(instant) {
2185
- abstractMethodFail('ZoneRules.daylightSavings');
2186
- };
2187
- _proto.isDaylightSavings = function isDaylightSavings(instant) {
2188
- abstractMethodFail('ZoneRules.isDaylightSavings');
2189
- };
2190
- _proto.isValidOffset = function isValidOffset(localDateTime, offset) {
2191
- abstractMethodFail('ZoneRules.isValidOffset');
2192
- };
2193
- _proto.nextTransition = function nextTransition(instant) {
2194
- abstractMethodFail('ZoneRules.nextTransition');
2195
- };
2196
- _proto.previousTransition = function previousTransition(instant) {
2197
- abstractMethodFail('ZoneRules.previousTransition');
2257
+ _proto3.getFrom = function getFrom(temporal) {
2258
+ if (temporal.isSupported(this) === false) {
2259
+ throw new UnsupportedTemporalTypeException('Unsupported field: QuarterOfYear');
2260
+ }
2261
+ var moy = temporal.getLong(ChronoField.MONTH_OF_YEAR);
2262
+ return MathUtil.intDiv(moy + 2, 3);
2198
2263
  };
2199
- _proto.transitions = function transitions() {
2200
- abstractMethodFail('ZoneRules.transitions');
2264
+ _proto3.adjustInto = function adjustInto(temporal, newValue) {
2265
+ var curValue = this.getFrom(temporal);
2266
+ this.range().checkValidValue(newValue, this);
2267
+ return temporal.with(ChronoField.MONTH_OF_YEAR, temporal.getLong(ChronoField.MONTH_OF_YEAR) + (newValue - curValue) * 3);
2201
2268
  };
2202
- _proto.transitionRules = function transitionRules() {
2203
- abstractMethodFail('ZoneRules.transitionRules');
2269
+ return QUARTER_OF_YEAR_FIELD;
2270
+ }(Field);
2271
+ var WEEK_OF_WEEK_BASED_YEAR_FIELD = function (_Field3) {
2272
+ function WEEK_OF_WEEK_BASED_YEAR_FIELD() {
2273
+ return _Field3.apply(this, arguments) || this;
2274
+ }
2275
+ _inheritsLoose(WEEK_OF_WEEK_BASED_YEAR_FIELD, _Field3);
2276
+ var _proto4 = WEEK_OF_WEEK_BASED_YEAR_FIELD.prototype;
2277
+ _proto4.toString = function toString() {
2278
+ return 'WeekOfWeekBasedYear';
2204
2279
  };
2205
- _proto.toString = function toString() {
2206
- abstractMethodFail('ZoneRules.toString');
2280
+ _proto4.baseUnit = function baseUnit() {
2281
+ return ChronoUnit.WEEKS;
2207
2282
  };
2208
- _proto.toJSON = function toJSON() {
2209
- return this.toString();
2283
+ _proto4.rangeUnit = function rangeUnit() {
2284
+ return WEEK_BASED_YEARS;
2210
2285
  };
2211
- return ZoneRules;
2212
- }();
2213
- var Fixed = function (_ZoneRules) {
2214
- function Fixed(offset) {
2215
- var _this;
2216
- _this = _ZoneRules.call(this) || this;
2217
- _this._offset = offset;
2218
- return _this;
2219
- }
2220
- _inheritsLoose(Fixed, _ZoneRules);
2221
- var _proto2 = Fixed.prototype;
2222
- _proto2.isFixedOffset = function isFixedOffset() {
2223
- return true;
2286
+ _proto4.range = function range() {
2287
+ return ValueRange.of(1, 52, 53);
2224
2288
  };
2225
- _proto2.offsetOfInstant = function offsetOfInstant() {
2226
- return this._offset;
2289
+ _proto4.isSupportedBy = function isSupportedBy(temporal) {
2290
+ return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
2227
2291
  };
2228
- _proto2.offsetOfEpochMilli = function offsetOfEpochMilli() {
2229
- return this._offset;
2292
+ _proto4.rangeRefinedBy = function rangeRefinedBy(temporal) {
2293
+ if (temporal.isSupported(this) === false) {
2294
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
2295
+ }
2296
+ return Field._getWeekRangeByLocalDate(LocalDate.from(temporal));
2230
2297
  };
2231
- _proto2.offsetOfLocalDateTime = function offsetOfLocalDateTime() {
2232
- return this._offset;
2298
+ _proto4.getFrom = function getFrom(temporal) {
2299
+ if (temporal.isSupported(this) === false) {
2300
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
2301
+ }
2302
+ return Field._getWeek(LocalDate.from(temporal));
2233
2303
  };
2234
- _proto2.validOffsets = function validOffsets() {
2235
- return [this._offset];
2304
+ _proto4.adjustInto = function adjustInto(temporal, newValue) {
2305
+ this.range().checkValidValue(newValue, this);
2306
+ return temporal.plus(MathUtil.safeSubtract(newValue, this.getFrom(temporal)), ChronoUnit.WEEKS);
2236
2307
  };
2237
- _proto2.transition = function transition() {
2238
- return null;
2308
+ _proto4.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
2309
+ var wbyLong = fieldValues.get(WEEK_BASED_YEAR);
2310
+ var dowLong = fieldValues.get(ChronoField.DAY_OF_WEEK);
2311
+ if (wbyLong == null || dowLong == null) {
2312
+ return null;
2313
+ }
2314
+ var wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);
2315
+ var wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
2316
+ var date;
2317
+ if (resolverStyle === ResolverStyle.LENIENT) {
2318
+ var dow = dowLong;
2319
+ var weeks = 0;
2320
+ if (dow > 7) {
2321
+ weeks = MathUtil.intDiv(dow - 1, 7);
2322
+ dow = MathUtil.intMod(dow - 1, 7) + 1;
2323
+ } else if (dow < 1) {
2324
+ weeks = MathUtil.intDiv(dow, 7) - 1;
2325
+ dow = MathUtil.intMod(dow, 7) + 7;
2326
+ }
2327
+ date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).plusWeeks(weeks).with(ChronoField.DAY_OF_WEEK, dow);
2328
+ } else {
2329
+ var _dow2 = ChronoField.DAY_OF_WEEK.checkValidIntValue(dowLong);
2330
+ if (resolverStyle === ResolverStyle.STRICT) {
2331
+ var temp = LocalDate.of(wby, 1, 4);
2332
+ var range = Field._getWeekRangeByLocalDate(temp);
2333
+ range.checkValidValue(wowby, this);
2334
+ } else {
2335
+ this.range().checkValidValue(wowby, this);
2336
+ }
2337
+ date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).with(ChronoField.DAY_OF_WEEK, _dow2);
2338
+ }
2339
+ fieldValues.remove(this);
2340
+ fieldValues.remove(WEEK_BASED_YEAR);
2341
+ fieldValues.remove(ChronoField.DAY_OF_WEEK);
2342
+ return date;
2239
2343
  };
2240
- _proto2.standardOffset = function standardOffset() {
2241
- return this._offset;
2344
+ _proto4.displayName = function displayName() {
2345
+ return 'Week';
2242
2346
  };
2243
- _proto2.daylightSavings = function daylightSavings() {
2244
- return Duration.ZERO;
2347
+ return WEEK_OF_WEEK_BASED_YEAR_FIELD;
2348
+ }(Field);
2349
+ var WEEK_BASED_YEAR_FIELD = function (_Field4) {
2350
+ function WEEK_BASED_YEAR_FIELD() {
2351
+ return _Field4.apply(this, arguments) || this;
2352
+ }
2353
+ _inheritsLoose(WEEK_BASED_YEAR_FIELD, _Field4);
2354
+ var _proto5 = WEEK_BASED_YEAR_FIELD.prototype;
2355
+ _proto5.toString = function toString() {
2356
+ return 'WeekBasedYear';
2245
2357
  };
2246
- _proto2.isDaylightSavings = function isDaylightSavings() {
2247
- return false;
2358
+ _proto5.baseUnit = function baseUnit() {
2359
+ return WEEK_BASED_YEARS;
2248
2360
  };
2249
- _proto2.isValidOffset = function isValidOffset(localDateTime, offset) {
2250
- return this._offset.equals(offset);
2361
+ _proto5.rangeUnit = function rangeUnit() {
2362
+ return ChronoUnit.FOREVER;
2251
2363
  };
2252
- _proto2.nextTransition = function nextTransition() {
2253
- return null;
2364
+ _proto5.range = function range() {
2365
+ return ChronoField.YEAR.range();
2254
2366
  };
2255
- _proto2.previousTransition = function previousTransition() {
2256
- return null;
2367
+ _proto5.isSupportedBy = function isSupportedBy(temporal) {
2368
+ return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
2257
2369
  };
2258
- _proto2.transitions = function transitions() {
2259
- return [];
2370
+ _proto5.rangeRefinedBy = function rangeRefinedBy(temporal) {
2371
+ return ChronoField.YEAR.range();
2260
2372
  };
2261
- _proto2.transitionRules = function transitionRules() {
2262
- return [];
2373
+ _proto5.getFrom = function getFrom(temporal) {
2374
+ if (temporal.isSupported(this) === false) {
2375
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
2376
+ }
2377
+ return Field._getWeekBasedYear(LocalDate.from(temporal));
2263
2378
  };
2264
- _proto2.equals = function equals(other) {
2265
- if (this === other) {
2266
- return true;
2379
+ _proto5.adjustInto = function adjustInto(temporal, newValue) {
2380
+ if (this.isSupportedBy(temporal) === false) {
2381
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
2267
2382
  }
2268
- if (other instanceof Fixed) {
2269
- return this._offset.equals(other._offset);
2383
+ var newWby = this.range().checkValidIntValue(newValue, WEEK_BASED_YEAR);
2384
+ var date = LocalDate.from(temporal);
2385
+ var dow = date.get(ChronoField.DAY_OF_WEEK);
2386
+ var week = Field._getWeek(date);
2387
+ if (week === 53 && Field._getWeekRangeByYear(newWby) === 52) {
2388
+ week = 52;
2270
2389
  }
2271
- return false;
2272
- };
2273
- _proto2.toString = function toString() {
2274
- return "FixedRules:" + this._offset.toString();
2390
+ var resolved = LocalDate.of(newWby, 1, 4);
2391
+ var days = dow - resolved.get(ChronoField.DAY_OF_WEEK) + (week - 1) * 7;
2392
+ resolved = resolved.plusDays(days);
2393
+ return temporal.with(resolved);
2275
2394
  };
2276
- return Fixed;
2277
- }(ZoneRules);
2278
-
2279
- var SECONDS_CACHE = {};
2280
- var ID_CACHE = {};
2281
- var ZoneOffset = function (_ZoneId) {
2282
- function ZoneOffset(totalSeconds) {
2395
+ return WEEK_BASED_YEAR_FIELD;
2396
+ }(Field);
2397
+ var Unit = function (_TemporalUnit) {
2398
+ function Unit(name, estimatedDuration) {
2283
2399
  var _this;
2284
- _this = _ZoneId.call(this) || this;
2285
- ZoneOffset._validateTotalSeconds(totalSeconds);
2286
- _this._totalSeconds = MathUtil.safeToInt(totalSeconds);
2287
- _this._rules = ZoneRules.of(_this);
2288
- _this._id = ZoneOffset._buildId(totalSeconds);
2400
+ _this = _TemporalUnit.call(this) || this;
2401
+ _this._name = name;
2402
+ _this._duration = estimatedDuration;
2289
2403
  return _this;
2290
2404
  }
2291
- _inheritsLoose(ZoneOffset, _ZoneId);
2292
- var _proto = ZoneOffset.prototype;
2293
- _proto.totalSeconds = function totalSeconds() {
2294
- return this._totalSeconds;
2405
+ _inheritsLoose(Unit, _TemporalUnit);
2406
+ var _proto6 = Unit.prototype;
2407
+ _proto6.duration = function duration() {
2408
+ return this._duration;
2295
2409
  };
2296
- _proto.id = function id() {
2297
- return this._id;
2410
+ _proto6.isDurationEstimated = function isDurationEstimated() {
2411
+ return true;
2298
2412
  };
2299
- ZoneOffset._buildId = function _buildId(totalSeconds) {
2300
- if (totalSeconds === 0) {
2301
- return 'Z';
2302
- } else {
2303
- var absTotalSeconds = Math.abs(totalSeconds);
2304
- var absHours = MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_HOUR);
2305
- var absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
2306
- var buf = "" + (totalSeconds < 0 ? '-' : '+') + (absHours < 10 ? '0' : '') + absHours + (absMinutes < 10 ? ':0' : ':') + absMinutes;
2307
- var absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);
2308
- if (absSeconds !== 0) {
2309
- buf += (absSeconds < 10 ? ':0' : ':') + absSeconds;
2310
- }
2311
- return buf;
2312
- }
2413
+ _proto6.isDateBased = function isDateBased() {
2414
+ return true;
2313
2415
  };
2314
- ZoneOffset._validateTotalSeconds = function _validateTotalSeconds(totalSeconds) {
2315
- if (Math.abs(totalSeconds) > ZoneOffset.MAX_SECONDS) {
2316
- throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2317
- }
2416
+ _proto6.isTimeBased = function isTimeBased() {
2417
+ return false;
2318
2418
  };
2319
- ZoneOffset._validate = function _validate(hours, minutes, seconds) {
2320
- if (hours < -18 || hours > 18) {
2321
- throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18");
2322
- }
2323
- if (hours > 0) {
2324
- if (minutes < 0 || seconds < 0) {
2325
- throw new DateTimeException('Zone offset minutes and seconds must be positive because hours is positive');
2326
- }
2327
- } else if (hours < 0) {
2328
- if (minutes > 0 || seconds > 0) {
2329
- throw new DateTimeException('Zone offset minutes and seconds must be negative because hours is negative');
2330
- }
2331
- } else if (minutes > 0 && seconds < 0 || minutes < 0 && seconds > 0) {
2332
- throw new DateTimeException('Zone offset minutes and seconds must have the same sign');
2333
- }
2334
- if (Math.abs(minutes) > 59) {
2335
- throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59");
2336
- }
2337
- if (Math.abs(seconds) > 59) {
2338
- throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59");
2339
- }
2340
- if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
2341
- throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2419
+ _proto6.isSupportedBy = function isSupportedBy(temporal) {
2420
+ return temporal.isSupported(ChronoField.EPOCH_DAY);
2421
+ };
2422
+ _proto6.addTo = function addTo(temporal, periodToAdd) {
2423
+ switch (this) {
2424
+ case WEEK_BASED_YEARS:
2425
+ {
2426
+ var added = MathUtil.safeAdd(temporal.get(WEEK_BASED_YEAR), periodToAdd);
2427
+ return temporal.with(WEEK_BASED_YEAR, added);
2428
+ }
2429
+ case QUARTER_YEARS:
2430
+ return temporal.plus(MathUtil.intDiv(periodToAdd, 256), ChronoUnit.YEARS).plus(MathUtil.intMod(periodToAdd, 256) * 3, ChronoUnit.MONTHS);
2431
+ default:
2432
+ throw new IllegalStateException('Unreachable');
2342
2433
  }
2343
2434
  };
2344
- ZoneOffset.of = function of(offsetId) {
2345
- requireNonNull(offsetId, 'offsetId');
2346
- var offset = ID_CACHE[offsetId];
2347
- if (offset != null) {
2348
- return offset;
2349
- }
2350
- var hours, minutes, seconds;
2351
- switch (offsetId.length) {
2352
- case 2:
2353
- offsetId = offsetId[0] + "0" + offsetId[1];
2354
- case 3:
2355
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2356
- minutes = 0;
2357
- seconds = 0;
2358
- break;
2359
- case 5:
2360
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2361
- minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2362
- seconds = 0;
2363
- break;
2364
- case 6:
2365
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2366
- minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2367
- seconds = 0;
2368
- break;
2369
- case 7:
2370
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2371
- minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2372
- seconds = ZoneOffset._parseNumber(offsetId, 5, false);
2373
- break;
2374
- case 9:
2375
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2376
- minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2377
- seconds = ZoneOffset._parseNumber(offsetId, 7, true);
2378
- break;
2435
+ _proto6.between = function between(temporal1, temporal2) {
2436
+ switch (this) {
2437
+ case WEEK_BASED_YEARS:
2438
+ return MathUtil.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
2439
+ case QUARTER_YEARS:
2440
+ return MathUtil.intDiv(temporal1.until(temporal2, ChronoUnit.MONTHS), 3);
2379
2441
  default:
2380
- throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId);
2381
- }
2382
- var first = offsetId[0];
2383
- if (first !== '+' && first !== '-') {
2384
- throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId);
2385
- }
2386
- if (first === '-') {
2387
- return ZoneOffset.ofHoursMinutesSeconds(-hours, -minutes, -seconds);
2388
- } else {
2389
- return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, seconds);
2390
- }
2391
- };
2392
- ZoneOffset._parseNumber = function _parseNumber(offsetId, pos, precededByColon) {
2393
- if (precededByColon && offsetId[pos - 1] !== ':') {
2394
- throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId);
2395
- }
2396
- var ch1 = offsetId[pos];
2397
- var ch2 = offsetId[pos + 1];
2398
- if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
2399
- throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId);
2442
+ throw new IllegalStateException('Unreachable');
2400
2443
  }
2401
- return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
2402
2444
  };
2403
- ZoneOffset.ofHours = function ofHours(hours) {
2404
- return ZoneOffset.ofHoursMinutesSeconds(hours, 0, 0);
2445
+ _proto6.toString = function toString() {
2446
+ return this._name;
2405
2447
  };
2406
- ZoneOffset.ofHoursMinutes = function ofHoursMinutes(hours, minutes) {
2407
- return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, 0);
2448
+ return Unit;
2449
+ }(TemporalUnit);
2450
+ var DAY_OF_QUARTER = null;
2451
+ var QUARTER_OF_YEAR = null;
2452
+ var WEEK_OF_WEEK_BASED_YEAR = null;
2453
+ var WEEK_BASED_YEAR = null;
2454
+ var WEEK_BASED_YEARS = null;
2455
+ var QUARTER_YEARS = null;
2456
+ function _init$g() {
2457
+ DAY_OF_QUARTER = new DAY_OF_QUARTER_FIELD();
2458
+ QUARTER_OF_YEAR = new QUARTER_OF_YEAR_FIELD();
2459
+ WEEK_OF_WEEK_BASED_YEAR = new WEEK_OF_WEEK_BASED_YEAR_FIELD();
2460
+ WEEK_BASED_YEAR = new WEEK_BASED_YEAR_FIELD();
2461
+ WEEK_BASED_YEARS = new Unit('WeekBasedYears', Duration.ofSeconds(31556952));
2462
+ QUARTER_YEARS = new Unit('QuarterYears', Duration.ofSeconds(31556952 / 4));
2463
+ IsoFields.DAY_OF_QUARTER = DAY_OF_QUARTER;
2464
+ IsoFields.QUARTER_OF_YEAR = QUARTER_OF_YEAR;
2465
+ IsoFields.WEEK_OF_WEEK_BASED_YEAR = WEEK_OF_WEEK_BASED_YEAR;
2466
+ IsoFields.WEEK_BASED_YEAR = WEEK_BASED_YEAR;
2467
+ IsoFields.WEEK_BASED_YEARS = WEEK_BASED_YEARS;
2468
+ IsoFields.QUARTER_YEARS = QUARTER_YEARS;
2469
+ LocalDate.prototype.isoWeekOfWeekyear = function () {
2470
+ return this.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
2408
2471
  };
2409
- ZoneOffset.ofHoursMinutesSeconds = function ofHoursMinutesSeconds(hours, minutes, seconds) {
2410
- ZoneOffset._validate(hours, minutes, seconds);
2411
- var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;
2412
- return ZoneOffset.ofTotalSeconds(totalSeconds);
2472
+ LocalDate.prototype.isoWeekyear = function () {
2473
+ return this.get(IsoFields.WEEK_BASED_YEAR);
2413
2474
  };
2414
- ZoneOffset.ofTotalMinutes = function ofTotalMinutes(totalMinutes) {
2415
- var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;
2416
- return ZoneOffset.ofTotalSeconds(totalSeconds);
2475
+ }
2476
+
2477
+ /*
2478
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2479
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2480
+ */
2481
+
2482
+ var StringUtil = function () {
2483
+ function StringUtil() {}
2484
+ StringUtil.startsWith = function startsWith(text, pattern) {
2485
+ return text.indexOf(pattern) === 0;
2417
2486
  };
2418
- ZoneOffset.ofTotalSeconds = function ofTotalSeconds(totalSeconds) {
2419
- if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {
2420
- var totalSecs = totalSeconds;
2421
- var result = SECONDS_CACHE[totalSecs];
2422
- if (result == null) {
2423
- result = new ZoneOffset(totalSeconds);
2424
- SECONDS_CACHE[totalSecs] = result;
2425
- ID_CACHE[result.id()] = result;
2426
- }
2427
- return result;
2428
- } else {
2429
- return new ZoneOffset(totalSeconds);
2487
+ StringUtil.hashCode = function hashCode(text) {
2488
+ var len = text.length;
2489
+ if (len === 0) {
2490
+ return 0;
2491
+ }
2492
+ var hash = 0;
2493
+ for (var i = 0; i < len; i++) {
2494
+ var chr = text.charCodeAt(i);
2495
+ hash = (hash << 5) - hash + chr;
2496
+ hash |= 0;
2430
2497
  }
2498
+ return MathUtil.smi(hash);
2431
2499
  };
2432
- _proto.rules = function rules() {
2433
- return this._rules;
2500
+ return StringUtil;
2501
+ }();
2502
+
2503
+ /*
2504
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2505
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
2506
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2507
+ */
2508
+
2509
+ var ZoneId = function () {
2510
+ function ZoneId() {}
2511
+ ZoneId.systemDefault = function systemDefault() {
2512
+ throw new DateTimeException('not supported operation');
2434
2513
  };
2435
- _proto.get = function get(field) {
2436
- return this.getLong(field);
2514
+ ZoneId.getAvailableZoneIds = function getAvailableZoneIds() {
2515
+ throw new DateTimeException('not supported operation');
2437
2516
  };
2438
- _proto.getLong = function getLong(field) {
2439
- if (field === ChronoField.OFFSET_SECONDS) {
2440
- return this._totalSeconds;
2441
- } else if (field instanceof ChronoField) {
2442
- throw new DateTimeException("Unsupported field: " + field);
2443
- }
2444
- return field.getFrom(this);
2517
+ ZoneId.of = function of(zoneId) {
2518
+ throw new DateTimeException("not supported operation" + zoneId);
2445
2519
  };
2446
- _proto.query = function query(_query) {
2447
- requireNonNull(_query, 'query');
2448
- if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
2449
- return this;
2450
- } else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.precision() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId()) {
2451
- return null;
2452
- }
2453
- return _query.queryFrom(this);
2520
+ ZoneId.ofOffset = function ofOffset(prefix, offset) {
2521
+ throw new DateTimeException("not supported operation" + prefix + offset);
2454
2522
  };
2455
- _proto.adjustInto = function adjustInto(temporal) {
2456
- return temporal.with(ChronoField.OFFSET_SECONDS, this._totalSeconds);
2523
+ ZoneId.from = function from(temporal) {
2524
+ throw new DateTimeException("not supported operation" + temporal);
2457
2525
  };
2458
- _proto.compareTo = function compareTo(other) {
2459
- requireNonNull(other, 'other');
2460
- return other._totalSeconds - this._totalSeconds;
2526
+ var _proto = ZoneId.prototype;
2527
+ _proto.id = function id() {
2528
+ abstractMethodFail('ZoneId.id');
2461
2529
  };
2462
- _proto.equals = function equals(obj) {
2463
- if (this === obj) {
2530
+ _proto.rules = function rules() {
2531
+ abstractMethodFail('ZoneId.rules');
2532
+ };
2533
+ _proto.normalized = function normalized() {
2534
+ var rules = this.rules();
2535
+ if (rules.isFixedOffset()) {
2536
+ return rules.offset(Instant.EPOCH);
2537
+ }
2538
+ return this;
2539
+ };
2540
+ _proto.equals = function equals(other) {
2541
+ if (this === other) {
2464
2542
  return true;
2465
2543
  }
2466
- if (obj instanceof ZoneOffset) {
2467
- return this._totalSeconds === obj._totalSeconds;
2544
+ if (other instanceof ZoneId) {
2545
+ return this.id() === other.id();
2468
2546
  }
2469
2547
  return false;
2470
2548
  };
2471
2549
  _proto.hashCode = function hashCode() {
2472
- return this._totalSeconds;
2550
+ return StringUtil.hashCode(this.id());
2473
2551
  };
2474
2552
  _proto.toString = function toString() {
2475
- return this._id;
2553
+ return this.id();
2476
2554
  };
2477
- return ZoneOffset;
2478
- }(ZoneId);
2479
- function _init$g() {
2480
- ZoneOffset.MAX_SECONDS = 18 * LocalTime.SECONDS_PER_HOUR;
2481
- ZoneOffset.UTC = ZoneOffset.ofTotalSeconds(0);
2482
- ZoneOffset.MIN = ZoneOffset.ofTotalSeconds(-ZoneOffset.MAX_SECONDS);
2483
- ZoneOffset.MAX = ZoneOffset.ofTotalSeconds(ZoneOffset.MAX_SECONDS);
2484
- }
2485
-
2486
- var DateTimeBuilder = function (_TemporalAccessor) {
2487
- function DateTimeBuilder() {
2488
- var _this;
2489
- _this = _TemporalAccessor.call(this) || this;
2490
- _this.fieldValues = new EnumMap();
2491
- _this.chrono = null;
2492
- _this.zone = null;
2493
- _this.date = null;
2494
- _this.time = null;
2495
- _this.leapSecond = false;
2496
- _this.excessDays = null;
2497
- return _this;
2498
- }
2499
- _inheritsLoose(DateTimeBuilder, _TemporalAccessor);
2500
- DateTimeBuilder.create = function create(field, value) {
2501
- var dtb = new DateTimeBuilder();
2502
- dtb._addFieldValue(field, value);
2503
- return dtb;
2555
+ _proto.toJSON = function toJSON() {
2556
+ return this.toString();
2504
2557
  };
2505
- var _proto = DateTimeBuilder.prototype;
2506
- _proto.getFieldValue0 = function getFieldValue0(field) {
2507
- return this.fieldValues.get(field);
2558
+ return ZoneId;
2559
+ }();
2560
+
2561
+ var ZoneRules = function () {
2562
+ function ZoneRules() {}
2563
+ ZoneRules.of = function of(offset) {
2564
+ requireNonNull(offset, 'offset');
2565
+ return new Fixed(offset);
2508
2566
  };
2509
- _proto._addFieldValue = function _addFieldValue(field, value) {
2510
- requireNonNull(field, 'field');
2511
- var old = this.getFieldValue0(field);
2512
- if (old != null && old !== value) {
2513
- throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value + ": " + this);
2567
+ var _proto = ZoneRules.prototype;
2568
+ _proto.isFixedOffset = function isFixedOffset() {
2569
+ abstractMethodFail('ZoneRules.isFixedOffset');
2570
+ };
2571
+ _proto.offset = function offset(instantOrLocalDateTime) {
2572
+ if (instantOrLocalDateTime instanceof Instant) {
2573
+ return this.offsetOfInstant(instantOrLocalDateTime);
2574
+ } else {
2575
+ return this.offsetOfLocalDateTime(instantOrLocalDateTime);
2514
2576
  }
2515
- return this._putFieldValue0(field, value);
2516
2577
  };
2517
- _proto._putFieldValue0 = function _putFieldValue0(field, value) {
2518
- this.fieldValues.put(field, value);
2519
- return this;
2578
+ _proto.offsetOfInstant = function offsetOfInstant(instant) {
2579
+ abstractMethodFail('ZoneRules.offsetInstant');
2520
2580
  };
2521
- _proto.resolve = function resolve(resolverStyle, resolverFields) {
2522
- if (resolverFields != null) {
2523
- this.fieldValues.retainAll(resolverFields);
2581
+ _proto.offsetOfEpochMilli = function offsetOfEpochMilli(epochMilli) {
2582
+ abstractMethodFail('ZoneRules.offsetOfEpochMilli');
2583
+ };
2584
+ _proto.offsetOfLocalDateTime = function offsetOfLocalDateTime(localDateTime) {
2585
+ abstractMethodFail('ZoneRules.offsetLocalDateTime');
2586
+ };
2587
+ _proto.validOffsets = function validOffsets(localDateTime) {
2588
+ abstractMethodFail('ZoneRules.validOffsets');
2589
+ };
2590
+ _proto.transition = function transition(localDateTime) {
2591
+ abstractMethodFail('ZoneRules.transition');
2592
+ };
2593
+ _proto.standardOffset = function standardOffset(instant) {
2594
+ abstractMethodFail('ZoneRules.standardOffset');
2595
+ };
2596
+ _proto.daylightSavings = function daylightSavings(instant) {
2597
+ abstractMethodFail('ZoneRules.daylightSavings');
2598
+ };
2599
+ _proto.isDaylightSavings = function isDaylightSavings(instant) {
2600
+ abstractMethodFail('ZoneRules.isDaylightSavings');
2601
+ };
2602
+ _proto.isValidOffset = function isValidOffset(localDateTime, offset) {
2603
+ abstractMethodFail('ZoneRules.isValidOffset');
2604
+ };
2605
+ _proto.nextTransition = function nextTransition(instant) {
2606
+ abstractMethodFail('ZoneRules.nextTransition');
2607
+ };
2608
+ _proto.previousTransition = function previousTransition(instant) {
2609
+ abstractMethodFail('ZoneRules.previousTransition');
2610
+ };
2611
+ _proto.transitions = function transitions() {
2612
+ abstractMethodFail('ZoneRules.transitions');
2613
+ };
2614
+ _proto.transitionRules = function transitionRules() {
2615
+ abstractMethodFail('ZoneRules.transitionRules');
2616
+ };
2617
+ _proto.toString = function toString() {
2618
+ abstractMethodFail('ZoneRules.toString');
2619
+ };
2620
+ _proto.toJSON = function toJSON() {
2621
+ return this.toString();
2622
+ };
2623
+ return ZoneRules;
2624
+ }();
2625
+ var Fixed = function (_ZoneRules) {
2626
+ function Fixed(offset) {
2627
+ var _this;
2628
+ _this = _ZoneRules.call(this) || this;
2629
+ _this._offset = offset;
2630
+ return _this;
2631
+ }
2632
+ _inheritsLoose(Fixed, _ZoneRules);
2633
+ var _proto2 = Fixed.prototype;
2634
+ _proto2.isFixedOffset = function isFixedOffset() {
2635
+ return true;
2636
+ };
2637
+ _proto2.offsetOfInstant = function offsetOfInstant() {
2638
+ return this._offset;
2639
+ };
2640
+ _proto2.offsetOfEpochMilli = function offsetOfEpochMilli() {
2641
+ return this._offset;
2642
+ };
2643
+ _proto2.offsetOfLocalDateTime = function offsetOfLocalDateTime() {
2644
+ return this._offset;
2645
+ };
2646
+ _proto2.validOffsets = function validOffsets() {
2647
+ return [this._offset];
2648
+ };
2649
+ _proto2.transition = function transition() {
2650
+ return null;
2651
+ };
2652
+ _proto2.standardOffset = function standardOffset() {
2653
+ return this._offset;
2654
+ };
2655
+ _proto2.daylightSavings = function daylightSavings() {
2656
+ return Duration.ZERO;
2657
+ };
2658
+ _proto2.isDaylightSavings = function isDaylightSavings() {
2659
+ return false;
2660
+ };
2661
+ _proto2.isValidOffset = function isValidOffset(localDateTime, offset) {
2662
+ return this._offset.equals(offset);
2663
+ };
2664
+ _proto2.nextTransition = function nextTransition() {
2665
+ return null;
2666
+ };
2667
+ _proto2.previousTransition = function previousTransition() {
2668
+ return null;
2669
+ };
2670
+ _proto2.transitions = function transitions() {
2671
+ return [];
2672
+ };
2673
+ _proto2.transitionRules = function transitionRules() {
2674
+ return [];
2675
+ };
2676
+ _proto2.equals = function equals(other) {
2677
+ if (this === other) {
2678
+ return true;
2524
2679
  }
2525
- this._mergeDate(resolverStyle);
2526
- this._mergeTime(resolverStyle);
2527
- this._resolveTimeInferZeroes(resolverStyle);
2528
- if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
2529
- this.date = this.date.plus(this.excessDays);
2530
- this.excessDays = Period.ZERO;
2680
+ if (other instanceof Fixed) {
2681
+ return this._offset.equals(other._offset);
2531
2682
  }
2532
- this._resolveInstant();
2533
- return this;
2683
+ return false;
2534
2684
  };
2535
- _proto._mergeDate = function _mergeDate(resolverStyle) {
2536
- this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
2685
+ _proto2.toString = function toString() {
2686
+ return "FixedRules:" + this._offset.toString();
2537
2687
  };
2538
- _proto._checkDate = function _checkDate(date) {
2539
- if (date != null) {
2540
- this._addObject(date);
2541
- for (var fieldName in this.fieldValues.keySet()) {
2542
- var field = ChronoField.byName(fieldName);
2543
- if (field) {
2544
- if (this.fieldValues.get(field) !== undefined) {
2545
- if (field.isDateBased()) {
2546
- var val1 = void 0;
2547
- try {
2548
- val1 = date.getLong(field);
2549
- } catch (ex) {
2550
- if (ex instanceof DateTimeException) {
2551
- continue;
2552
- } else {
2553
- throw ex;
2554
- }
2555
- }
2556
- var val2 = this.fieldValues.get(field);
2557
- if (val1 !== val2) {
2558
- throw new DateTimeException("Conflict found: Field " + field + " " + val1 + " differs from " + field + " " + val2 + " derived from " + date);
2559
- }
2560
- }
2561
- }
2562
- }
2688
+ return Fixed;
2689
+ }(ZoneRules);
2690
+
2691
+ var SECONDS_CACHE = {};
2692
+ var ID_CACHE = {};
2693
+ var ZoneOffset = function (_ZoneId) {
2694
+ function ZoneOffset(totalSeconds) {
2695
+ var _this;
2696
+ _this = _ZoneId.call(this) || this;
2697
+ ZoneOffset._validateTotalSeconds(totalSeconds);
2698
+ _this._totalSeconds = MathUtil.safeToInt(totalSeconds);
2699
+ _this._rules = ZoneRules.of(_this);
2700
+ _this._id = ZoneOffset._buildId(totalSeconds);
2701
+ return _this;
2702
+ }
2703
+ _inheritsLoose(ZoneOffset, _ZoneId);
2704
+ var _proto = ZoneOffset.prototype;
2705
+ _proto.totalSeconds = function totalSeconds() {
2706
+ return this._totalSeconds;
2707
+ };
2708
+ _proto.id = function id() {
2709
+ return this._id;
2710
+ };
2711
+ ZoneOffset._buildId = function _buildId(totalSeconds) {
2712
+ if (totalSeconds === 0) {
2713
+ return 'Z';
2714
+ } else {
2715
+ var absTotalSeconds = Math.abs(totalSeconds);
2716
+ var absHours = MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_HOUR);
2717
+ var absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
2718
+ var buf = "" + (totalSeconds < 0 ? '-' : '+') + (absHours < 10 ? '0' : '') + absHours + (absMinutes < 10 ? ':0' : ':') + absMinutes;
2719
+ var absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);
2720
+ if (absSeconds !== 0) {
2721
+ buf += (absSeconds < 10 ? ':0' : ':') + absSeconds;
2563
2722
  }
2723
+ return buf;
2564
2724
  }
2565
2725
  };
2566
- _proto._mergeTime = function _mergeTime(resolverStyle) {
2567
- if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
2568
- var ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
2569
- if (resolverStyle !== ResolverStyle.LENIENT) {
2570
- if (resolverStyle === ResolverStyle.SMART && ch === 0) ; else {
2571
- ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
2572
- }
2573
- }
2574
- this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
2726
+ ZoneOffset._validateTotalSeconds = function _validateTotalSeconds(totalSeconds) {
2727
+ if (Math.abs(totalSeconds) > ZoneOffset.MAX_SECONDS) {
2728
+ throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2575
2729
  }
2576
- if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
2577
- var _ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
2578
- if (resolverStyle !== ResolverStyle.LENIENT) {
2579
- if (resolverStyle === ResolverStyle.SMART && _ch === 0) ; else {
2580
- ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(_ch);
2581
- }
2582
- }
2583
- this._addFieldValue(ChronoField.HOUR_OF_AMPM, _ch === 12 ? 0 : _ch);
2730
+ };
2731
+ ZoneOffset._validate = function _validate(hours, minutes, seconds) {
2732
+ if (hours < -18 || hours > 18) {
2733
+ throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18");
2584
2734
  }
2585
- if (resolverStyle !== ResolverStyle.LENIENT) {
2586
- if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
2587
- ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
2735
+ if (hours > 0) {
2736
+ if (minutes < 0 || seconds < 0) {
2737
+ throw new DateTimeException('Zone offset minutes and seconds must be positive because hours is positive');
2588
2738
  }
2589
- if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
2590
- ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
2739
+ } else if (hours < 0) {
2740
+ if (minutes > 0 || seconds > 0) {
2741
+ throw new DateTimeException('Zone offset minutes and seconds must be negative because hours is negative');
2591
2742
  }
2743
+ } else if (minutes > 0 && seconds < 0 || minutes < 0 && seconds > 0) {
2744
+ throw new DateTimeException('Zone offset minutes and seconds must have the same sign');
2592
2745
  }
2593
- if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
2594
- var ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
2595
- var hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
2596
- this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
2746
+ if (Math.abs(minutes) > 59) {
2747
+ throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59");
2597
2748
  }
2598
- if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
2599
- var nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
2600
- if (resolverStyle !== ResolverStyle.LENIENT) {
2601
- ChronoField.NANO_OF_DAY.checkValidValue(nod);
2602
- }
2603
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1000000000));
2604
- this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000));
2749
+ if (Math.abs(seconds) > 59) {
2750
+ throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59");
2605
2751
  }
2606
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
2607
- var cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
2608
- if (resolverStyle !== ResolverStyle.LENIENT) {
2609
- ChronoField.MICRO_OF_DAY.checkValidValue(cod);
2610
- }
2611
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1000000));
2612
- this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1000000));
2613
- }
2614
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
2615
- var lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
2616
- if (resolverStyle !== ResolverStyle.LENIENT) {
2617
- ChronoField.MILLI_OF_DAY.checkValidValue(lod);
2618
- }
2619
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1000));
2620
- this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1000));
2621
- }
2622
- if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
2623
- var sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
2624
- if (resolverStyle !== ResolverStyle.LENIENT) {
2625
- ChronoField.SECOND_OF_DAY.checkValidValue(sod);
2626
- }
2627
- this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
2628
- this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
2629
- this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
2630
- }
2631
- if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
2632
- var mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
2633
- if (resolverStyle !== ResolverStyle.LENIENT) {
2634
- ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
2635
- }
2636
- this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
2637
- this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
2638
- }
2639
- if (resolverStyle !== ResolverStyle.LENIENT) {
2640
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
2641
- ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
2642
- }
2643
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2644
- ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
2645
- }
2646
- }
2647
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2648
- var los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2649
- var cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
2650
- this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1000 + MathUtil.intMod(cos, 1000));
2651
- }
2652
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
2653
- var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2654
- this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
2655
- this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
2656
- }
2657
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
2658
- var _nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2659
- this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(_nos, 1000000));
2660
- this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2661
- }
2662
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2663
- var _cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
2664
- this._putFieldValue0(ChronoField.NANO_OF_SECOND, _cos * 1000);
2665
- } else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
2666
- var _los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2667
- this._putFieldValue0(ChronoField.NANO_OF_SECOND, _los * 1000000);
2752
+ if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
2753
+ throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2668
2754
  }
2669
2755
  };
2670
- _proto._resolveTimeInferZeroes = function _resolveTimeInferZeroes(resolverStyle) {
2671
- var hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
2672
- var moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
2673
- var som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
2674
- var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2675
- if (hod == null) {
2676
- return;
2756
+ ZoneOffset.of = function of(offsetId) {
2757
+ requireNonNull(offsetId, 'offsetId');
2758
+ var offset = ID_CACHE[offsetId];
2759
+ if (offset != null) {
2760
+ return offset;
2677
2761
  }
2678
- if (moh == null && (som != null || nos != null)) {
2679
- return;
2762
+ var hours, minutes, seconds;
2763
+ switch (offsetId.length) {
2764
+ case 2:
2765
+ offsetId = offsetId[0] + "0" + offsetId[1];
2766
+ case 3:
2767
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2768
+ minutes = 0;
2769
+ seconds = 0;
2770
+ break;
2771
+ case 5:
2772
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2773
+ minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2774
+ seconds = 0;
2775
+ break;
2776
+ case 6:
2777
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2778
+ minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2779
+ seconds = 0;
2780
+ break;
2781
+ case 7:
2782
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2783
+ minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2784
+ seconds = ZoneOffset._parseNumber(offsetId, 5, false);
2785
+ break;
2786
+ case 9:
2787
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2788
+ minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2789
+ seconds = ZoneOffset._parseNumber(offsetId, 7, true);
2790
+ break;
2791
+ default:
2792
+ throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId);
2680
2793
  }
2681
- if (moh != null && som == null && nos != null) {
2682
- return;
2794
+ var first = offsetId[0];
2795
+ if (first !== '+' && first !== '-') {
2796
+ throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId);
2683
2797
  }
2684
- if (resolverStyle !== ResolverStyle.LENIENT) {
2685
- if (hod != null) {
2686
- if (resolverStyle === ResolverStyle.SMART && hod === 24 && (moh == null || moh === 0) && (som == null || som === 0) && (nos == null || nos === 0)) {
2687
- hod = 0;
2688
- this.excessDays = Period.ofDays(1);
2689
- }
2690
- var hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
2691
- if (moh != null) {
2692
- var mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
2693
- if (som != null) {
2694
- var somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
2695
- if (nos != null) {
2696
- var nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
2697
- this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
2698
- } else {
2699
- this._addObject(LocalTime.of(hodVal, mohVal, somVal));
2700
- }
2701
- } else {
2702
- if (nos == null) {
2703
- this._addObject(LocalTime.of(hodVal, mohVal));
2704
- }
2705
- }
2706
- } else {
2707
- if (som == null && nos == null) {
2708
- this._addObject(LocalTime.of(hodVal, 0));
2709
- }
2710
- }
2711
- }
2798
+ if (first === '-') {
2799
+ return ZoneOffset.ofHoursMinutesSeconds(-hours, -minutes, -seconds);
2712
2800
  } else {
2713
- if (hod != null) {
2714
- var _hodVal = hod;
2715
- if (moh != null) {
2716
- if (som != null) {
2717
- if (nos == null) {
2718
- nos = 0;
2719
- }
2720
- var totalNanos = MathUtil.safeMultiply(_hodVal, 3600000000000);
2721
- totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 60000000000));
2722
- totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1000000000));
2723
- totalNanos = MathUtil.safeAdd(totalNanos, nos);
2724
- var excessDays = MathUtil.floorDiv(totalNanos, 86400000000000);
2725
- var nod = MathUtil.floorMod(totalNanos, 86400000000000);
2726
- this._addObject(LocalTime.ofNanoOfDay(nod));
2727
- this.excessDays = Period.ofDays(excessDays);
2728
- } else {
2729
- var totalSecs = MathUtil.safeMultiply(_hodVal, 3600);
2730
- totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
2731
- var _excessDays = MathUtil.floorDiv(totalSecs, 86400);
2732
- var sod = MathUtil.floorMod(totalSecs, 86400);
2733
- this._addObject(LocalTime.ofSecondOfDay(sod));
2734
- this.excessDays = Period.ofDays(_excessDays);
2735
- }
2736
- } else {
2737
- var _excessDays2 = MathUtil.safeToInt(MathUtil.floorDiv(_hodVal, 24));
2738
- _hodVal = MathUtil.floorMod(_hodVal, 24);
2739
- this._addObject(LocalTime.of(_hodVal, 0));
2740
- this.excessDays = Period.ofDays(_excessDays2);
2741
- }
2742
- }
2801
+ return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, seconds);
2743
2802
  }
2744
- this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
2745
- this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
2746
- this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
2747
- this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
2748
2803
  };
2749
- _proto._addObject = function _addObject(dateOrTime) {
2750
- if (dateOrTime instanceof ChronoLocalDate) {
2751
- this.date = dateOrTime;
2752
- } else if (dateOrTime instanceof LocalTime) {
2753
- this.time = dateOrTime;
2804
+ ZoneOffset._parseNumber = function _parseNumber(offsetId, pos, precededByColon) {
2805
+ if (precededByColon && offsetId[pos - 1] !== ':') {
2806
+ throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId);
2807
+ }
2808
+ var ch1 = offsetId[pos];
2809
+ var ch2 = offsetId[pos + 1];
2810
+ if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
2811
+ throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId);
2754
2812
  }
2813
+ return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
2755
2814
  };
2756
- _proto._resolveInstant = function _resolveInstant() {
2757
- if (this.date != null && this.time != null) {
2758
- var offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
2759
- if (offsetSecs != null) {
2760
- var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
2761
- var instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
2762
- this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
2763
- } else if (this.zone != null) {
2764
- var _instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
2765
- this.fieldValues.put(ChronoField.INSTANT_SECONDS, _instant);
2815
+ ZoneOffset.ofHours = function ofHours(hours) {
2816
+ return ZoneOffset.ofHoursMinutesSeconds(hours, 0, 0);
2817
+ };
2818
+ ZoneOffset.ofHoursMinutes = function ofHoursMinutes(hours, minutes) {
2819
+ return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, 0);
2820
+ };
2821
+ ZoneOffset.ofHoursMinutesSeconds = function ofHoursMinutesSeconds(hours, minutes, seconds) {
2822
+ ZoneOffset._validate(hours, minutes, seconds);
2823
+ var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;
2824
+ return ZoneOffset.ofTotalSeconds(totalSeconds);
2825
+ };
2826
+ ZoneOffset.ofTotalMinutes = function ofTotalMinutes(totalMinutes) {
2827
+ var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;
2828
+ return ZoneOffset.ofTotalSeconds(totalSeconds);
2829
+ };
2830
+ ZoneOffset.ofTotalSeconds = function ofTotalSeconds(totalSeconds) {
2831
+ if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {
2832
+ var totalSecs = totalSeconds;
2833
+ var result = SECONDS_CACHE[totalSecs];
2834
+ if (result == null) {
2835
+ result = new ZoneOffset(totalSeconds);
2836
+ SECONDS_CACHE[totalSecs] = result;
2837
+ ID_CACHE[result.id()] = result;
2766
2838
  }
2839
+ return result;
2840
+ } else {
2841
+ return new ZoneOffset(totalSeconds);
2767
2842
  }
2768
2843
  };
2769
- _proto.build = function build(type) {
2770
- return type.queryFrom(this);
2844
+ _proto.rules = function rules() {
2845
+ return this._rules;
2771
2846
  };
2772
- _proto.isSupported = function isSupported(field) {
2773
- if (field == null) {
2774
- return false;
2775
- }
2776
- return this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== undefined || this.date != null && this.date.isSupported(field) || this.time != null && this.time.isSupported(field);
2847
+ _proto.get = function get(field) {
2848
+ return this.getLong(field);
2777
2849
  };
2778
2850
  _proto.getLong = function getLong(field) {
2779
- requireNonNull(field, 'field');
2780
- var value = this.getFieldValue0(field);
2781
- if (value == null) {
2782
- if (this.date != null && this.date.isSupported(field)) {
2783
- return this.date.getLong(field);
2784
- }
2785
- if (this.time != null && this.time.isSupported(field)) {
2786
- return this.time.getLong(field);
2787
- }
2788
- throw new DateTimeException("Field not found: " + field);
2851
+ if (field === ChronoField.OFFSET_SECONDS) {
2852
+ return this._totalSeconds;
2853
+ } else if (field instanceof ChronoField) {
2854
+ throw new DateTimeException("Unsupported field: " + field);
2789
2855
  }
2790
- return value;
2856
+ return field.getFrom(this);
2791
2857
  };
2792
2858
  _proto.query = function query(_query) {
2793
- if (_query === TemporalQueries.zoneId()) {
2794
- return this.zone;
2795
- } else if (_query === TemporalQueries.chronology()) {
2796
- return this.chrono;
2797
- } else if (_query === TemporalQueries.localDate()) {
2798
- return this.date != null ? LocalDate.from(this.date) : null;
2799
- } else if (_query === TemporalQueries.localTime()) {
2800
- return this.time;
2801
- } else if (_query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
2802
- return _query.queryFrom(this);
2803
- } else if (_query === TemporalQueries.precision()) {
2859
+ requireNonNull(_query, 'query');
2860
+ if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
2861
+ return this;
2862
+ } else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.precision() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId()) {
2804
2863
  return null;
2805
2864
  }
2806
2865
  return _query.queryFrom(this);
2807
2866
  };
2808
- return DateTimeBuilder;
2809
- }(TemporalAccessor);
2810
-
2811
- var DateTimeParseContext = function () {
2812
- function DateTimeParseContext() {
2813
- if (arguments.length === 1) {
2814
- if (arguments[0] instanceof DateTimeParseContext) {
2815
- this._constructorSelf.apply(this, arguments);
2816
- return;
2817
- } else {
2818
- this._constructorFormatter.apply(this, arguments);
2819
- }
2820
- } else {
2821
- this._constructorParam.apply(this, arguments);
2822
- }
2823
- this._caseSensitive = true;
2824
- this._strict = true;
2825
- this._parsed = [new Parsed(this)];
2826
- }
2827
- var _proto = DateTimeParseContext.prototype;
2828
- _proto._constructorParam = function _constructorParam(locale, symbols, chronology) {
2829
- this._locale = locale;
2830
- this._symbols = symbols;
2831
- this._overrideChronology = chronology;
2832
- };
2833
- _proto._constructorFormatter = function _constructorFormatter(formatter) {
2834
- this._locale = formatter.locale();
2835
- this._symbols = formatter.decimalStyle();
2836
- this._overrideChronology = formatter.chronology();
2837
- };
2838
- _proto._constructorSelf = function _constructorSelf(other) {
2839
- this._locale = other._locale;
2840
- this._symbols = other._symbols;
2841
- this._overrideChronology = other._overrideChronology;
2842
- this._overrideZone = other._overrideZone;
2843
- this._caseSensitive = other._caseSensitive;
2844
- this._strict = other._strict;
2845
- this._parsed = [new Parsed(this)];
2846
- };
2847
- _proto.copy = function copy() {
2848
- return new DateTimeParseContext(this);
2849
- };
2850
- _proto.symbols = function symbols() {
2851
- return this._symbols;
2852
- };
2853
- _proto.isStrict = function isStrict() {
2854
- return this._strict;
2855
- };
2856
- _proto.setStrict = function setStrict(strict) {
2857
- this._strict = strict;
2858
- };
2859
- _proto.locale = function locale() {
2860
- return this._locale;
2861
- };
2862
- _proto.setLocale = function setLocale(locale) {
2863
- this._locale = locale;
2864
- };
2865
- _proto.startOptional = function startOptional() {
2866
- this._parsed.push(this.currentParsed().copy());
2867
- };
2868
- _proto.endOptional = function endOptional(successful) {
2869
- if (successful) {
2870
- this._parsed.splice(this._parsed.length - 2, 1);
2871
- } else {
2872
- this._parsed.splice(this._parsed.length - 1, 1);
2873
- }
2874
- };
2875
- _proto.isCaseSensitive = function isCaseSensitive() {
2876
- return this._caseSensitive;
2867
+ _proto.adjustInto = function adjustInto(temporal) {
2868
+ return temporal.with(ChronoField.OFFSET_SECONDS, this._totalSeconds);
2877
2869
  };
2878
- _proto.setCaseSensitive = function setCaseSensitive(caseSensitive) {
2879
- this._caseSensitive = caseSensitive;
2870
+ _proto.compareTo = function compareTo(other) {
2871
+ requireNonNull(other, 'other');
2872
+ return other._totalSeconds - this._totalSeconds;
2880
2873
  };
2881
- _proto.subSequenceEquals = function subSequenceEquals(cs1, offset1, cs2, offset2, length) {
2882
- if (offset1 + length > cs1.length || offset2 + length > cs2.length) {
2883
- return false;
2884
- }
2885
- if (!this.isCaseSensitive()) {
2886
- cs1 = cs1.toLowerCase();
2887
- cs2 = cs2.toLowerCase();
2888
- }
2889
- for (var i = 0; i < length; i++) {
2890
- var ch1 = cs1[offset1 + i];
2891
- var ch2 = cs2[offset2 + i];
2892
- if (ch1 !== ch2) {
2893
- return false;
2894
- }
2874
+ _proto.equals = function equals(obj) {
2875
+ if (this === obj) {
2876
+ return true;
2895
2877
  }
2896
- return true;
2897
- };
2898
- _proto.charEquals = function charEquals(ch1, ch2) {
2899
- if (this.isCaseSensitive()) {
2900
- return ch1 === ch2;
2878
+ if (obj instanceof ZoneOffset) {
2879
+ return this._totalSeconds === obj._totalSeconds;
2901
2880
  }
2902
- return this.charEqualsIgnoreCase(ch1, ch2);
2903
- };
2904
- _proto.charEqualsIgnoreCase = function charEqualsIgnoreCase(c1, c2) {
2905
- return c1 === c2 || c1.toLowerCase() === c2.toLowerCase();
2906
- };
2907
- _proto.setParsedField = function setParsedField(field, value, errorPos, successPos) {
2908
- var currentParsedFieldValues = this.currentParsed().fieldValues;
2909
- var old = currentParsedFieldValues.get(field);
2910
- currentParsedFieldValues.set(field, value);
2911
- return old != null && old !== value ? ~errorPos : successPos;
2912
- };
2913
- _proto.setParsedZone = function setParsedZone(zone) {
2914
- requireNonNull(zone, 'zone');
2915
- this.currentParsed().zone = zone;
2916
- };
2917
- _proto.getParsed = function getParsed(field) {
2918
- return this.currentParsed().fieldValues.get(field);
2919
- };
2920
- _proto.toParsed = function toParsed() {
2921
- return this.currentParsed();
2922
- };
2923
- _proto.currentParsed = function currentParsed() {
2924
- return this._parsed[this._parsed.length - 1];
2881
+ return false;
2925
2882
  };
2926
- _proto.setParsedLeapSecond = function setParsedLeapSecond() {
2927
- this.currentParsed().leapSecond = true;
2883
+ _proto.hashCode = function hashCode() {
2884
+ return this._totalSeconds;
2928
2885
  };
2929
- _proto.getEffectiveChronology = function getEffectiveChronology() {
2930
- var chrono = this.currentParsed().chrono;
2931
- if (chrono == null) {
2932
- chrono = this._overrideChronology;
2933
- if (chrono == null) {
2934
- chrono = IsoChronology.INSTANCE;
2935
- }
2936
- }
2937
- return chrono;
2886
+ _proto.toString = function toString() {
2887
+ return this._id;
2938
2888
  };
2939
- return DateTimeParseContext;
2940
- }();
2941
- var Parsed = function (_Temporal) {
2942
- function Parsed(dateTimeParseContext) {
2889
+ return ZoneOffset;
2890
+ }(ZoneId);
2891
+ function _init$f() {
2892
+ ZoneOffset.MAX_SECONDS = 18 * LocalTime.SECONDS_PER_HOUR;
2893
+ ZoneOffset.UTC = ZoneOffset.ofTotalSeconds(0);
2894
+ ZoneOffset.MIN = ZoneOffset.ofTotalSeconds(-ZoneOffset.MAX_SECONDS);
2895
+ ZoneOffset.MAX = ZoneOffset.ofTotalSeconds(ZoneOffset.MAX_SECONDS);
2896
+ }
2897
+
2898
+ var DateTimeBuilder = function (_TemporalAccessor) {
2899
+ function DateTimeBuilder() {
2943
2900
  var _this;
2944
- _this = _Temporal.call(this) || this;
2901
+ _this = _TemporalAccessor.call(this) || this;
2902
+ _this.fieldValues = new EnumMap();
2945
2903
  _this.chrono = null;
2946
2904
  _this.zone = null;
2947
- _this.fieldValues = new EnumMap();
2905
+ _this.date = null;
2906
+ _this.time = null;
2948
2907
  _this.leapSecond = false;
2949
- _this.excessDays = Period.ZERO;
2950
- _this.dateTimeParseContext = dateTimeParseContext;
2908
+ _this.excessDays = null;
2951
2909
  return _this;
2952
2910
  }
2953
- _inheritsLoose(Parsed, _Temporal);
2954
- var _proto2 = Parsed.prototype;
2955
- _proto2.copy = function copy() {
2956
- var cloned = new Parsed();
2957
- cloned.chrono = this.chrono;
2958
- cloned.zone = this.zone;
2959
- cloned.fieldValues.putAll(this.fieldValues);
2960
- cloned.leapSecond = this.leapSecond;
2961
- cloned.dateTimeParseContext = this.dateTimeParseContext;
2962
- return cloned;
2911
+ _inheritsLoose(DateTimeBuilder, _TemporalAccessor);
2912
+ DateTimeBuilder.create = function create(field, value) {
2913
+ var dtb = new DateTimeBuilder();
2914
+ dtb._addFieldValue(field, value);
2915
+ return dtb;
2963
2916
  };
2964
- _proto2.toString = function toString() {
2965
- return this.fieldValues + ", " + this.chrono + ", " + this.zone;
2917
+ var _proto = DateTimeBuilder.prototype;
2918
+ _proto.getFieldValue0 = function getFieldValue0(field) {
2919
+ return this.fieldValues.get(field);
2966
2920
  };
2967
- _proto2.isSupported = function isSupported(field) {
2968
- return this.fieldValues.containsKey(field);
2921
+ _proto._addFieldValue = function _addFieldValue(field, value) {
2922
+ requireNonNull(field, 'field');
2923
+ var old = this.getFieldValue0(field);
2924
+ if (old != null && old !== value) {
2925
+ throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value + ": " + this);
2926
+ }
2927
+ return this._putFieldValue0(field, value);
2969
2928
  };
2970
- _proto2.get = function get(field) {
2971
- var val = this.fieldValues.get(field);
2972
- assert(val != null);
2973
- return val;
2929
+ _proto._putFieldValue0 = function _putFieldValue0(field, value) {
2930
+ this.fieldValues.put(field, value);
2931
+ return this;
2974
2932
  };
2975
- _proto2.query = function query(_query) {
2976
- if (_query === TemporalQueries.chronology()) {
2977
- return this.chrono;
2933
+ _proto.resolve = function resolve(resolverStyle, resolverFields) {
2934
+ if (resolverFields != null) {
2935
+ this.fieldValues.retainAll(resolverFields);
2978
2936
  }
2979
- if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
2980
- return this.zone;
2937
+ if (this._resolveFields(resolverStyle)) ;
2938
+ this._mergeDate(resolverStyle);
2939
+ this._mergeTime(resolverStyle);
2940
+ this._resolveTimeInferZeroes(resolverStyle);
2941
+ if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
2942
+ this.date = this.date.plus(this.excessDays);
2943
+ this.excessDays = Period.ZERO;
2981
2944
  }
2982
- return _Temporal.prototype.query.call(this, _query);
2945
+ this._resolveInstant();
2946
+ return this;
2983
2947
  };
2984
- _proto2.toBuilder = function toBuilder() {
2985
- var builder = new DateTimeBuilder();
2986
- builder.fieldValues.putAll(this.fieldValues);
2987
- builder.chrono = this.dateTimeParseContext.getEffectiveChronology();
2988
- if (this.zone != null) {
2989
- builder.zone = this.zone;
2990
- } else {
2991
- builder.zone = this.overrideZone;
2948
+ _proto._resolveFields = function _resolveFields(resolverStyle) {
2949
+ var resolved = false;
2950
+ for (var _i = 0, _arr = [IsoFields.WEEK_OF_WEEK_BASED_YEAR, IsoFields.DAY_OF_QUARTER]; _i < _arr.length; _i++) {
2951
+ var field = _arr[_i];
2952
+ if (this.fieldValues.containsKey(field)) {
2953
+ var date = field.resolve(this.fieldValues, this, resolverStyle);
2954
+ if (date != null) {
2955
+ this._checkDate(date);
2956
+ resolved = true;
2957
+ }
2958
+ }
2992
2959
  }
2993
- builder.leapSecond = this.leapSecond;
2994
- builder.excessDays = this.excessDays;
2995
- return builder;
2960
+ return resolved;
2996
2961
  };
2997
- return Parsed;
2998
- }(Temporal);
2999
-
3000
- /*
3001
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3002
- * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
3003
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
3004
- */
3005
-
3006
- var DateTimePrintContext = function () {
3007
- function DateTimePrintContext(temporal, localeOrFormatter, symbols) {
3008
- if (arguments.length === 2 && arguments[1] instanceof DateTimeFormatter) {
3009
- this._temporal = DateTimePrintContext.adjust(temporal, localeOrFormatter);
3010
- this._locale = localeOrFormatter.locale();
3011
- this._symbols = localeOrFormatter.decimalStyle();
3012
- } else {
3013
- this._temporal = temporal;
3014
- this._locale = localeOrFormatter;
3015
- this._symbols = symbols;
3016
- }
3017
- this._optional = 0;
3018
- }
3019
- DateTimePrintContext.adjust = function adjust(temporal, formatter) {
3020
- return temporal;
3021
- };
3022
- var _proto = DateTimePrintContext.prototype;
3023
- _proto.symbols = function symbols() {
3024
- return this._symbols;
3025
- };
3026
- _proto.startOptional = function startOptional() {
3027
- this._optional++;
3028
- };
3029
- _proto.endOptional = function endOptional() {
3030
- this._optional--;
2962
+ _proto._mergeDate = function _mergeDate(resolverStyle) {
2963
+ this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
3031
2964
  };
3032
- _proto.getValueQuery = function getValueQuery(query) {
3033
- var result = this._temporal.query(query);
3034
- if (result == null && this._optional === 0) {
3035
- throw new DateTimeException("Unable to extract value: " + this._temporal);
2965
+ _proto._checkDate = function _checkDate(date) {
2966
+ if (date != null) {
2967
+ this._addObject(date);
2968
+ for (var fieldName in this.fieldValues.keySet()) {
2969
+ var field = ChronoField.byName(fieldName);
2970
+ if (field) {
2971
+ if (this.fieldValues.get(field) !== undefined) {
2972
+ if (field.isDateBased()) {
2973
+ var val1 = void 0;
2974
+ try {
2975
+ val1 = date.getLong(field);
2976
+ } catch (ex) {
2977
+ if (ex instanceof DateTimeException) {
2978
+ continue;
2979
+ } else {
2980
+ throw ex;
2981
+ }
2982
+ }
2983
+ var val2 = this.fieldValues.get(field);
2984
+ if (val1 !== val2) {
2985
+ throw new DateTimeException("Conflict found: Field " + field + " " + val1 + " differs from " + field + " " + val2 + " derived from " + date);
2986
+ }
2987
+ }
2988
+ }
2989
+ }
2990
+ }
3036
2991
  }
3037
- return result;
3038
2992
  };
3039
- _proto.getValue = function getValue(field) {
3040
- try {
3041
- return this._temporal.getLong(field);
3042
- } catch (ex) {
3043
- if (ex instanceof DateTimeException && this._optional > 0) {
3044
- return null;
2993
+ _proto._mergeTime = function _mergeTime(resolverStyle) {
2994
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
2995
+ var ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
2996
+ if (resolverStyle !== ResolverStyle.LENIENT) {
2997
+ if (resolverStyle === ResolverStyle.SMART && ch === 0) ; else {
2998
+ ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
2999
+ }
3045
3000
  }
3046
- throw ex;
3001
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
3047
3002
  }
3048
- };
3049
- _proto.temporal = function temporal() {
3050
- return this._temporal;
3051
- };
3052
- _proto.locale = function locale() {
3053
- return this._locale;
3054
- };
3055
- _proto.setDateTime = function setDateTime(temporal) {
3056
- this._temporal = temporal;
3057
- };
3058
- _proto.setLocale = function setLocale(locale) {
3059
- this._locale = locale;
3060
- };
3061
- return DateTimePrintContext;
3062
- }();
3063
-
3064
- var IsoFields = {};
3065
- var QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
3066
- var Field = function (_TemporalField) {
3067
- function Field() {
3068
- return _TemporalField.apply(this, arguments) || this;
3069
- }
3070
- _inheritsLoose(Field, _TemporalField);
3071
- var _proto = Field.prototype;
3072
- _proto.isDateBased = function isDateBased() {
3073
- return true;
3074
- };
3075
- _proto.isTimeBased = function isTimeBased() {
3076
- return false;
3077
- };
3078
- _proto._isIso = function _isIso() {
3079
- return true;
3080
- };
3081
- Field._getWeekRangeByLocalDate = function _getWeekRangeByLocalDate(date) {
3082
- var wby = Field._getWeekBasedYear(date);
3083
- return ValueRange.of(1, Field._getWeekRangeByYear(wby));
3084
- };
3085
- Field._getWeekRangeByYear = function _getWeekRangeByYear(wby) {
3086
- var date = LocalDate.of(wby, 1, 1);
3087
- if (date.dayOfWeek() === DayOfWeek.THURSDAY || date.dayOfWeek() === DayOfWeek.WEDNESDAY && date.isLeapYear()) {
3088
- return 53;
3003
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
3004
+ var _ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
3005
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3006
+ if (resolverStyle === ResolverStyle.SMART && _ch === 0) ; else {
3007
+ ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(_ch);
3008
+ }
3009
+ }
3010
+ this._addFieldValue(ChronoField.HOUR_OF_AMPM, _ch === 12 ? 0 : _ch);
3089
3011
  }
3090
- return 52;
3091
- };
3092
- Field._getWeek = function _getWeek(date) {
3093
- var dow0 = date.dayOfWeek().ordinal();
3094
- var doy0 = date.dayOfYear() - 1;
3095
- var doyThu0 = doy0 + (3 - dow0);
3096
- var alignedWeek = MathUtil.intDiv(doyThu0, 7);
3097
- var firstThuDoy0 = doyThu0 - alignedWeek * 7;
3098
- var firstMonDoy0 = firstThuDoy0 - 3;
3099
- if (firstMonDoy0 < -3) {
3100
- firstMonDoy0 += 7;
3012
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3013
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
3014
+ ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
3015
+ }
3016
+ if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
3017
+ ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
3018
+ }
3101
3019
  }
3102
- if (doy0 < firstMonDoy0) {
3103
- return Field._getWeekRangeByLocalDate(date.withDayOfYear(180).minusYears(1)).maximum();
3020
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
3021
+ var ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
3022
+ var hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
3023
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
3104
3024
  }
3105
- var week = MathUtil.intDiv(doy0 - firstMonDoy0, 7) + 1;
3106
- if (week === 53) {
3107
- if ((firstMonDoy0 === -3 || firstMonDoy0 === -2 && date.isLeapYear()) === false) {
3108
- week = 1;
3025
+ if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
3026
+ var nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
3027
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3028
+ ChronoField.NANO_OF_DAY.checkValidValue(nod);
3109
3029
  }
3030
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1000000000));
3031
+ this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000));
3110
3032
  }
3111
- return week;
3112
- };
3113
- Field._getWeekBasedYear = function _getWeekBasedYear(date) {
3114
- var year = date.year();
3115
- var doy = date.dayOfYear();
3116
- if (doy <= 3) {
3117
- var dow = date.dayOfWeek().ordinal();
3118
- if (doy - dow < -2) {
3119
- year--;
3033
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
3034
+ var cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
3035
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3036
+ ChronoField.MICRO_OF_DAY.checkValidValue(cod);
3120
3037
  }
3121
- } else if (doy >= 363) {
3122
- var _dow = date.dayOfWeek().ordinal();
3123
- doy = doy - 363 - (date.isLeapYear() ? 1 : 0);
3124
- if (doy - _dow >= 0) {
3125
- year++;
3038
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1000000));
3039
+ this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1000000));
3040
+ }
3041
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
3042
+ var lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
3043
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3044
+ ChronoField.MILLI_OF_DAY.checkValidValue(lod);
3126
3045
  }
3046
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1000));
3047
+ this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1000));
3048
+ }
3049
+ if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
3050
+ var sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
3051
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3052
+ ChronoField.SECOND_OF_DAY.checkValidValue(sod);
3053
+ }
3054
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
3055
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
3056
+ this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
3057
+ }
3058
+ if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
3059
+ var mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
3060
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3061
+ ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
3062
+ }
3063
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
3064
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
3065
+ }
3066
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3067
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
3068
+ ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
3069
+ }
3070
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3071
+ ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
3072
+ }
3073
+ }
3074
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3075
+ var los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3076
+ var cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
3077
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1000 + MathUtil.intMod(cos, 1000));
3078
+ }
3079
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
3080
+ var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3081
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
3082
+ this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
3083
+ }
3084
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
3085
+ var _nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3086
+ this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(_nos, 1000000));
3087
+ this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3088
+ }
3089
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3090
+ var _cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
3091
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, _cos * 1000);
3092
+ } else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
3093
+ var _los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3094
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, _los * 1000000);
3127
3095
  }
3128
- return year;
3129
- };
3130
- _proto.displayName = function displayName() {
3131
- return this.toString();
3132
- };
3133
- _proto.resolve = function resolve() {
3134
- return null;
3135
- };
3136
- _proto.name = function name() {
3137
- return this.toString();
3138
- };
3139
- return Field;
3140
- }(TemporalField);
3141
- var DAY_OF_QUARTER_FIELD = function (_Field) {
3142
- function DAY_OF_QUARTER_FIELD() {
3143
- return _Field.apply(this, arguments) || this;
3144
- }
3145
- _inheritsLoose(DAY_OF_QUARTER_FIELD, _Field);
3146
- var _proto2 = DAY_OF_QUARTER_FIELD.prototype;
3147
- _proto2.toString = function toString() {
3148
- return 'DayOfQuarter';
3149
3096
  };
3150
- _proto2.baseUnit = function baseUnit() {
3151
- return ChronoUnit.DAYS;
3097
+ _proto._resolveTimeInferZeroes = function _resolveTimeInferZeroes(resolverStyle) {
3098
+ var hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
3099
+ var moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
3100
+ var som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
3101
+ var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3102
+ if (hod == null) {
3103
+ return;
3104
+ }
3105
+ if (moh == null && (som != null || nos != null)) {
3106
+ return;
3107
+ }
3108
+ if (moh != null && som == null && nos != null) {
3109
+ return;
3110
+ }
3111
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3112
+ if (hod != null) {
3113
+ if (resolverStyle === ResolverStyle.SMART && hod === 24 && (moh == null || moh === 0) && (som == null || som === 0) && (nos == null || nos === 0)) {
3114
+ hod = 0;
3115
+ this.excessDays = Period.ofDays(1);
3116
+ }
3117
+ var hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
3118
+ if (moh != null) {
3119
+ var mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
3120
+ if (som != null) {
3121
+ var somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
3122
+ if (nos != null) {
3123
+ var nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
3124
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
3125
+ } else {
3126
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal));
3127
+ }
3128
+ } else {
3129
+ if (nos == null) {
3130
+ this._addObject(LocalTime.of(hodVal, mohVal));
3131
+ }
3132
+ }
3133
+ } else {
3134
+ if (som == null && nos == null) {
3135
+ this._addObject(LocalTime.of(hodVal, 0));
3136
+ }
3137
+ }
3138
+ }
3139
+ } else {
3140
+ if (hod != null) {
3141
+ var _hodVal = hod;
3142
+ if (moh != null) {
3143
+ if (som != null) {
3144
+ if (nos == null) {
3145
+ nos = 0;
3146
+ }
3147
+ var totalNanos = MathUtil.safeMultiply(_hodVal, 3600000000000);
3148
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 60000000000));
3149
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1000000000));
3150
+ totalNanos = MathUtil.safeAdd(totalNanos, nos);
3151
+ var excessDays = MathUtil.floorDiv(totalNanos, 86400000000000);
3152
+ var nod = MathUtil.floorMod(totalNanos, 86400000000000);
3153
+ this._addObject(LocalTime.ofNanoOfDay(nod));
3154
+ this.excessDays = Period.ofDays(excessDays);
3155
+ } else {
3156
+ var totalSecs = MathUtil.safeMultiply(_hodVal, 3600);
3157
+ totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
3158
+ var _excessDays = MathUtil.floorDiv(totalSecs, 86400);
3159
+ var sod = MathUtil.floorMod(totalSecs, 86400);
3160
+ this._addObject(LocalTime.ofSecondOfDay(sod));
3161
+ this.excessDays = Period.ofDays(_excessDays);
3162
+ }
3163
+ } else {
3164
+ var _excessDays2 = MathUtil.safeToInt(MathUtil.floorDiv(_hodVal, 24));
3165
+ _hodVal = MathUtil.floorMod(_hodVal, 24);
3166
+ this._addObject(LocalTime.of(_hodVal, 0));
3167
+ this.excessDays = Period.ofDays(_excessDays2);
3168
+ }
3169
+ }
3170
+ }
3171
+ this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
3172
+ this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
3173
+ this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
3174
+ this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
3152
3175
  };
3153
- _proto2.rangeUnit = function rangeUnit() {
3154
- return QUARTER_YEARS;
3176
+ _proto._addObject = function _addObject(dateOrTime) {
3177
+ if (dateOrTime instanceof ChronoLocalDate) {
3178
+ this.date = dateOrTime;
3179
+ } else if (dateOrTime instanceof LocalTime) {
3180
+ this.time = dateOrTime;
3181
+ }
3155
3182
  };
3156
- _proto2.range = function range() {
3157
- return ValueRange.of(1, 90, 92);
3183
+ _proto._resolveInstant = function _resolveInstant() {
3184
+ if (this.date != null && this.time != null) {
3185
+ var offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
3186
+ if (offsetSecs != null) {
3187
+ var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
3188
+ var instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
3189
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
3190
+ } else if (this.zone != null) {
3191
+ var _instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
3192
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, _instant);
3193
+ }
3194
+ }
3158
3195
  };
3159
- _proto2.isSupportedBy = function isSupportedBy(temporal) {
3160
- return temporal.isSupported(ChronoField.DAY_OF_YEAR) && temporal.isSupported(ChronoField.MONTH_OF_YEAR) && temporal.isSupported(ChronoField.YEAR) && this._isIso(temporal);
3196
+ _proto.build = function build(type) {
3197
+ return type.queryFrom(this);
3161
3198
  };
3162
- _proto2.rangeRefinedBy = function rangeRefinedBy(temporal) {
3163
- if (temporal.isSupported(this) === false) {
3164
- throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
3165
- }
3166
- var qoy = temporal.getLong(QUARTER_OF_YEAR);
3167
- if (qoy === 1) {
3168
- var year = temporal.getLong(ChronoField.YEAR);
3169
- return IsoChronology.isLeapYear(year) ? ValueRange.of(1, 91) : ValueRange.of(1, 90);
3170
- } else if (qoy === 2) {
3171
- return ValueRange.of(1, 91);
3172
- } else if (qoy === 3 || qoy === 4) {
3173
- return ValueRange.of(1, 92);
3199
+ _proto.isSupported = function isSupported(field) {
3200
+ if (field == null) {
3201
+ return false;
3174
3202
  }
3175
- return this.range();
3203
+ return this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== undefined || this.date != null && this.date.isSupported(field) || this.time != null && this.time.isSupported(field);
3176
3204
  };
3177
- _proto2.getFrom = function getFrom(temporal) {
3178
- if (temporal.isSupported(this) === false) {
3179
- throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
3205
+ _proto.getLong = function getLong(field) {
3206
+ requireNonNull(field, 'field');
3207
+ var value = this.getFieldValue0(field);
3208
+ if (value == null) {
3209
+ if (this.date != null && this.date.isSupported(field)) {
3210
+ return this.date.getLong(field);
3211
+ }
3212
+ if (this.time != null && this.time.isSupported(field)) {
3213
+ return this.time.getLong(field);
3214
+ }
3215
+ throw new DateTimeException("Field not found: " + field);
3180
3216
  }
3181
- var doy = temporal.get(ChronoField.DAY_OF_YEAR);
3182
- var moy = temporal.get(ChronoField.MONTH_OF_YEAR);
3183
- var year = temporal.getLong(ChronoField.YEAR);
3184
- return doy - QUARTER_DAYS[MathUtil.intDiv(moy - 1, 3) + (IsoChronology.isLeapYear(year) ? 4 : 0)];
3185
- };
3186
- _proto2.adjustInto = function adjustInto(temporal, newValue) {
3187
- var curValue = this.getFrom(temporal);
3188
- this.range().checkValidValue(newValue, this);
3189
- return temporal.with(ChronoField.DAY_OF_YEAR, temporal.getLong(ChronoField.DAY_OF_YEAR) + (newValue - curValue));
3217
+ return value;
3190
3218
  };
3191
- _proto2.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
3192
- var yearLong = fieldValues.get(ChronoField.YEAR);
3193
- var qoyLong = fieldValues.get(QUARTER_OF_YEAR);
3194
- if (yearLong == null || qoyLong == null) {
3219
+ _proto.query = function query(_query) {
3220
+ if (_query === TemporalQueries.zoneId()) {
3221
+ return this.zone;
3222
+ } else if (_query === TemporalQueries.chronology()) {
3223
+ return this.chrono;
3224
+ } else if (_query === TemporalQueries.localDate()) {
3225
+ return this.date != null ? LocalDate.from(this.date) : null;
3226
+ } else if (_query === TemporalQueries.localTime()) {
3227
+ return this.time;
3228
+ } else if (_query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
3229
+ return _query.queryFrom(this);
3230
+ } else if (_query === TemporalQueries.precision()) {
3195
3231
  return null;
3196
3232
  }
3197
- var y = ChronoField.YEAR.checkValidIntValue(yearLong);
3198
- var doq = fieldValues.get(DAY_OF_QUARTER);
3199
- var date;
3200
- if (resolverStyle === ResolverStyle.LENIENT) {
3201
- var qoy = qoyLong;
3202
- date = LocalDate.of(y, 1, 1);
3203
- date = date.plusMonths(MathUtil.safeMultiply(MathUtil.safeSubtract(qoy, 1), 3));
3204
- date = date.plusDays(MathUtil.safeSubtract(doq, 1));
3205
- } else {
3206
- var _qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);
3207
- if (resolverStyle === ResolverStyle.STRICT) {
3208
- var max = 92;
3209
- if (_qoy === 1) {
3210
- max = IsoChronology.isLeapYear(y) ? 91 : 90;
3211
- } else if (_qoy === 2) {
3212
- max = 91;
3213
- }
3214
- ValueRange.of(1, max).checkValidValue(doq, this);
3233
+ return _query.queryFrom(this);
3234
+ };
3235
+ return DateTimeBuilder;
3236
+ }(TemporalAccessor);
3237
+
3238
+ var DateTimeParseContext = function () {
3239
+ function DateTimeParseContext() {
3240
+ if (arguments.length === 1) {
3241
+ if (arguments[0] instanceof DateTimeParseContext) {
3242
+ this._constructorSelf.apply(this, arguments);
3243
+ return;
3215
3244
  } else {
3216
- this.range().checkValidValue(doq, this);
3245
+ this._constructorFormatter.apply(this, arguments);
3217
3246
  }
3218
- date = LocalDate.of(y, (_qoy - 1) * 3 + 1, 1).plusDays(doq - 1);
3247
+ } else {
3248
+ this._constructorParam.apply(this, arguments);
3219
3249
  }
3220
- fieldValues.remove(this);
3221
- fieldValues.remove(ChronoField.YEAR);
3222
- fieldValues.remove(QUARTER_OF_YEAR);
3223
- return date;
3224
- };
3225
- return DAY_OF_QUARTER_FIELD;
3226
- }(Field);
3227
- var QUARTER_OF_YEAR_FIELD = function (_Field2) {
3228
- function QUARTER_OF_YEAR_FIELD() {
3229
- return _Field2.apply(this, arguments) || this;
3250
+ this._caseSensitive = true;
3251
+ this._strict = true;
3252
+ this._parsed = [new Parsed(this)];
3230
3253
  }
3231
- _inheritsLoose(QUARTER_OF_YEAR_FIELD, _Field2);
3232
- var _proto3 = QUARTER_OF_YEAR_FIELD.prototype;
3233
- _proto3.toString = function toString() {
3234
- return 'QuarterOfYear';
3235
- };
3236
- _proto3.baseUnit = function baseUnit() {
3237
- return QUARTER_YEARS;
3238
- };
3239
- _proto3.rangeUnit = function rangeUnit() {
3240
- return ChronoUnit.YEARS;
3241
- };
3242
- _proto3.range = function range() {
3243
- return ValueRange.of(1, 4);
3254
+ var _proto = DateTimeParseContext.prototype;
3255
+ _proto._constructorParam = function _constructorParam(locale, symbols, chronology) {
3256
+ this._locale = locale;
3257
+ this._symbols = symbols;
3258
+ this._overrideChronology = chronology;
3244
3259
  };
3245
- _proto3.isSupportedBy = function isSupportedBy(temporal) {
3246
- return temporal.isSupported(ChronoField.MONTH_OF_YEAR) && this._isIso(temporal);
3260
+ _proto._constructorFormatter = function _constructorFormatter(formatter) {
3261
+ this._locale = formatter.locale();
3262
+ this._symbols = formatter.decimalStyle();
3263
+ this._overrideChronology = formatter.chronology();
3247
3264
  };
3248
- _proto3.rangeRefinedBy = function rangeRefinedBy(temporal) {
3249
- return this.range();
3265
+ _proto._constructorSelf = function _constructorSelf(other) {
3266
+ this._locale = other._locale;
3267
+ this._symbols = other._symbols;
3268
+ this._overrideChronology = other._overrideChronology;
3269
+ this._overrideZone = other._overrideZone;
3270
+ this._caseSensitive = other._caseSensitive;
3271
+ this._strict = other._strict;
3272
+ this._parsed = [new Parsed(this)];
3250
3273
  };
3251
- _proto3.getFrom = function getFrom(temporal) {
3252
- if (temporal.isSupported(this) === false) {
3253
- throw new UnsupportedTemporalTypeException('Unsupported field: QuarterOfYear');
3254
- }
3255
- var moy = temporal.getLong(ChronoField.MONTH_OF_YEAR);
3256
- return MathUtil.intDiv(moy + 2, 3);
3274
+ _proto.copy = function copy() {
3275
+ return new DateTimeParseContext(this);
3257
3276
  };
3258
- _proto3.adjustInto = function adjustInto(temporal, newValue) {
3259
- var curValue = this.getFrom(temporal);
3260
- this.range().checkValidValue(newValue, this);
3261
- return temporal.with(ChronoField.MONTH_OF_YEAR, temporal.getLong(ChronoField.MONTH_OF_YEAR) + (newValue - curValue) * 3);
3277
+ _proto.symbols = function symbols() {
3278
+ return this._symbols;
3262
3279
  };
3263
- return QUARTER_OF_YEAR_FIELD;
3264
- }(Field);
3265
- var WEEK_OF_WEEK_BASED_YEAR_FIELD = function (_Field3) {
3266
- function WEEK_OF_WEEK_BASED_YEAR_FIELD() {
3267
- return _Field3.apply(this, arguments) || this;
3268
- }
3269
- _inheritsLoose(WEEK_OF_WEEK_BASED_YEAR_FIELD, _Field3);
3270
- var _proto4 = WEEK_OF_WEEK_BASED_YEAR_FIELD.prototype;
3271
- _proto4.toString = function toString() {
3272
- return 'WeekOfWeekBasedYear';
3280
+ _proto.isStrict = function isStrict() {
3281
+ return this._strict;
3273
3282
  };
3274
- _proto4.baseUnit = function baseUnit() {
3275
- return ChronoUnit.WEEKS;
3283
+ _proto.setStrict = function setStrict(strict) {
3284
+ this._strict = strict;
3276
3285
  };
3277
- _proto4.rangeUnit = function rangeUnit() {
3278
- return WEEK_BASED_YEARS;
3286
+ _proto.locale = function locale() {
3287
+ return this._locale;
3279
3288
  };
3280
- _proto4.range = function range() {
3281
- return ValueRange.of(1, 52, 53);
3289
+ _proto.setLocale = function setLocale(locale) {
3290
+ this._locale = locale;
3282
3291
  };
3283
- _proto4.isSupportedBy = function isSupportedBy(temporal) {
3284
- return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
3292
+ _proto.startOptional = function startOptional() {
3293
+ this._parsed.push(this.currentParsed().copy());
3285
3294
  };
3286
- _proto4.rangeRefinedBy = function rangeRefinedBy(temporal) {
3287
- if (temporal.isSupported(this) === false) {
3288
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
3295
+ _proto.endOptional = function endOptional(successful) {
3296
+ if (successful) {
3297
+ this._parsed.splice(this._parsed.length - 2, 1);
3298
+ } else {
3299
+ this._parsed.splice(this._parsed.length - 1, 1);
3289
3300
  }
3290
- return Field._getWeekRangeByLocalDate(LocalDate.from(temporal));
3291
3301
  };
3292
- _proto4.getFrom = function getFrom(temporal) {
3293
- if (temporal.isSupported(this) === false) {
3294
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
3295
- }
3296
- return Field._getWeek(LocalDate.from(temporal));
3302
+ _proto.isCaseSensitive = function isCaseSensitive() {
3303
+ return this._caseSensitive;
3297
3304
  };
3298
- _proto4.adjustInto = function adjustInto(temporal, newValue) {
3299
- this.range().checkValidValue(newValue, this);
3300
- return temporal.plus(MathUtil.safeSubtract(newValue, this.getFrom(temporal)), ChronoUnit.WEEKS);
3305
+ _proto.setCaseSensitive = function setCaseSensitive(caseSensitive) {
3306
+ this._caseSensitive = caseSensitive;
3301
3307
  };
3302
- _proto4.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
3303
- var wbyLong = fieldValues.get(WEEK_BASED_YEAR);
3304
- var dowLong = fieldValues.get(ChronoField.DAY_OF_WEEK);
3305
- if (wbyLong == null || dowLong == null) {
3306
- return null;
3308
+ _proto.subSequenceEquals = function subSequenceEquals(cs1, offset1, cs2, offset2, length) {
3309
+ if (offset1 + length > cs1.length || offset2 + length > cs2.length) {
3310
+ return false;
3307
3311
  }
3308
- var wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);
3309
- var wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
3310
- var date;
3311
- if (resolverStyle === ResolverStyle.LENIENT) {
3312
- var dow = dowLong;
3313
- var weeks = 0;
3314
- if (dow > 7) {
3315
- weeks = MathUtil.intDiv(dow - 1, 7);
3316
- dow = MathUtil.intMod(dow - 1, 7) + 1;
3317
- } else if (dow < 1) {
3318
- weeks = MathUtil.intDiv(dow, 7) - 1;
3319
- dow = MathUtil.intMod(dow, 7) + 7;
3320
- }
3321
- date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).plusWeeks(weeks).with(ChronoField.DAY_OF_WEEK, dow);
3322
- } else {
3323
- var _dow2 = ChronoField.DAY_OF_WEEK.checkValidIntValue(dowLong);
3324
- if (resolverStyle === ResolverStyle.STRICT) {
3325
- var temp = LocalDate.of(wby, 1, 4);
3326
- var range = Field._getWeekRangeByLocalDate(temp);
3327
- range.checkValidValue(wowby, this);
3328
- } else {
3329
- this.range().checkValidValue(wowby, this);
3312
+ if (!this.isCaseSensitive()) {
3313
+ cs1 = cs1.toLowerCase();
3314
+ cs2 = cs2.toLowerCase();
3315
+ }
3316
+ for (var i = 0; i < length; i++) {
3317
+ var ch1 = cs1[offset1 + i];
3318
+ var ch2 = cs2[offset2 + i];
3319
+ if (ch1 !== ch2) {
3320
+ return false;
3330
3321
  }
3331
- date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).with(ChronoField.DAY_OF_WEEK, _dow2);
3332
3322
  }
3333
- fieldValues.remove(this);
3334
- fieldValues.remove(WEEK_BASED_YEAR);
3335
- fieldValues.remove(ChronoField.DAY_OF_WEEK);
3336
- return date;
3337
- };
3338
- _proto4.displayName = function displayName() {
3339
- return 'Week';
3323
+ return true;
3340
3324
  };
3341
- return WEEK_OF_WEEK_BASED_YEAR_FIELD;
3342
- }(Field);
3343
- var WEEK_BASED_YEAR_FIELD = function (_Field4) {
3344
- function WEEK_BASED_YEAR_FIELD() {
3345
- return _Field4.apply(this, arguments) || this;
3346
- }
3347
- _inheritsLoose(WEEK_BASED_YEAR_FIELD, _Field4);
3348
- var _proto5 = WEEK_BASED_YEAR_FIELD.prototype;
3349
- _proto5.toString = function toString() {
3350
- return 'WeekBasedYear';
3325
+ _proto.charEquals = function charEquals(ch1, ch2) {
3326
+ if (this.isCaseSensitive()) {
3327
+ return ch1 === ch2;
3328
+ }
3329
+ return this.charEqualsIgnoreCase(ch1, ch2);
3351
3330
  };
3352
- _proto5.baseUnit = function baseUnit() {
3353
- return WEEK_BASED_YEARS;
3331
+ _proto.charEqualsIgnoreCase = function charEqualsIgnoreCase(c1, c2) {
3332
+ return c1 === c2 || c1.toLowerCase() === c2.toLowerCase();
3354
3333
  };
3355
- _proto5.rangeUnit = function rangeUnit() {
3356
- return ChronoUnit.FOREVER;
3334
+ _proto.setParsedField = function setParsedField(field, value, errorPos, successPos) {
3335
+ var currentParsedFieldValues = this.currentParsed().fieldValues;
3336
+ var old = currentParsedFieldValues.get(field);
3337
+ currentParsedFieldValues.set(field, value);
3338
+ return old != null && old !== value ? ~errorPos : successPos;
3357
3339
  };
3358
- _proto5.range = function range() {
3359
- return ChronoField.YEAR.range();
3340
+ _proto.setParsedZone = function setParsedZone(zone) {
3341
+ requireNonNull(zone, 'zone');
3342
+ this.currentParsed().zone = zone;
3360
3343
  };
3361
- _proto5.isSupportedBy = function isSupportedBy(temporal) {
3362
- return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
3344
+ _proto.getParsed = function getParsed(field) {
3345
+ return this.currentParsed().fieldValues.get(field);
3363
3346
  };
3364
- _proto5.rangeRefinedBy = function rangeRefinedBy(temporal) {
3365
- return ChronoField.YEAR.range();
3347
+ _proto.toParsed = function toParsed() {
3348
+ return this.currentParsed();
3366
3349
  };
3367
- _proto5.getFrom = function getFrom(temporal) {
3368
- if (temporal.isSupported(this) === false) {
3369
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
3370
- }
3371
- return Field._getWeekBasedYear(LocalDate.from(temporal));
3350
+ _proto.currentParsed = function currentParsed() {
3351
+ return this._parsed[this._parsed.length - 1];
3372
3352
  };
3373
- _proto5.adjustInto = function adjustInto(temporal, newValue) {
3374
- if (this.isSupportedBy(temporal) === false) {
3375
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
3376
- }
3377
- var newWby = this.range().checkValidIntValue(newValue, WEEK_BASED_YEAR);
3378
- var date = LocalDate.from(temporal);
3379
- var dow = date.get(ChronoField.DAY_OF_WEEK);
3380
- var week = Field._getWeek(date);
3381
- if (week === 53 && Field._getWeekRangeByYear(newWby) === 52) {
3382
- week = 52;
3353
+ _proto.setParsedLeapSecond = function setParsedLeapSecond() {
3354
+ this.currentParsed().leapSecond = true;
3355
+ };
3356
+ _proto.getEffectiveChronology = function getEffectiveChronology() {
3357
+ var chrono = this.currentParsed().chrono;
3358
+ if (chrono == null) {
3359
+ chrono = this._overrideChronology;
3360
+ if (chrono == null) {
3361
+ chrono = IsoChronology.INSTANCE;
3362
+ }
3383
3363
  }
3384
- var resolved = LocalDate.of(newWby, 1, 4);
3385
- var days = dow - resolved.get(ChronoField.DAY_OF_WEEK) + (week - 1) * 7;
3386
- resolved = resolved.plusDays(days);
3387
- return temporal.with(resolved);
3364
+ return chrono;
3388
3365
  };
3389
- return WEEK_BASED_YEAR_FIELD;
3390
- }(Field);
3391
- var Unit = function (_TemporalUnit) {
3392
- function Unit(name, estimatedDuration) {
3366
+ return DateTimeParseContext;
3367
+ }();
3368
+ var Parsed = function (_Temporal) {
3369
+ function Parsed(dateTimeParseContext) {
3393
3370
  var _this;
3394
- _this = _TemporalUnit.call(this) || this;
3395
- _this._name = name;
3396
- _this._duration = estimatedDuration;
3371
+ _this = _Temporal.call(this) || this;
3372
+ _this.chrono = null;
3373
+ _this.zone = null;
3374
+ _this.fieldValues = new EnumMap();
3375
+ _this.leapSecond = false;
3376
+ _this.excessDays = Period.ZERO;
3377
+ _this.dateTimeParseContext = dateTimeParseContext;
3397
3378
  return _this;
3398
3379
  }
3399
- _inheritsLoose(Unit, _TemporalUnit);
3400
- var _proto6 = Unit.prototype;
3401
- _proto6.duration = function duration() {
3402
- return this._duration;
3380
+ _inheritsLoose(Parsed, _Temporal);
3381
+ var _proto2 = Parsed.prototype;
3382
+ _proto2.copy = function copy() {
3383
+ var cloned = new Parsed();
3384
+ cloned.chrono = this.chrono;
3385
+ cloned.zone = this.zone;
3386
+ cloned.fieldValues.putAll(this.fieldValues);
3387
+ cloned.leapSecond = this.leapSecond;
3388
+ cloned.dateTimeParseContext = this.dateTimeParseContext;
3389
+ return cloned;
3403
3390
  };
3404
- _proto6.isDurationEstimated = function isDurationEstimated() {
3405
- return true;
3391
+ _proto2.toString = function toString() {
3392
+ return this.fieldValues + ", " + this.chrono + ", " + this.zone;
3406
3393
  };
3407
- _proto6.isDateBased = function isDateBased() {
3408
- return true;
3394
+ _proto2.isSupported = function isSupported(field) {
3395
+ return this.fieldValues.containsKey(field);
3409
3396
  };
3410
- _proto6.isTimeBased = function isTimeBased() {
3411
- return false;
3397
+ _proto2.get = function get(field) {
3398
+ var val = this.fieldValues.get(field);
3399
+ assert(val != null);
3400
+ return val;
3412
3401
  };
3413
- _proto6.isSupportedBy = function isSupportedBy(temporal) {
3414
- return temporal.isSupported(ChronoField.EPOCH_DAY);
3402
+ _proto2.query = function query(_query) {
3403
+ if (_query === TemporalQueries.chronology()) {
3404
+ return this.chrono;
3405
+ }
3406
+ if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
3407
+ return this.zone;
3408
+ }
3409
+ return _Temporal.prototype.query.call(this, _query);
3415
3410
  };
3416
- _proto6.addTo = function addTo(temporal, periodToAdd) {
3417
- switch (this) {
3418
- case WEEK_BASED_YEARS:
3419
- {
3420
- var added = MathUtil.safeAdd(temporal.get(WEEK_BASED_YEAR), periodToAdd);
3421
- return temporal.with(WEEK_BASED_YEAR, added);
3422
- }
3423
- case QUARTER_YEARS:
3424
- return temporal.plus(MathUtil.intDiv(periodToAdd, 256), ChronoUnit.YEARS).plus(MathUtil.intMod(periodToAdd, 256) * 3, ChronoUnit.MONTHS);
3425
- default:
3426
- throw new IllegalStateException('Unreachable');
3411
+ _proto2.toBuilder = function toBuilder() {
3412
+ var builder = new DateTimeBuilder();
3413
+ builder.fieldValues.putAll(this.fieldValues);
3414
+ builder.chrono = this.dateTimeParseContext.getEffectiveChronology();
3415
+ if (this.zone != null) {
3416
+ builder.zone = this.zone;
3417
+ } else {
3418
+ builder.zone = this.overrideZone;
3427
3419
  }
3420
+ builder.leapSecond = this.leapSecond;
3421
+ builder.excessDays = this.excessDays;
3422
+ return builder;
3428
3423
  };
3429
- _proto6.between = function between(temporal1, temporal2) {
3430
- switch (this) {
3431
- case WEEK_BASED_YEARS:
3432
- return MathUtil.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
3433
- case QUARTER_YEARS:
3434
- return MathUtil.intDiv(temporal1.until(temporal2, ChronoUnit.MONTHS), 3);
3435
- default:
3436
- throw new IllegalStateException('Unreachable');
3424
+ return Parsed;
3425
+ }(Temporal);
3426
+
3427
+ /*
3428
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3429
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
3430
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
3431
+ */
3432
+
3433
+ var DateTimePrintContext = function () {
3434
+ function DateTimePrintContext(temporal, localeOrFormatter, symbols) {
3435
+ if (arguments.length === 2 && arguments[1] instanceof DateTimeFormatter) {
3436
+ this._temporal = DateTimePrintContext.adjust(temporal, localeOrFormatter);
3437
+ this._locale = localeOrFormatter.locale();
3438
+ this._symbols = localeOrFormatter.decimalStyle();
3439
+ } else {
3440
+ this._temporal = temporal;
3441
+ this._locale = localeOrFormatter;
3442
+ this._symbols = symbols;
3437
3443
  }
3444
+ this._optional = 0;
3445
+ }
3446
+ DateTimePrintContext.adjust = function adjust(temporal, formatter) {
3447
+ return temporal;
3438
3448
  };
3439
- _proto6.toString = function toString() {
3440
- return this._name;
3449
+ var _proto = DateTimePrintContext.prototype;
3450
+ _proto.symbols = function symbols() {
3451
+ return this._symbols;
3441
3452
  };
3442
- return Unit;
3443
- }(TemporalUnit);
3444
- var DAY_OF_QUARTER = null;
3445
- var QUARTER_OF_YEAR = null;
3446
- var WEEK_OF_WEEK_BASED_YEAR = null;
3447
- var WEEK_BASED_YEAR = null;
3448
- var WEEK_BASED_YEARS = null;
3449
- var QUARTER_YEARS = null;
3450
- function _init$f() {
3451
- DAY_OF_QUARTER = new DAY_OF_QUARTER_FIELD();
3452
- QUARTER_OF_YEAR = new QUARTER_OF_YEAR_FIELD();
3453
- WEEK_OF_WEEK_BASED_YEAR = new WEEK_OF_WEEK_BASED_YEAR_FIELD();
3454
- WEEK_BASED_YEAR = new WEEK_BASED_YEAR_FIELD();
3455
- WEEK_BASED_YEARS = new Unit('WeekBasedYears', Duration.ofSeconds(31556952));
3456
- QUARTER_YEARS = new Unit('QuarterYears', Duration.ofSeconds(31556952 / 4));
3457
- IsoFields.DAY_OF_QUARTER = DAY_OF_QUARTER;
3458
- IsoFields.QUARTER_OF_YEAR = QUARTER_OF_YEAR;
3459
- IsoFields.WEEK_OF_WEEK_BASED_YEAR = WEEK_OF_WEEK_BASED_YEAR;
3460
- IsoFields.WEEK_BASED_YEAR = WEEK_BASED_YEAR;
3461
- IsoFields.WEEK_BASED_YEARS = WEEK_BASED_YEARS;
3462
- IsoFields.QUARTER_YEARS = QUARTER_YEARS;
3463
- LocalDate.prototype.isoWeekOfWeekyear = function () {
3464
- return this.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
3453
+ _proto.startOptional = function startOptional() {
3454
+ this._optional++;
3465
3455
  };
3466
- LocalDate.prototype.isoWeekyear = function () {
3467
- return this.get(IsoFields.WEEK_BASED_YEAR);
3456
+ _proto.endOptional = function endOptional() {
3457
+ this._optional--;
3468
3458
  };
3469
- }
3459
+ _proto.getValueQuery = function getValueQuery(query) {
3460
+ var result = this._temporal.query(query);
3461
+ if (result == null && this._optional === 0) {
3462
+ throw new DateTimeException("Unable to extract value: " + this._temporal);
3463
+ }
3464
+ return result;
3465
+ };
3466
+ _proto.getValue = function getValue(field) {
3467
+ try {
3468
+ return this._temporal.getLong(field);
3469
+ } catch (ex) {
3470
+ if (ex instanceof DateTimeException && this._optional > 0) {
3471
+ return null;
3472
+ }
3473
+ throw ex;
3474
+ }
3475
+ };
3476
+ _proto.temporal = function temporal() {
3477
+ return this._temporal;
3478
+ };
3479
+ _proto.locale = function locale() {
3480
+ return this._locale;
3481
+ };
3482
+ _proto.setDateTime = function setDateTime(temporal) {
3483
+ this._temporal = temporal;
3484
+ };
3485
+ _proto.setLocale = function setLocale(locale) {
3486
+ this._locale = locale;
3487
+ };
3488
+ return DateTimePrintContext;
3489
+ }();
3470
3490
 
3471
3491
  /**
3472
3492
  * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
@@ -5518,7 +5538,7 @@ function _init$d() {
5518
5538
  DateTimeFormatter.ISO_OFFSET_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5519
5539
  DateTimeFormatter.ISO_OFFSET_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5520
5540
  DateTimeFormatter.ISO_ORDINAL_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-').appendValue(ChronoField.DAY_OF_YEAR).toFormatter(ResolverStyle.STRICT);
5521
- DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-W').appendValue(ChronoField.ALIGNED_WEEK_OF_YEAR).appendLiteral('-').appendValue(ChronoField.DAY_OF_WEEK).toFormatter(ResolverStyle.STRICT);
5541
+ DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().appendValue(IsoFields.WEEK_BASED_YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-W').appendValue(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 2).appendLiteral('-').appendValue(ChronoField.DAY_OF_WEEK, 1).toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5522
5542
  DateTimeFormatter.ISO_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5523
5543
  DateTimeFormatter.ISO_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT);
5524
5544
  DateTimeFormatter.ISO_DATE_TIME = new DateTimeFormatterBuilder().append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
@@ -9802,8 +9822,16 @@ var Instant = function (_Temporal) {
9802
9822
  };
9803
9823
  _proto._microsUntil = function _microsUntil(end) {
9804
9824
  var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
9825
+ var nanosDiff = end.nano() - this.nano();
9826
+ if (secsDiff > 0 && nanosDiff < 0) {
9827
+ secsDiff--;
9828
+ nanosDiff += LocalTime.NANOS_PER_SECOND;
9829
+ } else if (secsDiff < 0 && nanosDiff > 0) {
9830
+ secsDiff++;
9831
+ nanosDiff -= LocalTime.NANOS_PER_SECOND;
9832
+ }
9805
9833
  var totalMicros = MathUtil.safeMultiply(secsDiff, 1000000);
9806
- return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(end.nano() - this.nano(), 1000));
9834
+ return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(nanosDiff, 1000));
9807
9835
  };
9808
9836
  _proto._nanosUntil = function _nanosUntil(end) {
9809
9837
  var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
@@ -10342,7 +10370,7 @@ function init() {
10342
10370
  _init$l();
10343
10371
  _init$k();
10344
10372
  _init$3();
10345
- _init$f();
10373
+ _init$g();
10346
10374
  _init$1();
10347
10375
  _init$j();
10348
10376
  _init$2();
@@ -10353,7 +10381,7 @@ function init() {
10353
10381
  _init$b();
10354
10382
  _init$c();
10355
10383
  _init$h();
10356
- _init$g();
10384
+ _init$f();
10357
10385
  _init$7();
10358
10386
  _init();
10359
10387
  _init$9();