@js-joda/extra 0.9.0 → 0.10.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/extra - 0.9.0
1
+ //! @version @js-joda/extra - 0.10.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)
@@ -29,6 +29,15 @@
29
29
  * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
30
30
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
31
31
  */
32
+ function assert(assertion, msg, error) {
33
+ if (!assertion) {
34
+ if (error) {
35
+ throw new error(msg);
36
+ } else {
37
+ throw new Error(msg);
38
+ }
39
+ }
40
+ }
32
41
  function requireNonNull(value, parameterName) {
33
42
  if (value == null) {
34
43
  throw new core.NullPointerException(parameterName + " must not be null");
@@ -44,24 +53,24 @@
44
53
  return value;
45
54
  }
46
55
 
47
- var MathUtil$1 = core._.MathUtil;
56
+ var MathUtil$5 = core._.MathUtil;
48
57
  var DayOfMonth = function (_TemporalAccessor) {
49
58
  _inheritsLoose(DayOfMonth, _TemporalAccessor);
50
59
 
51
60
  DayOfMonth.now = function now(zoneIdOrClock) {
52
61
  switch (arguments.length) {
53
62
  case 0:
54
- return DayOfMonth.now0();
63
+ return DayOfMonth._now0();
55
64
 
56
65
  case 1:
57
66
  requireNonNull(zoneIdOrClock, 'clockOrZone');
58
67
 
59
68
  if (zoneIdOrClock instanceof core.ZoneId) {
60
- return DayOfMonth.nowZoneId(zoneIdOrClock);
69
+ return DayOfMonth._nowZoneId(zoneIdOrClock);
61
70
  }
62
71
 
63
72
  if (zoneIdOrClock instanceof core.Clock) {
64
- return DayOfMonth.nowClock(zoneIdOrClock);
73
+ return DayOfMonth._nowClock(zoneIdOrClock);
65
74
  }
66
75
 
67
76
  throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
@@ -71,15 +80,15 @@
71
80
  }
72
81
  };
73
82
 
74
- DayOfMonth.now0 = function now0() {
83
+ DayOfMonth._now0 = function _now0() {
75
84
  return this.now(core.Clock.systemDefaultZone());
76
85
  };
77
86
 
78
- DayOfMonth.nowZoneId = function nowZoneId(zone) {
87
+ DayOfMonth._nowZoneId = function _nowZoneId(zone) {
79
88
  return this.now(core.Clock.system(zone));
80
89
  };
81
90
 
82
- DayOfMonth.nowClock = function nowClock(clock) {
91
+ DayOfMonth._nowClock = function _nowClock(clock) {
83
92
  var now = core.LocalDate.now(clock);
84
93
  return DayOfMonth.of(now.dayOfMonth());
85
94
  };
@@ -110,7 +119,7 @@
110
119
  var _this;
111
120
 
112
121
  _this = _TemporalAccessor.call(this) || this;
113
- _this._day = MathUtil$1.safeToInt(dayOfMonth);
122
+ _this._day = MathUtil$5.safeToInt(dayOfMonth);
114
123
  return _this;
115
124
  }
116
125
 
@@ -217,7 +226,7 @@
217
226
 
218
227
  return DayOfMonth;
219
228
  }(core.TemporalAccessor);
220
- function _init$2() {
229
+ function _init$7() {
221
230
  DayOfMonth.VALUES = new Array(31);
222
231
 
223
232
  for (var i = 0; i < 31; i++) {
@@ -225,24 +234,24 @@
225
234
  }
226
235
  }
227
236
 
228
- var MathUtil = core._.MathUtil;
237
+ var MathUtil$4 = core._.MathUtil;
229
238
  var DayOfYear = function (_TemporalAccessor) {
230
239
  _inheritsLoose(DayOfYear, _TemporalAccessor);
231
240
 
232
241
  DayOfYear.now = function now(zoneIdOrClock) {
233
242
  switch (arguments.length) {
234
243
  case 0:
235
- return DayOfYear.now0();
244
+ return DayOfYear._now0();
236
245
 
237
246
  case 1:
238
247
  requireNonNull(zoneIdOrClock, 'clockOrZone');
239
248
 
240
249
  if (zoneIdOrClock instanceof core.ZoneId) {
241
- return DayOfYear.nowZoneId(zoneIdOrClock);
250
+ return DayOfYear._nowZoneId(zoneIdOrClock);
242
251
  }
243
252
 
244
253
  if (zoneIdOrClock instanceof core.Clock) {
245
- return DayOfYear.nowClock(zoneIdOrClock);
254
+ return DayOfYear._nowClock(zoneIdOrClock);
246
255
  }
247
256
 
248
257
  throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
@@ -252,15 +261,15 @@
252
261
  }
253
262
  };
254
263
 
255
- DayOfYear.now0 = function now0() {
264
+ DayOfYear._now0 = function _now0() {
256
265
  return DayOfYear.now(core.Clock.systemDefaultZone());
257
266
  };
258
267
 
259
- DayOfYear.nowZoneId = function nowZoneId(zone) {
268
+ DayOfYear._nowZoneId = function _nowZoneId(zone) {
260
269
  return DayOfYear.now(core.Clock.system(zone));
261
270
  };
262
271
 
263
- DayOfYear.nowClock = function nowClock(clock) {
272
+ DayOfYear._nowClock = function _nowClock(clock) {
264
273
  var now = core.LocalDate.now(clock);
265
274
  return DayOfYear.of(now.dayOfYear());
266
275
  };
@@ -292,7 +301,7 @@
292
301
  var _this;
293
302
 
294
303
  _this = _TemporalAccessor.call(this) || this;
295
- _this._day = MathUtil.safeToInt(dayOfYear);
304
+ _this._day = MathUtil$4.safeToInt(dayOfYear);
296
305
  return _this;
297
306
  }
298
307
 
@@ -394,7 +403,7 @@
394
403
 
395
404
  return DayOfYear;
396
405
  }(core.TemporalAccessor);
397
- function _init$1() {
406
+ function _init$6() {
398
407
  DayOfYear.VALUES = new Array(366);
399
408
 
400
409
  for (var i = 0; i < 366; i++) {
@@ -662,10 +671,1965 @@
662
671
 
663
672
  return Interval;
664
673
  }();
665
- function _init() {
674
+ function _init$5() {
666
675
  Interval.ALL = Interval.of(core.Instant.MIN, core.Instant.MAX);
667
676
  }
668
677
 
678
+ /**
679
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper & Michał Sobkiewicz
680
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
681
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
682
+ */
683
+ var MINP1 = core.LocalDate.MIN.plusDays(1);
684
+ var MAXM1 = core.LocalDate.MAX.minusDays(1);
685
+ var LocalDateRange = function () {
686
+ LocalDateRange.of = function of(startInclusive, endExclusiveOrPeriod) {
687
+ if (startInclusive instanceof core.LocalDate && endExclusiveOrPeriod instanceof core.LocalDate) {
688
+ return LocalDateRange._ofLocalDateLocalDate(startInclusive, endExclusiveOrPeriod);
689
+ }
690
+
691
+ if (startInclusive instanceof core.LocalDate && endExclusiveOrPeriod instanceof core.Period) {
692
+ return LocalDateRange._ofLocalDatePeriod(startInclusive, endExclusiveOrPeriod);
693
+ }
694
+
695
+ var messageParts = [];
696
+
697
+ if (!(startInclusive instanceof core.LocalDate)) {
698
+ messageParts.push("startInclusive must be an instance of LocalDate but is " + startInclusive.constructor.name);
699
+ }
700
+
701
+ if (!(endExclusiveOrPeriod instanceof core.LocalDate || endExclusiveOrPeriod instanceof core.Period)) {
702
+ messageParts.push("endExclusiveOrPeriod must be an instance of LocalDate or Period but is " + endExclusiveOrPeriod.constructor.name);
703
+ }
704
+
705
+ throw new core.IllegalArgumentException(messageParts.join(' and '));
706
+ };
707
+
708
+ LocalDateRange._ofLocalDateLocalDate = function _ofLocalDateLocalDate(startInclusive, endExclusive) {
709
+ requireNonNull(startInclusive, 'startInclusive');
710
+ requireNonNull(endExclusive, 'endExclusive');
711
+ requireInstance(startInclusive, core.LocalDate, 'startInclusive');
712
+ requireInstance(endExclusive, core.LocalDate, 'endExclusive');
713
+ return new LocalDateRange(startInclusive, endExclusive);
714
+ };
715
+
716
+ LocalDateRange._ofLocalDatePeriod = function _ofLocalDatePeriod(startInclusive, period) {
717
+ requireNonNull(startInclusive, 'startInclusive');
718
+ requireNonNull(period, 'period');
719
+ requireInstance(startInclusive, core.LocalDate, 'startInclusive');
720
+ requireInstance(period, core.Period, 'period');
721
+
722
+ if (period.isNegative()) {
723
+ throw new core.DateTimeException('Period must not be zero or negative');
724
+ }
725
+
726
+ return new LocalDateRange(startInclusive, startInclusive.plus(period));
727
+ };
728
+
729
+ LocalDateRange.ofClosed = function ofClosed(startInclusive, endInclusive) {
730
+ requireNonNull(startInclusive, 'startInclusive');
731
+ requireNonNull(endInclusive, 'endInclusive');
732
+ requireInstance(startInclusive, core.LocalDate, 'startInclusive');
733
+ requireInstance(endInclusive, core.LocalDate, 'endInclusive');
734
+
735
+ if (endInclusive.isBefore(startInclusive)) {
736
+ throw new core.DateTimeException('Start date must be on or before end date');
737
+ }
738
+
739
+ var end = endInclusive.equals(core.LocalDate.MAX) ? core.LocalDate.MAX : endInclusive.plusDays(1);
740
+ return new LocalDateRange(startInclusive, end);
741
+ };
742
+
743
+ LocalDateRange.ofEmpty = function ofEmpty(date) {
744
+ requireNonNull(date, 'date');
745
+ requireInstance(date, core.LocalDate, 'date');
746
+ return new LocalDateRange(date, date);
747
+ };
748
+
749
+ LocalDateRange.ofUnbounded = function ofUnbounded() {
750
+ return LocalDateRange.ALL;
751
+ };
752
+
753
+ LocalDateRange.ofUnboundedStart = function ofUnboundedStart(endExclusive) {
754
+ requireNonNull(endExclusive, 'endExclusive');
755
+ requireInstance(endExclusive, core.LocalDate, 'endExclusive');
756
+ return LocalDateRange.of(core.LocalDate.MIN, endExclusive);
757
+ };
758
+
759
+ LocalDateRange.ofUnboundedEnd = function ofUnboundedEnd(startInclusive) {
760
+ return LocalDateRange.of(startInclusive, core.LocalDate.MAX);
761
+ };
762
+
763
+ LocalDateRange.parse = function parse(text) {
764
+ requireNonNull(text, 'text');
765
+
766
+ for (var i = 0; i < text.length; i++) {
767
+ if (text[i] === '/') {
768
+ var firstChar = text.charAt(0);
769
+
770
+ if (firstChar === 'P' || firstChar === 'p') {
771
+ var duration = core.Period.parse(text.slice(0, i));
772
+ var end = core.LocalDate.parse(text.slice(i + 1, text.length));
773
+ return LocalDateRange.of(end.minus(duration), end);
774
+ } else {
775
+ var start = core.LocalDate.parse(text.slice(0, i));
776
+
777
+ if (i + 1 < text.length) {
778
+ var c = text[i + 1];
779
+
780
+ if (c === 'P' || c === 'p') {
781
+ var _duration = core.Period.parse(text.slice(i + 1, text.length));
782
+
783
+ return LocalDateRange.of(start, start.plus(_duration));
784
+ }
785
+ }
786
+
787
+ var _end = core.LocalDate.parse(text.slice(i + 1, text.length));
788
+
789
+ return LocalDateRange.of(start, _end);
790
+ }
791
+ }
792
+ }
793
+
794
+ throw new core.DateTimeParseException('LocalDateRange cannot be parsed, no forward slash found', text, 0);
795
+ };
796
+
797
+ function LocalDateRange(startInclusive, endExclusive) {
798
+ requireNonNull(startInclusive, 'startInclusive');
799
+ requireNonNull(endExclusive, 'endExclusive');
800
+ requireInstance(startInclusive, core.LocalDate, 'startInclusive');
801
+ requireInstance(endExclusive, core.LocalDate, 'endExclusive');
802
+
803
+ if (endExclusive.isBefore(startInclusive)) {
804
+ throw new core.DateTimeException('End date must be on or after start date');
805
+ }
806
+
807
+ if (startInclusive.equals(MAXM1)) {
808
+ throw new core.DateTimeException('Range must not start at LocalDate.MAX.minusDays(1)');
809
+ }
810
+
811
+ if (endExclusive.equals(MINP1)) {
812
+ throw new core.DateTimeException('Range must not end at LocalDate.MIN.plusDays(1)');
813
+ }
814
+
815
+ if (endExclusive.equals(core.LocalDate.MIN) || startInclusive.equals(core.LocalDate.MAX)) {
816
+ throw new core.DateTimeException('Empty range must not be at LocalDate.MIN or LocalDate.MAX');
817
+ }
818
+
819
+ this._start = startInclusive;
820
+ this._end = endExclusive;
821
+ }
822
+
823
+ var _proto = LocalDateRange.prototype;
824
+
825
+ _proto.start = function start() {
826
+ return this._start;
827
+ };
828
+
829
+ _proto.end = function end() {
830
+ return this._end;
831
+ };
832
+
833
+ _proto.endInclusive = function endInclusive() {
834
+ if (this.isUnboundedEnd()) {
835
+ return core.LocalDate.MAX;
836
+ }
837
+
838
+ return this._end.minusDays(1);
839
+ };
840
+
841
+ _proto.isEmpty = function isEmpty() {
842
+ return this._start.equals(this._end);
843
+ };
844
+
845
+ _proto.isUnboundedStart = function isUnboundedStart() {
846
+ return this._start.equals(core.LocalDate.MIN);
847
+ };
848
+
849
+ _proto.isUnboundedEnd = function isUnboundedEnd() {
850
+ return this._end.equals(core.LocalDate.MAX);
851
+ };
852
+
853
+ _proto.withStart = function withStart(adjuster) {
854
+ return LocalDateRange.of(this._start.with(adjuster), this._end);
855
+ };
856
+
857
+ _proto.withEnd = function withEnd(adjuster) {
858
+ return LocalDateRange.of(this._start, this._end.with(adjuster));
859
+ };
860
+
861
+ _proto.contains = function contains(date) {
862
+ requireNonNull(date, 'date');
863
+ return this._start.compareTo(date) <= 0 && (date.compareTo(this._end) < 0 || this.isUnboundedEnd());
864
+ };
865
+
866
+ _proto.encloses = function encloses(other) {
867
+ requireNonNull(other, 'other');
868
+ return this._start.compareTo(other._start) <= 0 && other._end.compareTo(this._end) <= 0;
869
+ };
870
+
871
+ _proto.abuts = function abuts(other) {
872
+ requireNonNull(other, 'other');
873
+ return this._end.equals(other._start) !== this._start.equals(other._end);
874
+ };
875
+
876
+ _proto.isConnected = function isConnected(other) {
877
+ requireNonNull(other, 'other');
878
+ return this.equals(other) || this._start.compareTo(other._end) <= 0 && other._start.compareTo(this._end) <= 0;
879
+ };
880
+
881
+ _proto.overlaps = function overlaps(other) {
882
+ requireNonNull(other, 'other');
883
+ return other.equals(this) || this._start.compareTo(other._end) < 0 && other._start.compareTo(this._end) < 0;
884
+ };
885
+
886
+ _proto.intersection = function intersection(other) {
887
+ requireNonNull(other, 'other');
888
+
889
+ if (this.isConnected(other) === false) {
890
+ throw new core.DateTimeException("Ranges do not connect: " + this + " and " + other);
891
+ }
892
+
893
+ var cmpStart = this._start.compareTo(other._start);
894
+
895
+ var cmpEnd = this._end.compareTo(other._end);
896
+
897
+ if (cmpStart >= 0 && cmpEnd <= 0) {
898
+ return this;
899
+ } else if (cmpStart <= 0 && cmpEnd >= 0) {
900
+ return other;
901
+ } else {
902
+ var newStart = cmpStart >= 0 ? this._start : other._start;
903
+ var newEnd = cmpEnd <= 0 ? this._end : other._end;
904
+ return LocalDateRange.of(newStart, newEnd);
905
+ }
906
+ };
907
+
908
+ _proto.union = function union(other) {
909
+ requireNonNull(other, 'other');
910
+
911
+ if (this.isConnected(other) === false) {
912
+ throw new core.DateTimeException("Ranges do not connect: " + this + " and " + other);
913
+ }
914
+
915
+ var cmpStart = this._start.compareTo(other._start);
916
+
917
+ var cmpEnd = this._end.compareTo(other._end);
918
+
919
+ if (cmpStart >= 0 && cmpEnd <= 0) {
920
+ return other;
921
+ } else if (cmpStart <= 0 && cmpEnd >= 0) {
922
+ return this;
923
+ } else {
924
+ var newStart = cmpStart >= 0 ? other._start : this._start;
925
+ var newEnd = cmpEnd <= 0 ? other._end : this._end;
926
+ return LocalDateRange.of(newStart, newEnd);
927
+ }
928
+ };
929
+
930
+ _proto.span = function span(other) {
931
+ requireNonNull(other, 'other');
932
+
933
+ var cmpStart = this._start.compareTo(other._start);
934
+
935
+ var cmpEnd = this._end.compareTo(other._end);
936
+
937
+ var newStart = cmpStart >= 0 ? other._start : this._start;
938
+ var newEnd = cmpEnd <= 0 ? other._end : this._end;
939
+ return LocalDateRange.of(newStart, newEnd);
940
+ };
941
+
942
+ _proto.isAfter = function isAfter(localDateOrLocalDateRange) {
943
+ if (localDateOrLocalDateRange instanceof core.LocalDate) {
944
+ return this._isAfterLocalDate(localDateOrLocalDateRange);
945
+ }
946
+
947
+ if (localDateOrLocalDateRange instanceof LocalDateRange) {
948
+ return this._isAfterLocalDateRange(localDateOrLocalDateRange);
949
+ }
950
+
951
+ throw new core.IllegalArgumentException("localDateOrLocalDateRange must be an instance of LocalDate or LocalDateRange but is " + localDateOrLocalDateRange.constructor.name);
952
+ };
953
+
954
+ _proto.isBefore = function isBefore(localDateOrLocalDateRange) {
955
+ if (localDateOrLocalDateRange instanceof core.LocalDate) {
956
+ return this._isBeforeLocalDate(localDateOrLocalDateRange);
957
+ }
958
+
959
+ if (localDateOrLocalDateRange instanceof LocalDateRange) {
960
+ return this._isBeforeLocalDateRange(localDateOrLocalDateRange);
961
+ }
962
+
963
+ throw new core.IllegalArgumentException("localDateOrLocalDateRange must be an instance of LocalDate or LocalDateRange but is " + localDateOrLocalDateRange.constructor.name);
964
+ };
965
+
966
+ _proto._isAfterLocalDate = function _isAfterLocalDate(date) {
967
+ return this._start.compareTo(date) > 0;
968
+ };
969
+
970
+ _proto._isBeforeLocalDate = function _isBeforeLocalDate(date) {
971
+ return this._end.compareTo(date) <= 0 && this._start.compareTo(date) < 0;
972
+ };
973
+
974
+ _proto._isAfterLocalDateRange = function _isAfterLocalDateRange(other) {
975
+ return this._start.compareTo(other._end) >= 0 && !other.equals(this);
976
+ };
977
+
978
+ _proto._isBeforeLocalDateRange = function _isBeforeLocalDateRange(range) {
979
+ return this._end.compareTo(range._start) <= 0 && !range.equals(this);
980
+ };
981
+
982
+ _proto.lengthInDays = function lengthInDays() {
983
+ if (this.isUnboundedStart() || this.isUnboundedEnd()) {
984
+ return Number.NaN;
985
+ }
986
+
987
+ return this._end.toEpochDay() - this._start.toEpochDay();
988
+ };
989
+
990
+ _proto.toPeriod = function toPeriod() {
991
+ if (this.isUnboundedStart() || this.isUnboundedEnd()) {
992
+ throw new core.ArithmeticException('Unbounded range cannot be converted to a Period');
993
+ }
994
+
995
+ return core.Period.between(this._start, this._end);
996
+ };
997
+
998
+ _proto.equals = function equals(obj) {
999
+ if (this === obj) {
1000
+ return true;
1001
+ }
1002
+
1003
+ if (obj instanceof LocalDateRange) {
1004
+ var other = obj;
1005
+ return this._start.equals(other._start) && this._end.equals(other._end);
1006
+ }
1007
+
1008
+ return false;
1009
+ };
1010
+
1011
+ _proto.hashCode = function hashCode() {
1012
+ return this._start.hashCode() ^ this._end.hashCode();
1013
+ };
1014
+
1015
+ _proto.toString = function toString() {
1016
+ return this._start.toString() + "/" + this._end.toString();
1017
+ };
1018
+
1019
+ return LocalDateRange;
1020
+ }();
1021
+ function _init$4() {
1022
+ LocalDateRange.ALL = new LocalDateRange(core.LocalDate.MIN, core.LocalDate.MAX);
1023
+ }
1024
+
1025
+ var MathUtil$3 = core._.MathUtil;
1026
+ var SECONDS_PER_DAY = 86400;
1027
+ var OffsetDate = function (_Temporal) {
1028
+ _inheritsLoose(OffsetDate, _Temporal);
1029
+
1030
+ OffsetDate.now = function now(zoneIdOrClock) {
1031
+ if (arguments.length === 0) {
1032
+ return OffsetDate._now0();
1033
+ } else if (arguments.length === 1 && zoneIdOrClock instanceof core.ZoneId) {
1034
+ return OffsetDate._nowZoneId(zoneIdOrClock);
1035
+ } else {
1036
+ return OffsetDate._nowClock(zoneIdOrClock);
1037
+ }
1038
+ };
1039
+
1040
+ OffsetDate._now0 = function _now0() {
1041
+ return OffsetDate.now(core.Clock.systemDefaultZone());
1042
+ };
1043
+
1044
+ OffsetDate._nowZoneId = function _nowZoneId(zone) {
1045
+ return OffsetDate.now(core.Clock.system(zone));
1046
+ };
1047
+
1048
+ OffsetDate._nowClock = function _nowClock(clock) {
1049
+ requireNonNull(clock, 'clock');
1050
+ var now = clock.instant();
1051
+ return OffsetDate.ofInstant(now, clock.zone().rules().offset(now));
1052
+ };
1053
+
1054
+ OffsetDate.of = function of() {
1055
+ switch (arguments.length) {
1056
+ case 2:
1057
+ return OffsetDate._ofLocalDateZoneOffset.apply(OffsetDate, arguments);
1058
+
1059
+ case 4:
1060
+ return OffsetDate._ofIntIntIntZoneOffset.apply(OffsetDate, arguments);
1061
+
1062
+ default:
1063
+ throw new core.IllegalArgumentException('Illegal number of arguments');
1064
+ }
1065
+ };
1066
+
1067
+ OffsetDate._ofLocalDateZoneOffset = function _ofLocalDateZoneOffset(date, offset) {
1068
+ return new OffsetDate(date, offset);
1069
+ };
1070
+
1071
+ OffsetDate._ofIntIntIntZoneOffset = function _ofIntIntIntZoneOffset(year, month, dayOfMonth, offset) {
1072
+ var d = core.LocalDate.of(year, month, dayOfMonth);
1073
+ return new OffsetDate(d, offset);
1074
+ };
1075
+
1076
+ OffsetDate.ofInstant = function ofInstant(instant, zone) {
1077
+ requireNonNull(instant, 'instant');
1078
+ requireNonNull(zone, 'zone');
1079
+ var rules = zone.rules();
1080
+ var offset = rules.offset(instant);
1081
+ var epochSec = instant.epochSecond() + offset.totalSeconds();
1082
+ var epochDay = MathUtil$3.floorDiv(epochSec, SECONDS_PER_DAY);
1083
+ var date = core.LocalDate.ofEpochDay(epochDay);
1084
+ return new OffsetDate(date, offset);
1085
+ };
1086
+
1087
+ OffsetDate.from = function from(temporal) {
1088
+ if (temporal instanceof OffsetDate) {
1089
+ return temporal;
1090
+ }
1091
+
1092
+ requireNonNull(temporal, 'temporal');
1093
+
1094
+ try {
1095
+ var date = core.LocalDate.from(temporal);
1096
+ var offset = core.ZoneOffset.from(temporal);
1097
+ return new OffsetDate(date, offset);
1098
+ } catch (ex) {
1099
+ throw new core.DateTimeException("Unable to obtain OffsetDate from TemporalAccessor: " + temporal.constructor.name, ex);
1100
+ }
1101
+ };
1102
+
1103
+ OffsetDate.parse = function parse(text, formatter) {
1104
+ if (formatter === void 0) {
1105
+ formatter = core.DateTimeFormatter.ISO_OFFSET_DATE;
1106
+ }
1107
+
1108
+ requireNonNull(formatter, 'formatter');
1109
+ return formatter.parse(text, OffsetDate.FROM);
1110
+ };
1111
+
1112
+ function OffsetDate(date, offset) {
1113
+ var _this;
1114
+
1115
+ _this = _Temporal.call(this) || this;
1116
+ _this._date = requireNonNull(date, 'date');
1117
+ _this._offset = requireNonNull(offset, 'offset');
1118
+ return _this;
1119
+ }
1120
+
1121
+ var _proto = OffsetDate.prototype;
1122
+
1123
+ _proto._with = function _with(date, offset) {
1124
+ if (this._date === date && this._offset.equals(offset)) {
1125
+ return this;
1126
+ }
1127
+
1128
+ return new OffsetDate(date, offset);
1129
+ };
1130
+
1131
+ _proto.isSupported = function isSupported(fieldOrUnit) {
1132
+ if (fieldOrUnit instanceof core.TemporalField) {
1133
+ return this._isSupportedField(fieldOrUnit);
1134
+ }
1135
+
1136
+ if (fieldOrUnit instanceof core.TemporalUnit) {
1137
+ return this._isSupportedUnit(fieldOrUnit);
1138
+ }
1139
+
1140
+ if (fieldOrUnit == null) {
1141
+ return false;
1142
+ }
1143
+
1144
+ throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
1145
+ };
1146
+
1147
+ _proto._isSupportedField = function _isSupportedField(field) {
1148
+ if (field instanceof core.ChronoField) {
1149
+ return field.isDateBased() || field === core.ChronoField.OFFSET_SECONDS;
1150
+ }
1151
+
1152
+ return field != null && field.isSupportedBy(this);
1153
+ };
1154
+
1155
+ _proto._isSupportedUnit = function _isSupportedUnit(unit) {
1156
+ if (unit instanceof core.ChronoUnit) {
1157
+ return unit.isDateBased();
1158
+ }
1159
+
1160
+ return unit != null && unit.isSupportedBy(this);
1161
+ };
1162
+
1163
+ _proto.range = function range(field) {
1164
+ requireNonNull(field, 'field');
1165
+ requireInstance(field, core.TemporalField, 'field');
1166
+
1167
+ if (field instanceof core.ChronoField) {
1168
+ if (field === core.ChronoField.OFFSET_SECONDS) {
1169
+ return field.range();
1170
+ }
1171
+
1172
+ return this._date.range(field);
1173
+ }
1174
+
1175
+ return field.rangeRefinedBy(this);
1176
+ };
1177
+
1178
+ _proto.get = function get(field) {
1179
+ requireNonNull(field, 'field');
1180
+ requireInstance(field, core.TemporalField, 'field');
1181
+ return this.range(field).checkValidIntValue(this.getLong(field), field);
1182
+ };
1183
+
1184
+ _proto.getLong = function getLong(field) {
1185
+ requireNonNull(field, 'field');
1186
+ requireInstance(field, core.TemporalField, 'field');
1187
+
1188
+ if (field instanceof core.ChronoField) {
1189
+ if (field === core.ChronoField.OFFSET_SECONDS) {
1190
+ return this.offset().totalSeconds();
1191
+ }
1192
+
1193
+ return this._date.getLong(field);
1194
+ }
1195
+
1196
+ return field.getFrom(this);
1197
+ };
1198
+
1199
+ _proto.offset = function offset() {
1200
+ return this._offset;
1201
+ };
1202
+
1203
+ _proto.withOffsetSameLocal = function withOffsetSameLocal(offset) {
1204
+ requireNonNull(offset, 'offset');
1205
+ return this._with(this._date, offset);
1206
+ };
1207
+
1208
+ _proto.toLocalDate = function toLocalDate() {
1209
+ return this._date;
1210
+ };
1211
+
1212
+ _proto.year = function year() {
1213
+ return this._date.year();
1214
+ };
1215
+
1216
+ _proto.monthValue = function monthValue() {
1217
+ return this._date.monthValue();
1218
+ };
1219
+
1220
+ _proto.month = function month() {
1221
+ return this._date.month();
1222
+ };
1223
+
1224
+ _proto.dayOfMonth = function dayOfMonth() {
1225
+ return this._date.dayOfMonth();
1226
+ };
1227
+
1228
+ _proto.dayOfYear = function dayOfYear() {
1229
+ return this._date.dayOfYear();
1230
+ };
1231
+
1232
+ _proto.dayOfWeek = function dayOfWeek() {
1233
+ return this._date.dayOfWeek();
1234
+ };
1235
+
1236
+ _proto._withAdjuster = function _withAdjuster(adjuster) {
1237
+ if (adjuster instanceof core.LocalDate) {
1238
+ return this._with(adjuster, this._offset);
1239
+ } else if (adjuster instanceof core.ZoneOffset) {
1240
+ return this._with(this._date, adjuster);
1241
+ } else if (adjuster instanceof OffsetDate) {
1242
+ return adjuster;
1243
+ }
1244
+
1245
+ return _Temporal.prototype._withAdjuster.call(this, adjuster);
1246
+ };
1247
+
1248
+ _proto._withField = function _withField(field, newValue) {
1249
+ requireNonNull(field, 'field');
1250
+ requireInstance(field, core.TemporalField, 'field');
1251
+
1252
+ if (field instanceof core.ChronoField) {
1253
+ if (field === core.ChronoField.OFFSET_SECONDS) {
1254
+ var f = field;
1255
+ return this._with(this._date, core.ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
1256
+ }
1257
+
1258
+ return this._with(this._date.with(field, newValue), this._offset);
1259
+ }
1260
+
1261
+ return field.adjustInto(this, newValue);
1262
+ };
1263
+
1264
+ _proto.withYear = function withYear(year) {
1265
+ return this._with(this._date.withYear(year), this._offset);
1266
+ };
1267
+
1268
+ _proto.withMonth = function withMonth(month) {
1269
+ return this._with(this._date.withMonth(month), this._offset);
1270
+ };
1271
+
1272
+ _proto.withDayOfMonth = function withDayOfMonth(dayOfMonth) {
1273
+ return this._with(this._date.withDayOfMonth(dayOfMonth), this._offset);
1274
+ };
1275
+
1276
+ _proto.withDayOfYear = function withDayOfYear(dayOfYear) {
1277
+ return this._with(this._date.withDayOfYear(dayOfYear), this._offset);
1278
+ };
1279
+
1280
+ _proto._plusUnit = function _plusUnit(amountToAdd, unit) {
1281
+ if (unit instanceof core.ChronoUnit) {
1282
+ return this._with(this._date.plus(amountToAdd, unit), this._offset);
1283
+ }
1284
+
1285
+ return unit.addTo(this, amountToAdd);
1286
+ };
1287
+
1288
+ _proto.plusYears = function plusYears(years) {
1289
+ return this._with(this._date.plusYears(years), this._offset);
1290
+ };
1291
+
1292
+ _proto.plusMonths = function plusMonths(months) {
1293
+ return this._with(this._date.plusMonths(months), this._offset);
1294
+ };
1295
+
1296
+ _proto.plusWeeks = function plusWeeks(weeks) {
1297
+ return this._with(this._date.plusWeeks(weeks), this._offset);
1298
+ };
1299
+
1300
+ _proto.plusDays = function plusDays(days) {
1301
+ return this._with(this._date.plusDays(days), this._offset);
1302
+ };
1303
+
1304
+ _proto.minusYears = function minusYears(years) {
1305
+ return this._with(this._date.minusYears(years), this._offset);
1306
+ };
1307
+
1308
+ _proto.minusMonths = function minusMonths(months) {
1309
+ return this._with(this._date.minusMonths(months), this._offset);
1310
+ };
1311
+
1312
+ _proto.minusWeeks = function minusWeeks(weeks) {
1313
+ return this._with(this._date.minusWeeks(weeks), this._offset);
1314
+ };
1315
+
1316
+ _proto.minusDays = function minusDays(days) {
1317
+ return this._with(this._date.minusDays(days), this._offset);
1318
+ };
1319
+
1320
+ _proto.query = function query(_query) {
1321
+ requireNonNull(_query, 'query');
1322
+ requireInstance(_query, core.TemporalQuery, 'query');
1323
+
1324
+ if (_query === core.TemporalQueries.chronology()) {
1325
+ return core.IsoChronology.INSTANCE;
1326
+ } else if (_query === core.TemporalQueries.precision()) {
1327
+ return core.ChronoUnit.DAYS;
1328
+ } else if (_query === core.TemporalQueries.offset() || _query === core.TemporalQueries.zone()) {
1329
+ return this.offset();
1330
+ }
1331
+
1332
+ return _Temporal.prototype.query.call(this, _query);
1333
+ };
1334
+
1335
+ _proto.adjustInto = function adjustInto(temporal) {
1336
+ return temporal.with(core.ChronoField.OFFSET_SECONDS, this.offset().totalSeconds()).with(core.ChronoField.EPOCH_DAY, this.toLocalDate().toEpochDay());
1337
+ };
1338
+
1339
+ _proto.until = function until(endExclusive, unit) {
1340
+ var end = OffsetDate.from(endExclusive);
1341
+
1342
+ if (unit instanceof core.ChronoUnit) {
1343
+ var offsetDiff = end._offset.totalSeconds() - this._offset.totalSeconds();
1344
+
1345
+ var endLocal = end._date.plusDays(MathUtil$3.intDiv(-offsetDiff, SECONDS_PER_DAY));
1346
+
1347
+ return this._date.until(endLocal, unit);
1348
+ }
1349
+
1350
+ return unit.between(this, end);
1351
+ };
1352
+
1353
+ _proto.format = function format(formatter) {
1354
+ requireNonNull(formatter, 'formatter');
1355
+ return formatter.format(this);
1356
+ };
1357
+
1358
+ _proto.atTime = function atTime(time) {
1359
+ return core.OffsetDateTime.of(this._date, time, this._offset);
1360
+ };
1361
+
1362
+ _proto._toEpochSecond = function _toEpochSecond() {
1363
+ var epochDay = this._date.toEpochDay();
1364
+
1365
+ var secs = epochDay * SECONDS_PER_DAY;
1366
+ return secs - this._offset.totalSeconds();
1367
+ };
1368
+
1369
+ _proto.toEpochSecond = function toEpochSecond(time) {
1370
+ requireNonNull(time, 'time');
1371
+ return this._toEpochSecond() + time.toSecondOfDay();
1372
+ };
1373
+
1374
+ _proto.compareTo = function compareTo(other) {
1375
+ requireNonNull(other, 'other');
1376
+ requireInstance(other, OffsetDate, 'other');
1377
+
1378
+ if (this._offset.equals(other._offset)) {
1379
+ return this._date.compareTo(other._date);
1380
+ }
1381
+
1382
+ var compare = this._toEpochSecond() - other._toEpochSecond();
1383
+
1384
+ if (compare === 0) {
1385
+ compare = this._date.compareTo(other._date);
1386
+ }
1387
+
1388
+ return compare;
1389
+ };
1390
+
1391
+ _proto.isAfter = function isAfter(other) {
1392
+ requireNonNull(other, 'other');
1393
+ requireInstance(other, OffsetDate, 'other');
1394
+ return this._toEpochSecond() > other._toEpochSecond();
1395
+ };
1396
+
1397
+ _proto.isBefore = function isBefore(other) {
1398
+ requireNonNull(other, 'other');
1399
+ requireInstance(other, OffsetDate, 'other');
1400
+ return this._toEpochSecond() < other._toEpochSecond();
1401
+ };
1402
+
1403
+ _proto.isEqual = function isEqual(other) {
1404
+ requireNonNull(other, 'other');
1405
+ requireInstance(other, OffsetDate, 'other');
1406
+ return this._toEpochSecond() === other._toEpochSecond();
1407
+ };
1408
+
1409
+ _proto.equals = function equals(obj) {
1410
+ if (this === obj) {
1411
+ return true;
1412
+ }
1413
+
1414
+ if (obj instanceof OffsetDate) {
1415
+ var other = obj;
1416
+ return this._date.equals(other._date) && this._offset.equals(other._offset);
1417
+ }
1418
+
1419
+ return false;
1420
+ };
1421
+
1422
+ _proto.hashCode = function hashCode() {
1423
+ return this._date.hashCode() ^ this._offset.hashCode();
1424
+ };
1425
+
1426
+ _proto.toString = function toString() {
1427
+ return this._date.toString() + this._offset.toString();
1428
+ };
1429
+
1430
+ return OffsetDate;
1431
+ }(core.Temporal);
1432
+ function _init$3() {
1433
+ OffsetDate.MIN = OffsetDate.of(core.LocalDate.MIN, core.ZoneOffset.MAX);
1434
+ OffsetDate.MAX = OffsetDate.of(core.LocalDate.MAX, core.ZoneOffset.MIN);
1435
+ OffsetDate.FROM = createTemporalQuery$3('OffsetDate.FROM', function (temporal) {
1436
+ return OffsetDate.from(temporal);
1437
+ });
1438
+ }
1439
+
1440
+ function createTemporalQuery$3(name, queryFromFunction) {
1441
+ var ExtendedTemporalQuery = function (_TemporalQuery) {
1442
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1443
+
1444
+ function ExtendedTemporalQuery() {
1445
+ return _TemporalQuery.apply(this, arguments) || this;
1446
+ }
1447
+
1448
+ return ExtendedTemporalQuery;
1449
+ }(core.TemporalQuery);
1450
+
1451
+ ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
1452
+ return new ExtendedTemporalQuery(name);
1453
+ }
1454
+
1455
+ var MathUtil$2 = core._.MathUtil;
1456
+ var Quarter = function (_TemporalAccessor) {
1457
+ _inheritsLoose(Quarter, _TemporalAccessor);
1458
+
1459
+ Quarter.valueOf = function valueOf(name) {
1460
+ requireNonNull(name, 'name');
1461
+
1462
+ switch (name) {
1463
+ case 'Q1':
1464
+ return Quarter.Q1;
1465
+
1466
+ case 'Q2':
1467
+ return Quarter.Q2;
1468
+
1469
+ case 'Q3':
1470
+ return Quarter.Q3;
1471
+
1472
+ case 'Q4':
1473
+ return Quarter.Q4;
1474
+ }
1475
+
1476
+ throw new core.IllegalArgumentException("No enum constant Quarter." + name);
1477
+ };
1478
+
1479
+ Quarter.values = function values() {
1480
+ return QUARTERS.slice();
1481
+ };
1482
+
1483
+ Quarter.of = function of(quarterOfYear) {
1484
+ requireNonNull(quarterOfYear, 'quarterOfYear');
1485
+
1486
+ switch (quarterOfYear) {
1487
+ case 1:
1488
+ return Quarter.Q1;
1489
+
1490
+ case 2:
1491
+ return Quarter.Q2;
1492
+
1493
+ case 3:
1494
+ return Quarter.Q3;
1495
+
1496
+ case 4:
1497
+ return Quarter.Q4;
1498
+
1499
+ default:
1500
+ throw new core.DateTimeException("Invalid value for Quarter: " + quarterOfYear);
1501
+ }
1502
+ };
1503
+
1504
+ Quarter.ofMonth = function ofMonth(monthOfYear) {
1505
+ requireNonNull(monthOfYear, 'monthOfYear');
1506
+ core.ChronoField.MONTH_OF_YEAR.range().checkValidValue(monthOfYear, core.ChronoField.MONTH_OF_YEAR);
1507
+ return Quarter.of(MathUtil$2.intDiv(monthOfYear - 1, 3) + 1);
1508
+ };
1509
+
1510
+ Quarter.from = function from(temporal) {
1511
+ if (temporal instanceof Quarter) {
1512
+ return temporal;
1513
+ } else if (temporal instanceof core.Month) {
1514
+ var month = temporal;
1515
+ return Quarter.of(MathUtil$2.intDiv(month.ordinal(), 3) + 1);
1516
+ }
1517
+
1518
+ try {
1519
+ var qoy = MathUtil$2.safeToInt(temporal.getLong(core.IsoFields.QUARTER_OF_YEAR));
1520
+ return Quarter.of(qoy);
1521
+ } catch (ex) {
1522
+ throw new core.DateTimeException("Unable to obtain Quarter from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
1523
+ }
1524
+ };
1525
+
1526
+ function Quarter(value, name) {
1527
+ var _this;
1528
+
1529
+ _this = _TemporalAccessor.call(this) || this;
1530
+ _this._value = MathUtil$2.safeToInt(value);
1531
+ _this._name = name;
1532
+ return _this;
1533
+ }
1534
+
1535
+ var _proto = Quarter.prototype;
1536
+
1537
+ _proto.value = function value() {
1538
+ return this._value;
1539
+ };
1540
+
1541
+ _proto.displayName = function displayName(style, locale) {
1542
+ throw new core.IllegalArgumentException('Pattern using (localized) text not implemented yet!');
1543
+ };
1544
+
1545
+ _proto.isSupported = function isSupported(field) {
1546
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1547
+ return true;
1548
+ } else if (field instanceof core.ChronoField) {
1549
+ return false;
1550
+ }
1551
+
1552
+ return field != null && field.isSupportedBy(this);
1553
+ };
1554
+
1555
+ _proto.range = function range(field) {
1556
+ requireNonNull(field, 'field');
1557
+
1558
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1559
+ return field.range();
1560
+ } else if (field instanceof core.ChronoField) {
1561
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
1562
+ }
1563
+
1564
+ return _TemporalAccessor.prototype.range.call(this, field);
1565
+ };
1566
+
1567
+ _proto.get = function get(field) {
1568
+ requireNonNull(field, 'field');
1569
+ requireInstance(field, core.TemporalField, 'field');
1570
+ return this.range(field).checkValidIntValue(this.getLong(field), field);
1571
+ };
1572
+
1573
+ _proto.getLong = function getLong(field) {
1574
+ requireNonNull(field, 'field');
1575
+
1576
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1577
+ return this.value();
1578
+ } else if (field instanceof core.ChronoField) {
1579
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
1580
+ }
1581
+
1582
+ return field.getFrom(this);
1583
+ };
1584
+
1585
+ _proto.plus = function plus(quarters) {
1586
+ var amount = MathUtil$2.intMod(quarters, 4);
1587
+ return QUARTERS[(this.ordinal() + amount + 4) % 4];
1588
+ };
1589
+
1590
+ _proto.minus = function minus(quarters) {
1591
+ return this.plus(-MathUtil$2.intMod(quarters, 4));
1592
+ };
1593
+
1594
+ _proto.length = function length(leapYear) {
1595
+ switch (this) {
1596
+ case Quarter.Q1:
1597
+ return leapYear ? 91 : 90;
1598
+
1599
+ case Quarter.Q2:
1600
+ return 91;
1601
+
1602
+ default:
1603
+ return 92;
1604
+ }
1605
+ };
1606
+
1607
+ _proto.firstMonth = function firstMonth() {
1608
+ switch (this) {
1609
+ case Quarter.Q1:
1610
+ return core.Month.JANUARY;
1611
+
1612
+ case Quarter.Q2:
1613
+ return core.Month.APRIL;
1614
+
1615
+ case Quarter.Q3:
1616
+ return core.Month.JULY;
1617
+
1618
+ case Quarter.Q4:
1619
+ return core.Month.OCTOBER;
1620
+
1621
+ default:
1622
+ throw new core.IllegalStateException('Unreachable');
1623
+ }
1624
+ };
1625
+
1626
+ _proto.query = function query(_query) {
1627
+ requireNonNull(_query, 'query');
1628
+ requireInstance(_query, core.TemporalQuery, 'query');
1629
+
1630
+ if (_query === core.TemporalQueries.chronology()) {
1631
+ return core.IsoChronology.INSTANCE;
1632
+ } else if (_query === core.TemporalQueries.precision()) {
1633
+ return core.IsoFields.QUARTER_YEARS;
1634
+ }
1635
+
1636
+ return _TemporalAccessor.prototype.query.call(this, _query);
1637
+ };
1638
+
1639
+ _proto.adjustInto = function adjustInto(temporal) {
1640
+ requireNonNull(temporal, 'temporal');
1641
+ return temporal.with(core.IsoFields.QUARTER_OF_YEAR, this.value());
1642
+ };
1643
+
1644
+ _proto.ordinal = function ordinal() {
1645
+ return this._value - 1;
1646
+ };
1647
+
1648
+ _proto.name = function name() {
1649
+ return this._name;
1650
+ };
1651
+
1652
+ _proto.compareTo = function compareTo(other) {
1653
+ requireNonNull(other, 'other');
1654
+ requireInstance(other, Quarter, 'other');
1655
+ return this._value - other._value;
1656
+ };
1657
+
1658
+ _proto.toString = function toString() {
1659
+ return this.name();
1660
+ };
1661
+
1662
+ _proto.equals = function equals(other) {
1663
+ return this === other;
1664
+ };
1665
+
1666
+ _proto.hashCode = function hashCode() {
1667
+ return this._value;
1668
+ };
1669
+
1670
+ return Quarter;
1671
+ }(core.TemporalAccessor);
1672
+ var QUARTERS;
1673
+ function _init$2() {
1674
+ Quarter.Q1 = new Quarter(1, 'Q1');
1675
+ Quarter.Q2 = new Quarter(2, 'Q2');
1676
+ Quarter.Q3 = new Quarter(3, 'Q3');
1677
+ Quarter.Q4 = new Quarter(4, 'Q4');
1678
+ Quarter.FROM = createTemporalQuery$2('Quarter.FROM', function (temporal) {
1679
+ return Quarter.from(temporal);
1680
+ });
1681
+ QUARTERS = [Quarter.Q1, Quarter.Q2, Quarter.Q3, Quarter.Q4];
1682
+ }
1683
+
1684
+ function createTemporalQuery$2(name, queryFromFunction) {
1685
+ var ExtendedTemporalQuery = function (_TemporalQuery) {
1686
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1687
+
1688
+ function ExtendedTemporalQuery() {
1689
+ return _TemporalQuery.apply(this, arguments) || this;
1690
+ }
1691
+
1692
+ return ExtendedTemporalQuery;
1693
+ }(core.TemporalQuery);
1694
+
1695
+ ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
1696
+ return new ExtendedTemporalQuery(name);
1697
+ }
1698
+
1699
+ var MathUtil$1 = core._.MathUtil;
1700
+ var YearQuarter = function (_Temporal) {
1701
+ _inheritsLoose(YearQuarter, _Temporal);
1702
+
1703
+ YearQuarter.now = function now(zoneIdOrClock) {
1704
+ if (arguments.length === 0) {
1705
+ return YearQuarter._now0();
1706
+ } else if (arguments.length === 1 && zoneIdOrClock instanceof core.ZoneId) {
1707
+ return YearQuarter._nowZoneId(zoneIdOrClock);
1708
+ } else {
1709
+ return YearQuarter._nowClock(zoneIdOrClock);
1710
+ }
1711
+ };
1712
+
1713
+ YearQuarter._now0 = function _now0() {
1714
+ return YearQuarter.now(core.Clock.systemDefaultZone());
1715
+ };
1716
+
1717
+ YearQuarter._nowZoneId = function _nowZoneId(zone) {
1718
+ return YearQuarter.now(core.Clock.system(zone));
1719
+ };
1720
+
1721
+ YearQuarter._nowClock = function _nowClock(clock) {
1722
+ var now = core.LocalDate.now(clock);
1723
+ return YearQuarter.of(now.getYear(), Quarter.from(now.getMonth()));
1724
+ };
1725
+
1726
+ YearQuarter.of = function of(year, quarter) {
1727
+ if (year instanceof core.Year && quarter instanceof Quarter) {
1728
+ return YearQuarter._ofYearQuarter(year, quarter);
1729
+ }
1730
+
1731
+ if (year instanceof core.Year && typeof quarter === 'number') {
1732
+ return YearQuarter._ofYearInt(year, quarter);
1733
+ }
1734
+
1735
+ if (typeof year === 'number' && quarter instanceof Quarter) {
1736
+ return YearQuarter._ofIntQuarter(year, quarter);
1737
+ }
1738
+
1739
+ if (typeof year === 'number' && typeof quarter === 'number') {
1740
+ return YearQuarter._ofIntInt(year, quarter);
1741
+ }
1742
+
1743
+ var yearMessage = "year must be an instance of Year or number but is " + year.constructor.name;
1744
+ var quarterMessage = "quarter must be an instance of Quarter or number but is " + quarter.constructor.name;
1745
+ throw new core.IllegalArgumentException(yearMessage + " and " + quarterMessage);
1746
+ };
1747
+
1748
+ YearQuarter._ofYearQuarter = function _ofYearQuarter(year, quarter) {
1749
+ return YearQuarter.of(year.value(), quarter);
1750
+ };
1751
+
1752
+ YearQuarter._ofYearInt = function _ofYearInt(year, quarter) {
1753
+ return YearQuarter.of(year.value(), Quarter.of(quarter));
1754
+ };
1755
+
1756
+ YearQuarter._ofIntQuarter = function _ofIntQuarter(year, quarter) {
1757
+ core.ChronoField.YEAR.checkValidValue(year);
1758
+ requireNonNull(quarter, 'quarter');
1759
+ return new YearQuarter(year, quarter);
1760
+ };
1761
+
1762
+ YearQuarter._ofIntInt = function _ofIntInt(year, quarter) {
1763
+ core.ChronoField.YEAR.checkValidValue(year);
1764
+ return new YearQuarter(year, Quarter.of(quarter));
1765
+ };
1766
+
1767
+ YearQuarter.from = function from(temporal) {
1768
+ if (temporal instanceof YearQuarter) {
1769
+ return temporal;
1770
+ }
1771
+
1772
+ requireNonNull(temporal, 'temporal');
1773
+
1774
+ try {
1775
+ var year = MathUtil$1.safeToInt(temporal.getLong(core.ChronoField.YEAR));
1776
+ var qoy = MathUtil$1.safeToInt(temporal.getLong(core.IsoFields.QUARTER_OF_YEAR));
1777
+ return YearQuarter.of(year, qoy);
1778
+ } catch (ex) {
1779
+ throw new core.DateTimeException("Unable to obtain YearQuarter from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
1780
+ }
1781
+ };
1782
+
1783
+ YearQuarter.parse = function parse(text, formatter) {
1784
+ if (formatter === void 0) {
1785
+ formatter = YearQuarter.PARSER;
1786
+ }
1787
+
1788
+ requireNonNull(formatter, 'formatter');
1789
+ requireInstance(formatter, core.DateTimeFormatter, 'formatter');
1790
+ return formatter.parse(text, YearQuarter.FROM);
1791
+ };
1792
+
1793
+ function YearQuarter(year, quarter) {
1794
+ var _this;
1795
+
1796
+ _this = _Temporal.call(this) || this;
1797
+ _this._year = MathUtil$1.safeToInt(year);
1798
+ _this._quarter = requireInstance(quarter, Quarter, 'Quarter');
1799
+ return _this;
1800
+ }
1801
+
1802
+ var _proto = YearQuarter.prototype;
1803
+
1804
+ _proto._with = function _with(newYear, newQuarter) {
1805
+ if (this._year === newYear && this._quarter === newQuarter) {
1806
+ return this;
1807
+ }
1808
+
1809
+ return new YearQuarter(newYear, newQuarter);
1810
+ };
1811
+
1812
+ _proto.isSupported = function isSupported(fieldOrUnit) {
1813
+ if (fieldOrUnit instanceof core.TemporalField) {
1814
+ return this._isSupportedField(fieldOrUnit);
1815
+ }
1816
+
1817
+ if (fieldOrUnit instanceof core.TemporalUnit) {
1818
+ return this._isSupportedUnit(fieldOrUnit);
1819
+ }
1820
+
1821
+ if (fieldOrUnit == null) {
1822
+ return false;
1823
+ }
1824
+
1825
+ throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
1826
+ };
1827
+
1828
+ _proto._isSupportedField = function _isSupportedField(field) {
1829
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1830
+ return true;
1831
+ } else if (field instanceof core.ChronoField) {
1832
+ return field === core.ChronoField.YEAR || field === core.ChronoField.YEAR_OF_ERA || field === core.ChronoField.ERA;
1833
+ }
1834
+
1835
+ return field != null && field.isSupportedBy(this);
1836
+ };
1837
+
1838
+ _proto._isSupportedUnit = function _isSupportedUnit(unit) {
1839
+ if (unit === core.IsoFields.QUARTER_YEARS) {
1840
+ return true;
1841
+ } else if (unit instanceof core.ChronoUnit) {
1842
+ return unit === core.ChronoUnit.YEARS || unit === core.ChronoUnit.DECADES || unit === core.ChronoUnit.CENTURIES || unit === core.ChronoUnit.MILLENNIA || unit === core.ChronoUnit.ERAS;
1843
+ }
1844
+
1845
+ return unit != null && unit.isSupportedBy(this);
1846
+ };
1847
+
1848
+ _proto.range = function range(field) {
1849
+ requireNonNull(field, 'field');
1850
+ requireInstance(field, core.TemporalField, 'field');
1851
+
1852
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1853
+ return core.IsoFields.QUARTER_OF_YEAR.range();
1854
+ }
1855
+
1856
+ if (field === core.ChronoField.YEAR_OF_ERA) {
1857
+ return this.year() <= 0 ? core.ValueRange.of(1, core.Year.MAX_VALUE + 1) : core.ValueRange.of(1, core.Year.MAX_VALUE);
1858
+ }
1859
+
1860
+ return _Temporal.prototype.range.call(this, field);
1861
+ };
1862
+
1863
+ _proto.get = function get(field) {
1864
+ requireNonNull(field, 'field');
1865
+ requireInstance(field, core.TemporalField, 'field');
1866
+ return this.range(field).checkValidIntValue(this.getLong(field), field);
1867
+ };
1868
+
1869
+ _proto.getLong = function getLong(field) {
1870
+ requireNonNull(field, 'field');
1871
+ requireInstance(field, core.TemporalField, 'field');
1872
+
1873
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1874
+ return this._quarter.value();
1875
+ } else if (field instanceof core.ChronoField) {
1876
+ switch (field) {
1877
+ case core.ChronoField.YEAR_OF_ERA:
1878
+ return this._year < 1 ? 1 - this._year : this._year;
1879
+
1880
+ case core.ChronoField.YEAR:
1881
+ return this._year;
1882
+
1883
+ case core.ChronoField.ERA:
1884
+ return this._year < 1 ? 0 : 1;
1885
+
1886
+ default:
1887
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
1888
+ }
1889
+ }
1890
+
1891
+ return _Temporal.prototype.get.call(this, field);
1892
+ };
1893
+
1894
+ _proto._prolepticQuarter = function _prolepticQuarter() {
1895
+ return this._year * 4 + (this._quarter.value() - 1);
1896
+ };
1897
+
1898
+ _proto.year = function year() {
1899
+ return this._year;
1900
+ };
1901
+
1902
+ _proto.quarterValue = function quarterValue() {
1903
+ return this._quarter.value();
1904
+ };
1905
+
1906
+ _proto.quarter = function quarter() {
1907
+ return this._quarter;
1908
+ };
1909
+
1910
+ _proto.isLeapYear = function isLeapYear() {
1911
+ return core.IsoChronology.isLeapYear(this._year);
1912
+ };
1913
+
1914
+ _proto.isValidDay = function isValidDay(dayOfQuarter) {
1915
+ return dayOfQuarter >= 1 && dayOfQuarter <= this.lengthOfQuarter();
1916
+ };
1917
+
1918
+ _proto.lengthOfQuarter = function lengthOfQuarter() {
1919
+ return this._quarter.length(this.isLeapYear());
1920
+ };
1921
+
1922
+ _proto.lengthOfYear = function lengthOfYear() {
1923
+ return this.isLeapYear() ? 366 : 365;
1924
+ };
1925
+
1926
+ _proto._withAdjuster = function _withAdjuster(adjuster) {
1927
+ if (adjuster instanceof YearQuarter) {
1928
+ return adjuster;
1929
+ }
1930
+
1931
+ return _Temporal.prototype._withAdjuster.call(this, adjuster);
1932
+ };
1933
+
1934
+ _proto._withField = function _withField(field, newValue) {
1935
+ requireNonNull(field, 'field');
1936
+ requireInstance(field, core.TemporalField, 'field');
1937
+
1938
+ if (field === core.IsoFields.QUARTER_OF_YEAR) {
1939
+ return this.withQuarter(core.IsoFields.QUARTER_OF_YEAR.range().checkValidIntValue(newValue, core.IsoFields.QUARTER_OF_YEAR));
1940
+ } else if (field instanceof core.ChronoField) {
1941
+ field.checkValidValue(newValue);
1942
+
1943
+ switch (field) {
1944
+ case core.ChronoField.YEAR_OF_ERA:
1945
+ return this.withYear(this._year < 1 ? 1 - newValue : newValue);
1946
+
1947
+ case core.ChronoField.YEAR:
1948
+ return this.withYear(newValue);
1949
+
1950
+ case core.ChronoField.ERA:
1951
+ return this.getLong(core.ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year);
1952
+
1953
+ default:
1954
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
1955
+ }
1956
+ }
1957
+
1958
+ return field.adjustInto(this, newValue);
1959
+ };
1960
+
1961
+ _proto.withYear = function withYear(year) {
1962
+ core.ChronoField.YEAR.checkValidValue(year);
1963
+ return this._with(year, this._quarter);
1964
+ };
1965
+
1966
+ _proto.withQuarter = function withQuarter(quarter) {
1967
+ core.IsoFields.QUARTER_OF_YEAR.range().checkValidValue(quarter, core.IsoFields.QUARTER_OF_YEAR);
1968
+ return this._with(this._year, Quarter.of(quarter));
1969
+ };
1970
+
1971
+ _proto._plusUnit = function _plusUnit(amountToAdd, unit) {
1972
+ if (unit === core.IsoFields.QUARTER_YEARS) {
1973
+ return this.plusQuarters(amountToAdd);
1974
+ } else if (unit instanceof core.ChronoUnit) {
1975
+ switch (unit) {
1976
+ case core.ChronoUnit.YEARS:
1977
+ return this.plusYears(amountToAdd);
1978
+
1979
+ case core.ChronoUnit.DECADES:
1980
+ return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 10));
1981
+
1982
+ case core.ChronoUnit.CENTURIES:
1983
+ return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 100));
1984
+
1985
+ case core.ChronoUnit.MILLENNIA:
1986
+ return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 1000));
1987
+
1988
+ case core.ChronoUnit.ERAS:
1989
+ return this.with(core.ChronoField.ERA, MathUtil$1.safeAdd(this.getLong(core.ChronoField.ERA), amountToAdd));
1990
+
1991
+ default:
1992
+ throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
1993
+ }
1994
+ }
1995
+
1996
+ return unit.addTo(this, amountToAdd);
1997
+ };
1998
+
1999
+ _proto.plusYears = function plusYears(yearsToAdd) {
2000
+ if (yearsToAdd === 0) {
2001
+ return this;
2002
+ }
2003
+
2004
+ var newYear = core.ChronoField.YEAR.checkValidIntValue(this._year + yearsToAdd);
2005
+ return this._with(newYear, this._quarter);
2006
+ };
2007
+
2008
+ _proto.plusQuarters = function plusQuarters(quartersToAdd) {
2009
+ if (quartersToAdd === 0) {
2010
+ return this;
2011
+ }
2012
+
2013
+ var quarterCount = this._year * 4 + (this._quarter.value() - 1);
2014
+ var calcQuarters = quarterCount + quartersToAdd;
2015
+ var newYear = core.ChronoField.YEAR.checkValidIntValue(MathUtil$1.intDiv(calcQuarters, 4));
2016
+ var newQuarter = MathUtil$1.floorMod(calcQuarters, 4) + 1;
2017
+ return this._with(newYear, Quarter.of(newQuarter));
2018
+ };
2019
+
2020
+ _proto.minusYears = function minusYears(yearsToSubtract) {
2021
+ return yearsToSubtract === MathUtil$1.MIN_SAFE_INTEGER ? this.plusYears(MathUtil$1.MIN_SAFE_INTEGER).plusYears(1) : this.plusYears(-yearsToSubtract);
2022
+ };
2023
+
2024
+ _proto.minusQuarters = function minusQuarters(quartersToSubtract) {
2025
+ return quartersToSubtract === MathUtil$1.MIN_SAFE_INTEGER ? this.plusQuarters(MathUtil$1.MIN_SAFE_INTEGER).plusQuarters(1) : this.plusQuarters(-quartersToSubtract);
2026
+ };
2027
+
2028
+ _proto.query = function query(_query) {
2029
+ if (_query === core.TemporalQueries.chronology()) {
2030
+ return core.IsoChronology.INSTANCE;
2031
+ } else if (_query === core.TemporalQueries.precision()) {
2032
+ return core.IsoFields.QUARTER_YEARS;
2033
+ }
2034
+
2035
+ return _Temporal.prototype.query.call(this, _query);
2036
+ };
2037
+
2038
+ _proto.adjustInto = function adjustInto(temporal) {
2039
+ var newProlepticQuarter = this._prolepticQuarter();
2040
+
2041
+ var oldProlepticQuarter = temporal.get(core.ChronoField.YEAR) * 4 + (temporal.get(core.IsoFields.QUARTER_OF_YEAR) - 1);
2042
+ return temporal.plus(newProlepticQuarter - oldProlepticQuarter, core.IsoFields.QUARTER_YEARS);
2043
+ };
2044
+
2045
+ _proto.until = function until(endExclusive, unit) {
2046
+ requireNonNull(endExclusive, 'endExclusive');
2047
+ requireNonNull(unit, 'unit');
2048
+ requireInstance(endExclusive, core.Temporal, 'endExclusive');
2049
+ requireInstance(unit, core.TemporalUnit, 'unit');
2050
+ var end = YearQuarter.from(endExclusive);
2051
+
2052
+ var quartersUntil = end._prolepticQuarter() - this._prolepticQuarter();
2053
+
2054
+ if (unit === core.IsoFields.QUARTER_YEARS) {
2055
+ return quartersUntil;
2056
+ } else if (unit instanceof core.ChronoUnit) {
2057
+ switch (unit) {
2058
+ case core.ChronoUnit.YEARS:
2059
+ return MathUtil$1.intDiv(quartersUntil, 4);
2060
+
2061
+ case core.ChronoUnit.DECADES:
2062
+ return MathUtil$1.intDiv(quartersUntil, 40);
2063
+
2064
+ case core.ChronoUnit.CENTURIES:
2065
+ return MathUtil$1.intDiv(quartersUntil, 400);
2066
+
2067
+ case core.ChronoUnit.MILLENNIA:
2068
+ return MathUtil$1.intDiv(quartersUntil, 4000);
2069
+
2070
+ case core.ChronoUnit.ERAS:
2071
+ return end.getLong(core.ChronoField.ERA) - this.getLong(core.ChronoField.ERA);
2072
+
2073
+ default:
2074
+ throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
2075
+ }
2076
+ }
2077
+
2078
+ return unit.between(this, end);
2079
+ };
2080
+
2081
+ _proto.format = function format(formatter) {
2082
+ requireNonNull(formatter, 'formatter');
2083
+ return formatter.format(this);
2084
+ };
2085
+
2086
+ _proto.atDay = function atDay(dayOfQuarter) {
2087
+ core.ValueRange.of(1, this.lengthOfQuarter()).checkValidValue(dayOfQuarter, core.IsoFields.DAY_OF_QUARTER);
2088
+ var leap = core.Year.isLeap(this._year);
2089
+
2090
+ var month = this._quarter.firstMonth();
2091
+
2092
+ while (dayOfQuarter > month.length(leap)) {
2093
+ dayOfQuarter -= month.length(leap);
2094
+ month = month.plus(1);
2095
+ }
2096
+
2097
+ return core.LocalDate.of(this._year, month, dayOfQuarter);
2098
+ };
2099
+
2100
+ _proto.atEndOfQuarter = function atEndOfQuarter() {
2101
+ var month = this._quarter.firstMonth().plus(2);
2102
+
2103
+ return core.LocalDate.of(this._year, month, month.maxLength());
2104
+ };
2105
+
2106
+ _proto.compareTo = function compareTo(other) {
2107
+ requireNonNull(other, 'other');
2108
+ requireInstance(other, YearQuarter, 'other');
2109
+ var cmp = this._year - other._year;
2110
+
2111
+ if (cmp === 0) {
2112
+ cmp = this._quarter.compareTo(other._quarter);
2113
+ }
2114
+
2115
+ return cmp;
2116
+ };
2117
+
2118
+ _proto.isAfter = function isAfter(other) {
2119
+ return this.compareTo(other) > 0;
2120
+ };
2121
+
2122
+ _proto.isBefore = function isBefore(other) {
2123
+ return this.compareTo(other) < 0;
2124
+ };
2125
+
2126
+ _proto.equals = function equals(obj) {
2127
+ if (this === obj) {
2128
+ return true;
2129
+ }
2130
+
2131
+ if (obj instanceof YearQuarter) {
2132
+ var other = obj;
2133
+ return this._year === other._year && this._quarter === other._quarter;
2134
+ }
2135
+
2136
+ return false;
2137
+ };
2138
+
2139
+ _proto.hashCode = function hashCode() {
2140
+ return this._year ^ this._quarter.value() << 27;
2141
+ };
2142
+
2143
+ _proto.toString = function toString() {
2144
+ var yearString;
2145
+ var yearValue = this._year;
2146
+ var absYear = Math.abs(yearValue);
2147
+
2148
+ if (absYear < 1000) {
2149
+ if (yearValue < 0) {
2150
+ yearString = "-" + ("" + (yearValue - 10000)).slice(-4);
2151
+ } else {
2152
+ yearString = ("" + (yearValue + 10000)).slice(-4);
2153
+ }
2154
+ } else {
2155
+ if (yearValue > 9999) {
2156
+ yearString = "+" + yearValue;
2157
+ } else {
2158
+ yearString = "" + yearValue;
2159
+ }
2160
+ }
2161
+
2162
+ return yearString.concat('-').concat(this._quarter);
2163
+ };
2164
+
2165
+ return YearQuarter;
2166
+ }(core.Temporal);
2167
+ function _init$1() {
2168
+ YearQuarter.PARSER = new core.DateTimeFormatterBuilder().parseCaseInsensitive().appendValue(core.ChronoField.YEAR, 4, 10, core.SignStyle.EXCEEDS_PAD).appendLiteral('-').appendLiteral('Q').appendValue(core.IsoFields.QUARTER_OF_YEAR, 1).toFormatter();
2169
+ YearQuarter.FROM = createTemporalQuery$1('YearQuarter.FROM', function (temporal) {
2170
+ return YearQuarter.from(temporal);
2171
+ });
2172
+ }
2173
+
2174
+ function createTemporalQuery$1(name, queryFromFunction) {
2175
+ var ExtendedTemporalQuery = function (_TemporalQuery) {
2176
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
2177
+
2178
+ function ExtendedTemporalQuery() {
2179
+ return _TemporalQuery.apply(this, arguments) || this;
2180
+ }
2181
+
2182
+ return ExtendedTemporalQuery;
2183
+ }(core.TemporalQuery);
2184
+
2185
+ ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
2186
+ return new ExtendedTemporalQuery(name);
2187
+ }
2188
+
2189
+ var MathUtil = core._.MathUtil;
2190
+ var YearWeek = function (_Temporal) {
2191
+ _inheritsLoose(YearWeek, _Temporal);
2192
+
2193
+ YearWeek.now = function now(zoneIdOrClock) {
2194
+ switch (arguments.length) {
2195
+ case 0:
2196
+ return YearWeek._now0();
2197
+
2198
+ case 1:
2199
+ requireNonNull(zoneIdOrClock, 'clockOrZone');
2200
+
2201
+ if (zoneIdOrClock instanceof core.ZoneId) {
2202
+ return YearWeek._nowZoneId(zoneIdOrClock);
2203
+ }
2204
+
2205
+ if (zoneIdOrClock instanceof core.Clock) {
2206
+ return YearWeek._nowClock(zoneIdOrClock);
2207
+ }
2208
+
2209
+ throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
2210
+
2211
+ default:
2212
+ throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
2213
+ }
2214
+ };
2215
+
2216
+ YearWeek._now0 = function _now0() {
2217
+ return YearWeek.now(core.Clock.systemDefaultZone());
2218
+ };
2219
+
2220
+ YearWeek._nowZoneId = function _nowZoneId(zone) {
2221
+ return YearWeek.now(core.Clock.system(zone));
2222
+ };
2223
+
2224
+ YearWeek._nowClock = function _nowClock(clock) {
2225
+ var now = core.LocalDate.now(clock);
2226
+ return YearWeek.of(now.get(core.IsoFields.WEEK_BASED_YEAR), now.get(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
2227
+ };
2228
+
2229
+ YearWeek.of = function of(year, week) {
2230
+ MathUtil.verifyInt(week);
2231
+
2232
+ if (year instanceof core.Year) {
2233
+ return this._ofYearWeek(year, week);
2234
+ } else {
2235
+ MathUtil.verifyInt(year);
2236
+ return this._ofWeekBasedYear(year, week);
2237
+ }
2238
+ };
2239
+
2240
+ YearWeek._ofYearWeek = function _ofYearWeek(year, week) {
2241
+ var weekBasedYear = year.value();
2242
+ return this._ofWeekBasedYear(weekBasedYear, week);
2243
+ };
2244
+
2245
+ YearWeek._ofWeekBasedYear = function _ofWeekBasedYear(weekBasedYear, week) {
2246
+ core.IsoFields.WEEK_BASED_YEAR.range().checkValidValue(weekBasedYear, core.IsoFields.WEEK_BASED_YEAR);
2247
+ core.IsoFields.WEEK_OF_WEEK_BASED_YEAR.range().checkValidValue(week, core.IsoFields.WEEK_OF_WEEK_BASED_YEAR);
2248
+
2249
+ if (week === 53 && YearWeek._weekRange(weekBasedYear) < 53) {
2250
+ week = 1;
2251
+ weekBasedYear++;
2252
+ core.IsoFields.WEEK_BASED_YEAR.range().checkValidValue(weekBasedYear, core.IsoFields.WEEK_BASED_YEAR);
2253
+ }
2254
+
2255
+ return new YearWeek(weekBasedYear, week);
2256
+ };
2257
+
2258
+ YearWeek._weekRange = function _weekRange(weekBasedYear) {
2259
+ var date = core.LocalDate.of(weekBasedYear, 1, 1);
2260
+
2261
+ if (date.dayOfWeek() === core.DayOfWeek.THURSDAY || date.dayOfWeek() === core.DayOfWeek.WEDNESDAY && date.isLeapYear()) {
2262
+ return 53;
2263
+ }
2264
+
2265
+ return 52;
2266
+ };
2267
+
2268
+ YearWeek.from = function from(temporal) {
2269
+ if (temporal instanceof YearWeek) {
2270
+ return temporal;
2271
+ }
2272
+
2273
+ requireNonNull(temporal, 'temporal');
2274
+
2275
+ try {
2276
+ var year = MathUtil.safeToInt(temporal.getLong(core.IsoFields.WEEK_BASED_YEAR));
2277
+ var week = MathUtil.safeToInt(temporal.getLong(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
2278
+ return YearWeek.of(year, week);
2279
+ } catch (ex) {
2280
+ throw new core.DateTimeException("Unable to obtain YearWeek from TemporalAccessor: " + temporal.constructor.name, ex);
2281
+ }
2282
+ };
2283
+
2284
+ YearWeek.parse = function parse(text, formatter) {
2285
+ if (formatter === void 0) {
2286
+ formatter = YearWeek.PARSER;
2287
+ }
2288
+
2289
+ assert(formatter != null, 'formatter', core.NullPointerException);
2290
+ return formatter.parse(text, YearWeek.FROM);
2291
+ };
2292
+
2293
+ function YearWeek(weekBasedYear, week) {
2294
+ var _this;
2295
+
2296
+ _this = _Temporal.call(this) || this;
2297
+ _this._year = weekBasedYear;
2298
+ _this._week = week;
2299
+ return _this;
2300
+ }
2301
+
2302
+ var _proto = YearWeek.prototype;
2303
+
2304
+ _proto.isSupported = function isSupported(fieldOrUnit) {
2305
+ if (fieldOrUnit instanceof core.TemporalField) {
2306
+ return this._isSupportedField(fieldOrUnit);
2307
+ }
2308
+
2309
+ if (fieldOrUnit instanceof core.TemporalUnit) {
2310
+ return this._isSupportedUnit(fieldOrUnit);
2311
+ }
2312
+
2313
+ if (fieldOrUnit == null) {
2314
+ return false;
2315
+ }
2316
+
2317
+ throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
2318
+ };
2319
+
2320
+ _proto._isSupportedField = function _isSupportedField(field) {
2321
+ if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR || field === core.IsoFields.WEEK_BASED_YEAR) {
2322
+ return true;
2323
+ } else if (field instanceof core.ChronoField) {
2324
+ return false;
2325
+ }
2326
+
2327
+ return field != null && field.isSupportedBy(this);
2328
+ };
2329
+
2330
+ _proto._isSupportedUnit = function _isSupportedUnit(unit) {
2331
+ if (unit === core.ChronoUnit.WEEKS || unit === core.IsoFields.WEEK_BASED_YEARS) {
2332
+ return true;
2333
+ } else if (unit instanceof core.ChronoUnit) {
2334
+ return false;
2335
+ }
2336
+
2337
+ return unit != null && unit.isSupportedBy(this);
2338
+ };
2339
+
2340
+ _proto.range = function range(field) {
2341
+ requireNonNull(field, 'field');
2342
+
2343
+ if (field === core.IsoFields.WEEK_BASED_YEAR) {
2344
+ return core.IsoFields.WEEK_BASED_YEAR.range();
2345
+ }
2346
+
2347
+ if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
2348
+ return core.ValueRange.of(1, YearWeek._weekRange(this._year));
2349
+ }
2350
+
2351
+ return _Temporal.prototype.range.call(this, field);
2352
+ };
2353
+
2354
+ _proto.get = function get(field) {
2355
+ return this.range(field).checkValidIntValue(this.getLong(field), field);
2356
+ };
2357
+
2358
+ _proto.getLong = function getLong(field) {
2359
+ requireNonNull(field, 'field');
2360
+
2361
+ if (field === core.IsoFields.WEEK_BASED_YEAR) {
2362
+ return this._year;
2363
+ }
2364
+
2365
+ if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
2366
+ return this._week;
2367
+ }
2368
+
2369
+ if (field instanceof core.ChronoField) {
2370
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
2371
+ }
2372
+
2373
+ return field.getFrom(this);
2374
+ };
2375
+
2376
+ _proto.year = function year() {
2377
+ return this._year;
2378
+ };
2379
+
2380
+ _proto.week = function week() {
2381
+ return this._week;
2382
+ };
2383
+
2384
+ _proto.is53WeekYear = function is53WeekYear() {
2385
+ return YearWeek._weekRange(this._year) === 53;
2386
+ };
2387
+
2388
+ _proto.lengthOfYear = function lengthOfYear() {
2389
+ return this.is53WeekYear() ? 371 : 364;
2390
+ };
2391
+
2392
+ _proto._withAdjuster = function _withAdjuster(adjuster) {
2393
+ if (adjuster instanceof YearWeek) {
2394
+ return adjuster;
2395
+ }
2396
+
2397
+ return _Temporal.prototype._withAdjuster.call(this, adjuster);
2398
+ };
2399
+
2400
+ _proto._withField = function _withField(field, newValue) {
2401
+ if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
2402
+ return this.withWeek(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR.range().checkValidIntValue(newValue, core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
2403
+ } else if (field === core.IsoFields.WEEK_BASED_YEAR) {
2404
+ return this.withYear(core.IsoFields.WEEK_BASED_YEAR.range().checkValidIntValue(newValue, core.IsoFields.WEEK_BASED_YEAR));
2405
+ } else if (field instanceof core.ChronoField) {
2406
+ throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
2407
+ }
2408
+
2409
+ return field.adjustInto(this, newValue);
2410
+ };
2411
+
2412
+ _proto.withYear = function withYear(weekBasedYear) {
2413
+ if (this._week === 53 && YearWeek._weekRange(weekBasedYear) < 53) {
2414
+ return YearWeek.of(weekBasedYear, 52);
2415
+ }
2416
+
2417
+ return YearWeek.of(weekBasedYear, this._week);
2418
+ };
2419
+
2420
+ _proto.withWeek = function withWeek(week) {
2421
+ return YearWeek.of(this._year, week);
2422
+ };
2423
+
2424
+ _proto._plusUnit = function _plusUnit(amountToAdd, unit) {
2425
+ if (unit === core.ChronoUnit.WEEKS) {
2426
+ return this.plusWeeks(amountToAdd);
2427
+ } else if (unit === core.IsoFields.WEEK_BASED_YEARS) {
2428
+ return this.plusYears(amountToAdd);
2429
+ } else if (unit instanceof core.ChronoUnit) {
2430
+ throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
2431
+ }
2432
+
2433
+ return unit.addTo(this, amountToAdd);
2434
+ };
2435
+
2436
+ _proto.plusYears = function plusYears(yearsToAdd) {
2437
+ if (yearsToAdd === 0) {
2438
+ return this;
2439
+ }
2440
+
2441
+ var newYear = MathUtil.safeToInt(MathUtil.safeAdd(this._year, yearsToAdd));
2442
+ return this.withYear(newYear);
2443
+ };
2444
+
2445
+ _proto.plusWeeks = function plusWeeks(weeksToAdd) {
2446
+ if (weeksToAdd === 0) {
2447
+ return this;
2448
+ }
2449
+
2450
+ var mondayOfWeek = this.atDay(core.DayOfWeek.MONDAY).plusWeeks(weeksToAdd);
2451
+ return YearWeek.from(mondayOfWeek);
2452
+ };
2453
+
2454
+ _proto._minusUnit = function _minusUnit(amountToSubtract, unit) {
2455
+ requireNonNull(amountToSubtract, 'amountToSubtract');
2456
+ requireNonNull(unit, 'unit');
2457
+ return this._plusUnit(-amountToSubtract, unit);
2458
+ };
2459
+
2460
+ _proto.minusYears = function minusYears(yearsToSubtract) {
2461
+ if (yearsToSubtract === 0) {
2462
+ return this;
2463
+ }
2464
+
2465
+ var newYear = MathUtil.safeToInt(MathUtil.safeSubtract(this._year, yearsToSubtract));
2466
+ return this.withYear(newYear);
2467
+ };
2468
+
2469
+ _proto.minusWeeks = function minusWeeks(weeksToSubtract) {
2470
+ if (weeksToSubtract === 0) {
2471
+ return this;
2472
+ }
2473
+
2474
+ var mondayOfWeek = this.atDay(core.DayOfWeek.MONDAY).minusWeeks(weeksToSubtract);
2475
+ return YearWeek.from(mondayOfWeek);
2476
+ };
2477
+
2478
+ _proto.query = function query(_query) {
2479
+ requireNonNull(_query, 'query');
2480
+ requireInstance(_query, core.TemporalQuery, 'query');
2481
+
2482
+ if (_query === core.TemporalQueries.chronology()) {
2483
+ return core.IsoChronology.INSTANCE;
2484
+ }
2485
+
2486
+ return _Temporal.prototype.query.call(this, _query);
2487
+ };
2488
+
2489
+ _proto.adjustInto = function adjustInto(temporal) {
2490
+ return temporal.with(core.IsoFields.WEEK_BASED_YEAR, this._year).with(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR, this._week);
2491
+ };
2492
+
2493
+ _proto.until = function until(endExclusive, unit) {
2494
+ var end = YearWeek.from(endExclusive);
2495
+
2496
+ if (unit === core.ChronoUnit.WEEKS) {
2497
+ return this._daysUntil(end);
2498
+ } else if (unit === core.IsoFields.WEEK_BASED_YEARS) {
2499
+ return this._yearsUntil(end);
2500
+ } else if (unit instanceof core.ChronoUnit) {
2501
+ throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
2502
+ }
2503
+
2504
+ return unit.between(this, end);
2505
+ };
2506
+
2507
+ _proto._daysUntil = function _daysUntil(end) {
2508
+ var startDate = this.atDay(core.DayOfWeek.MONDAY);
2509
+ var endDate = end.atDay(core.DayOfWeek.MONDAY);
2510
+ var days = endDate.toEpochDay() - startDate.toEpochDay();
2511
+ return MathUtil.intDiv(days, 7);
2512
+ };
2513
+
2514
+ _proto._yearsUntil = function _yearsUntil(end) {
2515
+ var yearsDiff = end._year - this._year;
2516
+
2517
+ if (yearsDiff > 0 && end._week < this._week) {
2518
+ return yearsDiff - 1;
2519
+ }
2520
+
2521
+ if (yearsDiff < 0 && end._week > this._week) {
2522
+ return yearsDiff + 1;
2523
+ }
2524
+
2525
+ return yearsDiff;
2526
+ };
2527
+
2528
+ _proto.format = function format(formatter) {
2529
+ requireNonNull(formatter, 'formatter');
2530
+ return formatter.format(this);
2531
+ };
2532
+
2533
+ _proto.atDay = function atDay(dayOfWeek) {
2534
+ requireNonNull(dayOfWeek, 'dayOfWeek');
2535
+ var correction = core.LocalDate.of(this._year, 1, 4).dayOfWeek().value() + 3;
2536
+ var dayOfYear = this._week * 7 + dayOfWeek.value() - correction;
2537
+ var maxDaysOfYear = core.Year.isLeap(this._year) ? 366 : 365;
2538
+
2539
+ if (dayOfYear > maxDaysOfYear) {
2540
+ return core.LocalDate.ofYearDay(this._year + 1, dayOfYear - maxDaysOfYear);
2541
+ }
2542
+
2543
+ if (dayOfYear > 0) {
2544
+ return core.LocalDate.ofYearDay(this._year, dayOfYear);
2545
+ } else {
2546
+ var daysOfPreviousYear = core.Year.isLeap(this._year - 1) ? 366 : 365;
2547
+ return core.LocalDate.ofYearDay(this._year - 1, daysOfPreviousYear + dayOfYear);
2548
+ }
2549
+ };
2550
+
2551
+ _proto.compareTo = function compareTo(other) {
2552
+ requireNonNull(other, 'other');
2553
+ requireInstance(other, YearWeek, 'other');
2554
+ var cmp = this._year - other._year;
2555
+
2556
+ if (cmp === 0) {
2557
+ cmp = this._week - other._week;
2558
+ }
2559
+
2560
+ return cmp;
2561
+ };
2562
+
2563
+ _proto.isAfter = function isAfter(other) {
2564
+ return this.compareTo(other) > 0;
2565
+ };
2566
+
2567
+ _proto.isBefore = function isBefore(other) {
2568
+ return this.compareTo(other) < 0;
2569
+ };
2570
+
2571
+ _proto.equals = function equals(obj) {
2572
+ if (this === obj) {
2573
+ return true;
2574
+ }
2575
+
2576
+ if (obj instanceof YearWeek) {
2577
+ return this._year === obj._year && this._week === obj._week;
2578
+ }
2579
+
2580
+ return false;
2581
+ };
2582
+
2583
+ _proto.hashCode = function hashCode() {
2584
+ return this._year ^ this._week << 25;
2585
+ };
2586
+
2587
+ _proto.toString = function toString() {
2588
+ var yearString;
2589
+ var yearValue = this._year;
2590
+ var absYear = Math.abs(yearValue);
2591
+
2592
+ if (absYear < 1000) {
2593
+ if (yearValue < 0) {
2594
+ yearString = "-" + ("" + (yearValue - 10000)).slice(-4);
2595
+ } else {
2596
+ yearString = ("" + (yearValue + 10000)).slice(-4);
2597
+ }
2598
+ } else {
2599
+ if (yearValue > 9999) {
2600
+ yearString = "+" + yearValue;
2601
+ } else {
2602
+ yearString = "" + yearValue;
2603
+ }
2604
+ }
2605
+
2606
+ return yearString.concat(this._week < 10 ? '-W0' : '-W').concat(this._week);
2607
+ };
2608
+
2609
+ return YearWeek;
2610
+ }(core.Temporal);
2611
+ function _init() {
2612
+ YearWeek.PARSER = new core.DateTimeFormatterBuilder().parseCaseInsensitive().appendValue(core.IsoFields.WEEK_BASED_YEAR, 4, 10, core.SignStyle.EXCEEDS_PAD).appendLiteral('-W').appendValue(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR, 2).toFormatter();
2613
+ YearWeek.FROM = createTemporalQuery('YearWeek.FROM', function (temporal) {
2614
+ return YearWeek.from(temporal);
2615
+ });
2616
+ }
2617
+
2618
+ function createTemporalQuery(name, queryFromFunction) {
2619
+ var ExtendedTemporalQuery = function (_TemporalQuery) {
2620
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
2621
+
2622
+ function ExtendedTemporalQuery() {
2623
+ return _TemporalQuery.apply(this, arguments) || this;
2624
+ }
2625
+
2626
+ return ExtendedTemporalQuery;
2627
+ }(core.TemporalQuery);
2628
+
2629
+ ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
2630
+ return new ExtendedTemporalQuery(name);
2631
+ }
2632
+
669
2633
  /*
670
2634
  * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
671
2635
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
@@ -678,6 +2642,11 @@
678
2642
  }
679
2643
 
680
2644
  isInit = true;
2645
+ _init$7();
2646
+ _init$6();
2647
+ _init$5();
2648
+ _init$4();
2649
+ _init$3();
681
2650
  _init$2();
682
2651
  _init$1();
683
2652
  _init();
@@ -700,6 +2669,11 @@
700
2669
  exports.DayOfMonth = DayOfMonth;
701
2670
  exports.DayOfYear = DayOfYear;
702
2671
  exports.Interval = Interval;
2672
+ exports.LocalDateRange = LocalDateRange;
2673
+ exports.OffsetDate = OffsetDate;
2674
+ exports.Quarter = Quarter;
2675
+ exports.YearQuarter = YearQuarter;
2676
+ exports.YearWeek = YearWeek;
703
2677
 
704
2678
  Object.defineProperty(exports, '__esModule', { value: true });
705
2679