"use strict";

exports.__esModule = true;
exports.timeZonesList = exports.getTimeZoneName = exports.getTimeZoneByName = exports.getTimeZone = exports.convertTimeToOtherTimeZone = exports.convertTimeToLocalTimeZone = void 0;
var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var getTimeZone = exports.getTimeZone = function getTimeZone() {
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
};
var getTimeZoneByName = exports.getTimeZoneByName = function getTimeZoneByName(name) {
  for (var _iterator = _createForOfIteratorHelperLoose(timeZonesList.entries()), _step; !(_step = _iterator()).done;) {
    var _ref = _step.value;
    var _ref2 = _slicedToArray(_ref, 2);
    var key = _ref2[0];
    var value = _ref2[1];
    if (value === name) return key;
  }
  return getTimeZone();
};
var getTimeZoneName = exports.getTimeZoneName = function getTimeZoneName() {
  var customerTimezone = getTimeZone();
  var timezoneName = timeZonesList.get(customerTimezone);
  return timezoneName;
};

//converting time from other timezone to local
var convertTimeToLocalTimeZone = exports.convertTimeToLocalTimeZone = function convertTimeToLocalTimeZone(date, timezone) {
  var dateWithoutZone = _momentTimezone.default.tz(date, timezone).format("YYYY-MM-DDTHH:mm:ss.SSS");
  var localZone = (0, _momentTimezone.default)(dateWithoutZone).format("Z");
  var dateWithLocalZone = [dateWithoutZone, localZone].join("");
  return new Date(dateWithLocalZone);
};

