@opengeoweb/webmap 8.0.0 → 8.1.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.
Files changed (74) hide show
  1. package/README.md +0 -0
  2. package/index.esm.d.ts +0 -0
  3. package/index.esm.js +1479 -1250
  4. package/package.json +2 -2
  5. package/src/index.d.ts +0 -0
  6. package/src/lib/components/WMAnimate.d.ts +2 -8
  7. package/src/lib/components/WMAnimate.spec.d.ts +0 -0
  8. package/src/lib/components/WMBBOX.d.ts +0 -0
  9. package/src/lib/components/WMBBOX.spec.d.ts +0 -0
  10. package/src/lib/components/WMCanvasBuffer.d.ts +0 -0
  11. package/src/lib/components/WMCanvasBuffer.spec.d.ts +0 -0
  12. package/src/lib/components/WMConstants.d.ts +0 -0
  13. package/src/lib/components/WMDrawMarker.d.ts +0 -0
  14. package/src/lib/components/WMDrawMarker.spec.d.ts +0 -0
  15. package/src/lib/components/WMFlyToBBox.d.ts +0 -0
  16. package/src/lib/components/WMFlyToBBox.spec.d.ts +0 -0
  17. package/src/lib/components/WMGetServiceFromStore.d.ts +0 -0
  18. package/src/lib/components/WMGlobals.d.ts +0 -0
  19. package/src/lib/components/WMImage.d.ts +0 -0
  20. package/src/lib/components/WMImage.spec.d.ts +0 -0
  21. package/src/lib/components/WMImageStore.d.ts +0 -0
  22. package/src/lib/components/WMImageStore.spec.d.ts +0 -0
  23. package/src/lib/components/WMJSDimension.d.ts +0 -0
  24. package/src/lib/components/WMJSDimension.spec.d.ts +0 -0
  25. package/src/lib/components/WMJSExternalDependencies.d.ts +0 -0
  26. package/src/lib/components/WMJSMap.d.ts +10 -10
  27. package/src/lib/components/WMJSMap.spec.d.ts +0 -0
  28. package/src/lib/components/WMJSMapHelpers.d.ts +0 -0
  29. package/src/lib/components/WMJSMapHelpers.spec.d.ts +0 -0
  30. package/src/lib/components/WMJSService.d.ts +3 -3
  31. package/src/lib/components/WMJSService.spec.d.ts +0 -0
  32. package/src/lib/components/WMJSTools.d.ts +1 -1
  33. package/src/lib/components/WMJSTools.spec.d.ts +0 -0
  34. package/src/lib/components/WMLayer.d.ts +2 -4
  35. package/src/lib/components/WMLayer.spec.d.ts +0 -0
  36. package/src/lib/components/WMLegend.d.ts +0 -0
  37. package/src/lib/components/WMLegend.spec.d.ts +0 -0
  38. package/src/lib/components/WMListener.d.ts +0 -0
  39. package/src/lib/components/WMMapPin.d.ts +0 -0
  40. package/src/lib/components/WMPrefetch.d.ts +9 -0
  41. package/src/lib/components/WMPrefetch.spec.d.ts +1 -0
  42. package/src/lib/components/WMProjection.d.ts +0 -0
  43. package/src/lib/components/WMTileRenderer.d.ts +0 -0
  44. package/src/lib/components/WMTileRenderer.spec.d.ts +0 -0
  45. package/src/lib/components/WMTime.d.ts +0 -0
  46. package/src/lib/components/WMTime.spec.d.ts +0 -0
  47. package/src/lib/components/WMTimeTypes.d.ts +0 -0
  48. package/src/lib/components/WMTimer.d.ts +0 -0
  49. package/src/lib/components/WMTimer.spec.d.ts +0 -0
  50. package/src/lib/components/WMXMLParser.d.ts +0 -0
  51. package/src/lib/components/WMXMLParser.spec.d.ts +0 -0
  52. package/src/lib/components/index.d.ts +2 -2
  53. package/src/lib/components/types.d.ts +0 -0
  54. package/src/lib/index.d.ts +0 -0
  55. package/src/lib/utils/I18n/lang.en.d.ts +0 -0
  56. package/src/lib/utils/I18n/lang.nl.d.ts +0 -0
  57. package/src/lib/utils/getCapabilities/getCapabilities.d.ts +0 -0
  58. package/src/lib/utils/getCapabilities/getCapabilities.spec.d.ts +0 -0
  59. package/src/lib/utils/getCapabilities/index.d.ts +0 -0
  60. package/src/lib/utils/getCapabilities/mocks/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +0 -0
  61. package/src/lib/utils/getCapabilities/mocks/index.d.ts +0 -0
  62. package/src/lib/utils/getCapabilities/mocks/mockGetCapabilities.d.ts +0 -0
  63. package/src/lib/utils/index.d.ts +0 -0
  64. package/src/lib/utils/specs/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +0 -0
  65. package/src/lib/utils/specs/WMS130GetCapabilitiesHarmN25.d.ts +0 -0
  66. package/src/lib/utils/specs/WMS130GetCapabilitiesRadarTestWithInheritAndReplaceLayerprops.d.ts +0 -0
  67. package/src/lib/utils/specs/WMS130GetCapabilitiesRadarTestWithInheritLayerprops.d.ts +0 -0
  68. package/src/lib/utils/specs/WMS130GetCapabilitiesRadarTestWithoutInheritLayerprops.d.ts +0 -0
  69. package/src/lib/utils/specs/WMSSmartMet.d.ts +0 -0
  70. package/src/lib/utils/testSettings.d.ts +0 -0
  71. package/src/lib/utils/testUtils.d.ts +0 -0
  72. package/src/lib/utils/tilesettings.d.ts +0 -0
  73. package/src/lib/utils/utils.d.ts +0 -0
  74. package/src/lib/utils/utils.spec.d.ts +0 -0
package/index.esm.js CHANGED
@@ -17755,7 +17755,7 @@ var DebugType;
17755
17755
  DebugType[DebugType["Warning"] = 1] = "Warning";
17756
17756
  DebugType[DebugType["Error"] = 2] = "Error";
17757
17757
  })(DebugType || (DebugType = {}));
17758
- var debug = function debug(type, message) {
17758
+ var debugLogger = function debugLogger(type, message) {
17759
17759
  };
17760
17760
  /**
17761
17761
  * Checks if variable is defined or not
@@ -17853,7 +17853,7 @@ var URLEncode = function URLEncode(plaintext) {
17853
17853
  } else {
17854
17854
  var charCode = ch.charCodeAt(0);
17855
17855
  if (charCode > 255) {
17856
- debug(DebugType.Warning);
17856
+ debugLogger(DebugType.Warning);
17857
17857
  encoded += '+';
17858
17858
  } else {
17859
17859
  encoded += '%';
@@ -18317,7 +18317,7 @@ var WMImage = /*#__PURE__*/function () {
18317
18317
  key: "setSource",
18318
18318
  value: function setSource(src, options) {
18319
18319
  if (this._isLoading) {
18320
- debug(DebugType.Error);
18320
+ debugLogger(DebugType.Error);
18321
18321
  return;
18322
18322
  }
18323
18323
  this.srcToLoad = src;
@@ -18404,9 +18404,9 @@ var WMImage = /*#__PURE__*/function () {
18404
18404
  _this2.getElement().src = base64Flag + imageStr;
18405
18405
  });
18406
18406
  })["catch"](function () {
18407
- debug(DebugType.Error, "Unable to fetch image ".concat(url, " with headers [").concat(JSON.stringify(headers), "]"));
18407
+ debugLogger(DebugType.Error, "Unable to fetch image ".concat(url, " with headers [").concat(JSON.stringify(headers), "]"));
18408
18408
  if (url.startsWith('http://')) {
18409
- debug(DebugType.Error);
18409
+ debugLogger(DebugType.Error);
18410
18410
  }
18411
18411
  _this2._loadEvent(true);
18412
18412
  });
@@ -18558,11 +18558,11 @@ var WMImageStore = /*#__PURE__*/function () {
18558
18558
  key: "addImageEventCallback",
18559
18559
  value: function addImageEventCallback(callback, id) {
18560
18560
  if (!id) {
18561
- debug(DebugType.Error);
18561
+ debugLogger(DebugType.Error);
18562
18562
  return;
18563
18563
  }
18564
18564
  if (!callback) {
18565
- debug(DebugType.Error);
18565
+ debugLogger(DebugType.Error);
18566
18566
  return;
18567
18567
  }
18568
18568
  this._loadEventCallbackList.push({
@@ -18903,7 +18903,7 @@ var WMListener = /*#__PURE__*/function () {
18903
18903
  try {
18904
18904
  returnList.push(this._callBacks[j].functionpointer(param, this));
18905
18905
  } catch (e) {
18906
- debug(DebugType.Error);
18906
+ debugLogger(DebugType.Error);
18907
18907
  }
18908
18908
  }
18909
18909
  }
@@ -19159,7 +19159,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19159
19159
  this._ctx.drawImage(imageElement, imageX, imageY, imageW, imageH);
19160
19160
  if (enableConsoleDebugging) ;
19161
19161
  } catch (e) {
19162
- debug(DebugType.Error);
19162
+ debugLogger(DebugType.Error);
19163
19163
  }
19164
19164
  }
19165
19165
  }, {
@@ -19220,7 +19220,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19220
19220
  for (var j = 0; j < this.layers.length; j += 1) {
19221
19221
  var image = this._imageStore.getImageForSrc(this.layers[j].imageSource);
19222
19222
  if (image.hasError()) {
19223
- debug(DebugType.Error, "image error: ".concat(image.getSrc()));
19223
+ debugLogger(DebugType.Error, "image error: ".concat(image.getSrc()));
19224
19224
  }
19225
19225
  }
19226
19226
  try {
@@ -19228,7 +19228,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19228
19228
  this.onLoadReadyFunction(this);
19229
19229
  }
19230
19230
  } catch (e) {
19231
- debug(DebugType.Error);
19231
+ debugLogger(DebugType.Error);
19232
19232
  }
19233
19233
  }
