import { SYSTEM_TIMEZONE_FORMATTER as f, REGEX_TZ_OFFSET as c } from "./constants.js";
import { EMPTY_ARRAY as T } from "../../../../utils/value/constants.js";
import { mod as i } from "../../../../utils/value/number.js";
const a = /\+(?=-)|([+-]00:00)/g, p = /(^\D?)(\d)$/, E = ([t, e]) => (Math.abs(t * 60) + e) * (t < 0 ? -1 : 1), O = (t) => Object.freeze([
  Math.floor(t / 60),
  // offset hours
  i(t, 60)
  // offset minutes
]), S = (t) => parseInt(t, 10) || 0, z = (t) => `GMT+${O(t).map((s) => `${s}`.replace(p, "$10$2")).join(":")}`.replace(a, ""), m = (t) => {
  const e = t?.match(c)?.[0].replace("GMT", "").split(":", 2).map(S) ?? T;
  return E(e.concat(0, 0).slice(0, 2));
}, G = (t, e = f) => {
  const o = new Date(t), s = m(f?.format(o));
  return m(e?.format(o)) - s;
}, r = (t, e, o = 1) => {
  const { offset: s, timestamp: n } = t(e);
  return n - s * o * 6e4;
}, R = (t, e) => r(t, e, 1), g = (t, e) => r(t, e, -1);
export {
  E as computeTimezoneOffsetInMinutes,
  O as computeTimezoneOffsetsFromMinutes,
  z as getGMTSuffixForTimezoneOffset,
  G as getTimezoneOffsetForTimestamp,
  m as getTimezoneOffsetFromFormattedDateString,
  S as parseTimezoneOffset,
  R as systemToTimezone,
  g as timezoneToSystem
};
