import { z } from "zod";
import "./orgDomains-eTg-cjth.js";
import dayjs from "dayjs";
const yyyymmdd = (date) => date instanceof Date ? dayjs(date).format("YYYY-MM-DD") : date.format("YYYY-MM-DD");
const isSupportedTimeZone = (timeZone) => {
  try {
    dayjs().tz(timeZone);
    return true;
  } catch (error) {
    return false;
  }
};
const getTimeZone = (date) => date["$x"]["$timezone"];
function getUTCOffsetByTimezone(timeZone, date) {
  if (!timeZone)
    return null;
  return dayjs(date).tz(timeZone).utcOffset();
}
const stringToDayjs = (val) => {
  const matches = val.match(/([+-]\d{2}:\d{2})$/);
  const timezone = matches ? matches[1] : "+00:00";
  return dayjs(val).utcOffset(timezone);
};
const stringToDayjsZod = z.string().transform(stringToDayjs);
export {
  getTimeZone as a,
  stringToDayjsZod as b,
  getUTCOffsetByTimezone as g,
  isSupportedTimeZone as i,
  stringToDayjs as s,
  yyyymmdd as y
};