19234
19234
  }, {
@@ -19261,7 +19261,7 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19261
19261
  value: function setSrc(layerIndex, imageSource, linkedInfo, opacity, bbox) {
19262
19262
  var _a, _b;
19263
19263
  if (!isDefined(imageSource)) {
19264
- debug(DebugType.Warning);
19264
+ debugLogger(DebugType.Warning);
19265
19265
  return;
19266
19266
  }
19267
19267
  /* HTTP Headers for the image, necessary in case of certain authentication forms */
@@ -19319,29 +19319,835 @@ var WMCanvasBuffer = /*#__PURE__*/function () {
19319
19319
  return WMCanvasBuffer;
19320
19320
  }();
19321
19321
 
19322
- /**
19323
- * Prefetches given requests
19324
- *
19325
- * @param requests An array of requests to prefetch
19326
- * @return The list of images in prefetch
19322
+ function _typeof(o) {
19323
+ "@babel/helpers - typeof";
19324
+
19325
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
19326
+ return typeof o;
19327
+ } : function (o) {
19328
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
19329
+ }, _typeof(o);
19330
+ }
19331
+
19332
+ function toInteger(dirtyNumber) {
19333
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
19334
+ return NaN;
19335
+ }
19336
+ var number = Number(dirtyNumber);
19337
+ if (isNaN(number)) {
19338
+ return number;
19339
+ }
19340
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
19341
+ }
19342
+
19343
+ function requiredArgs(required, args) {
19344
+ if (args.length < required) {
19345
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
19346
+ }
19347
+ }
19348
+
19349
+ /**
19350
+ * @name toDate
19351
+ * @category Common Helpers
19352
+ * @summary Convert the given argument to an instance of Date.
19353
+ *
19354
+ * @description
19355
+ * Convert the given argument to an instance of Date.
19356
+ *
19357
+ * If the argument is an instance of Date, the function returns its clone.
19358
+ *
19359
+ * If the argument is a number, it is treated as a timestamp.
19360
+ *
19361
+ * If the argument is none of the above, the function returns Invalid Date.
19362
+ *
19363
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
19364
+ *
19365
+ * @param {Date|Number} argument - the value to convert
19366
+ * @returns {Date} the parsed date in the local time zone
19367
+ * @throws {TypeError} 1 argument required
19368
+ *
19369
+ * @example
19370
+ * // Clone the date:
19371
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
19372
+ * //=> Tue Feb 11 2014 11:30:30
19373
+ *
19374
+ * @example
19375
+ * // Convert the timestamp to date:
19376
+ * const result = toDate(1392098430000)
19377
+ * //=> Tue Feb 11 2014 11:30:30
19378
+ */
19379
+ function toDate(argument) {
19380
+ requiredArgs(1, arguments);
19381
+ var argStr = Object.prototype.toString.call(argument);
19382
+
19383
+ // Clone the date
19384
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
19385
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
19386
+ return new Date(argument.getTime());
19387
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
19388
+ return new Date(argument);
19389
+ } else {
19390
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
19391
+ // eslint-disable-next-line no-console
19392
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
19393
+ // eslint-disable-next-line no-console
19394
+ console.warn(new Error().stack);
19395
+ }
19396
+ return new Date(NaN);
19397
+ }
19398
+ }
19399
+
19400
+ /**
19401
+ * @name addDays
19402
+ * @category Day Helpers
19403
+ * @summary Add the specified number of days to the given date.
19404
+ *
19405
+ * @description
19406
+ * Add the specified number of days to the given date.
19407
+ *
19408
+ * @param {Date|Number} date - the date to be changed
19409
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19410
+ * @returns {Date} - the new date with the days added
19411
+ * @throws {TypeError} - 2 arguments required
19412
+ *
19413
+ * @example
19414
+ * // Add 10 days to 1 September 2014:
19415
+ * const result = addDays(new Date(2014, 8, 1), 10)
19416
+ * //=> Thu Sep 11 2014 00:00:00
19417
+ */
19418
+ function addDays(dirtyDate, dirtyAmount) {
19419
+ requiredArgs(2, arguments);
19420
+ var date = toDate(dirtyDate);
19421
+ var amount = toInteger(dirtyAmount);
19422
+ if (isNaN(amount)) {
19423
+ return new Date(NaN);
19424
+ }
19425
+ if (!amount) {
19426
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
19427
+ return date;
19428
+ }
19429
+ date.setDate(date.getDate() + amount);
19430
+ return date;
19431
+ }
19432
+
19433
+ /**
19434
+ * @name addMonths
19435
+ * @category Month Helpers
19436
+ * @summary Add the specified number of months to the given date.
19437
+ *
19438
+ * @description
19439
+ * Add the specified number of months to the given date.
19440
+ *
19441
+ * @param {Date|Number} date - the date to be changed
19442
+ * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19443
+ * @returns {Date} the new date with the months added
19444
+ * @throws {TypeError} 2 arguments required
19445
+ *
19446
+ * @example
19447
+ * // Add 5 months to 1 September 2014:
19448
+ * const result = addMonths(new Date(2014, 8, 1), 5)
19449
+ * //=> Sun Feb 01 2015 00:00:00
19450
+ */
19451
+ function addMonths(dirtyDate, dirtyAmount) {
19452
+ requiredArgs(2, arguments);
19453
+ var date = toDate(dirtyDate);
19454
+ var amount = toInteger(dirtyAmount);
19455
+ if (isNaN(amount)) {
19456
+ return new Date(NaN);
19457
+ }
19458
+ if (!amount) {
19459
+ // If 0 months, no-op to avoid changing times in the hour before end of DST
19460
+ return date;
19461
+ }
19462
+ var dayOfMonth = date.getDate();
19463
+
19464
+ // The JS Date object supports date math by accepting out-of-bounds values for
19465
+ // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
19466
+ // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
19467
+ // want except that dates will wrap around the end of a month, meaning that
19468
+ // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
19469
+ // we'll default to the end of the desired month by adding 1 to the desired
19470
+ // month and using a date of 0 to back up one day to the end of the desired
19471
+ // month.
19472
+ var endOfDesiredMonth = new Date(date.getTime());
19473
+ endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
19474
+ var daysInMonth = endOfDesiredMonth.getDate();
19475
+ if (dayOfMonth >= daysInMonth) {
19476
+ // If we're already at the end of the month, then this is the correct date
19477
+ // and we're done.
19478
+ return endOfDesiredMonth;
19479
+ } else {
19480
+ // Otherwise, we now know that setting the original day-of-month value won't
19481
+ // cause an overflow, so set the desired day-of-month. Note that we can't
19482
+ // just set the date of `endOfDesiredMonth` because that object may have had
19483
+ // its time changed in the unusual case where where a DST transition was on
19484
+ // the last day of the month and its local time was in the hour skipped or
19485
+ // repeated next to a DST transition. So we use `date` instead which is
19486
+ // guaranteed to still have the original time.
19487
+ date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
19488
+ return date;
19489
+ }
19490
+ }
19491
+
19492
+ /**
19493
+ * @name add
19494
+ * @category Common Helpers
19495
+ * @summary Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
19496
+ *
19497
+ * @description
19498
+ * Add the specified years, months, weeks, days, hours, minutes and seconds to the given date.
19499
+ *
19500
+ * @param {Date|Number} date - the date to be changed
19501
+ * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19502
+ *
19503
+ * | Key | Description |
19504
+ * |----------------|------------------------------------|
19505
+ * | years | Amount of years to be added |
19506
+ * | months | Amount of months to be added |
19507
+ * | weeks | Amount of weeks to be added |
19508
+ * | days | Amount of days to be added |
19509
+ * | hours | Amount of hours to be added |
19510
+ * | minutes | Amount of minutes to be added |
19511
+ * | seconds | Amount of seconds to be added |
19512
+ *
19513
+ * All values default to 0
19514
+ *
19515
+ * @returns {Date} the new date with the seconds added
19516
+ * @throws {TypeError} 2 arguments required
19517
+ *
19518
+ * @example
19519
+ * // Add the following duration to 1 September 2014, 10:19:50
19520
+ * const result = add(new Date(2014, 8, 1, 10, 19, 50), {
19521
+ * years: 2,
19522
+ * months: 9,
19523
+ * weeks: 1,
19524
+ * days: 7,
19525
+ * hours: 5,
19526
+ * minutes: 9,
19527
+ * seconds: 30,
19528
+ * })
19529
+ * //=> Thu Jun 15 2017 15:29:20
19530
+ */
19531
+ function add(dirtyDate, duration) {
19532
+ requiredArgs(2, arguments);
19533
+ if (!duration || _typeof(duration) !== 'object') return new Date(NaN);
19534
+ var years = duration.years ? toInteger(duration.years) : 0;
19535
+ var months = duration.months ? toInteger(duration.months) : 0;
19536
+ var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
19537
+ var days = duration.days ? toInteger(duration.days) : 0;
19538
+ var hours = duration.hours ? toInteger(duration.hours) : 0;
19539
+ var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
19540
+ var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
19541
+
19542
+ // Add years and months
19543
+ var date = toDate(dirtyDate);
19544
+ var dateWithMonths = months || years ? addMonths(date, months + years * 12) : date;
19545
+
19546
+ // Add weeks and days
19547
+ var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
19548
+
19549
+ // Add days, hours, minutes and seconds
19550
+ var minutesToAdd = minutes + hours * 60;
19551
+ var secondsToAdd = seconds + minutesToAdd * 60;
19552
+ var msToAdd = secondsToAdd * 1000;
19553
+ var finalDate = new Date(dateWithDays.getTime() + msToAdd);
19554
+ return finalDate;
19555
+ }
19556
+
19557
+ /**
19558
+ * Days in 1 week.
19559
+ *
19560
+ * @name daysInWeek
19561
+ * @constant
19562
+ * @type {number}
19563
+ * @default
19564
+ */
19565
+
19566
+ /**
19567
+ * Milliseconds in 1 minute
19568
+ *
19569
+ * @name millisecondsInMinute
19570
+ * @constant
19571
+ * @type {number}
19572
+ * @default
19573
+ */
19574
+ var millisecondsInMinute = 60000;
19575
+
19576
+ /**
19577
+ * Milliseconds in 1 hour
19578
+ *
19579
+ * @name millisecondsInHour
19580
+ * @constant
19581
+ * @type {number}
19582
+ * @default
19583
+ */
19584
+ var millisecondsInHour = 3600000;
19585
+
19586
+ /**
19587
+ * @name isDate
19588
+ * @category Common Helpers
19589
+ * @summary Is the given value a date?
19590
+ *
19591
+ * @description
19592
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
19593
+ *
19594
+ * @param {*} value - the value to check
19595
+ * @returns {boolean} true if the given value is a date
19596
+ * @throws {TypeError} 1 arguments required
19597
+ *
19598
+ * @example
19599
+ * // For a valid date:
19600
+ * const result = isDate(new Date())
19601
+ * //=> true
19602
+ *
19603
+ * @example
19604
+ * // For an invalid date:
19605
+ * const result = isDate(new Date(NaN))
19606
+ * //=> true
19607
+ *
19608
+ * @example
19609
+ * // For some value:
19610
+ * const result = isDate('2014-02-31')
19611
+ * //=> false
19612
+ *
19613
+ * @example
19614
+ * // For an object:
19615
+ * const result = isDate({})
19616
+ * //=> false
19617
+ */
19618
+ function isDate(value) {
19619
+ requiredArgs(1, arguments);
19620
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
19621
+ }
19622
+
19623
+ /**
19624
+ * @name isValid
19625
+ * @category Common Helpers
19626
+ * @summary Is the given date valid?
19627
+ *
19628
+ * @description
19629
+ * Returns false if argument is Invalid Date and true otherwise.
19630
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
19631
+ * Invalid Date is a Date, whose time value is NaN.
19632
+ *
19633
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
19634
+ *
19635
+ * @param {*} date - the date to check
19636
+ * @returns {Boolean} the date is valid
19637
+ * @throws {TypeError} 1 argument required
19638
+ *
19639
+ * @example
19640
+ * // For the valid date:
19641
+ * const result = isValid(new Date(2014, 1, 31))
19642
+ * //=> true
19643
+ *
19644
+ * @example
19645
+ * // For the value, convertable into a date:
19646
+ * const result = isValid(1393804800000)
19647
+ * //=> true
19648
+ *
19649
+ * @example
19650
+ * // For the invalid date:
19651
+ * const result = isValid(new Date(''))
19652
+ * //=> false
19653
+ */
19654
+ function isValid(dirtyDate) {
19655
+ requiredArgs(1, arguments);
19656
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
19657
+ return false;
19658
+ }
19659
+ var date = toDate(dirtyDate);
19660
+ return !isNaN(Number(date));
19661
+ }
19662
+
19663
+ /**
19664
+ * @name isWithinInterval
19665
+ * @category Interval Helpers
19666
+ * @summary Is the given date within the interval?
19667
+ *
19668
+ * @description
19669
+ * Is the given date within the interval? (Including start and end.)
19670
+ *
19671
+ * @param {Date|Number} date - the date to check
19672
+ * @param {Interval} interval - the interval to check
19673
+ * @returns {Boolean} the date is within the interval
19674
+ * @throws {TypeError} 2 arguments required
19675
+ * @throws {RangeError} The start of an interval cannot be after its end
19676
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
19677
+ *
19678
+ * @example
19679
+ * // For the date within the interval:
19680
+ * isWithinInterval(new Date(2014, 0, 3), {
19681
+ * start: new Date(2014, 0, 1),
19682
+ * end: new Date(2014, 0, 7)
19683
+ * })
19684
+ * //=> true
19685
+ *
19686
+ * @example
19687
+ * // For the date outside of the interval:
19688
+ * isWithinInterval(new Date(2014, 0, 10), {
19689
+ * start: new Date(2014, 0, 1),
19690
+ * end: new Date(2014, 0, 7)
19691
+ * })
19692
+ * //=> false
19693
+ *
19694
+ * @example
19695
+ * // For date equal to interval start:
19696
+ * isWithinInterval(date, { start, end: date }) // => true
19697
+ *
19698
+ * @example
19699
+ * // For date equal to interval end:
19700
+ * isWithinInterval(date, { start: date, end }) // => true
19701
+ */
19702
+ function isWithinInterval(dirtyDate, interval) {
19703
+ requiredArgs(2, arguments);
19704
+ var time = toDate(dirtyDate).getTime();
19705
+ var startTime = toDate(interval.start).getTime();
19706
+ var endTime = toDate(interval.end).getTime();
19707
+
19708
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
19709
+ if (!(startTime <= endTime)) {
19710
+ throw new RangeError('Invalid interval');
19711
+ }
19712
+ return time >= startTime && time <= endTime;
19713
+ }
19714
+
19715
+ /**
19716
+ * @name subDays
19717
+ * @category Day Helpers
19718
+ * @summary Subtract the specified number of days from the given date.
19719
+ *
19720
+ * @description
19721
+ * Subtract the specified number of days from the given date.
19722
+ *
19723
+ * @param {Date|Number} date - the date to be changed
19724
+ * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19725
+ * @returns {Date} the new date with the days subtracted
19726
+ * @throws {TypeError} 2 arguments required
19727
+ *
19728
+ * @example
19729
+ * // Subtract 10 days from 1 September 2014:
19730
+ * const result = subDays(new Date(2014, 8, 1), 10)
19731
+ * //=> Fri Aug 22 2014 00:00:00
19732
+ */
19733
+ function subDays(dirtyDate, dirtyAmount) {
19734
+ requiredArgs(2, arguments);
19735
+ var amount = toInteger(dirtyAmount);
19736
+ return addDays(dirtyDate, -amount);
19737
+ }
19738
+
19739
+ /**
19740
+ * @name parseISO
19741
+ * @category Common Helpers
19742
+ * @summary Parse ISO string
19743
+ *
19744
+ * @description
19745
+ * Parse the given string in ISO 8601 format and return an instance of Date.
19746
+ *
19747
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
19748
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
19749
+ *
19750
+ * If the argument isn't a string, the function cannot parse the string or
19751
+ * the values are invalid, it returns Invalid Date.
19752
+ *
19753
+ * @param {String} argument - the value to convert
19754
+ * @param {Object} [options] - an object with options.
19755
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
19756
+ * @returns {Date} the parsed date in the local time zone
19757
+ * @throws {TypeError} 1 argument required
19758
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
19759
+ *
19760
+ * @example
19761
+ * // Convert string '2014-02-11T11:30:30' to date:
19762
+ * const result = parseISO('2014-02-11T11:30:30')
19763
+ * //=> Tue Feb 11 2014 11:30:30
19764
+ *
19765
+ * @example
19766
+ * // Convert string '+02014101' to date,
19767
+ * // if the additional number of digits in the extended year format is 1:
19768
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
19769
+ * //=> Fri Apr 11 2014 00:00:00
19770
+ */
19771
+ function parseISO(argument, options) {
19772
+ var _options$additionalDi;
19773
+ requiredArgs(1, arguments);
19774
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
19775
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
19776
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
19777
+ }
19778
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
19779
+ return new Date(NaN);
19780
+ }
19781
+ var dateStrings = splitDateString(argument);
19782
+ var date;
19783
+ if (dateStrings.date) {
19784
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
19785
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
19786
+ }
19787
+ if (!date || isNaN(date.getTime())) {
19788
+ return new Date(NaN);
19789
+ }
19790
+ var timestamp = date.getTime();
19791
+ var time = 0;
19792
+ var offset;
19793
+ if (dateStrings.time) {
19794
+ time = parseTime(dateStrings.time);
19795
+ if (isNaN(time)) {
19796
+ return new Date(NaN);
19797
+ }
19798
+ }
19799
+ if (dateStrings.timezone) {
19800
+ offset = parseTimezone(dateStrings.timezone);
19801
+ if (isNaN(offset)) {
19802
+ return new Date(NaN);
19803
+ }
19804
+ } else {
19805
+ var dirtyDate = new Date(timestamp + time);
19806
+ // js parsed string assuming it's in UTC timezone
19807
+ // but we need it to be parsed in our timezone
19808
+ // so we use utc values to build date in our timezone.
19809
+ // Year values from 0 to 99 map to the years 1900 to 1999
19810
+ // so set year explicitly with setFullYear.
19811
+ var result = new Date(0);
19812
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
19813
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
19814
+ return result;
19815
+ }
19816
+ return new Date(timestamp + time + offset);
19817
+ }
19818
+ var patterns = {
19819
+ dateTimeDelimiter: /[T ]/,
19820
+ timeZoneDelimiter: /[Z ]/i,
19821
+ timezone: /([Z+-].*)$/
19822
+ };
19823
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
19824
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
19825
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
19826
+ function splitDateString(dateString) {
19827
+ var dateStrings = {};
19828
+ var array = dateString.split(patterns.dateTimeDelimiter);
19829
+ var timeString;
19830
+
19831
+ // The regex match should only return at maximum two array elements.
19832
+ // [date], [time], or [date, time].
19833
+ if (array.length > 2) {
19834
+ return dateStrings;
19835
+ }
19836
+ if (/:/.test(array[0])) {
19837
+ timeString = array[0];
19838
+ } else {
19839
+ dateStrings.date = array[0];
19840
+ timeString = array[1];
19841
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
19842
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
19843
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
19844
+ }
19845
+ }
19846
+ if (timeString) {
19847
+ var token = patterns.timezone.exec(timeString);
19848
+ if (token) {
19849
+ dateStrings.time = timeString.replace(token[1], '');
19850
+ dateStrings.timezone = token[1];
19851
+ } else {
19852
+ dateStrings.time = timeString;
19853
+ }
19854
+ }
19855
+ return dateStrings;
19856
+ }
19857
+ function parseYear(dateString, additionalDigits) {
19858
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
19859
+ var captures = dateString.match(regex);
19860
+ // Invalid ISO-formatted year
19861
+ if (!captures) return {
19862
+ year: NaN,
19863
+ restDateString: ''
19864
+ };
19865
+ var year = captures[1] ? parseInt(captures[1]) : null;
19866
+ var century = captures[2] ? parseInt(captures[2]) : null;
19867
+
19868
+ // either year or century is null, not both
19869
+ return {
19870
+ year: century === null ? year : century * 100,
19871
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
19872
+ };
19873
+ }
19874
+ function parseDate(dateString, year) {
19875
+ // Invalid ISO-formatted year
19876
+ if (year === null) return new Date(NaN);
19877
+ var captures = dateString.match(dateRegex);
19878
+ // Invalid ISO-formatted string
19879
+ if (!captures) return new Date(NaN);
19880
+ var isWeekDate = !!captures[4];
19881
+ var dayOfYear = parseDateUnit(captures[1]);
19882
+ var month = parseDateUnit(captures[2]) - 1;
19883
+ var day = parseDateUnit(captures[3]);
19884
+ var week = parseDateUnit(captures[4]);
19885
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
19886
+ if (isWeekDate) {
19887
+ if (!validateWeekDate(year, week, dayOfWeek)) {
19888
+ return new Date(NaN);
19889
+ }
19890
+ return dayOfISOWeekYear(year, week, dayOfWeek);
19891
+ } else {
19892
+ var date = new Date(0);
19893
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
19894
+ return new Date(NaN);
19895
+ }
19896
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
19897
+ return date;
19898
+ }
19899
+ }
19900
+ function parseDateUnit(value) {
19901
+ return value ? parseInt(value) : 1;
19902
+ }
19903
+ function parseTime(timeString) {
19904
+ var captures = timeString.match(timeRegex);
19905
+ if (!captures) return NaN; // Invalid ISO-formatted time
19906
+
19907
+ var hours = parseTimeUnit(captures[1]);
19908
+ var minutes = parseTimeUnit(captures[2]);
19909
+ var seconds = parseTimeUnit(captures[3]);
19910
+ if (!validateTime(hours, minutes, seconds)) {
19911
+ return NaN;
19912
+ }
19913
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
19914
+ }
19915
+ function parseTimeUnit(value) {
19916
+ return value && parseFloat(value.replace(',', '.')) || 0;
19917
+ }
19918
+ function parseTimezone(timezoneString) {
19919
+ if (timezoneString === 'Z') return 0;
19920
+ var captures = timezoneString.match(timezoneRegex);
19921
+ if (!captures) return 0;
19922
+ var sign = captures[1] === '+' ? -1 : 1;
19923
+ var hours = parseInt(captures[2]);
19924
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
19925
+ if (!validateTimezone(hours, minutes)) {
19926
+ return NaN;
19927
+ }
19928
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
19929
+ }
19930
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
19931
+ var date = new Date(0);
19932
+ date.setUTCFullYear(isoWeekYear, 0, 4);
19933
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
19934
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
19935
+ date.setUTCDate(date.getUTCDate() + diff);
19936
+ return date;
19937
+ }
19938
+
19939
+ // Validation functions
19940
+
19941
+ // February is null to handle the leap year (using ||)
19942
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
19943
+ function isLeapYearIndex(year) {
19944
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
19945
+ }
19946
+ function validateDate(year, month, date) {
19947
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
19948
+ }
19949
+ function validateDayOfYearDate(year, dayOfYear) {
19950
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
19951
+ }
19952
+ function validateWeekDate(_year, week, day) {
19953
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
19954
+ }
19955
+ function validateTime(hours, minutes, seconds) {
19956
+ if (hours === 24) {
19957
+ return minutes === 0 && seconds === 0;
19958
+ }
19959
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
19960
+ }
19961
+ function validateTimezone(_hours, minutes) {
19962
+ return minutes >= 0 && minutes <= 59;
19963
+ }
19964
+
19965
+ /**
19966
+ * @name subMonths
19967
+ * @category Month Helpers
19968
+ * @summary Subtract the specified number of months from the given date.
19969
+ *
19970
+ * @description
19971
+ * Subtract the specified number of months from the given date.
19972
+ *
19973
+ * @param {Date|Number} date - the date to be changed
19974
+ * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
19975
+ * @returns {Date} the new date with the months subtracted
19976
+ * @throws {TypeError} 2 arguments required
19977
+ *
19978
+ * @example
19979
+ * // Subtract 5 months from 1 February 2015:
19980
+ * const result = subMonths(new Date(2015, 1, 1), 5)
19981
+ * //=> Mon Sep 01 2014 00:00:00
19327
19982
  */