//converting time from local timezone to other
var convertTimeToOtherTimeZone = exports.convertTimeToOtherTimeZone = function convertTimeToOtherTimeZone(date, timezone) {
  var dateWithoutZone = (0, _momentTimezone.default)(date).format("YYYY-MM-DDTHH:mm:ss.SSS");
  var otherZone = _momentTimezone.default.tz(date, timezone).format("Z");
  var dateWithOtherZone = [dateWithoutZone, otherZone].join("");
  return new Date(dateWithOtherZone);
};
var timeZonesList = exports.timeZonesList = new Map([["Africa/Bangui", "W. Central Africa Standard Time"], ["Africa/Cairo", "Egypt Standard Time"], ["Africa/Casablanca", "Morocco Standard Time"], ["Africa/Harare", "South Africa Standard Time"], ["Africa/Johannesburg", "South Africa Standard Time"], ["Africa/Lagos", "W. Central Africa Standard Time"], ["Africa/Monrovia", "Greenwich Standard Time"], ["Africa/Nairobi", "E. Africa Standard Time"], ["Africa/Windhoek", "Namibia Standard Time"], ["America/Anchorage", "Alaskan Standard Time"], ["America/Argentina/San_Juan", "Argentina Standard Time"], ["America/Asuncion", "Paraguay Standard Time"], ["America/Bahia", "Bahia Standard Time"], ["America/Bogota", "SA Pacific Standard Time"], ["America/Buenos_Aires", "Argentina Standard Time"], ["America/Caracas", "Venezuela Standard Time"], ["America/Cayenne", "SA Eastern Standard Time"], ["America/Chicago", "Central Standard Time"], ["America/Chihuahua", "Mountain Standard Time (Mexico)"], ["America/Cuiaba", "Central Brazilian Standard Time"], ["America/Denver", "Mountain Standard Time"], ["America/Fortaleza", "SA Eastern Standard Time"], ["America/Godthab", "Greenland Standard Time"], ["America/Guatemala", "Central America Standard Time"], ["America/Halifax", "Atlantic Standard Time"], ["America/Indianapolis", "US Eastern Standard Time"], ["America/Indiana/Indianapolis", "US Eastern Standard Time"], ["America/La_Paz", "SA Western Standard Time"], ["America/Los_Angeles", "Pacific Standard Time"], ["America/Mexico_City", "Mexico Standard Time"], ["America/Montevideo", "Montevideo Standard Time"], ["America/New_York", "Eastern Standard Time"], ["America/Noronha", "UTC-02"], ["America/Phoenix", "US Mountain Standard Time"], ["America/Regina", "Canada Central Standard Time"], ["America/Santa_Isabel", "Pacific Standard Time (Mexico)"], ["America/Santiago", "Pacific SA Standard Time"], ["America/Sao_Paulo", "E. South America Standard Time"], ["America/St_Johns", "Newfoundland Standard Time"], ["America/Tijuana", "Pacific Standard Time"], ["Antarctica/McMurdo", "New Zealand Standard Time"], ["Atlantic/South_Georgia", "UTC-02"], ["Asia/Almaty", "Central Asia Standard Time"], ["Asia/Amman", "Jordan Standard Time"], ["Asia/Baghdad", "Arabic Standard Time"], ["Asia/Baku", "Azerbaijan Standard Time"], ["Asia/Bangkok", "SE Asia Standard Time"], ["Asia/Beirut", "Middle East Standard Time"], ["Asia/Calcutta", "India Standard Time"], ["Asia/Colombo", "Sri Lanka Standard Time"], ["Asia/Damascus", "Syria Standard Time"], ["Asia/Dhaka", "Bangladesh Standard Time"], ["Asia/Dubai", "Arabian Standard Time"], ["Asia/Irkutsk", "North Asia East Standard Time"], ["Asia/Jerusalem", "Israel Standard Time"], ["Asia/Kabul", "Afghanistan Standard Time"], ["Asia/Kamchatka", "Kamchatka Standard Time"], ["Asia/Karachi", "Pakistan Standard Time"], ["Asia/Katmandu", "Nepal Standard Time"], ["Asia/Kolkata", "India Standard Time"], ["Asia/Krasnoyarsk", "North Asia Standard Time"], ["Asia/Kuala_Lumpur", "Singapore Standard Time"], ["Asia/Kuwait", "Arab Standard Time"], ["Asia/Magadan", "Magadan Standard Time"], ["Asia/Muscat", "Arabian Standard Time"], ["Asia/Novosibirsk", "N. Central Asia Standard Time"], ["Asia/Oral", "West Asia Standard Time"], ["Asia/Rangoon", "Myanmar Standard Time"], ["Asia/Riyadh", "Arab Standard Time"], ["Asia/Seoul", "Korea Standard Time"], ["Asia/Shanghai", "China Standard Time"], ["Asia/Singapore", "Singapore Standard Time"], ["Asia/Taipei", "Taipei Standard Time"], ["Asia/Tashkent", "West Asia Standard Time"], ["Asia/Tbilisi", "Georgian Standard Time"], ["Asia/Tehran", "Iran Standard Time"], ["Asia/Tokyo", "Tokyo Standard Time"], ["Asia/Ulaanbaatar", "Ulaanbaatar Standard Time"], ["Asia/Vladivostok", "Vladivostok Standard Time"], ["Asia/Yakutsk", "Yakutsk Standard Time"], ["Asia/Yekaterinburg", "Ekaterinburg Standard Time"], ["Asia/Yerevan", "Armenian Standard Time"], ["Atlantic/Azores", "Azores Standard Time"], ["Atlantic/Cape_Verde", "Cape Verde Standard Time"], ["Atlantic/Reykjavik", "Greenwich Standard Time"], ["Australia/Adelaide", "Cen. Australia Standard Time"], ["Australia/Brisbane", "E. Australia Standard Time"], ["Australia/Darwin", "AUS Central Standard Time"], ["Australia/Hobart", "Tasmania Standard Time"], ["Australia/Perth", "W. Australia Standard Time"], ["Australia/Sydney", "AUS Eastern Standard Time"], ["UTC", "UTC"], ["Etc/GMT+11", "UTC-11"], ["Etc/GMT+12", "Dateline Standard Time"], ["Etc/GMT+2", "UTC-02"], ["Etc/GMT-12", "UTC+12"], ["Europe/Amsterdam", "W. Europe Standard Time"], ["Europe/Athens", "GTB Standard Time"], ["Europe/Belgrade", "Central Europe Standard Time"], ["Europe/Berlin", "W. Europe Standard Time"], ["Europe/Brussels", "Romance Standard Time"], ["Europe/Budapest", "Central Europe Standard Time"], ["Europe/Dublin", "GMT Standard Time"], ["Europe/Helsinki", "FLE Standard Time"], ["Europe/Istanbul", "GTB Standard Time"], ["Europe/Kiev", "FLE Standard Time"], ["Europe/London", "GMT Standard Time"], ["Europe/Minsk", "E. Europe Standard Time"], ["Europe/Moscow", "Russian Standard Time"], ["Europe/Paris", "Romance Standard Time"], ["Europe/Sarajevo", "Central European Standard Time"], ["Europe/Warsaw", "Central European Standard Time"], ["Indian/Mauritius", "Mauritius Standard Time"], ["Pacific/Apia", "Samoa Standard Time"], ["Pacific/Auckland", "New Zealand Standard Time"], ["Pacific/Fiji", "Fiji Standard Time"], ["Pacific/Guadalcanal", "Central Pacific Standard Time"], ["Pacific/Guam", "West Pacific Standard Time"], ["Pacific/Honolulu", "Hawaiian Standard Time"], ["Pacific/Pago_Pago", "UTC-11"], ["Pacific/Port_Moresby", "West Pacific Standard Time"], ["Pacific/Tongatapu", "Tonga Standard Time"]]);
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(getTimeZone, "getTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(getTimeZoneByName, "getTimeZoneByName", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(getTimeZoneName, "getTimeZoneName", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(convertTimeToLocalTimeZone, "convertTimeToLocalTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(convertTimeToOtherTimeZone, "convertTimeToOtherTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(timeZonesList, "timeZonesList", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(getTimeZone, "getTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(getTimeZoneByName, "getTimeZoneByName", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(getTimeZoneName, "getTimeZoneName", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(convertTimeToLocalTimeZone, "convertTimeToLocalTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(convertTimeToOtherTimeZone, "convertTimeToOtherTimeZone", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
  reactHotLoader.register(timeZonesList, "timeZonesList", "/home/vsts/work/1/s/src/utils/timezoneHelper.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();