text: // moment.js
  // version : 2.18.1
  // authors : Tim Wood, Iskren Chernev, Moment.js contributors
  // license : MIT
  // momentjs.com
  import './units/index';
  import { formatFunctions, makeFormatFunction } from './format/format';
  import { getLocale } from './locale/locales';
  import { isDateValid } from './utils/type-checks';
  export function formatDate(date, format, locale, isUTC, offset = 0) {
      const _locale = getLocale(locale || 'en');
      if (!_locale) {
          throw new Error(`Locale "${locale}" is not defined, please add it with "defineLocale(...)"`);
      }
      const _format = format || (isUTC ? 'YYYY-MM-DDTHH:mm:ss[Z]' : 'YYYY-MM-DDTHH:mm:ssZ');
      const output = formatMoment(date, _format, _locale, isUTC, offset);
      if (!output) {
          return output;
      }
      return _locale.postformat(output);
  }
  // format date using native date object
  export function formatMoment(date, _format, locale, isUTC, offset = 0) {
      if (!isDateValid(date)) {
          return locale.invalidDate;
      }
      const format = expandFormat(_format, locale);
      formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
      return formatFunctions[format](date, locale, isUTC, offset);
  }
  export function expandFormat(_format, locale) {
      let format = _format;
      let i = 5;
      const localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
      const replaceLongDateFormatTokens = (input) => {
          return locale.formatLongDate(input) || input;
      };
      localFormattingTokens.lastIndex = 0;
      while (i >= 0 && localFormattingTokens.test(format)) {
          format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
          localFormattingTokens.lastIndex = 0;
          i -= 1;
      }
      return format;
  }
  //# sourceMappingURL=format.js.map