19328
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
19329
- var prefetch = function prefetch(requests) {
19330
- var prefetching = [];
19983
+ function subMonths(dirtyDate, dirtyAmount) {
19984
+ requiredArgs(2, arguments);
19985
+ var amount = toInteger(dirtyAmount);
19986
+ return addMonths(dirtyDate, -amount);
19987
+ }
19988
+
19989
+ /**
19990
+ * @name sub
19991
+ * @category Common Helpers
19992
+ * @summary Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.
19993
+ *
19994
+ * @description
19995
+ * Subtract the specified years, months, weeks, days, hours, minutes and seconds from the given date.
19996
+ *
19997
+ * @param {Date|Number} date - the date to be changed
19998
+ * @param {Duration} duration - the object with years, months, weeks, days, hours, minutes and seconds to be subtracted
19999
+ *
20000
+ * | Key | Description |
20001
+ * |---------|------------------------------------|
20002
+ * | years | Amount of years to be subtracted |
20003
+ * | months | Amount of months to be subtracted |
20004
+ * | weeks | Amount of weeks to be subtracted |
20005
+ * | days | Amount of days to be subtracted |
20006
+ * | hours | Amount of hours to be subtracted |
20007
+ * | minutes | Amount of minutes to be subtracted |
20008
+ * | seconds | Amount of seconds to be subtracted |
20009
+ *
20010
+ * All values default to 0
20011
+ *
20012
+ * @returns {Date} the new date with the seconds subtracted
20013
+ * @throws {TypeError} 2 arguments required
20014
+ *
20015
+ * @example
20016
+ * // Subtract the following duration from 15 June 2017 15:29:20
20017
+ * const result = sub(new Date(2017, 5, 15, 15, 29, 20), {
20018
+ * years: 2,
20019
+ * months: 9,
20020
+ * weeks: 1,
20021
+ * days: 7,
20022
+ * hours: 5,
20023
+ * minutes: 9,
20024
+ * seconds: 30
20025
+ * })
20026
+ * //=> Mon Sep 1 2014 10:19:50
20027
+ */
20028
+ function sub(date, duration) {
20029
+ requiredArgs(2, arguments);
20030
+ if (!duration || _typeof(duration) !== 'object') return new Date(NaN);
20031
+ var years = duration.years ? toInteger(duration.years) : 0;
20032
+ var months = duration.months ? toInteger(duration.months) : 0;
20033
+ var weeks = duration.weeks ? toInteger(duration.weeks) : 0;
20034
+ var days = duration.days ? toInteger(duration.days) : 0;
20035
+ var hours = duration.hours ? toInteger(duration.hours) : 0;
20036
+ var minutes = duration.minutes ? toInteger(duration.minutes) : 0;
20037
+ var seconds = duration.seconds ? toInteger(duration.seconds) : 0;
20038
+
20039
+ // Subtract years and months
20040
+ var dateWithoutMonths = subMonths(date, months + years * 12);
20041
+
20042
+ // Subtract weeks and days
20043
+ var dateWithoutDays = subDays(dateWithoutMonths, days + weeks * 7);
20044
+
20045
+ // Subtract hours, minutes and seconds
20046
+ var minutestoSub = minutes + hours * 60;
20047
+ var secondstoSub = seconds + minutestoSub * 60;
20048
+ var mstoSub = secondstoSub * 1000;
20049
+ var finalDate = new Date(dateWithoutDays.getTime() - mstoSub);
20050
+ return finalDate;
20051
+ }
20052
+
20053
+ var MAX_IMAGES_TO_PREFETCH_DEFAULT = 8;
20054
+ function prefetchImagesForAnimation(wmMap) {
20055
+ var maxImagesToPrefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_IMAGES_TO_PREFETCH_DEFAULT;
20056
+ var animationSteps = wmMap.animationList;
20057
+ var countAnimationSteps = animationSteps.length;
20058
+ var timesToPrefetchInOrder = lodash.exports.range(0, countAnimationSteps).map(function (offset) {
20059
+ // start prefecthing images for the next animation step first
20060
+ // when reaching end of animation, start from the beginning
20061
+ var indexOfNextAnimationStep = (wmMap.currentAnimationStep + offset) % countAnimationSteps;
20062
+ return animationSteps[indexOfNextAnimationStep].value;
20063
+ });
20064
+ var currentTime = animationSteps[wmMap.currentAnimationStep].value;
20065
+ prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime);
20066
+ }
20067
+ function prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime) {
20068
+ var _iterator = _createForOfIteratorHelper(timesToPrefetchInOrder),
20069
+ _step;
20070
+ try {
20071
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
20072
+ var timeToPrefetch = _step.value;
20073
+ // dont prefetch if already prefetching too many images
20074
+ var countImagesLoading = getMapImageStore.getNumImagesLoading();
20075
+ if (countImagesLoading > maxImagesToPrefetch - 1) {
20076
+ break;
20077
+ }
20078
+ var layersImageUrls = getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime);
20079
+ prefetchLayerImagesForTime(layersImageUrls);
20080
+ }
20081
+ } catch (err) {
20082
+ _iterator.e(err);
20083
+ } finally {
20084
+ _iterator.f();
20085
+ }
20086
+ }
20087
+ function getLayersImageUrlsForTime(wmMap, timeToPrefetch, currentTime) {
20088
+ // get urls for layers at time
20089
+ wmMap.setTimeDimension(timeToPrefetch, false);
20090
+ var layersImageUrls = wmMap.getWMSRequests();
20091
+ // set map back to correct time
20092
+ wmMap.setTimeDimension(currentTime, false);
20093
+ return layersImageUrls;
20094
+ }
20095
+ function prefetchLayerImagesForTime(requests) {
19331
20096
  requests.forEach(function (request) {
19332
20097
  var image = getMapImageStore.getImage(request.url, {
19333
20098
  headers: request.headers
19334
20099
  });
19335
20100
  if (image.hasNotStartedLoading()) {
19336
- prefetching.push(image);
19337
20101
  image.load();
19338
20102
  }
19339
20103
  });
19340
- return prefetching;
19341
- };
20104
+ }
20105
+ function prefetchImagesForNonAnimation(wmMap) {
20106
+ var maxImagesToPrefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MAX_IMAGES_TO_PREFETCH_DEFAULT;
20107
+ var timestepInMinutes = wmMap.timestepInMinutes;
20108
+ var timeDimension = wmMap.getDimension('time');
20109
+ if (!timeDimension || !timestepInMinutes) {
20110
+ return;
20111
+ }
20112
+ var currentValue = timeDimension.currentValue;
20113
+ var currentTimeIsoString = timeDimension.getClosestValue(currentValue);
20114
+ var currentTime = parseISO(currentTimeIsoString);
20115
+ if (!isValid(currentTime)) {
20116
+ return;
20117
+ }
20118
+ var maxTimesToPrefetchIfOneLayer = maxImagesToPrefetch / 2;
20119
+ var timesToPrefetchInOrder = lodash.exports.range(0, maxTimesToPrefetchIfOneLayer).flatMap(function (offset) {
20120
+ var duration = {
20121
+ minutes: timestepInMinutes * offset
20122
+ };
20123
+ var nextTime = add(currentTime, duration).toISOString();
20124
+ var previousTime = sub(currentTime, duration).toISOString();
20125
+ return [nextTime, previousTime];
20126
+ });
20127
+ prefetchLayerImagesInOrder(wmMap, timesToPrefetchInOrder, maxImagesToPrefetch, currentTime.toISOString());
20128
+ }
20129
+
20130
+ /* *
20131
+ * Licensed under the Apache License, Version 2.0 (the "License");
20132
+ * you may not use this file except in compliance with the License.
20133
+ * You may obtain a copy of the License at
20134
+ *
20135
+ * http://www.apache.org/licenses/LICENSE-2.0
20136
+ *
20137
+ * Unless required by applicable law or agreed to in writing, software
20138
+ * distributed under the License is distributed on an "AS IS" BASIS,
20139
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20140
+ * See the License for the specific language governing permissions and
20141
+ * limitations under the License.
20142
+ *
20143
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
20144
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
20145
+ * */
20146
+ var _WMJSAnimate_instances, _WMJSAnimate_animate;
19342
20147
  var WMJSAnimate = /*#__PURE__*/function () {
19343
20148
  function WMJSAnimate(_map) {
19344
20149
  _classCallCheck(this, WMJSAnimate);
20150
+ _WMJSAnimate_instances.add(this);
19345
20151
  this._imageStore = getMapImageStore;
19346
20152
  this.isNextTimeCloseToWallClockTime = false;
19347
20153
  _map.animationDelay = 100;
@@ -19367,15 +20173,11 @@ var WMJSAnimate = /*#__PURE__*/function () {
19367
20173
  this._divAnimationInfo.style.fontFamily = '"Courier New", "Lucida Console", Monospace';
19368
20174
  this._divAnimationInfo.style.fontSize = '10px';
19369
20175
  _map.getBaseElement().append(this._divAnimationInfo);
19370
- _map.isAnimatingLoopRunning = false;
19371
20176
  this._map = _map;
19372
20177
  /* Bind */
19373
- this._animate = this._animate.bind(this);
19374
- this._animateLoop = this._animateLoop.bind(this);
19375
- this.prefetchImagesForAnimationSteps = this.prefetchImagesForAnimationSteps.bind(this);
20178
+ this.loopAnimation = this.loopAnimation.bind(this);
19376
20179
  this.stopAnimating = this.stopAnimating.bind(this);
19377
20180
  _map.stopAnimating = this.stopAnimating;
19378
- _map.checkAnimation = this.prefetchImagesForAnimationSteps;
19379
20181
  }
19380
20182
  _createClass(WMJSAnimate, [{
19381
20183
  key: "isCurrentAnimationTimeCloseToWallClockTime",
@@ -19403,31 +20205,10 @@ var WMJSAnimate = /*#__PURE__*/function () {
19403
20205
  return false;
19404
20206
  }
19405
20207
  }, {
19406
- key: "_animate",
19407
- value: function _animate() {
19408
- if (this._map.isAnimating === false) {
19409
- return;
19410
- }
19411
- if (this._map.animateBusy === true) {
19412
- return;
19413
- }
19414
- var animationStep = this._map.animationList[this._map.currentAnimationStep];
19415
- if (!animationStep) {
19416
- debug(DebugType.Error, "No animation step for ".concat(this._map.currentAnimationStep));
19417
- return;
19418
- }
19419
- this._map.setDimension(animationStep.name, animationStep.value, false);
19420
- this._callBack.triggerEvent('ondimchange');
19421
- this._callBack.triggerEvent('onnextanimationstep', this._map);
19422
- this._map.addLayersToCanvasAndDisplayThem();
19423
- this._map.animateBusy = false;
19424
- }
19425
- }, {
19426
- key: "_animateLoop",
19427
- value: function _animateLoop() {
20208
+ key: "loopAnimation",
20209
+ value: function loopAnimation() {
19428
20210
  var _this = this;
19429
20211
  if (this._map.isAnimating === false) {
19430
- this._map.isAnimatingLoopRunning = false;
19431
20212
  return;
19432
20213
  }
19433
20214
  var animationDelay = this._map.animationDelay;
@@ -19440,23 +20221,22 @@ var WMJSAnimate = /*#__PURE__*/function () {
19440
20221
  animationDelay *= 5;
19441
20222
  }
19442
20223
  // set up timer for next animation step
19443
- this._map.animationTimer.init(animationDelay, this._animateLoop);
19444
- this.prefetchImagesForAnimationSteps();
20224
+ this._map.animationTimer.init(animationDelay, this.loopAnimation);
20225
+ prefetchImagesForAnimation(this._map);
19445
20226
  if (this._map.mouseHoverAnimationBox !== false) {
19446
20227
  return;
19447
20228
  }
19448
- this._animate();
20229
+ __classPrivateFieldGet(this, _WMJSAnimate_instances, "m", _WMJSAnimate_animate).call(this);
19449
20230
  var nextAnimationStepIndex = this._map.currentAnimationStep + 1;
19450
20231
  if (nextAnimationStepIndex >= animationSteps.length) {
19451
20232
  nextAnimationStepIndex = 0;
19452
20233
  }
19453
20234
  // get urls for images in next animation step
19454
- var nextAnimationStep = animationSteps[nextAnimationStepIndex];
19455
- nextAnimationStep.requests = this.getRequestsForAnimationStep(animationSteps, nextAnimationStepIndex);
20235
+ var layersImageUrls = getLayersImageUrlsForTime(this._map, animationSteps[nextAnimationStepIndex].value, animationSteps[this._map.currentAnimationStep].value);
19456
20236
  // if images for next animation step is ready or haven't started loading
19457
20237
  // change map animation step to next step
19458
20238
  var numberOfImagesReadyForNextAnimationStep = 0;
19459
- nextAnimationStep.requests.forEach(function (request) {
20239
+ layersImageUrls.forEach(function (request) {
19460
20240
  var url = request.url;
19461
20241
  var image = getMapImageStore.getImageForSrc(url);
19462
20242
  /* Get a loaded image which has no error */
@@ -19470,57 +20250,14 @@ var WMJSAnimate = /*#__PURE__*/function () {
19470
20250
  numberOfImagesReadyForNextAnimationStep += 1;
19471
20251
  return;
19472
20252
  }
19473
- var imageHasntStartedLoading = !(image === null || image === void 0 ? void 0 : image.isLoading());
19474
- if (imageHasntStartedLoading) {
19475
- /* No alternatives and current image is not loading, so lets continue the animation */
19476
- numberOfImagesReadyForNextAnimationStep += 1;
19477
- }
19478
- });
19479
- if (numberOfImagesReadyForNextAnimationStep >= nextAnimationStep.requests.length) {
19480
- this._map.currentAnimationStep = nextAnimationStepIndex;
19481
- }
19482
- }
19483
- }, {
19484
- key: "prefetchImagesForAnimationSteps",
19485
- value: function prefetchImagesForAnimationSteps() {
19486
- if (this._map.isAnimating === false) {
19487
- this._map.isAnimatingLoopRunning = false;
19488
- return;
19489
- }
19490
- if (!this._map.animationTimer) {
19491
- this._map.animationTimer = new WMTimer();
19492
- }
19493
- var animationSteps = this._map.animationList;
19494
- var countAnimationSteps = animationSteps === null || animationSteps === void 0 ? void 0 : animationSteps.length;
19495
- if (countAnimationSteps && this._map.mouseHoverAnimationBox === false) {
19496
- for (var j = 0; j < countAnimationSteps; j += 1) {
19497
- // dont prefetch if already prefetching too many images
19498
- var maxSimultaneousLoads = 4;
19499
- var countImagesLoading = this._imageStore.getNumImagesLoading();
19500
- if (countImagesLoading > maxSimultaneousLoads - 1) {
19501
- break;
19502
- }
19503
- // start prefecthing images for the next animation step first
19504
- var index = j + this._map.currentAnimationStep;
19505
- while (index < 0) {
19506
- index += countAnimationSteps;
19507
- }
19508
- while (index >= countAnimationSteps) {
19509
- index -= countAnimationSteps;
19510
- }
19511
- if (index < 0) {
19512
- index = 0;
19513
- }
19514
- // get urls for animation step
19515
- var animationStep = animationSteps[index];
19516
- animationStep.requests = this.getRequestsForAnimationStep(animationSteps, index);
19517
- // prefetch images for animation step
19518
- animationStep.imagesInPrefetch = prefetch(animationStep.requests);
20253
+ var imageHasntStartedLoading = !(image === null || image === void 0 ? void 0 : image.isLoading());
20254
+ if (imageHasntStartedLoading) {
20255
+ /* No alternatives and current image is not loading, so lets continue the animation */
20256
+ numberOfImagesReadyForNextAnimationStep += 1;
19519
20257
  }
19520
- }
19521
- if (this._map.isAnimatingLoopRunning === false) {
19522
- this._map.isAnimatingLoopRunning = true;
19523
- this._animateLoop();
20258
+ });
20259
+ if (numberOfImagesReadyForNextAnimationStep >= layersImageUrls.length) {
20260
+ this._map.currentAnimationStep = nextAnimationStepIndex;
19524
20261
  }
19525
20262
  }
19526
20263
  }, {
@@ -19536,21 +20273,27 @@ var WMJSAnimate = /*#__PURE__*/function () {
19536
20273
  this._map.rebuildMapDimensions();
19537
20274
  this._callBack.triggerEvent('onstopanimation', this._map);
19538
20275
  }
19539
- }, {
19540
- key: "getRequestsForAnimationStep",
19541
- value: function getRequestsForAnimationStep(animationSteps, index) {
19542
- // get urls for animation step
19543
- var animationStep = animationSteps[index];
19544
- this._map.setDimension(animationStep.name, animationStep.value, false);
19545
- var requests = this._map.getWMSRequests();
19546
- // set map back to correct dimension
19547
- var animationStepShownOnMap = animationSteps[this._map.currentAnimationStep];
19548
- this._map.setDimension(animationStepShownOnMap.name, animationStepShownOnMap.value, false);
19549
- return requests;
19550
- }
19551
20276
  }]);
19552
20277
  return WMJSAnimate;
19553
20278
  }();
20279
+ _WMJSAnimate_instances = new WeakSet(), _WMJSAnimate_animate = function _WMJSAnimate_animate() {
20280
+ if (this._map.isAnimating === false) {
20281
+ return;
20282
+ }
20283
+ if (this._map.animateBusy === true) {
20284
+ return;
20285
+ }
20286
+ var animationStep = this._map.animationList[this._map.currentAnimationStep];
20287
+ if (!animationStep) {
20288
+ debugLogger(DebugType.Error, "No animation step for ".concat(this._map.currentAnimationStep));
20289
+ return;
20290
+ }
20291
+ this._map.setDimension(animationStep.name, animationStep.value, false);
20292
+ this._callBack.triggerEvent('ondimchange');
20293
+ this._callBack.triggerEvent('onnextanimationstep', this._map);
20294
+ this._map.addLayersToCanvasAndDisplayThem();
20295
+ this._map.animateBusy = false;
20296
+ };
19554
20297
 
19555
20298
  var WMTileRenderer = /*#__PURE__*/function () {
19556
20299
  function WMTileRenderer() {
@@ -19564,7 +20307,7 @@ var WMTileRenderer = /*#__PURE__*/function () {
19564
20307
  var renderedURLs = {};
19565
20308
  var imagesToRender = [];
19566
20309
  if (!layerName) {
19567
- debug(DebugType.Error);
20310
+ debugLogger(DebugType.Error);
19568
20311
  return undefined;
19569
20312
  }
19570
20313
  /* Temporal mappings from bgmaps.cgi service names to names defined here */
@@ -19579,7 +20322,7 @@ var WMTileRenderer = /*#__PURE__*/function () {
19579
20322
  }
19580
20323
  var tileLayer = tileOptions[layerName];
19581
20324
  if (!tileLayer) {
19582
- debug(DebugType.Error);
20325
+ debugLogger(DebugType.Error);
19583
20326
  return undefined;
19584
20327
  }
19585
20328
  var tileSettings = tileLayer[srs];
@@ -19769,11 +20512,11 @@ var WMTileRenderer = /*#__PURE__*/function () {
19769
20512
  tilenright = numTilesAtLevelX;
19770
20513
  }
19771
20514
  if (tilentop - tilenbottom > 20) {
19772
- debug(DebugType.Error);
20515
+ debugLogger(DebugType.Error);
19773
20516
  return;
19774
20517
  }
19775
20518
  if (tilenright - tilenleft > 20) {
19776
- debug(DebugType.Error);
20519
+ debugLogger(DebugType.Error);
19777
20520
  return;
19778
20521
  }
19779
20522
  for (var ty = tilenbottom - 1; ty < tilentop; ty += 1) {
@@ -19895,7 +20638,7 @@ var drawLegend = function drawLegend(canvasContext, width, height, layers) {
19895
20638
  try {
19896
20639
  ctx.drawImage(el, legendX, legendY);
19897
20640
  } catch (e) {
19898
- debug(DebugType.Error);
20641
+ debugLogger(DebugType.Error);
19899
20642
  }
19900
20643
  }
19901
20644
  }
@@ -25011,1043 +25754,581 @@ var moment$1 = {exports: {}};
25011
25754
 
25012
25755
  for (i = 0; i < 7; i++) {
25013
25756
  out[i] = get$1(format, (i + shift) % 7, field, 'day');
25014
- }
25015
- return out;
25016
- }
25017
-
25018
- function listMonths(format, index) {
25019
- return listMonthsImpl(format, index, 'months');
25020
- }
25021
-
25022
- function listMonthsShort(format, index) {
25023
- return listMonthsImpl(format, index, 'monthsShort');
25024
- }
25025
-
25026
- function listWeekdays(localeSorted, format, index) {
25027
- return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
25028
- }
25029
-
25030
- function listWeekdaysShort(localeSorted, format, index) {
25031
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
25032
- }
25033
-
25034
- function listWeekdaysMin(localeSorted, format, index) {
25035
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
25036
- }
25037
-
25038
- getSetGlobalLocale('en', {
25039
- eras: [
25040
- {
25041
- since: '0001-01-01',
25042
- until: +Infinity,
25043
- offset: 1,
25044
- name: 'Anno Domini',
25045
- narrow: 'AD',
25046
- abbr: 'AD',
25047
- },
25048
- {
25049
- since: '0000-12-31',
25050
- until: -Infinity,
25051
- offset: 1,
25052
- name: 'Before Christ',
25053
- narrow: 'BC',
25054
- abbr: 'BC',
25055
- },
25056
- ],
25057
- dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
25058
- ordinal: function (number) {
25059
- var b = number % 10,
25060
- output =
25061
- toInt((number % 100) / 10) === 1
25062
- ? 'th'
25063
- : b === 1
25064
- ? 'st'
25065
- : b === 2
25066
- ? 'nd'
25067
- : b === 3
25068
- ? 'rd'
25069
- : 'th';
25070
- return number + output;
25071
- },
25072
- });
25073
-
25074
- // Side effect imports
25075
-
25076
- hooks.lang = deprecate(
25077
- 'moment.lang is deprecated. Use moment.locale instead.',
25078
- getSetGlobalLocale
25079
- );
25080
- hooks.langData = deprecate(
25081
- 'moment.langData is deprecated. Use moment.localeData instead.',
25082
- getLocale
25083
- );
25084
-
25085
- var mathAbs = Math.abs;
25086
-
25087
- function abs() {
25088
- var data = this._data;
25089
-
25090
- this._milliseconds = mathAbs(this._milliseconds);
25091
- this._days = mathAbs(this._days);
25092
- this._months = mathAbs(this._months);
25093
-
25094
- data.milliseconds = mathAbs(data.milliseconds);
25095
- data.seconds = mathAbs(data.seconds);
25096
- data.minutes = mathAbs(data.minutes);
25097
- data.hours = mathAbs(data.hours);
25098
- data.months = mathAbs(data.months);
25099
- data.years = mathAbs(data.years);
25100
-
25101
- return this;
25102
- }
25103
-
25104
- function addSubtract$1(duration, input, value, direction) {
25105
- var other = createDuration(input, value);
25106
-
25107
- duration._milliseconds += direction * other._milliseconds;
25108
- duration._days += direction * other._days;
25109
- duration._months += direction * other._months;
25110
-
25111
- return duration._bubble();
25112
- }
25113
-
25114
- // supports only 2.0-style add(1, 's') or add(duration)
25115
- function add$1(input, value) {
25116
- return addSubtract$1(this, input, value, 1);
25117
- }
25118
-
25119
- // supports only 2.0-style subtract(1, 's') or subtract(duration)
25120
- function subtract$1(input, value) {
25121
- return addSubtract$1(this, input, value, -1);
25122
- }
25123
-
25124
- function absCeil(number) {
25125
- if (number < 0) {
25126
- return Math.floor(number);
25127
- } else {
25128
- return Math.ceil(number);
25129
- }
25130
- }
25131
-
25132
- function bubble() {
25133
- var milliseconds = this._milliseconds,
25134
- days = this._days,
25135
- months = this._months,
25136
- data = this._data,
25137
- seconds,
25138
- minutes,
25139
- hours,
25140
- years,
25141
- monthsFromDays;
25142
-
25143
- // if we have a mix of positive and negative values, bubble down first
25144
- // check: https://github.com/moment/moment/issues/2166
25145
- if (
25146
- !(
25147
- (milliseconds >= 0 && days >= 0 && months >= 0) ||
25148
- (milliseconds <= 0 && days <= 0 && months <= 0)
25149
- )
25150
- ) {
25151
- milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
25152
- days = 0;
25153
- months = 0;
25154
- }
25155
-
25156
- // The following code bubbles up values, see the tests for
25157
- // examples of what that means.
25158
- data.milliseconds = milliseconds % 1000;
25159
-
25160
- seconds = absFloor(milliseconds / 1000);
25161
- data.seconds = seconds % 60;
25162
-
25163
- minutes = absFloor(seconds / 60);
25164
- data.minutes = minutes % 60;
25165
-
25166
- hours = absFloor(minutes / 60);
25167
- data.hours = hours % 24;
25168
-
25169
- days += absFloor(hours / 24);
25170
-
25171
- // convert days to months
25172
- monthsFromDays = absFloor(daysToMonths(days));
25173
- months += monthsFromDays;
25174
- days -= absCeil(monthsToDays(monthsFromDays));
25175
-
25176
- // 12 months -> 1 year
25177
- years = absFloor(months / 12);
25178
- months %= 12;
25179
-
25180
- data.days = days;
25181
- data.months = months;
25182
- data.years = years;
25183
-
25184
- return this;
25185
- }
25186
-
25187
- function daysToMonths(days) {
25188
- // 400 years have 146097 days (taking into account leap year rules)
25189
- // 400 years have 12 months === 4800
25190
- return (days * 4800) / 146097;
25191
- }
25192
-
25193
- function monthsToDays(months) {
25194
- // the reverse of daysToMonths
25195
- return (months * 146097) / 4800;
25196
- }
25197
-
25198
- function as(units) {
25199
- if (!this.isValid()) {
25200
- return NaN;
25201
- }
25202
- var days,
25203
- months,
25204
- milliseconds = this._milliseconds;
25205
-
25206
- units = normalizeUnits(units);
25207
-
25208
- if (units === 'month' || units === 'quarter' || units === 'year') {
25209
- days = this._days + milliseconds / 864e5;
25210
- months = this._months + daysToMonths(days);
25211
- switch (units) {
25212
- case 'month':
25213
- return months;
25214
- case 'quarter':
25215
- return months / 3;
25216
- case 'year':
25217
- return months / 12;
25218
- }
25219
- } else {
25220
- // handle milliseconds separately because of floating point math errors (issue #1867)
25221
- days = this._days + Math.round(monthsToDays(this._months));
25222
- switch (units) {
25223
- case 'week':
25224
- return days / 7 + milliseconds / 6048e5;
25225
- case 'day':
25226
- return days + milliseconds / 864e5;
25227
- case 'hour':
25228
- return days * 24 + milliseconds / 36e5;
25229
- case 'minute':
25230
- return days * 1440 + milliseconds / 6e4;
25231
- case 'second':
25232
- return days * 86400 + milliseconds / 1000;
25233
- // Math.floor prevents floating point math errors here
25234
- case 'millisecond':
25235
- return Math.floor(days * 864e5) + milliseconds;
25236
- default:
25237
- throw new Error('Unknown unit ' + units);
25238
- }
25239
- }
25240
- }
25241
-
25242
- // TODO: Use this.as('ms')?
25243
- function valueOf$1() {
25244
- if (!this.isValid()) {
25245
- return NaN;
25246
- }
25247
- return (
25248
- this._milliseconds +
25249
- this._days * 864e5 +
25250
- (this._months % 12) * 2592e6 +
25251
- toInt(this._months / 12) * 31536e6
25252
- );
25757
+ }
25758
+ return out;
25253
25759
  }
25254
25760
 
25255
- function makeAs(alias) {
25256
- return function () {
25257
- return this.as(alias);
25258
- };
25761
+ function listMonths(format, index) {
25762
+ return listMonthsImpl(format, index, 'months');
25259
25763
  }
25260
25764
 
25261
- var asMilliseconds = makeAs('ms'),
25262
- asSeconds = makeAs('s'),
25263
- asMinutes = makeAs('m'),
25264
- asHours = makeAs('h'),
25265
- asDays = makeAs('d'),
25266
- asWeeks = makeAs('w'),
25267
- asMonths = makeAs('M'),
25268
- asQuarters = makeAs('Q'),
25269
- asYears = makeAs('y');
25765
+ function listMonthsShort(format, index) {
25766
+ return listMonthsImpl(format, index, 'monthsShort');
25767
+ }
25270
25768
 
25271
- function clone$1() {
25272
- return createDuration(this);
25769
+ function listWeekdays(localeSorted, format, index) {
25770
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
25273
25771
  }
25274
25772
 
25275
- function get$2(units) {
25276
- units = normalizeUnits(units);
25277
- return this.isValid() ? this[units + 's']() : NaN;
25773
+ function listWeekdaysShort(localeSorted, format, index) {
25774
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
25278
25775
  }
25279
25776
 
25280
- function makeGetter(name) {
25281
- return function () {
25282
- return this.isValid() ? this._data[name] : NaN;
25283
- };
25777
+ function listWeekdaysMin(localeSorted, format, index) {
25778
+ return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
25284
25779
  }
25285
25780
 
25286
- var milliseconds = makeGetter('milliseconds'),
25287
- seconds = makeGetter('seconds'),
25288
- minutes = makeGetter('minutes'),
25289
- hours = makeGetter('hours'),
25290
- days = makeGetter('days'),
25291
- months = makeGetter('months'),
25292
- years = makeGetter('years');
25781
+ getSetGlobalLocale('en', {
25782
+ eras: [
25783
+ {
25784
+ since: '0001-01-01',
25785
+ until: +Infinity,
25786
+ offset: 1,
25787
+ name: 'Anno Domini',
25788
+ narrow: 'AD',
25789
+ abbr: 'AD',
25790
+ },
25791
+ {
25792
+ since: '0000-12-31',
25793
+ until: -Infinity,
25794
+ offset: 1,
25795
+ name: 'Before Christ',
25796
+ narrow: 'BC',
25797
+ abbr: 'BC',
25798
+ },
25799
+ ],
25800
+ dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
25801
+ ordinal: function (number) {
25802
+ var b = number % 10,
25803
+ output =
25804
+ toInt((number % 100) / 10) === 1
25805
+ ? 'th'
25806
+ : b === 1
25807
+ ? 'st'
25808
+ : b === 2
25809
+ ? 'nd'
25810
+ : b === 3
25811
+ ? 'rd'
25812
+ : 'th';
25813
+ return number + output;
25814
+ },
25815
+ });
25293
25816
 
25294
- function weeks() {
25295
- return absFloor(this.days() / 7);
25296
- }
25817
+ // Side effect imports
25297
25818
 
25298
- var round = Math.round,
25299
- thresholds = {
25300
- ss: 44, // a few seconds to seconds
25301
- s: 45, // seconds to minute
25302
- m: 45, // minutes to hour
25303
- h: 22, // hours to day
25304
- d: 26, // days to month/week
25305
- w: null, // weeks to month
25306
- M: 11, // months to year
25307
- };
25819
+ hooks.lang = deprecate(
25820
+ 'moment.lang is deprecated. Use moment.locale instead.',
25821
+ getSetGlobalLocale
25822
+ );
25823
+ hooks.langData = deprecate(
25824
+ 'moment.langData is deprecated. Use moment.localeData instead.',
25825
+ getLocale
25826
+ );
25308
25827
 
25309
- // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
25310
- function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
25311
- return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
25312
- }
25828
+ var mathAbs = Math.abs;
25313
25829
 
25314
- function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
25315
- var duration = createDuration(posNegDuration).abs(),
25316
- seconds = round(duration.as('s')),
25317
- minutes = round(duration.as('m')),
25318
- hours = round(duration.as('h')),
25319
- days = round(duration.as('d')),
25320
- months = round(duration.as('M')),
25321
- weeks = round(duration.as('w')),
25322
- years = round(duration.as('y')),
25323
- a =
25324
- (seconds <= thresholds.ss && ['s', seconds]) ||
25325
- (seconds < thresholds.s && ['ss', seconds]) ||
25326
- (minutes <= 1 && ['m']) ||
25327
- (minutes < thresholds.m && ['mm', minutes]) ||
25328
- (hours <= 1 && ['h']) ||
25329
- (hours < thresholds.h && ['hh', hours]) ||
25330
- (days <= 1 && ['d']) ||
25331
- (days < thresholds.d && ['dd', days]);
25830
+ function abs() {
25831
+ var data = this._data;
25332
25832
 
25333
- if (thresholds.w != null) {
25334
- a =
25335
- a ||
25336
- (weeks <= 1 && ['w']) ||
25337
- (weeks < thresholds.w && ['ww', weeks]);
25338
- }
25339
- a = a ||
25340
- (months <= 1 && ['M']) ||
25341
- (months < thresholds.M && ['MM', months]) ||
25342
- (years <= 1 && ['y']) || ['yy', years];
25833
+ this._milliseconds = mathAbs(this._milliseconds);
25834
+ this._days = mathAbs(this._days);
25835
+ this._months = mathAbs(this._months);
25343
25836
 
25344
- a[2] = withoutSuffix;
25345
- a[3] = +posNegDuration > 0;
25346
- a[4] = locale;
25347
- return substituteTimeAgo.apply(null, a);
25348
- }
25837
+ data.milliseconds = mathAbs(data.milliseconds);
25838
+ data.seconds = mathAbs(data.seconds);
25839
+ data.minutes = mathAbs(data.minutes);
25840
+ data.hours = mathAbs(data.hours);
25841
+ data.months = mathAbs(data.months);
25842
+ data.years = mathAbs(data.years);
25349
25843
 
25350
- // This function allows you to set the rounding function for relative time strings
25351
- function getSetRelativeTimeRounding(roundingFunction) {
25352
- if (roundingFunction === undefined) {
25353
- return round;
25354
- }
25355
- if (typeof roundingFunction === 'function') {
25356
- round = roundingFunction;
25357
- return true;
25358
- }
25359
- return false;
25844
+ return this;
25360
25845
  }
25361
25846
 
25362
- // This function allows you to set a threshold for relative time strings
25363
- function getSetRelativeTimeThreshold(threshold, limit) {
25364
- if (thresholds[threshold] === undefined) {
25365
- return false;
25366
- }
25367
- if (limit === undefined) {
25368
- return thresholds[threshold];
25369
- }
25370
- thresholds[threshold] = limit;
25371
- if (threshold === 's') {
25372
- thresholds.ss = limit - 1;
25373
- }
25374
- return true;
25375
- }
25847
+ function addSubtract$1(duration, input, value, direction) {
25848
+ var other = createDuration(input, value);
25376
25849
 
25377
- function humanize(argWithSuffix, argThresholds) {
25378
- if (!this.isValid()) {
25379
- return this.localeData().invalidDate();
25380
- }
25850
+ duration._milliseconds += direction * other._milliseconds;
25851
+ duration._days += direction * other._days;
25852
+ duration._months += direction * other._months;
25381
25853
 
25382
- var withSuffix = false,
25383
- th = thresholds,
25384
- locale,
25385
- output;
25854
+ return duration._bubble();
25855
+ }
25386
25856
 
25387
- if (typeof argWithSuffix === 'object') {
25388
- argThresholds = argWithSuffix;
25389
- argWithSuffix = false;
25390
- }
25391
- if (typeof argWithSuffix === 'boolean') {
25392
- withSuffix = argWithSuffix;
25393
- }
25394
- if (typeof argThresholds === 'object') {
25395
- th = Object.assign({}, thresholds, argThresholds);
25396
- if (argThresholds.s != null && argThresholds.ss == null) {
25397
- th.ss = argThresholds.s - 1;
25398
- }
25399
- }
25857
+ // supports only 2.0-style add(1, 's') or add(duration)
25858
+ function add$1(input, value) {
25859
+ return addSubtract$1(this, input, value, 1);
25860
+ }
25400
25861
 
25401
- locale = this.localeData();
25402
- output = relativeTime$1(this, !withSuffix, th, locale);
25862
+ // supports only 2.0-style subtract(1, 's') or subtract(duration)
25863
+ function subtract$1(input, value) {
25864
+ return addSubtract$1(this, input, value, -1);
25865
+ }
25403
25866
 
25404
- if (withSuffix) {
25405
- output = locale.pastFuture(+this, output);
25867
+ function absCeil(number) {
25868
+ if (number < 0) {
25869
+ return Math.floor(number);
25870
+ } else {
25871
+ return Math.ceil(number);
25406
25872
  }
25407
-
25408
- return locale.postformat(output);
25409
25873
  }
25410
25874
 
25411
- var abs$1 = Math.abs;
25412
-
25413
- function sign(x) {
25414
- return (x > 0) - (x < 0) || +x;
25415
- }
25875
+ function bubble() {
25876
+ var milliseconds = this._milliseconds,
25877
+ days = this._days,
25878
+ months = this._months,
25879
+ data = this._data,
25880
+ seconds,
25881
+ minutes,
25882
+ hours,
25883
+ years,
25884
+ monthsFromDays;
25416
25885
 
25417
- function toISOString$1() {
25418
- // for ISO strings we do not use the normal bubbling rules:
25419
- // * milliseconds bubble up until they become hours
25420
- // * days do not bubble at all
25421
- // * months bubble up until they become years
25422
- // This is because there is no context-free conversion between hours and days
25423
- // (think of clock changes)
25424
- // and also not between days and months (28-31 days per month)
25425
- if (!this.isValid()) {
25426
- return this.localeData().invalidDate();
25886
+ // if we have a mix of positive and negative values, bubble down first
25887
+ // check: https://github.com/moment/moment/issues/2166
25888
+ if (
25889
+ !(
25890
+ (milliseconds >= 0 && days >= 0 && months >= 0) ||
25891
+ (milliseconds <= 0 && days <= 0 && months <= 0)
25892
+ )
25893
+ ) {
25894
+ milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
25895
+ days = 0;
25896
+ months = 0;
25427
25897
  }
25428
25898
 
25429
- var seconds = abs$1(this._milliseconds) / 1000,
25430
- days = abs$1(this._days),
25431
- months = abs$1(this._months),
25432
- minutes,
25433
- hours,
25434
- years,
25435
- s,
25436
- total = this.asSeconds(),
25437
- totalSign,
25438
- ymSign,
25439
- daysSign,
25440
- hmsSign;
25899
+ // The following code bubbles up values, see the tests for
25900
+ // examples of what that means.
25901
+ data.milliseconds = milliseconds % 1000;
25441
25902
 
25442
- if (!total) {
25443
- // this is the same as C#'s (Noda) and python (isodate)...
25444
- // but not other JS (goog.date)
25445
- return 'P0D';
25446
- }
25903
+ seconds = absFloor(milliseconds / 1000);
25904
+ data.seconds = seconds % 60;
25447
25905
 
25448
- // 3600 seconds -> 60 minutes -> 1 hour
25449
25906
  minutes = absFloor(seconds / 60);
25907
+ data.minutes = minutes % 60;
25908
+
25450
25909
  hours = absFloor(minutes / 60);
25451
- seconds %= 60;
25452
- minutes %= 60;
25910
+ data.hours = hours % 24;
25911
+
25912
+ days += absFloor(hours / 24);
25913
+
25914
+ // convert days to months
25915
+ monthsFromDays = absFloor(daysToMonths(days));
25916
+ months += monthsFromDays;
25917
+ days -= absCeil(monthsToDays(monthsFromDays));
25453
25918
 
25454
25919
  // 12 months -> 1 year
25455
25920
  years = absFloor(months / 12);
25456
25921
  months %= 12;
25457
25922
 
25458
- // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
25459
- s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
25460
-
25461
- totalSign = total < 0 ? '-' : '';
25462
- ymSign = sign(this._months) !== sign(total) ? '-' : '';
25463
- daysSign = sign(this._days) !== sign(total) ? '-' : '';
25464
- hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
25923
+ data.days = days;
25924
+ data.months = months;
25925
+ data.years = years;
25465
25926
 
25466
- return (
25467
- totalSign +
25468
- 'P' +
25469
- (years ? ymSign + years + 'Y' : '') +
25470
- (months ? ymSign + months + 'M' : '') +
25471
- (days ? daysSign + days + 'D' : '') +
25472
- (hours || minutes || seconds ? 'T' : '') +
25473
- (hours ? hmsSign + hours + 'H' : '') +
25474
- (minutes ? hmsSign + minutes + 'M' : '') +
25475
- (seconds ? hmsSign + s + 'S' : '')
25476
- );
25927
+ return this;
25477
25928
  }
25478
25929
 
25479
- var proto$2 = Duration.prototype;
25480
-
25481
- proto$2.isValid = isValid$1;
25482
- proto$2.abs = abs;
25483
- proto$2.add = add$1;
25484
- proto$2.subtract = subtract$1;
25485
- proto$2.as = as;
25486
- proto$2.asMilliseconds = asMilliseconds;
25487
- proto$2.asSeconds = asSeconds;
25488
- proto$2.asMinutes = asMinutes;
25489
- proto$2.asHours = asHours;
25490
- proto$2.asDays = asDays;
25491
- proto$2.asWeeks = asWeeks;
25492
- proto$2.asMonths = asMonths;
25493
- proto$2.asQuarters = asQuarters;
25494
- proto$2.asYears = asYears;
25495
- proto$2.valueOf = valueOf$1;
25496
- proto$2._bubble = bubble;
25497
- proto$2.clone = clone$1;
25498
- proto$2.get = get$2;
25499
- proto$2.milliseconds = milliseconds;
25500
- proto$2.seconds = seconds;
25501
- proto$2.minutes = minutes;
25502
- proto$2.hours = hours;
25503
- proto$2.days = days;
25504
- proto$2.weeks = weeks;
25505
- proto$2.months = months;
25506
- proto$2.years = years;
25507
- proto$2.humanize = humanize;
25508
- proto$2.toISOString = toISOString$1;
25509
- proto$2.toString = toISOString$1;
25510
- proto$2.toJSON = toISOString$1;
25511
- proto$2.locale = locale;
25512
- proto$2.localeData = localeData;
25513
-
25514
- proto$2.toIsoString = deprecate(
25515
- 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
25516
- toISOString$1
25517
- );
25518
- proto$2.lang = lang;
25519
-
25520
- // FORMATTING
25930
+ function daysToMonths(days) {
25931
+ // 400 years have 146097 days (taking into account leap year rules)
25932
+ // 400 years have 12 months === 4800
25933
+ return (days * 4800) / 146097;
25934
+ }
25521
25935
 
25522
- addFormatToken('X', 0, 0, 'unix');
25523
- addFormatToken('x', 0, 0, 'valueOf');
25936
+ function monthsToDays(months) {
25937
+ // the reverse of daysToMonths
25938
+ return (months * 146097) / 4800;
25939
+ }
25524
25940
 
25525
- // PARSING
25941
+ function as(units) {
25942
+ if (!this.isValid()) {
25943
+ return NaN;
25944
+ }
25945
+ var days,
25946
+ months,
25947
+ milliseconds = this._milliseconds;
25526
25948
 
25527
- addRegexToken('x', matchSigned);
25528
- addRegexToken('X', matchTimestamp);
25529
- addParseToken('X', function (input, array, config) {
25530
- config._d = new Date(parseFloat(input) * 1000);
25531
- });
25532
- addParseToken('x', function (input, array, config) {
25533
- config._d = new Date(toInt(input));
25534
- });
25949
+ units = normalizeUnits(units);
25535
25950
 
25536
- //! moment.js
25951
+ if (units === 'month' || units === 'quarter' || units === 'year') {
25952
+ days = this._days + milliseconds / 864e5;
25953
+ months = this._months + daysToMonths(days);
25954
+ switch (units) {
25955
+ case 'month':
25956
+ return months;
25957
+ case 'quarter':
25958
+ return months / 3;
25959
+ case 'year':
25960
+ return months / 12;
25961
+ }
25962
+ } else {
25963
+ // handle milliseconds separately because of floating point math errors (issue #1867)
25964
+ days = this._days + Math.round(monthsToDays(this._months));
25965
+ switch (units) {
25966
+ case 'week':
25967
+ return days / 7 + milliseconds / 6048e5;
25968
+ case 'day':
25969
+ return days + milliseconds / 864e5;
25970
+ case 'hour':
25971
+ return days * 24 + milliseconds / 36e5;
25972
+ case 'minute':
25973
+ return days * 1440 + milliseconds / 6e4;
25974
+ case 'second':
25975
+ return days * 86400 + milliseconds / 1000;
25976
+ // Math.floor prevents floating point math errors here
25977
+ case 'millisecond':
25978
+ return Math.floor(days * 864e5) + milliseconds;
25979
+ default:
25980
+ throw new Error('Unknown unit ' + units);
25981
+ }
25982
+ }
25983
+ }
25537
25984
 
25538
- hooks.version = '2.29.4';
25985
+ // TODO: Use this.as('ms')?
25986
+ function valueOf$1() {
25987
+ if (!this.isValid()) {
25988
+ return NaN;
25989
+ }
25990
+ return (
25991
+ this._milliseconds +
25992
+ this._days * 864e5 +
25993
+ (this._months % 12) * 2592e6 +
25994
+ toInt(this._months / 12) * 31536e6
25995
+ );
25996
+ }
25539
25997
 
25540
- setHookCallback(createLocal);
25998
+ function makeAs(alias) {
25999
+ return function () {
26000
+ return this.as(alias);
26001
+ };
26002
+ }
25541
26003
 
25542
- hooks.fn = proto;
25543
- hooks.min = min;
25544
- hooks.max = max;
25545
- hooks.now = now;
25546
- hooks.utc = createUTC;
25547
- hooks.unix = createUnix;
25548
- hooks.months = listMonths;
25549
- hooks.isDate = isDate;
25550
- hooks.locale = getSetGlobalLocale;
25551
- hooks.invalid = createInvalid;
25552
- hooks.duration = createDuration;
25553
- hooks.isMoment = isMoment;
25554
- hooks.weekdays = listWeekdays;
25555
- hooks.parseZone = createInZone;
25556
- hooks.localeData = getLocale;
25557
- hooks.isDuration = isDuration;
25558
- hooks.monthsShort = listMonthsShort;
25559
- hooks.weekdaysMin = listWeekdaysMin;
25560
- hooks.defineLocale = defineLocale;
25561
- hooks.updateLocale = updateLocale;
25562
- hooks.locales = listLocales;
25563
- hooks.weekdaysShort = listWeekdaysShort;
25564
- hooks.normalizeUnits = normalizeUnits;
25565
- hooks.relativeTimeRounding = getSetRelativeTimeRounding;
25566
- hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
25567
- hooks.calendarFormat = getCalendarFormat;
25568
- hooks.prototype = proto;
26004
+ var asMilliseconds = makeAs('ms'),
26005
+ asSeconds = makeAs('s'),
26006
+ asMinutes = makeAs('m'),
26007
+ asHours = makeAs('h'),
26008
+ asDays = makeAs('d'),
26009
+ asWeeks = makeAs('w'),
26010
+ asMonths = makeAs('M'),
26011
+ asQuarters = makeAs('Q'),
26012
+ asYears = makeAs('y');
25569
26013
 
25570
- // currently HTML5 input type only supports 24-hour formats
25571
- hooks.HTML5_FMT = {
25572
- DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
25573
- DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
25574
- DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
25575
- DATE: 'YYYY-MM-DD', // <input type="date" />
25576
- TIME: 'HH:mm', // <input type="time" />
25577
- TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
25578
- TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
25579
- WEEK: 'GGGG-[W]WW', // <input type="week" />
25580
- MONTH: 'YYYY-MM', // <input type="month" />
25581
- };
26014
+ function clone$1() {
26015
+ return createDuration(this);
26016
+ }
25582
26017
 
25583
- return hooks;
26018
+ function get$2(units) {
26019
+ units = normalizeUnits(units);
26020
+ return this.isValid() ? this[units + 's']() : NaN;
26021
+ }
25584
26022
 
25585
- })));
25586
- }(moment$1));
26023
+ function makeGetter(name) {
26024
+ return function () {
26025
+ return this.isValid() ? this._data[name] : NaN;
26026
+ };
26027
+ }
25587
26028
 
25588
- var moment = moment$1.exports;
26029
+ var milliseconds = makeGetter('milliseconds'),
26030
+ seconds = makeGetter('seconds'),
26031
+ minutes = makeGetter('minutes'),
26032
+ hours = makeGetter('hours'),
26033
+ days = makeGetter('days'),
26034
+ months = makeGetter('months'),
26035
+ years = makeGetter('years');
25589
26036
 
25590
- function _typeof(o) {
25591
- "@babel/helpers - typeof";
26037
+ function weeks() {
26038
+ return absFloor(this.days() / 7);
26039
+ }
25592
26040
 
25593
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
25594
- return typeof o;
25595
- } : function (o) {
25596
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
25597
- }, _typeof(o);
25598
- }
26041
+ var round = Math.round,
26042
+ thresholds = {
26043
+ ss: 44, // a few seconds to seconds
26044
+ s: 45, // seconds to minute
26045
+ m: 45, // minutes to hour
26046
+ h: 22, // hours to day
26047
+ d: 26, // days to month/week
26048
+ w: null, // weeks to month
26049
+ M: 11, // months to year
26050
+ };
25599
26051
 
25600
- function toInteger(dirtyNumber) {
25601
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
25602
- return NaN;
25603
- }
25604
- var number = Number(dirtyNumber);
25605
- if (isNaN(number)) {
25606
- return number;
25607
- }
25608
- return number < 0 ? Math.ceil(number) : Math.floor(number);
25609
- }
26052
+ // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
26053
+ function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
26054
+ return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
26055
+ }
25610
26056
 
25611
- function requiredArgs(required, args) {
25612
- if (args.length < required) {
25613
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
25614
- }
25615
- }
26057
+ function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
26058
+ var duration = createDuration(posNegDuration).abs(),
26059
+ seconds = round(duration.as('s')),
26060
+ minutes = round(duration.as('m')),
26061
+ hours = round(duration.as('h')),
26062
+ days = round(duration.as('d')),
26063
+ months = round(duration.as('M')),
26064
+ weeks = round(duration.as('w')),
26065
+ years = round(duration.as('y')),
26066
+ a =
26067
+ (seconds <= thresholds.ss && ['s', seconds]) ||
26068
+ (seconds < thresholds.s && ['ss', seconds]) ||
26069
+ (minutes <= 1 && ['m']) ||
26070
+ (minutes < thresholds.m && ['mm', minutes]) ||
26071
+ (hours <= 1 && ['h']) ||
26072
+ (hours < thresholds.h && ['hh', hours]) ||
26073
+ (days <= 1 && ['d']) ||
26074
+ (days < thresholds.d && ['dd', days]);
25616
26075
 
25617
- /**
25618
- * @name toDate
25619
- * @category Common Helpers
25620
- * @summary Convert the given argument to an instance of Date.
25621
- *
25622
- * @description
25623
- * Convert the given argument to an instance of Date.
25624
- *
25625
- * If the argument is an instance of Date, the function returns its clone.
25626
- *
25627
- * If the argument is a number, it is treated as a timestamp.
25628
- *
25629
- * If the argument is none of the above, the function returns Invalid Date.
25630
- *
25631
- * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
25632
- *
25633
- * @param {Date|Number} argument - the value to convert
25634
- * @returns {Date} the parsed date in the local time zone
25635
- * @throws {TypeError} 1 argument required
25636
- *
25637
- * @example
25638
- * // Clone the date:
25639
- * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
25640
- * //=> Tue Feb 11 2014 11:30:30
25641
- *
25642
- * @example
25643
- * // Convert the timestamp to date:
25644
- * const result = toDate(1392098430000)
25645
- * //=> Tue Feb 11 2014 11:30:30
25646
- */
25647
- function toDate(argument) {
25648
- requiredArgs(1, arguments);
25649
- var argStr = Object.prototype.toString.call(argument);
26076
+ if (thresholds.w != null) {
26077
+ a =
26078
+ a ||
26079
+ (weeks <= 1 && ['w']) ||
26080
+ (weeks < thresholds.w && ['ww', weeks]);
26081
+ }
26082
+ a = a ||
26083
+ (months <= 1 && ['M']) ||
26084
+ (months < thresholds.M && ['MM', months]) ||
26085
+ (years <= 1 && ['y']) || ['yy', years];
25650
26086
 
25651
- // Clone the date
25652
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
25653
- // Prevent the date to lose the milliseconds when passed to new Date() in IE10
25654
- return new Date(argument.getTime());
25655
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
25656
- return new Date(argument);
25657
- } else {
25658
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
25659
- // eslint-disable-next-line no-console
25660
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
25661
- // eslint-disable-next-line no-console
25662
- console.warn(new Error().stack);
26087
+ a[2] = withoutSuffix;
26088
+ a[3] = +posNegDuration > 0;
26089
+ a[4] = locale;
26090
+ return substituteTimeAgo.apply(null, a);
25663
26091
  }
25664
- return new Date(NaN);
25665
- }
25666
- }
25667
26092
 
25668
- /**
25669
- * Days in 1 week.
25670
- *
25671
- * @name daysInWeek
25672
- * @constant
25673
- * @type {number}
25674
- * @default
25675
- */
26093
+ // This function allows you to set the rounding function for relative time strings
26094
+ function getSetRelativeTimeRounding(roundingFunction) {
26095
+ if (roundingFunction === undefined) {
26096
+ return round;
26097
+ }
26098
+ if (typeof roundingFunction === 'function') {
26099
+ round = roundingFunction;
26100
+ return true;
26101
+ }
26102
+ return false;
26103
+ }
25676
26104
 
25677
- /**
25678
- * Milliseconds in 1 minute
25679
- *
25680
- * @name millisecondsInMinute
25681
- * @constant
25682
- * @type {number}
25683
- * @default
25684
- */
25685
- var millisecondsInMinute = 60000;
26105
+ // This function allows you to set a threshold for relative time strings
26106
+ function getSetRelativeTimeThreshold(threshold, limit) {
26107
+ if (thresholds[threshold] === undefined) {
26108
+ return false;
26109
+ }
26110
+ if (limit === undefined) {
26111
+ return thresholds[threshold];
26112
+ }
26113
+ thresholds[threshold] = limit;
26114
+ if (threshold === 's') {
26115
+ thresholds.ss = limit - 1;
26116
+ }
26117
+ return true;
26118
+ }
25686
26119
 
25687
- /**
25688
- * Milliseconds in 1 hour
25689
- *
25690
- * @name millisecondsInHour
25691
- * @constant
25692
- * @type {number}
25693
- * @default
25694
- */
25695
- var millisecondsInHour = 3600000;
26120
+ function humanize(argWithSuffix, argThresholds) {
26121
+ if (!this.isValid()) {
26122
+ return this.localeData().invalidDate();
26123
+ }
25696
26124
 
25697
- /**
25698
- * @name isDate
25699
- * @category Common Helpers
25700
- * @summary Is the given value a date?
25701
- *
25702
- * @description
25703
- * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
25704
- *
25705
- * @param {*} value - the value to check
25706
- * @returns {boolean} true if the given value is a date
25707
- * @throws {TypeError} 1 arguments required
25708
- *
25709
- * @example
25710
- * // For a valid date:
25711
- * const result = isDate(new Date())
25712
- * //=> true
25713
- *
25714
- * @example
25715
- * // For an invalid date:
25716
- * const result = isDate(new Date(NaN))
25717
- * //=> true
25718
- *
25719
- * @example
25720
- * // For some value:
25721
- * const result = isDate('2014-02-31')
25722
- * //=> false
25723
- *
25724
- * @example
25725
- * // For an object:
25726
- * const result = isDate({})
25727
- * //=> false
25728
- */
25729
- function isDate(value) {
25730
- requiredArgs(1, arguments);
25731
- return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
25732
- }
26125
+ var withSuffix = false,
26126
+ th = thresholds,
26127
+ locale,
26128
+ output;
25733
26129
 
25734
- /**
25735
- * @name isValid
25736
- * @category Common Helpers
25737
- * @summary Is the given date valid?
25738
- *
25739
- * @description
25740
- * Returns false if argument is Invalid Date and true otherwise.
25741
- * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
25742
- * Invalid Date is a Date, whose time value is NaN.
25743
- *
25744
- * Time value of Date: http://es5.github.io/#x15.9.1.1
25745
- *
25746
- * @param {*} date - the date to check
25747
- * @returns {Boolean} the date is valid
25748
- * @throws {TypeError} 1 argument required
25749
- *
25750
- * @example
25751
- * // For the valid date:
25752
- * const result = isValid(new Date(2014, 1, 31))
25753
- * //=> true
25754
- *
25755
- * @example
25756
- * // For the value, convertable into a date:
25757
- * const result = isValid(1393804800000)
25758
- * //=> true
25759
- *
25760
- * @example
25761
- * // For the invalid date:
25762
- * const result = isValid(new Date(''))
25763
- * //=> false
25764
- */
25765
- function isValid(dirtyDate) {
25766
- requiredArgs(1, arguments);
25767
- if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
25768
- return false;
25769
- }
25770
- var date = toDate(dirtyDate);
25771
- return !isNaN(Number(date));
25772
- }
26130
+ if (typeof argWithSuffix === 'object') {
26131
+ argThresholds = argWithSuffix;
26132
+ argWithSuffix = false;
26133
+ }
26134
+ if (typeof argWithSuffix === 'boolean') {
26135
+ withSuffix = argWithSuffix;
26136
+ }
26137
+ if (typeof argThresholds === 'object') {
26138
+ th = Object.assign({}, thresholds, argThresholds);
26139
+ if (argThresholds.s != null && argThresholds.ss == null) {
26140
+ th.ss = argThresholds.s - 1;
26141
+ }
26142
+ }
25773
26143
 
25774
- /**
25775
- * @name isWithinInterval
25776
- * @category Interval Helpers
25777
- * @summary Is the given date within the interval?
25778
- *
25779
- * @description
25780
- * Is the given date within the interval? (Including start and end.)
25781
- *
25782
- * @param {Date|Number} date - the date to check
25783
- * @param {Interval} interval - the interval to check
25784
- * @returns {Boolean} the date is within the interval
25785
- * @throws {TypeError} 2 arguments required
25786
- * @throws {RangeError} The start of an interval cannot be after its end
25787
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
25788
- *
25789
- * @example
25790
- * // For the date within the interval:
25791
- * isWithinInterval(new Date(2014, 0, 3), {
25792
- * start: new Date(2014, 0, 1),
25793
- * end: new Date(2014, 0, 7)
25794
- * })
25795
- * //=> true
25796
- *
25797
- * @example
25798
- * // For the date outside of the interval:
25799
- * isWithinInterval(new Date(2014, 0, 10), {
25800
- * start: new Date(2014, 0, 1),
25801
- * end: new Date(2014, 0, 7)
25802
- * })
25803
- * //=> false
25804
- *
25805
- * @example
25806
- * // For date equal to interval start:
25807
- * isWithinInterval(date, { start, end: date }) // => true
25808
- *
25809
- * @example
25810
- * // For date equal to interval end:
25811
- * isWithinInterval(date, { start: date, end }) // => true
25812
- */
25813
- function isWithinInterval(dirtyDate, interval) {
25814
- requiredArgs(2, arguments);
25815
- var time = toDate(dirtyDate).getTime();
25816
- var startTime = toDate(interval.start).getTime();
25817
- var endTime = toDate(interval.end).getTime();
26144
+ locale = this.localeData();
26145
+ output = relativeTime$1(this, !withSuffix, th, locale);
25818
26146
 
25819
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
25820
- if (!(startTime <= endTime)) {
25821
- throw new RangeError('Invalid interval');
25822
- }
25823
- return time >= startTime && time <= endTime;
25824
- }
26147
+ if (withSuffix) {
26148
+ output = locale.pastFuture(+this, output);
26149
+ }
25825
26150
 
25826
- /**
25827
- * @name parseISO
25828
- * @category Common Helpers
25829
- * @summary Parse ISO string
25830
- *
25831
- * @description
25832
- * Parse the given string in ISO 8601 format and return an instance of Date.
25833
- *
25834
- * Function accepts complete ISO 8601 formats as well as partial implementations.
25835
- * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
25836
- *
25837
- * If the argument isn't a string, the function cannot parse the string or
25838
- * the values are invalid, it returns Invalid Date.
25839
- *
25840
- * @param {String} argument - the value to convert
25841
- * @param {Object} [options] - an object with options.
25842
- * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
25843
- * @returns {Date} the parsed date in the local time zone
25844
- * @throws {TypeError} 1 argument required
25845
- * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
25846
- *
25847
- * @example
25848
- * // Convert string '2014-02-11T11:30:30' to date:
25849
- * const result = parseISO('2014-02-11T11:30:30')
25850
- * //=> Tue Feb 11 2014 11:30:30
25851
- *
25852
- * @example
25853
- * // Convert string '+02014101' to date,
25854
- * // if the additional number of digits in the extended year format is 1:
25855
- * const result = parseISO('+02014101', { additionalDigits: 1 })
25856
- * //=> Fri Apr 11 2014 00:00:00
25857
- */
25858
- function parseISO(argument, options) {
25859
- var _options$additionalDi;
25860
- requiredArgs(1, arguments);
25861
- var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
25862
- if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
25863
- throw new RangeError('additionalDigits must be 0, 1 or 2');
25864
- }
25865
- if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
25866
- return new Date(NaN);
25867
- }
25868
- var dateStrings = splitDateString(argument);
25869
- var date;
25870
- if (dateStrings.date) {
25871
- var parseYearResult = parseYear(dateStrings.date, additionalDigits);
25872
- date = parseDate(parseYearResult.restDateString, parseYearResult.year);
25873
- }
25874
- if (!date || isNaN(date.getTime())) {
25875
- return new Date(NaN);
25876
- }
25877
- var timestamp = date.getTime();
25878
- var time = 0;
25879
- var offset;
25880
- if (dateStrings.time) {
25881
- time = parseTime(dateStrings.time);
25882
- if (isNaN(time)) {
25883
- return new Date(NaN);
26151
+ return locale.postformat(output);
25884
26152
  }
25885
- }
25886
- if (dateStrings.timezone) {
25887
- offset = parseTimezone(dateStrings.timezone);
25888
- if (isNaN(offset)) {
25889
- return new Date(NaN);
26153
+
26154
+ var abs$1 = Math.abs;
26155
+
26156
+ function sign(x) {
26157
+ return (x > 0) - (x < 0) || +x;
25890
26158
  }
25891
- } else {
25892
- var dirtyDate = new Date(timestamp + time);
25893
- // js parsed string assuming it's in UTC timezone
25894
- // but we need it to be parsed in our timezone
25895
- // so we use utc values to build date in our timezone.
25896
- // Year values from 0 to 99 map to the years 1900 to 1999
25897
- // so set year explicitly with setFullYear.
25898
- var result = new Date(0);
25899
- result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
25900
- result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
25901
- return result;
25902
- }
25903
- return new Date(timestamp + time + offset);
25904
- }
25905
- var patterns = {
25906
- dateTimeDelimiter: /[T ]/,
25907
- timeZoneDelimiter: /[Z ]/i,
25908
- timezone: /([Z+-].*)$/
25909
- };
25910
- var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
25911
- var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
25912
- var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
25913
- function splitDateString(dateString) {
25914
- var dateStrings = {};
25915
- var array = dateString.split(patterns.dateTimeDelimiter);
25916
- var timeString;
25917
26159
 
25918
- // The regex match should only return at maximum two array elements.
25919
- // [date], [time], or [date, time].
25920
- if (array.length > 2) {
25921
- return dateStrings;
25922
- }
25923
- if (/:/.test(array[0])) {
25924
- timeString = array[0];
25925
- } else {
25926
- dateStrings.date = array[0];
25927
- timeString = array[1];
25928
- if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
25929
- dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
25930
- timeString = dateString.substr(dateStrings.date.length, dateString.length);
25931
- }
25932
- }
25933
- if (timeString) {
25934
- var token = patterns.timezone.exec(timeString);
25935
- if (token) {
25936
- dateStrings.time = timeString.replace(token[1], '');
25937
- dateStrings.timezone = token[1];
25938
- } else {
25939
- dateStrings.time = timeString;
25940
- }
25941
- }
25942
- return dateStrings;
25943
- }
25944
- function parseYear(dateString, additionalDigits) {
25945
- var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
25946
- var captures = dateString.match(regex);
25947
- // Invalid ISO-formatted year
25948
- if (!captures) return {
25949
- year: NaN,
25950
- restDateString: ''
25951
- };
25952
- var year = captures[1] ? parseInt(captures[1]) : null;
25953
- var century = captures[2] ? parseInt(captures[2]) : null;
26160
+ function toISOString$1() {
26161
+ // for ISO strings we do not use the normal bubbling rules:
26162
+ // * milliseconds bubble up until they become hours
26163
+ // * days do not bubble at all
26164
+ // * months bubble up until they become years
26165
+ // This is because there is no context-free conversion between hours and days
26166
+ // (think of clock changes)
26167
+ // and also not between days and months (28-31 days per month)
26168
+ if (!this.isValid()) {
26169
+ return this.localeData().invalidDate();
26170
+ }
26171
+
26172
+ var seconds = abs$1(this._milliseconds) / 1000,
26173
+ days = abs$1(this._days),
26174
+ months = abs$1(this._months),
26175
+ minutes,
26176
+ hours,
26177
+ years,
26178
+ s,
26179
+ total = this.asSeconds(),
26180
+ totalSign,
26181
+ ymSign,
26182
+ daysSign,
26183
+ hmsSign;
26184
+
26185
+ if (!total) {
26186
+ // this is the same as C#'s (Noda) and python (isodate)...
26187
+ // but not other JS (goog.date)
26188
+ return 'P0D';
26189
+ }
26190
+
26191
+ // 3600 seconds -> 60 minutes -> 1 hour
26192
+ minutes = absFloor(seconds / 60);
26193
+ hours = absFloor(minutes / 60);
26194
+ seconds %= 60;
26195
+ minutes %= 60;
26196
+
26197
+ // 12 months -> 1 year
26198
+ years = absFloor(months / 12);
26199
+ months %= 12;
26200
+
26201
+ // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
26202
+ s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
26203
+
26204
+ totalSign = total < 0 ? '-' : '';
26205
+ ymSign = sign(this._months) !== sign(total) ? '-' : '';
26206
+ daysSign = sign(this._days) !== sign(total) ? '-' : '';
26207
+ hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
26208
+
26209
+ return (
26210
+ totalSign +
26211
+ 'P' +
26212
+ (years ? ymSign + years + 'Y' : '') +
26213
+ (months ? ymSign + months + 'M' : '') +
26214
+ (days ? daysSign + days + 'D' : '') +
26215
+ (hours || minutes || seconds ? 'T' : '') +
26216
+ (hours ? hmsSign + hours + 'H' : '') +
26217
+ (minutes ? hmsSign + minutes + 'M' : '') +
26218
+ (seconds ? hmsSign + s + 'S' : '')
26219
+ );
26220
+ }
26221
+
26222
+ var proto$2 = Duration.prototype;
26223
+
26224
+ proto$2.isValid = isValid$1;
26225
+ proto$2.abs = abs;
26226
+ proto$2.add = add$1;
26227
+ proto$2.subtract = subtract$1;
26228
+ proto$2.as = as;
26229
+ proto$2.asMilliseconds = asMilliseconds;
26230
+ proto$2.asSeconds = asSeconds;
26231
+ proto$2.asMinutes = asMinutes;
26232
+ proto$2.asHours = asHours;
26233
+ proto$2.asDays = asDays;
26234
+ proto$2.asWeeks = asWeeks;
26235
+ proto$2.asMonths = asMonths;
26236
+ proto$2.asQuarters = asQuarters;
26237
+ proto$2.asYears = asYears;
26238
+ proto$2.valueOf = valueOf$1;
26239
+ proto$2._bubble = bubble;
26240
+ proto$2.clone = clone$1;
26241
+ proto$2.get = get$2;
26242
+ proto$2.milliseconds = milliseconds;
26243
+ proto$2.seconds = seconds;
26244
+ proto$2.minutes = minutes;
26245
+ proto$2.hours = hours;
26246
+ proto$2.days = days;
26247
+ proto$2.weeks = weeks;
26248
+ proto$2.months = months;
26249
+ proto$2.years = years;
26250
+ proto$2.humanize = humanize;
26251
+ proto$2.toISOString = toISOString$1;
26252
+ proto$2.toString = toISOString$1;
26253
+ proto$2.toJSON = toISOString$1;
26254
+ proto$2.locale = locale;
26255
+ proto$2.localeData = localeData;
26256
+
26257
+ proto$2.toIsoString = deprecate(
26258
+ 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
26259
+ toISOString$1
26260
+ );
26261
+ proto$2.lang = lang;
26262
+
26263
+ // FORMATTING
25954
26264
 
25955
- // either year or century is null, not both
25956
- return {
25957
- year: century === null ? year : century * 100,
25958
- restDateString: dateString.slice((captures[1] || captures[2]).length)
25959
- };
25960
- }
25961
- function parseDate(dateString, year) {
25962
- // Invalid ISO-formatted year
25963
- if (year === null) return new Date(NaN);
25964
- var captures = dateString.match(dateRegex);
25965
- // Invalid ISO-formatted string
25966
- if (!captures) return new Date(NaN);
25967
- var isWeekDate = !!captures[4];
25968
- var dayOfYear = parseDateUnit(captures[1]);
25969
- var month = parseDateUnit(captures[2]) - 1;
25970
- var day = parseDateUnit(captures[3]);
25971
- var week = parseDateUnit(captures[4]);
25972
- var dayOfWeek = parseDateUnit(captures[5]) - 1;
25973
- if (isWeekDate) {
25974
- if (!validateWeekDate(year, week, dayOfWeek)) {
25975
- return new Date(NaN);
25976
- }
25977
- return dayOfISOWeekYear(year, week, dayOfWeek);
25978
- } else {
25979
- var date = new Date(0);
25980
- if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
25981
- return new Date(NaN);
25982
- }
25983
- date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
25984
- return date;
25985
- }
25986
- }
25987
- function parseDateUnit(value) {
25988
- return value ? parseInt(value) : 1;
25989
- }
25990
- function parseTime(timeString) {
25991
- var captures = timeString.match(timeRegex);
25992
- if (!captures) return NaN; // Invalid ISO-formatted time
26265
+ addFormatToken('X', 0, 0, 'unix');
26266
+ addFormatToken('x', 0, 0, 'valueOf');
25993
26267
 
25994
- var hours = parseTimeUnit(captures[1]);
25995
- var minutes = parseTimeUnit(captures[2]);
25996
- var seconds = parseTimeUnit(captures[3]);
25997
- if (!validateTime(hours, minutes, seconds)) {
25998
- return NaN;
25999
- }
26000
- return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
26001
- }
26002
- function parseTimeUnit(value) {
26003
- return value && parseFloat(value.replace(',', '.')) || 0;
26004
- }
26005
- function parseTimezone(timezoneString) {
26006
- if (timezoneString === 'Z') return 0;
26007
- var captures = timezoneString.match(timezoneRegex);
26008
- if (!captures) return 0;
26009
- var sign = captures[1] === '+' ? -1 : 1;
26010
- var hours = parseInt(captures[2]);
26011
- var minutes = captures[3] && parseInt(captures[3]) || 0;
26012
- if (!validateTimezone(hours, minutes)) {
26013
- return NaN;
26014
- }
26015
- return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
26016
- }
26017
- function dayOfISOWeekYear(isoWeekYear, week, day) {
26018
- var date = new Date(0);
26019
- date.setUTCFullYear(isoWeekYear, 0, 4);
26020
- var fourthOfJanuaryDay = date.getUTCDay() || 7;
26021
- var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
26022
- date.setUTCDate(date.getUTCDate() + diff);
26023
- return date;
26024
- }
26268
+ // PARSING
26025
26269
 
