'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = formatDistance;
var formatDistanceLocale = {
  lessThanXSeconds: {
    one: "menys d'un segon",
    other: 'menys de {{count}} segons'
  },

  xSeconds: {
    one: '1 segon',
    other: '{{count}} segons'
  },

  halfAMinute: 'mig minut',

  lessThanXMinutes: {
    one: "menys d'un minut",
    other: 'menys de {{count}} minuts'
  },

  xMinutes: {
    one: '1 minut',
    other: '{{count}} minuts'
  },

  aboutXHours: {
    one: 'aproximadament una hora',
    other: 'aproximadament {{count}} hores'
  },

  xHours: {
    one: '1 hora',
    other: '{{count}} hores'
  },

  xDays: {
    one: '1 dia',
    other: '{{count}} dies'
  },

  aboutXMonths: {
    one: 'aproximadament un mes',
    other: 'aproximadament {{count}} mesos'
  },

  xMonths: {
    one: '1 mes',
    other: '{{count}} mesos'
  },

  aboutXYears: {
    one: 'aproximadament un any',
    other: 'aproximadament {{count}} anys'
  },

  xYears: {
    one: '1 any',
    other: '{{count}} anys'
  },

  overXYears: {
    one: "més d'un any",
    other: 'més de {{count}} anys'
  },

  almostXYears: {
    one: 'gairebé un any',
    other: 'gairebé {{count}} anys'
  }
};

function formatDistance(token, count, options) {
  options = options || {};

  var result;
  if (typeof formatDistanceLocale[token] === 'string') {
    result = formatDistanceLocale[token];
  } else if (count === 1) {
    result = formatDistanceLocale[token].one;
  } else {
    result = formatDistanceLocale[token].other.replace('{{count}}', count);
  }

  if (options.addSuffix) {
    if (options.comparison > 0) {
      return 'en ' + result;
    } else {
      return 'fa ' + result;
    }
  }

  return result;
}
module.exports = exports['default'];