26026
- // Validation functions
26270
+ addRegexToken('x', matchSigned);
26271
+ addRegexToken('X', matchTimestamp);
26272
+ addParseToken('X', function (input, array, config) {
26273
+ config._d = new Date(parseFloat(input) * 1000);
26274
+ });
26275
+ addParseToken('x', function (input, array, config) {
26276
+ config._d = new Date(toInt(input));
26277
+ });
26027
26278
 
26028
- // February is null to handle the leap year (using ||)
26029
- var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
26030
- function isLeapYearIndex(year) {
26031
- return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
26032
- }
26033
- function validateDate(year, month, date) {
26034
- return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
26035
- }
26036
- function validateDayOfYearDate(year, dayOfYear) {
26037
- return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
26038
- }
26039
- function validateWeekDate(_year, week, day) {
26040
- return week >= 1 && week <= 53 && day >= 0 && day <= 6;
26041
- }
26042
- function validateTime(hours, minutes, seconds) {
26043
- if (hours === 24) {
26044
- return minutes === 0 && seconds === 0;
26045
- }
26046
- return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
26047
- }
26048
- function validateTimezone(_hours, minutes) {
26049
- return minutes >= 0 && minutes <= 59;
26050
- }
26279
+ //! moment.js
26280
+
26281
+ hooks.version = '2.29.4';
26282
+
26283
+ setHookCallback(createLocal);
26284
+
26285
+ hooks.fn = proto;
26286
+ hooks.min = min;
26287
+ hooks.max = max;
26288
+ hooks.now = now;
26289
+ hooks.utc = createUTC;
26290
+ hooks.unix = createUnix;
26291
+ hooks.months = listMonths;
26292
+ hooks.isDate = isDate;
26293
+ hooks.locale = getSetGlobalLocale;
26294
+ hooks.invalid = createInvalid;
26295
+ hooks.duration = createDuration;
26296
+ hooks.isMoment = isMoment;
26297
+ hooks.weekdays = listWeekdays;
26298
+ hooks.parseZone = createInZone;
26299
+ hooks.localeData = getLocale;
26300
+ hooks.isDuration = isDuration;
26301
+ hooks.monthsShort = listMonthsShort;
26302
+ hooks.weekdaysMin = listWeekdaysMin;
26303
+ hooks.defineLocale = defineLocale;
26304
+ hooks.updateLocale = updateLocale;
26305
+ hooks.locales = listLocales;
26306
+ hooks.weekdaysShort = listWeekdaysShort;
26307
+ hooks.normalizeUnits = normalizeUnits;
26308
+ hooks.relativeTimeRounding = getSetRelativeTimeRounding;
26309
+ hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
26310
+ hooks.calendarFormat = getCalendarFormat;
26311
+ hooks.prototype = proto;
26312
+
26313
+ // currently HTML5 input type only supports 24-hour formats
26314
+ hooks.HTML5_FMT = {
26315
+ DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
26316
+ DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
26317
+ DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
26318
+ DATE: 'YYYY-MM-DD', // <input type="date" />
26319
+ TIME: 'HH:mm', // <input type="time" />
26320
+ TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
26321
+ TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
26322
+ WEEK: 'GGGG-[W]WW', // <input type="week" />
26323
+ MONTH: 'YYYY-MM', // <input type="month" />
26324
+ };
26325
+
26326
+ return hooks;
26327
+
26328
+ })));
26329
+ }(moment$1));
26330
+
26331
+ var moment = moment$1.exports;
26051
26332
 
26052
26333
  /** ************************************************ */
26053
26334
  /* Object to store a time duration / time interval */
@@ -26178,7 +26459,7 @@ var parseISO8601DateToDate = function parseISO8601DateToDate(unvalidatedIsotime)
26178
26459
  };
26179
26460
  var isotime = makeISO8601StringFromFlexibleWMSDateString(unvalidatedIsotime);
26180
26461
  if (!isValidISOTime(isotime)) {
26181
- debug(DebugType.Warning);
26462
+ debugLogger(DebugType.Warning);
26182
26463
  return undefined;
26183
26464
  }
26184
26465
  var _getTimeValues = getTimeValues(isotime),
@@ -26430,14 +26711,14 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
26430
26711
  this.startTime = parseISO8601DateToDate(times[0]);
26431
26712
  this.stopTime = parseISO8601DateToDate(times[1]);
26432
26713
  if (!this.startTime || !this.stopTime) {
26433
- debug(DebugType.Warning);
26714
+ debugLogger(DebugType.Warning);
26434
26715
  return;
26435
26716
  }
26436
26717
  /* Try to get the time interval. If not available default to 1 minute */
26437
26718
  var timeIntervalString = times[2] || 'PT1M';
26438
26719
  this.timeInterval = parseISO8601IntervalToDateInterval(timeIntervalString);
26439
26720
  if (!this.timeInterval) {
26440
- debug(DebugType.Warning);
26721
+ debugLogger(DebugType.Warning);
26441
26722
  return;
26442
26723
  }
26443
26724
  // Calculate the number if steps
@@ -26463,7 +26744,7 @@ var ParseISOTimeRangeDuration = /*#__PURE__*/function () {
26463
26744
  return null;
26464
26745
  }
26465
26746
  if (!this.timeInterval) {
26466
- debug(DebugType.Warning);
26747
+ debugLogger(DebugType.Warning);
26467
26748
  return null;
26468
26749
  }
26469
26750
  if (this.timeInterval.isRegularInterval === false) {
@@ -26656,7 +26937,7 @@ var WMJSDimension = /*#__PURE__*/function () {
26656
26937
  if (!referenceTimeValueToSet) {
26657
26938
  this.reInitializeValues(this.values);
26658
26939
  this.setClosestValue(null);
26659
- debug(DebugType.Warning);
26940
+ debugLogger(DebugType.Warning);
26660
26941
  return;
26661
26942
  }
26662
26943
  /*
@@ -26952,7 +27233,7 @@ var WMJSDimension = /*#__PURE__*/function () {
26952
27233
  value = this.getValueForIndex(index);
26953
27234
  } catch (e) {
26954
27235
  if (typeof e.message === 'number') {
26955
- if (e.message === 0) {
27236
+ if (e.message === '0') {
26956
27237
  value = WMDateTooEarlyString;
26957
27238
  } else {
26958
27239
  value = WMDateTooLateString;
@@ -27117,7 +27398,7 @@ var WMJSDimension = /*#__PURE__*/function () {
27117
27398
  }
27118
27399
  return foundIndex;
27119
27400
  } catch (e) {
27120
- debug(DebugType.Error);
27401
+ debugLogger(DebugType.Error);
27121
27402
  return -1;
27122
27403
  }
27123
27404
  }
@@ -27256,7 +27537,7 @@ var MapPin = /*#__PURE__*/function () {
27256
27537
  _this.redrawMap();
27257
27538
  };
27258
27539
  this.positionMapPinByLatLon = function (coord) {
27259
- debug(DebugType.Log, "positionMapPinByLatLon at ".concat(coord.x, ",").concat(coord.y));
27540
+ debugLogger(DebugType.Log, "positionMapPinByLatLon at ".concat(coord.x, ",").concat(coord.y));
27260
27541
  var newpos = _this._map.getPixelCoordFromLatLong(coord);
27261
27542
  _this.setMapPin(newpos.x, newpos.y);
27262
27543
  };
@@ -28256,7 +28537,7 @@ var WMJSMap = /*#__PURE__*/function () {
28256
28537
  }, this.internalMapId);
28257
28538
  this.callBack.addToCallback('display', this.display, true);
28258
28539
  this.callBack.addToCallback('draw', function () {
28259
- debug(DebugType.Log);
28540
+ debugLogger(DebugType.Log);
28260
28541
  }, true);
28261
28542
  bgMapImageStore.addImageEventCallback(function (image, id, imageEventType) {
28262
28543
  if (imageEventType === WMImageEventType.Loaded) {
@@ -28271,16 +28552,16 @@ var WMJSMap = /*#__PURE__*/function () {
28271
28552
  }, {
28272
28553
  key: "rebuildMapDimensions",
28273
28554
  value: function rebuildMapDimensions() {
28274
- for (var i = 0; i < this.layers.length; i += 1) {
28275
- for (var j = 0; j < this.layers[i].dimensions.length; j += 1) {
28276
- var dim = this.layers[i].dimensions[j];
28277
- var mapdim = this.getDimension(dim.name);
28555
+ var _this4 = this;
28556
+ this.layers.forEach(function (layer) {
28557
+ layer.dimensions.forEach(function (dim) {
28558
+ var mapdim = _this4.getDimension(dim.name);
28278
28559
  if (!isDefined(mapdim)) {
28279
28560
  var newdim = dim.clone();
28280
- this.mapdimensions.push(newdim);
28561
+ _this4.mapdimensions.push(newdim);
28281
28562
  }
28282
- }
28283
- }
28563
+ });
28564
+ });
28284
28565
  this.callBack.triggerEvent('onmapdimupdate');
28285
28566
  }
28286
28567
  }, {
@@ -28439,9 +28720,9 @@ var WMJSMap = /*#__PURE__*/function () {
28439
28720
  }
28440
28721
  } else {
28441
28722
  try {
28442
- debug(DebugType.Error, "WebMapJS warning: moveLayerDown: layer '".concat(layerToMove.name, "' not found."));
28723
+ debugLogger(DebugType.Error, "WebMapJS warning: moveLayerDown: layer '".concat(layerToMove.name, "' not found."));
28443
28724
  } catch (e) {
28444
- debug(DebugType.Error);
28725
+ debugLogger(DebugType.Error);
28445
28726
  }
28446
28727
  }
28447
28728
  }
@@ -28459,9 +28740,9 @@ var WMJSMap = /*#__PURE__*/function () {
28459
28740
  }
28460
28741
  } else {
28461
28742
  try {
28462
- debug(DebugType.Error, "WebMapJS: moveLayers: layer '".concat(_layerA.name, "' not found."));
28743
+ debugLogger(DebugType.Error, "WebMapJS: moveLayers: layer '".concat(_layerA.name, "' not found."));
28463
28744
  } catch (e) {
28464
- debug(DebugType.Error);
28745
+ debugLogger(DebugType.Error);
28465
28746
  }
28466
28747
  }
28467
28748
  }
@@ -28478,19 +28759,19 @@ var WMJSMap = /*#__PURE__*/function () {
28478
28759
  }
28479
28760
  } else {
28480
28761
  try {
28481
- debug(DebugType.Error, "WebMapJS: moveLayerUp: layer '".concat(layerToMove.name, "' not found."));
28762
+ debugLogger(DebugType.Error, "WebMapJS: moveLayerUp: layer '".concat(layerToMove.name, "' not found."));
28482
28763
  } catch (e) {
28483
- debug(DebugType.Error);
28764
+ debugLogger(DebugType.Error);
28484
28765
  }
28485
28766
  }
28486
28767
  }
28487
28768
  }, {
28488
28769
  key: "configureMapDimensions",
28489
28770
  value: function configureMapDimensions(layer) {
28490
- var _this4 = this;
28771
+ var _this5 = this;
28491
28772
  layer.dimensions.forEach(function (dimension) {
28492
- var mapDim = _this4.getDimension(dimension.name);
28493
- if (isDefined(mapDim) && isDefined(mapDim.currentValue) && dimension.linked) {
28773
+ var mapDim = _this5.getDimension(dimension.name);
28774
+ if ((mapDim === null || mapDim === void 0 ? void 0 : mapDim.currentValue) !== undefined && dimension.linked) {
28494
28775
  dimension.setClosestValue(mapDim.currentValue);
28495
28776
  }
28496
28777
  });
@@ -28502,25 +28783,25 @@ var WMJSMap = /*#__PURE__*/function () {
28502
28783
  }, {
28503
28784
  key: "addLayer",
28504
28785
  value: function addLayer(layer) {
28505
- var _this5 = this;
28786
+ var _this6 = this;
28506
28787
  return new Promise(function (resolve, reject) {
28507
28788
  if (!isDefined(layer)) {
28508
- debug(DebugType.Warning);
28789
+ debugLogger(DebugType.Warning);
28509
28790
  reject(new Error('undefined layer'));
28510
28791
  return;
28511
28792
  }
28512
28793
  if (!layer.constructor) {
28513
- debug(DebugType.Warning);
28794
+ debugLogger(DebugType.Warning);
28514
28795
  reject(new Error('layer has no constructor'));
28515
28796
  return;
28516
28797
  }
28517
28798
  /* Set a reference in the layer to this map */
28518
- layer.parentMap = _this5;
28519
- _this5.layers.push(layer);
28799
+ layer.parentMap = _this6;
28800
+ _this6.layers.push(layer);
28520
28801
  var done = function done(layerCallback) {
28521
- _this5.configureMapDimensions(layerCallback);
28522
- _this5.callBack.triggerEvent('onlayeradd');
28523
- resolve(_this5);
28802
+ _this6.configureMapDimensions(layerCallback);
28803
+ _this6.callBack.triggerEvent('onlayeradd');
28804
+ resolve(_this6);
28524
28805
  };
28525
28806
  layer.parseLayer(done, undefined, 'WMJSMap addLayer');
28526
28807
  });
@@ -28610,8 +28891,8 @@ var WMJSMap = /*#__PURE__*/function () {
28610
28891
  }, {
28611
28892
  key: "setSize",
28612
28893
  value: function setSize(w, h) {
28613
- var _this6 = this;
28614
- debug(DebugType.Log, 'setSize', w, h, this.initialized);
28894
+ var _this7 = this;
28895
+ debugLogger(DebugType.Log, 'setSize', w, h, this.initialized);
28615
28896
  if (w < 4 || h < 4 || this.initialized === false) {
28616
28897
  return;
28617
28898
  }
@@ -28627,9 +28908,9 @@ var WMJSMap = /*#__PURE__*/function () {
28627
28908
  return;
28628
28909
  }
28629
28910
  this._resizeTimer.init(200, function () {
28630
- _this6._resizeTimerBusy = false;
28631
- _this6._setSize(_this6.resizeWidth, _this6.resizeHeight);
28632
- _this6.draw('resizeTimer');
28911
+ _this7._resizeTimerBusy = false;
28912
+ _this7._setSize(_this7.resizeWidth, _this7.resizeHeight);
28913
+ _this7.draw('resizeTimer');
28633
28914
  });
28634
28915
  }
28635
28916
  }, {
@@ -28641,7 +28922,7 @@ var WMJSMap = /*#__PURE__*/function () {
28641
28922
  if (w < 4 || h < 4) {
28642
28923
  return;
28643
28924
  }
28644
- debug(DebugType.Log);
28925
+ debugLogger(DebugType.Log);
28645
28926
  var projinfo = this.getProjection();
28646
28927
  this.width = w;
28647
28928
  this.height = h;
@@ -28652,7 +28933,7 @@ var WMJSMap = /*#__PURE__*/function () {
28652
28933
  this.height = 4;
28653
28934
  }
28654
28935
  if (!projinfo.srs || !projinfo.bbox) {
28655
- debug(DebugType.Error);
28936
+ debugLogger(DebugType.Error);
28656
28937
  projinfo.srs = 'EPSG:4326';
28657
28938
  projinfo.bbox.left = -180;
28658
28939
  projinfo.bbox.bottom = -90;
@@ -28750,7 +29031,7 @@ var WMJSMap = /*#__PURE__*/function () {
28750
29031
  this.divDimInfo.style.display = 'none';
28751
29032
  }
28752
29033
  } catch (e) {
28753
- debug(DebugType.Error);
29034
+ debugLogger(DebugType.Error);
28754
29035
  }
28755
29036
  }
28756
29037
  }, {
@@ -28794,7 +29075,7 @@ var WMJSMap = /*#__PURE__*/function () {
28794
29075
  }
28795
29076
  }
28796
29077
  if (this.isAnimating) {
28797
- debug(DebugType.Log);
29078
+ debugLogger(DebugType.Log);
28798
29079
  return;
28799
29080
  }
28800
29081
  this._draw(this._animationList);
@@ -28805,7 +29086,7 @@ var WMJSMap = /*#__PURE__*/function () {
28805
29086
  }, {
28806
29087
  key: "_draw",
28807
29088
  value: function _draw(animationList) {
28808
- debug(DebugType.Log);
29089
+ debugLogger(DebugType.Log);
28809
29090
  this.drawnBBOX.setBBOX(this.bbox);
28810
29091
  this._drawAndLoad(animationList);
28811
29092
  }
@@ -28821,7 +29102,7 @@ var WMJSMap = /*#__PURE__*/function () {
28821
29102
  }, {
28822
29103
  key: "_drawAndLoad",
28823
29104
  value: function _drawAndLoad(animationList) {
28824
- var _this7 = this;
29105
+ var _this8 = this;
28825
29106
  if (this.width < 4 || this.height < 4) {
28826
29107
  this._drawReady();
28827
29108
  return;
@@ -28841,19 +29122,20 @@ var WMJSMap = /*#__PURE__*/function () {
28841
29122
  this.mouseHoverAnimationBox = false;
28842
29123
  animationList.forEach(function (animationStepWithoutRequests, j) {
28843
29124
  if (selectedTime && animationStepWithoutRequests.value === selectedTime) {
28844
- _this7.currentAnimationStep = j;
29125
+ _this8.currentAnimationStep = j;
28845
29126
  }
28846
29127
  var animationStep = {
28847
29128
  name: animationStepWithoutRequests.name,
28848
29129
  value: animationStepWithoutRequests.value,
28849
29130
  requests: []
28850
29131
  };
28851
- _this7.setDimension(animationStepWithoutRequests.name, animationStepWithoutRequests.value, false);
28852
- animationStep.requests = _this7.getWMSRequests();
28853
- _this7.animationList.push(animationStep);
29132
+ _this8.setDimension(animationStepWithoutRequests.name, animationStepWithoutRequests.value, false);
29133
+ animationStep.requests = _this8.getWMSRequests();
29134
+ _this8.animationList.push(animationStep);
28854
29135
  });
28855
29136
  this.setDimension(this.animationList[this.currentAnimationStep].name, this.animationList[this.currentAnimationStep].value, false);
28856
- this.wmAnimate.prefetchImagesForAnimationSteps();
29137
+ this.animationTimer = new WMTimer();
29138
+ this.wmAnimate.loopAnimation();
28857
29139
  }
28858
29140
  this.addLayersToCanvasAndDisplayThem();
28859
29141
  }
@@ -28865,7 +29147,7 @@ var WMJSMap = /*#__PURE__*/function () {
28865
29147
  }, {
28866
29148
  key: "_onMapReadyCallbackFunction",
28867
29149
  value: function _onMapReadyCallbackFunction() {
28868
- debug(DebugType.Log);
29150
+ debugLogger(DebugType.Log);
28869
29151
  this.draw('onmapready callback');
28870
29152
  }
28871
29153
  }, {
@@ -28876,11 +29158,11 @@ var WMJSMap = /*#__PURE__*/function () {
28876
29158
  }, {
28877
29159
  key: "getWMSRequests",
28878
29160
  value: function getWMSRequests() {
28879
- var _this8 = this;
29161
+ var _this9 = this;
28880
29162
  var requests = [];
28881
29163
  this.layers.forEach(function (layer) {
28882
29164
  if (layer.service && layer.enabled) {
28883
- var request = buildWMSGetMapRequest(_this8, layer);
29165
+ var request = buildWMSGetMapRequest(_this9, layer);
28884
29166
  if (request === null || request === void 0 ? void 0 : request.url) {
28885
29167
  requests.push(request);
28886
29168
  }
@@ -28891,35 +29173,37 @@ var WMJSMap = /*#__PURE__*/function () {
28891
29173
  }, {
28892
29174
  key: "addLayersToCanvasAndDisplayThem",
28893
29175
  value: function addLayersToCanvasAndDisplayThem() {
28894
- var _this9 = this;
29176
+ var _this10 = this;
28895
29177
  var _a, _b, _c;
28896
- debug(DebugType.Log);
29178
+ debugLogger(DebugType.Log);
28897
29179
  this.divBuffer.reset();
28898
29180
  var currentLayerIndex = 0;
28899
29181
  this.numBaseLayers = 0;
28900
29182
  (_a = this.baseLayers) === null || _a === void 0 ? void 0 : _a.forEach(function (baseLayer) {
28901
29183
  var _a;
28902
29184
  if (baseLayer.enabled && baseLayer.keepOnTop === false && baseLayer.type && baseLayer.type !== 'twms') {
28903
- _this9.numBaseLayers += 1;
28904
- var requestURL = (_a = buildWMSGetMapRequest(_this9, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
29185
+ _this10.numBaseLayers += 1;
29186
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
28905
29187
  if (requestURL) {
28906
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29188
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28907
29189
  layer: baseLayer
28908
- }, baseLayer.opacity, _this9.getDrawBBOX());
29190
+ }, baseLayer.opacity, _this10.getDrawBBOX());
28909
29191
  currentLayerIndex += 1;
28910
29192
  }
28911
29193
  }
28912
29194
  });
29195
+ if (!this.isAnimating) {
29196
+ prefetchImagesForNonAnimation(this);
29197
+ }
28913
29198
  /* Loop through all layers */
28914
29199
  (_b = this.layers) === null || _b === void 0 ? void 0 : _b.forEach(function (layer) {
28915
29200
  var _a;
28916
29201
  if (layer.service && layer.enabled && layer.isConfigured) {
28917
- layer.prefetchImages();
28918
- var requestURL = (_a = buildWMSGetMapRequest(_this9, layer)) === null || _a === void 0 ? void 0 : _a.url;
29202
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, layer)) === null || _a === void 0 ? void 0 : _a.url;
28919
29203
  if (requestURL) {
28920
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29204
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28921
29205
  layer: layer
28922
- }, layer.opacity, _this9.getDrawBBOX());
29206
+ }, layer.opacity, _this10.getDrawBBOX());
28923
29207
  currentLayerIndex += 1;
28924
29208
  }
28925
29209
  }
@@ -28927,11 +29211,11 @@ var WMJSMap = /*#__PURE__*/function () {
28927
29211
  (_c = this.baseLayers) === null || _c === void 0 ? void 0 : _c.forEach(function (baseLayer) {
28928
29212
  var _a;
28929
29213
  if (baseLayer.enabled && baseLayer.keepOnTop === true) {
28930
- var requestURL = (_a = buildWMSGetMapRequest(_this9, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
29214
+ var requestURL = (_a = buildWMSGetMapRequest(_this10, baseLayer)) === null || _a === void 0 ? void 0 : _a.url;
28931
29215
  if (requestURL) {
28932
- _this9.divBuffer.setSrc(currentLayerIndex, requestURL, {
29216
+ _this10.divBuffer.setSrc(currentLayerIndex, requestURL, {
28933
29217
  layer: baseLayer
28934
- }, baseLayer.opacity, _this9.getDrawBBOX());
29218
+ }, baseLayer.opacity, _this10.getDrawBBOX());
28935
29219
  currentLayerIndex += 1;
28936
29220
  }
28937
29221
  }
@@ -28963,7 +29247,7 @@ var WMJSMap = /*#__PURE__*/function () {
28963
29247
  key: "redrawBuffer",
28964
29248
  value: function redrawBuffer() {
28965
29249
  this.divBuffer.display();
28966
- debug(DebugType.Log);
29250
+ debugLogger(DebugType.Log);
28967
29251
  this.drawnBBOX.setBBOX(this.bbox);
28968
29252
  this.draw();
28969
29253
  }
@@ -29125,20 +29409,20 @@ var WMJSMap = /*#__PURE__*/function () {
29125
29409
  }, {
29126
29410
  key: "_buildLayerDims",
29127
29411
  value: function _buildLayerDims() {
29128
- var _this10 = this;
29412
+ var _this11 = this;
29129
29413
  if (this.buildLayerDimsBusy === true) {
29130
29414
  return;
29131
29415
  }
29132
29416
  this.mapdimensions.forEach(function (mapDim) {
29133
- _this10.layers.forEach(function (layer) {
29417
+ _this11.layers.forEach(function (layer) {
29134
29418
  layer.dimensions.forEach(function (layerDim) {
29135
29419
  if (layerDim.linked === true && layerDim.name === mapDim.name) {
29136
29420
  if (mapDim.currentValue === 'current' || mapDim.currentValue === 'default' || mapDim.currentValue === '' || mapDim.currentValue === 'earliest' || mapDim.currentValue === 'middle' || mapDim.currentValue === 'latest') {
29137
29421
  mapDim.currentValue = layerDim.getClosestValue(mapDim.currentValue);
29138
29422
  }
29139
- _this10.buildLayerDimsBusy = true;
29423
+ _this11.buildLayerDimsBusy = true;
29140
29424
  layerDim.setClosestValue(mapDim.currentValue);
29141
- _this10.buildLayerDimsBusy = false;
29425
+ _this11.buildLayerDimsBusy = false;
29142
29426
  }
29143
29427
  });
29144
29428
  });
@@ -29181,7 +29465,7 @@ var WMJSMap = /*#__PURE__*/function () {
29181
29465
  } catch (e) {
29182
29466
  return undefined;
29183
29467
  }
29184
- debug(DebugType.Log);
29468
+ debugLogger(DebugType.Log);
29185
29469
  return request;
29186
29470
  }
29187
29471
  /* End of GetFeature info handling */
@@ -29532,7 +29816,7 @@ var WMJSMap = /*#__PURE__*/function () {
29532
29816
  this.callBack.triggerEvent('onmousemove', [undefined, undefined]);
29533
29817
  this.updateMouseCursorCoordinates(undefined);
29534
29818
  } catch (e) {
29535
- debug(DebugType.Error);
29819
+ debugLogger(DebugType.Error);
29536
29820
  }
29537
29821
  this.mouseUpX = this.mouseX;
29538
29822
  this.mouseUpY = this.mouseY;
@@ -29672,7 +29956,7 @@ var WMJSMap = /*#__PURE__*/function () {
29672
29956
  this.gfiDialogList[j].origY = this.gfiDialogList[j].y;
29673
29957
  }
29674
29958
  this.mapPanning = 1;
29675
- debug(DebugType.Log);
29959
+ debugLogger(DebugType.Log);
29676
29960
  this.bbox.setBBOX(this.drawnBBOX);
29677
29961
  this.updateBBOX.setBBOX(this.drawnBBOX);
29678
29962
  this.mapPanStartGeoCoords = this.getGeoCoordFromPixelCoord({
@@ -29854,8 +30138,8 @@ var WMJSMap = /*#__PURE__*/function () {
29854
30138
  }, {
29855
30139
  key: "zoomTo",
29856
30140
  value: function zoomTo(_newbbox) {
29857
- var _this11 = this;
29858
- debug(DebugType.Log);
30141
+ var _this12 = this;
30142
+ debugLogger(DebugType.Log);
29859
30143
  var setOrigBox = false;
29860
30144
  var newbbox = new WMBBOX(_newbbox);
29861
30145
  // Maintain aspect ratio
@@ -29870,7 +30154,7 @@ var WMJSMap = /*#__PURE__*/function () {
29870
30154
  setOrigBox = true;
29871
30155
  }
29872
30156
  if (setOrigBox === true) {
29873
- debug(DebugType.Error);
30157
+ debugLogger(DebugType.Error);
29874
30158
  ratio = 1;
29875
30159
  }
29876
30160
  if (ratio < 0) {
@@ -29895,14 +30179,14 @@ var WMJSMap = /*#__PURE__*/function () {
29895
30179
  this._updateBoundingBox(this.bbox);
29896
30180
  this.drawnBBOX.setBBOX(this.bbox);
29897
30181
  var resetMapPinAndDialogs = function resetMapPinAndDialogs() {
29898
- for (var j = 0; j < _this11.gfiDialogList.length; j += 1) {
29899
- var newpos = _this11.getPixelCoordFromGeoCoord({
29900
- x: _this11.gfiDialogList[j].geoPosX,
29901
- y: _this11.gfiDialogList[j].geoPosY
30182
+ for (var j = 0; j < _this12.gfiDialogList.length; j += 1) {
30183
+ var newpos = _this12.getPixelCoordFromGeoCoord({
30184
+ x: _this12.gfiDialogList[j].geoPosX,
30185
+ y: _this12.gfiDialogList[j].geoPosY
29902
30186
  });
29903
- if (_this11.gfiDialogList[j].hasBeenDragged === false) {
29904
- if (_this11.gfiDialogList[j].moveToMouseCursor === true) {
29905
- _this11.gfiDialogList[j].setXY(_this11.gfiDialogList[j].origX + newpos.x, _this11.gfiDialogList[j].origY + newpos.y);
30187
+ if (_this12.gfiDialogList[j].hasBeenDragged === false) {
30188
+ if (_this12.gfiDialogList[j].moveToMouseCursor === true) {
30189
+ _this12.gfiDialogList[j].setXY(_this12.gfiDialogList[j].origX + newpos.x, _this12.gfiDialogList[j].origY + newpos.y);
29906
30190
  }
29907
30191
  }
29908
30192
  }
@@ -29971,7 +30255,7 @@ var WMJSMap = /*#__PURE__*/function () {
29971
30255
  }
29972
30256
  result = proj4(this.longlat, this.proj4.projection, [p.x, p.y]);
29973
30257
  } catch (e) {
29974
- debug(DebugType.Error);
30258
+ debugLogger(DebugType.Error);
29975
30259
  return undefined;
29976
30260
  }
29977
30261
  return this.getPixelCoordFromGeoCoord({
@@ -30100,14 +30384,19 @@ var WMJSMap = /*#__PURE__*/function () {
30100
30384
  }
30101
30385
  return undefined;
30102
30386
  }
30387
+ }, {
30388
+ key: "setTimeDimension",
30389
+ value: function setTimeDimension(value, triggerEvent) {
30390
+ this.setDimension('time', value, triggerEvent);
30391
+ }
30103
30392
  }, {
30104
30393
  key: "setDimension",
30105
30394
  value: function setDimension(name, value) {
30106
30395
  var triggerEvent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
30107
30396
  var adjustLayerDims = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
30108
- debug(DebugType.Log);
30397
+ debugLogger(DebugType.Log);
30109
30398
  if (!isDefined(name) || !isDefined(value)) {
30110
- debug(DebugType.Error);
30399
+ debugLogger(DebugType.Error);
30111
30400
  return;
30112
30401
  }
30113
30402
  var dim = this.getDimension(name);
@@ -30156,14 +30445,14 @@ var WMJSMap = /*#__PURE__*/function () {
30156
30445
  return;
30157
30446
  }
30158
30447
  }
30159
- debug(DebugType.Error, "WebMapJS: Unable to find the correct bbox with current map projection ".concat(this.srs, " for layer ").concat(layer.title, ". Using default bbox instead."));
30448
+ debugLogger(DebugType.Error, "WebMapJS: Unable to find the correct bbox with current map projection ".concat(this.srs, " for layer ").concat(layer.title, ". Using default bbox instead."));
30160
30449
  this.zoomTo(this.defaultBBOX);
30161
30450
  this.draw('zoomTolayer');
30162
30451
  }
30163
30452
  }, {
30164
30453
  key: "setBBOX",
30165
30454
  value: function setBBOX(left, bottom, right, top) {
30166
- debug(DebugType.Log);
30455
+ debugLogger(DebugType.Log);
30167
30456
  this.bbox.setBBOX(left, bottom, right, top);
30168
30457
  this.resizeBBOX.setBBOX(this.bbox);
30169
30458
  this.wMFlyToBBox.flyZoomToBBOXFly.setBBOX(this.bbox);
@@ -30830,7 +31119,7 @@ var loadGetCapabilitiesViaProxy = function loadGetCapabilitiesViaProxy(url, succ
30830
31119
  fetch(getcapreq, {}).then(function (result) {
30831
31120
  return result.text();
30832
31121
  }).then(function (result) {
30833
- debug(DebugType.Log, 'loadGetCapabilitiesViaProxy succesfully finished');
31122
+ debugLogger(DebugType.Log, 'loadGetCapabilitiesViaProxy succesfully finished');
30834
31123
  succes(result);
30835
31124
  })["catch"](function () {
30836
31125
  fail("Request failed for ".concat(getcapreq));
@@ -30862,7 +31151,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30862
31151
  return;
30863
31152
  }
30864
31153
  if (service.length === 0) {
30865
- debug(DebugType.Error);
31154
+ debugLogger(DebugType.Error);
30866
31155
  fail(I18n.service_url_empty.text);
30867
31156
  return;
30868
31157
  }
@@ -30876,7 +31165,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30876
31165
  service = hostName + service;
30877
31166
  }
30878
31167
  if (!service.startsWith('http://') && !service.startsWith('https:') && !service.startsWith('//')) {
30879
- debug(DebugType.Error);
31168
+ debugLogger(DebugType.Error);
30880
31169
  fail(I18n.service_url_empty.text);
30881
31170
  return;
30882
31171
  }
@@ -30884,7 +31173,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30884
31173
  // eslint-disable-next-line no-param-reassign
30885
31174
  service += '?';
30886
31175
  }
30887
- debug(DebugType.Log);
31176
+ debugLogger(DebugType.Log);
30888
31177
  var addParams = disableCache ? {
30889
31178
  random: Math.random()
30890
31179
  } : {};
@@ -30893,7 +31182,7 @@ var WMJSGetCapabilities = function WMJSGetCapabilities(service, succes, fail, op
30893
31182
  try {
30894
31183
  succes(data);
30895
31184
  } catch (e) {
30896
- debug(DebugType.Error);
31185
+ debugLogger(DebugType.Error, e.message);
30897
31186
  }
30898
31187
  })["catch"](function () {
30899
31188
  loadGetCapabilitiesViaProxy(url, succes, function () {
@@ -31177,7 +31466,7 @@ var WMJSService = /*#__PURE__*/function () {
31177
31466
  if (!failure) {
31178
31467
  // eslint-disable-next-line no-param-reassign
31179
31468
  failure = function failure(msg) {
31180
- debug(DebugType.Error);
31469
+ debugLogger(DebugType.Error);
31181
31470
  };
31182
31471
  }
31183
31472
  var parse = function parse(jsonData) {
@@ -31185,7 +31474,7 @@ var WMJSService = /*#__PURE__*/function () {
31185
31474
  try {
31186
31475
  _this2.version = _this2.checkVersion(jsonData);
31187
31476
  } catch (e) {
31188
- failure(e);
31477
+ failure(e.message);
31189
31478
  return;
31190
31479
  }
31191
31480
  var layerTreeStructure = buildLayerTreeFromNestedWMSLayer(rootLayer);
@@ -31250,23 +31539,6 @@ var WMGetServiceFromStore = function WMGetServiceFromStore(serviceName) {
31250
31539
  return service;
31251
31540
  };
31252
31541
 
31253
- /* *
31254
- * Licensed under the Apache License, Version 2.0 (the "License");
31255
- * you may not use this file except in compliance with the License.
31256
- * You may obtain a copy of the License at
31257
- *
31258
- * http://www.apache.org/licenses/LICENSE-2.0
31259
- *
31260
- * Unless required by applicable law or agreed to in writing, software
31261
- * distributed under the License is distributed on an "AS IS" BASIS,
31262
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31263
- * See the License for the specific language governing permissions and
31264
- * limitations under the License.
31265
- *
31266
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
31267
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
31268
- * */
31269
- var _WMLayer_instances, _WMLayer_prefetchImage;
31270
31542
  var LayerType;
31271
31543
  (function (LayerType) {
31272
31544
  LayerType["mapLayer"] = "mapLayer";
@@ -31407,7 +31679,6 @@ var WMLayer = /*#__PURE__*/function () {
31407
31679
  var _this = this;
31408
31680
  _classCallCheck(this, WMLayer);
31409
31681
  var _a;
31410
- _WMLayer_instances.add(this);
31411
31682
  this.init = this.init.bind(this);
31412
31683
  this.getLayerName = this.getLayerName.bind(this);
31413
31684
  this.toggleAutoUpdate = this.toggleAutoUpdate.bind(this);
@@ -31711,7 +31982,7 @@ var WMLayer = /*#__PURE__*/function () {
31711
31982
  }
31712
31983
  }
31713
31984
  } catch (e) {
31714
- debug(DebugType.Error);
31985
+ debugLogger(DebugType.Error);
31715
31986
  }
31716
31987
  if (this.name === undefined || this.name.length < 1) {
31717
31988
  this.title = WMEmptyLayerTitle;
@@ -31727,7 +31998,7 @@ var WMLayer = /*#__PURE__*/function () {
31727
31998
  }
31728
31999
  if (!isDefined(this.getmapURL)) {
31729
32000
  this.getmapURL = this.service;
31730
- debug(DebugType.Error);
32001
+ debugLogger(DebugType.Error);
31731
32002
  }
31732
32003
  this.getfeatureinfoURL = undefined;
31733
32004
  try {
@@ -31737,7 +32008,7 @@ var WMLayer = /*#__PURE__*/function () {
31737
32008
  }
31738
32009
  if (!isDefined(this.getfeatureinfoURL)) {
31739
32010
  this.getfeatureinfoURL = this.service;
31740
- debug(DebugType.Error);
32011
+ debugLogger(DebugType.Error);
31741
32012
  }
31742
32013
  this.getlegendgraphicURL = undefined;
31743
32014
  try {
@@ -31844,7 +32115,7 @@ var WMLayer = /*#__PURE__*/function () {
31844
32115
  _layerDoneCallback(__layer);
31845
32116
  // console.timeEnd(origin);
31846
32117
  } catch (e) {
31847
- debug(DebugType.Error);
32118
+ debugLogger(DebugType.Error, e.message);
31848
32119
  }
31849
32120
  }
31850
32121
  };
@@ -31889,7 +32160,7 @@ var WMLayer = /*#__PURE__*/function () {
31889
32160
  return new Promise(function (resolve, reject) {
31890
32161
  _this6.parseLayer(function (layer) {
31891
32162
  if (layer.hasError === true) {
31892
- debug(DebugType.Error, "[ERROR] Parse layer failed, Reason [".concat(layer.lastError, "]"));
32163
+ debugLogger(DebugType.Error, "[ERROR] Parse layer failed, Reason [".concat(layer.lastError, "]"));
31893
32164
  reject(layer);
31894
32165
  } else {
31895
32166
  resolve(layer);
@@ -31900,7 +32171,7 @@ var WMLayer = /*#__PURE__*/function () {
31900
32171
  }, {
31901
32172
  key: "cloneLayer",
31902
32173
  value: function cloneLayer() {
31903
- return new WMLayer(this);
32174
+ return new WMLayer(this._options);
31904
32175
  }
31905
32176
  /**
31906
32177
  * Set or change the name of this layer. This involves re-parsing the WMS GetCapabilities document and updating the affected layer properties. When done, it resolves the WMLayer
@@ -31920,11 +32191,11 @@ var WMLayer = /*#__PURE__*/function () {
31920
32191
  }, {
31921
32192
  key: "setStyle",
31922
32193
  value: function setStyle(styleName) {
31923
- debug(DebugType.Log);
32194
+ debugLogger(DebugType.Log);
31924
32195
  if (!this.styles || this.styles.length === 0) {
31925
32196
  this.currentStyle = '';
31926
32197
  this.legendGraphic = '';
31927
- debug(DebugType.Log);
32198
+ debugLogger(DebugType.Log);
31928
32199
  return;
31929
32200
  }
31930
32201
  var styleFound = false;
@@ -31936,7 +32207,7 @@ var WMLayer = /*#__PURE__*/function () {
31936
32207
  }
31937
32208
  }
31938
32209
  if (!styleFound) {
31939
- debug(DebugType.Log, "WMLayer::setStyle: Style ".concat(styleName, " not found, setting style ").concat(this.styles[0].name));
32210
+ debugLogger(DebugType.Log, "WMLayer::setStyle: Style ".concat(styleName, " not found, setting style ").concat(this.styles[0].name));
31940
32211
  this.currentStyle = this.styles[0].name;
31941
32212
  this.legendGraphic = this.styles[0].legendURL;
31942
32213
  }
@@ -32064,51 +32335,9 @@ var WMLayer = /*#__PURE__*/function () {
32064
32335
  this.parentMap.displayLayer(this, this.enabled);
32065
32336
  }
32066
32337
  }
32067
- }, {
32068
- key: "prefetchImages",
32069
- value: function prefetchImages() {
32070
- var _this7 = this;
32071
- var timeDimension = this.getDimension('time');
32072
- if (!timeDimension) {
32073
- return;
32074
- }
32075
- var currentTime = timeDimension.currentValue;
32076
- var currentTimeIndex = timeDimension.getIndexForValue(currentTime);
32077
- var lastIndex = timeDimension.size();
32078
- if (currentTimeIndex < 0 || lastIndex <= 0) {
32079
- return;
32080
- }
32081
- var COUNT_IMAGES_TO_PRELOAD_BEFORE_AND_AFTER_CURRENT_TIME = 10;
32082
- lodash.exports.range(1, COUNT_IMAGES_TO_PRELOAD_BEFORE_AND_AFTER_CURRENT_TIME).forEach(function (offset) {
32083
- var nextImageIndex = currentTimeIndex + offset;
32084
- if (nextImageIndex < lastIndex) {
32085
- __classPrivateFieldGet(_this7, _WMLayer_instances, "m", _WMLayer_prefetchImage).call(_this7, timeDimension, nextImageIndex, currentTime);
32086
- }
32087
- var previousImageIndex = currentTimeIndex - offset;
32088
- if (previousImageIndex >= 0) {
32089
- __classPrivateFieldGet(_this7, _WMLayer_instances, "m", _WMLayer_prefetchImage).call(_this7, timeDimension, previousImageIndex, currentTime);
32090
- }
32091
- });
32092
- }
32093
32338
  }]);
32094
32339
  return WMLayer;
32095
32340
  }();
32096
- _WMLayer_instances = new WeakSet(), _WMLayer_prefetchImage = function _WMLayer_prefetchImage(timeDimension, index, currentTime) {
32097
- var time = timeDimension.getValueForIndex(index);
32098
- var timeIsNotAValidIsoString = typeof time !== 'string' || !isValid(parseISO(time));
32099
- if (timeIsNotAValidIsoString) {
32100
- return;
32101
- }
32102
- timeDimension.setValue(time);
32103
- var request = buildWMSGetMapRequest(this.parentMap, this);
32104
- if (request) {
32105
- var image = getMapImageStore.getImage(request.url);
32106
- if (image.hasNotStartedLoading()) {
32107
- image.load();
32108
- }
32109
- }
32110
- timeDimension.setValue(currentTime);
32111
- };
32112
32341
 
32113
32342
  /* *
32114
32343
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33324,4 +33553,4 @@ var getCapabilities = /*#__PURE__*/Object.freeze({
33324
33553
  getLayersFlattenedFromService: getLayersFlattenedFromService
33325
33554
  });
33326
33555
 
33327
- export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debug, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };
33556
+ export { DateInterval, DebugType, EPSGCode, I18n, LayerType, ParseISOTimeRangeDuration, URLDecode, URLEncode, WMBBOX, WMDateOutSideRange, WMDateTooEarlyString, WMDateTooLateString, WMEmptyLayerName, WMEmptyLayerTitle, WMGetServiceFromStore, WMImage, WMImageEventType, WMJSDimension, WMJSMap, WMJSService, WMJScheckURL, WMLayer, WMTimer, clearImageCache, debugLogger, generateLayerId, generateMapId, generateTimesliderId, getCapabilities, getLegendGraphicURLForLayer, getMapImageStore, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, isDefined, legendImageStore, mockGetCapabilities, parseISO8601DateToDate, parseISO8601IntervalToDateInterval, registerWMJSMap, registerWMLayer, tilesettings, toArray, unRegisterAllWMJSLayersAndMaps, unRegisterWMJSLayer, unRegisterWMJSMap, testSettings as webmapTestSettings, utils as webmapUtils };