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AAQtQ,IAAIoM,KAAK,sBACpCyE,EAAO,GAAGG,iBAAiB,SAAS,SAASC,GACzCA,EAAMC,iBACqD,KAAvDV,OAAOW,0BAA0BC,mBACjCjB,OAAOkB,IAAIb,OAAOW,0BAA0BG,QAAS,CAAC,OAAS,cAAe,WAAcR,IAC3FhK,MAAK,SAAAyK,GACF,IAAIC,EAAOrO,KAAKC,MAAMoN,OAAOiB,aAAaC,QAAQnB,IAC7CiB,IACDA,EAAO,CAACG,SAAU,KAEtB,IAAMA,EAAWC,EAAIJ,EAAKG,UAAUjL,OAAO,IAAI6G,EAAQgE,EAASM,UAChEL,EAAKG,SAAWA,EAChBnB,OAAOiB,aAAaK,QAAQvB,EAAWpN,KAAK4O,UAAUP,IACtDhB,OAAOwB,SAAWxB,OAAOW,0BAA0Bc,KAAKC,QAC5D,IAEA/B,OAAOkB,IAAIb,OAAOW,0BAA0BG,QAAS,CAAC,OAAW,cAAe,WAAeR,IAC/F,SAAS9J,EAAM9D,GACXsN,OAAOwB,SAAWxB,OAAOW,0BAA0Bc,KAAKC,QAS5D,GAAG,QAAQC,MAAK,SAAS7O,GACrB8O,QAAQC,IAAI/O,GACZyN,EAAM,GAAGuB,UAAa,8DACtBvB,EAAM,GAAGuB,UAAa,MAAQhP,EAAMiP,aAAaC,QAAU,OAC3DhC,OAAOiC,YAAW,WACd1B,EAAM,GAAGuB,UAAc,EAC3B,GAAG,IACP,GAIR,GACJ,EA1CStS,EAAI,EAAGA,EAAIsQ,EAAQvQ,OAAQC,IAAG4Q,GA2C3C,G","sources":["webpack://shop-page/./node_modules/dinero.js/build/esm/dinero.js","webpack://shop-page/./node_modules/@drivescout/drivescout-vue/src/assets/js/Product.js","webpack://shop-page/./node_modules/@drivescout/drivescout-vue/src/assets/js/Teller.js","webpack://shop-page/./js/checkout_buttons.js"],"sourcesContent":["/**\n * Default values for all Dinero objects.\n *\n * You can override default values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.\n * Existing instances won't be affected.\n *\n * @property {Number} defaultAmount - The default amount for new Dinero objects (see {@link module:Dinero Dinero} for format).\n * @property {String} defaultCurrency - The default currency for new Dinero objects (see {@link module:Dinero Dinero} for format).\n * @property {Number} defaultPrecision - The default precision for new Dinero objects (see {@link module:Dinero Dinero} for format).\n *\n * @example\n * // Will set currency to 'EUR' for all Dinero objects.\n * Dinero.defaultCurrency = 'EUR'\n *\n * @type {Object}\n */\nvar Defaults = {\n defaultAmount: 0,\n defaultCurrency: 'USD',\n defaultPrecision: 2\n};\n/**\n * Global settings for all Dinero objects.\n *\n * You can override global values for all subsequent Dinero objects by changing them directly on the global `Dinero` object.\n * Existing instances won't be affected.\n *\n * @property {String} globalLocale - The global locale for new Dinero objects (see {@link module:Dinero~setLocale setLocale} for format).\n * @property {String} globalFormat - The global format for new Dinero objects (see {@link module:Dinero~toFormat toFormat} for format).\n * @property {String} globalRoundingMode - The global rounding mode for new Dinero objects (see {@link module:Dinero~multiply multiply} or {@link module:Dinero~divide divide} for format).\n * @property {String} globalFormatRoundingMode - The global rounding mode to format new Dinero objects (see {@link module:Dinero~toFormat toFormat} or {@link module:Dinero~toRoundedUnit toRoundedUnit} for format).\n * @property {(String|Promise)} globalExchangeRatesApi.endpoint - The global exchange rate API endpoint for new Dinero objects, or the global promise that resolves to the exchanges rates (see {@link module:Dinero~convert convert} for format).\n * @property {String} globalExchangeRatesApi.propertyPath - The global exchange rate API property path for new Dinero objects (see {@link module:Dinero~convert convert} for format).\n * @property {Object} globalExchangeRatesApi.headers - The global exchange rate API headers for new Dinero objects (see {@link module:Dinero~convert convert} for format).\n *\n * @example\n * // Will set locale to 'fr-FR' for all Dinero objects.\n * Dinero.globalLocale = 'fr-FR'\n * @example\n * // Will set global exchange rate API parameters for all Dinero objects.\n * Dinero.globalExchangeRatesApi = {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',\n * propertyPath: 'data.rates.{{to}}',\n * headers: {\n * 'user-key': 'xxxxxxxxx'\n * }\n * }\n *\n * @type {Object}\n */\n\nvar Globals = {\n globalLocale: 'en-US',\n globalFormat: '$0,0.00',\n globalRoundingMode: 'HALF_EVEN',\n globalFormatRoundingMode: 'HALF_AWAY_FROM_ZERO',\n globalExchangeRatesApi: {\n endpoint: undefined,\n headers: undefined,\n propertyPath: undefined\n }\n};\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _toArray(arr) {\n return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n}\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\n/**\n * Static methods for Dinero.\n * @ignore\n *\n * @type {Object}\n */\nvar Static = {\n /**\n * Returns an array of Dinero objects, normalized to the same precision (the highest).\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns an array of Dinero objects\n * // both with a precision of 3\n * // and an amount of 1000\n * Dinero.normalizePrecision([\n * Dinero({ amount: 100, precision: 2 }),\n * Dinero({ amount: 1000, precision: 3 })\n * ])\n *\n * @return {Dinero[]}\n */\n normalizePrecision: function normalizePrecision(objects) {\n var highestPrecision = objects.reduce(function (a, b) {\n return Math.max(a.getPrecision(), b.getPrecision());\n });\n return objects.map(function (object) {\n return object.getPrecision() !== highestPrecision ? object.convertPrecision(highestPrecision) : object;\n });\n },\n\n /**\n * Returns the smallest Dinero object from an array of Dinero objects\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns the smallest Dinero object with amount of 500 from an array of Dinero objects with different precisions\n * Dinero.minimum([\n * Dinero({ amount: 500, precision: 3 }),\n * Dinero({ amount: 100, precision: 2 })\n * ])\n * @example\n * // returns the smallest Dinero object with amount of 50 from an array of Dinero objects\n * Dinero.minimum([\n * Dinero({ amount: 50 }),\n * Dinero({ amount: 100 })\n * ])\n *\n * @return {Dinero[]}\n */\n minimum: function minimum(objects) {\n var _objects = _toArray(objects),\n firstObject = _objects[0],\n tailObjects = _objects.slice(1);\n\n var currentMinimum = firstObject;\n tailObjects.forEach(function (obj) {\n currentMinimum = currentMinimum.lessThan(obj) ? currentMinimum : obj;\n });\n return currentMinimum;\n },\n\n /**\n * Returns the biggest Dinero object from an array of Dinero objects\n *\n * @memberof module:Dinero\n * @method\n *\n * @param {Dinero[]} objects - An array of Dinero objects\n *\n * @example\n * // returns the biggest Dinero object with amount of 20, from an array of Dinero objects with different precisions\n * Dinero.maximum([\n * Dinero({ amount: 20, precision: 2 }),\n * Dinero({ amount: 150, precision: 3 })\n * ])\n * @example\n * // returns the biggest Dinero object with amount of 100, from an array of Dinero objects\n * Dinero.maximum([\n * Dinero({ amount: 100 }),\n * Dinero({ amount: 50 })\n * ])\n *\n * @return {Dinero[]}\n */\n maximum: function maximum(objects) {\n var _objects2 = _toArray(objects),\n firstObject = _objects2[0],\n tailObjects = _objects2.slice(1);\n\n var currentMaximum = firstObject;\n tailObjects.forEach(function (obj) {\n currentMaximum = currentMaximum.greaterThan(obj) ? currentMaximum : obj;\n });\n return currentMaximum;\n }\n};\n\n/**\n * Returns whether a value is numeric.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\nfunction isNumeric(value) {\n return !isNaN(parseInt(value)) && isFinite(value);\n}\n/**\n * Returns whether a value is a percentage.\n * @ignore\n *\n * @param {} percentage - The percentage to test.\n *\n * @return {Boolean}\n */\n\nfunction isPercentage(percentage) {\n return isNumeric(percentage) && percentage <= 100 && percentage >= 0;\n}\n/**\n * Returns whether an array of ratios is valid.\n * @ignore\n *\n * @param {} ratios - The ratios to test.\n *\n * @return {Boolean}\n */\n\nfunction areValidRatios(ratios) {\n return ratios.length > 0 && ratios.every(function (ratio) {\n return ratio >= 0;\n }) && ratios.some(function (ratio) {\n return ratio > 0;\n });\n}\n/**\n * Returns whether a value is even.\n * @ignore\n *\n * @param {Number} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isEven(value) {\n return value % 2 === 0;\n}\n/**\n * Returns whether a value is a float.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isFloat(value) {\n return isNumeric(value) && !Number.isInteger(value);\n}\n/**\n * Returns how many fraction digits a number has.\n * @ignore\n *\n * @param {Number} [number=0] - The number to test.\n *\n * @return {Number}\n */\n\nfunction countFractionDigits() {\n var number = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n var stringRepresentation = number.toString();\n\n if (stringRepresentation.indexOf('e-') > 0) {\n // It's too small for a normal string representation, e.g. 1e-7 instead of 0.00000001\n return parseInt(stringRepresentation.split('e-')[1]);\n } else {\n var fractionDigits = stringRepresentation.split('.')[1];\n return fractionDigits ? fractionDigits.length : 0;\n }\n}\n/**\n * Returns whether a number is half.\n * @ignore\n *\n * @param {Number} number - The number to test.\n *\n * @return {Number}\n */\n\nfunction isHalf(number) {\n return Math.abs(number) % 1 === 0.5;\n}\n/**\n * Fetches a JSON resource.\n * @ignore\n *\n * @param {String} url - The resource to fetch.\n * @param {Object} [options.headers] - The headers to pass.\n *\n * @throws {Error} If `request.status` is lesser than 200 or greater or equal to 400.\n * @throws {Error} If network fails.\n *\n * @return {JSON}\n */\n\nfunction getJSON(url) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return new Promise(function (resolve, reject) {\n var request = Object.assign(new XMLHttpRequest(), {\n onreadystatechange: function onreadystatechange() {\n if (request.readyState === 4) {\n if (request.status >= 200 && request.status < 400) resolve(JSON.parse(request.responseText));else reject(new Error(request.statusText));\n }\n },\n onerror: function onerror() {\n reject(new Error('Network error'));\n }\n });\n request.open('GET', url, true);\n setXHRHeaders(request, options.headers);\n request.send();\n });\n}\n/**\n * Returns an XHR object with attached headers.\n * @ignore\n *\n * @param {XMLHttpRequest} xhr - The XHR request to set headers to.\n * @param {Object} headers - The headers to set.\n *\n * @return {XMLHttpRequest}\n */\n\nfunction setXHRHeaders(xhr) {\n var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n for (var header in headers) {\n xhr.setRequestHeader(header, headers[header]);\n }\n\n return xhr;\n}\n/**\n * Returns whether a value is undefined.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isUndefined(value) {\n return typeof value === 'undefined';\n}\n/**\n * Returns an object flattened to one level deep.\n * @ignore\n *\n * @param {Object} object - The object to flatten.\n * @param {String} separator - The separator to use between flattened nodes.\n *\n * @return {Object}\n */\n\nfunction flattenObject(object) {\n var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';\n var finalObject = {};\n Object.entries(object).forEach(function (item) {\n if (_typeof(item[1]) === 'object') {\n var flatObject = flattenObject(item[1]);\n Object.entries(flatObject).forEach(function (node) {\n finalObject[item[0] + separator + node[0]] = node[1];\n });\n } else {\n finalObject[item[0]] = item[1];\n }\n });\n return finalObject;\n}\n/**\n * Returns whether a value is thenable.\n * @ignore\n *\n * @param {} value - The value to test.\n *\n * @return {Boolean}\n */\n\nfunction isThenable(value) {\n return Boolean(value) && (_typeof(value) === 'object' || typeof value === 'function') && typeof value.then === 'function';\n}\n\nfunction Calculator() {\n var floatMultiply = function floatMultiply(a, b) {\n var getFactor = function getFactor(number) {\n return Math.pow(10, countFractionDigits(number));\n };\n\n var factor = Math.max(getFactor(a), getFactor(b));\n return Math.round(a * factor) * Math.round(b * factor) / (factor * factor);\n };\n\n var roundingModes = {\n HALF_ODD: function HALF_ODD(number) {\n var rounded = Math.round(number);\n return isHalf(number) ? isEven(rounded) ? rounded - 1 : rounded : rounded;\n },\n HALF_EVEN: function HALF_EVEN(number) {\n var rounded = Math.round(number);\n return isHalf(number) ? isEven(rounded) ? rounded : rounded - 1 : rounded;\n },\n HALF_UP: function HALF_UP(number) {\n return Math.round(number);\n },\n HALF_DOWN: function HALF_DOWN(number) {\n return isHalf(number) ? Math.floor(number) : Math.round(number);\n },\n HALF_TOWARDS_ZERO: function HALF_TOWARDS_ZERO(number) {\n return isHalf(number) ? Math.sign(number) * Math.floor(Math.abs(number)) : Math.round(number);\n },\n HALF_AWAY_FROM_ZERO: function HALF_AWAY_FROM_ZERO(number) {\n return isHalf(number) ? Math.sign(number) * Math.ceil(Math.abs(number)) : Math.round(number);\n },\n DOWN: function DOWN(number) {\n return Math.floor(number);\n }\n };\n return {\n /**\n * Returns the sum of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to add.\n * @param {Number} b - The second number to add.\n *\n * @return {Number}\n */\n add: function add(a, b) {\n return a + b;\n },\n\n /**\n * Returns the difference of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to subtract.\n * @param {Number} b - The second number to subtract.\n *\n * @return {Number}\n */\n subtract: function subtract(a, b) {\n return a - b;\n },\n\n /**\n * Returns the product of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to multiply.\n * @param {Number} b - The second number to multiply.\n *\n * @return {Number}\n */\n multiply: function multiply(a, b) {\n return isFloat(a) || isFloat(b) ? floatMultiply(a, b) : a * b;\n },\n\n /**\n * Returns the quotient of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to divide.\n * @param {Number} b - The second number to divide.\n *\n * @return {Number}\n */\n divide: function divide(a, b) {\n return a / b;\n },\n\n /**\n * Returns the remainder of two numbers.\n * @ignore\n *\n * @param {Number} a - The first number to divide.\n * @param {Number} b - The second number to divide.\n *\n * @return {Number}\n */\n modulo: function modulo(a, b) {\n return a % b;\n },\n\n /**\n * Returns a rounded number based off a specific rounding mode.\n * @ignore\n *\n * @param {Number} number - The number to round.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use.\n *\n * @returns {Number}\n */\n round: function round(number) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'HALF_EVEN';\n return roundingModes[roundingMode](number);\n }\n };\n}\n\nvar calculator = Calculator();\nfunction Format(format) {\n var matches = /^(?:(\\$|USD)?0(?:(,)0)?(\\.)?(0+)?|0(?:(,)0)?(\\.)?(0+)?\\s?(dollar)?)$/gm.exec(format);\n return {\n /**\n * Returns the matches.\n * @ignore\n *\n * @return {Array}\n */\n getMatches: function getMatches() {\n return matches !== null ? matches.slice(1).filter(function (match) {\n return !isUndefined(match);\n }) : [];\n },\n\n /**\n * Returns the amount of fraction digits to display.\n * @ignore\n *\n * @return {Number}\n */\n getMinimumFractionDigits: function getMinimumFractionDigits() {\n var decimalPosition = function decimalPosition(match) {\n return match === '.';\n };\n\n return !isUndefined(this.getMatches().find(decimalPosition)) ? this.getMatches()[calculator.add(this.getMatches().findIndex(decimalPosition), 1)].split('').length : 0;\n },\n\n /**\n * Returns the currency display mode.\n * @ignore\n *\n * @return {String}\n */\n getCurrencyDisplay: function getCurrencyDisplay() {\n var modes = {\n USD: 'code',\n dollar: 'name',\n $: 'symbol'\n };\n return modes[this.getMatches().find(function (match) {\n return match === 'USD' || match === 'dollar' || match === '$';\n })];\n },\n\n /**\n * Returns the formatting style.\n * @ignore\n *\n * @return {String}\n */\n getStyle: function getStyle() {\n return !isUndefined(this.getCurrencyDisplay(this.getMatches())) ? 'currency' : 'decimal';\n },\n\n /**\n * Returns whether grouping should be used or not.\n * @ignore\n *\n * @return {Boolean}\n */\n getUseGrouping: function getUseGrouping() {\n return !isUndefined(this.getMatches().find(function (match) {\n return match === ',';\n }));\n }\n };\n}\n\nfunction CurrencyConverter(options) {\n /* istanbul ignore next */\n var mergeTags = function mergeTags() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var tags = arguments.length > 1 ? arguments[1] : undefined;\n\n for (var tag in tags) {\n string = string.replace(\"{{\".concat(tag, \"}}\"), tags[tag]);\n }\n\n return string;\n };\n /* istanbul ignore next */\n\n\n var getRatesFromRestApi = function getRatesFromRestApi(from, to) {\n return getJSON(mergeTags(options.endpoint, {\n from: from,\n to: to\n }), {\n headers: options.headers\n });\n };\n\n return {\n /**\n * Returns the exchange rate.\n * @ignore\n *\n * @param {String} from - The base currency.\n * @param {String} to - The destination currency.\n *\n * @return {Promise}\n */\n getExchangeRate: function getExchangeRate(from, to) {\n return (isThenable(options.endpoint) ? options.endpoint : getRatesFromRestApi(from, to)).then(function (data) {\n return flattenObject(data)[mergeTags(options.propertyPath, {\n from: from,\n to: to\n })];\n });\n }\n };\n}\n\n/**\n * Performs an assertion.\n * @ignore\n *\n * @param {Boolean} condition - The expression to assert.\n * @param {String} errorMessage - The message to throw if the assertion fails\n * @param {ErrorConstructor} [ErrorType=Error] - The error to throw if the assertion fails.\n *\n * @throws {Error} If `condition` returns `false`.\n */\n\nfunction assert(condition, errorMessage) {\n var ErrorType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Error;\n if (!condition) throw new ErrorType(errorMessage);\n}\n/**\n * Asserts a value is a percentage.\n * @ignore\n *\n * @param {} percentage - The percentage to test.\n *\n * @throws {RangeError} If `percentage` is out of range.\n */\n\nfunction assertPercentage(percentage) {\n assert(isPercentage(percentage), 'You must provide a numeric value between 0 and 100.', RangeError);\n}\n/**\n * Asserts an array of ratios is valid.\n * @ignore\n *\n * @param {} ratios - The ratios to test.\n *\n * @throws {TypeError} If `ratios` are invalid.\n */\n\nfunction assertValidRatios(ratios) {\n assert(areValidRatios(ratios), 'You must provide a non-empty array of numeric values greater than 0.', TypeError);\n}\n/**\n * Asserts a value is an integer.\n * @ignore\n *\n * @param {} number - The value to test.\n *\n * @throws {TypeError}\n */\n\nfunction assertInteger(number) {\n assert(Number.isInteger(number), 'You must provide an integer.', TypeError);\n}\n\nvar calculator$1 = Calculator();\n/**\n * A Dinero object is an immutable data structure representing a specific monetary value.\n * It comes with methods for creating, parsing, manipulating, testing, transforming and formatting them.\n *\n * A Dinero object has:\n *\n * * An `amount`, expressed in minor currency units, as an integer.\n * * A `currency`, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.\n * * A `precision`, expressed as an integer, to represent the number of decimal places in the `amount`.\n * This is helpful when you want to represent fractional minor currency units (e.g.: $10.4545).\n * You can also use it to represent a currency with a different [exponent](https://en.wikipedia.org/wiki/ISO_4217#Treatment_of_minor_currency_units_.28the_.22exponent.22.29) than `2` (e.g.: Iraqi dinar with 1000 fils in 1 dinar (exponent of `3`), Japanese yen with no sub-units (exponent of `0`)).\n * * An optional `locale` property that affects how output strings are formatted.\n *\n * Here's an overview of the public API:\n *\n * * **Access:** {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~getCurrency getCurrency}, {@link module:Dinero~getLocale getLocale} and {@link module:Dinero~getPrecision getPrecision}.\n * * **Manipulation:** {@link module:Dinero~add add}, {@link module:Dinero~subtract subtract}, {@link module:Dinero~multiply multiply}, {@link module:Dinero~divide divide}, {@link module:Dinero~percentage percentage}, {@link module:Dinero~allocate allocate} and {@link module:Dinero~convert convert}.\n * * **Testing:** {@link module:Dinero~equalsTo equalsTo}, {@link module:Dinero~lessThan lessThan}, {@link module:Dinero~lessThanOrEqual lessThanOrEqual}, {@link module:Dinero~greaterThan greaterThan}, {@link module:Dinero~greaterThanOrEqual greaterThanOrEqual}, {@link module:Dinero~isZero isZero}, {@link module:Dinero~isPositive isPositive}, {@link module:Dinero~isNegative isNegative}, {@link module:Dinero~hasSubUnits hasSubUnits}, {@link module:Dinero~hasSameCurrency hasSameCurrency} and {@link module:Dinero~hasSameAmount hasSameAmount}.\n * * **Configuration:** {@link module:Dinero~setLocale setLocale}.\n * * **Conversion & formatting:** {@link module:Dinero~toFormat toFormat}, {@link module:Dinero~toUnit toUnit}, {@link module:Dinero~toRoundedUnit toRoundedUnit}, {@link module:Dinero~toObject toObject}, {@link module:Dinero~toJSON toJSON}, {@link module:Dinero~convertPrecision convertPrecision} and {@link module:Dinero.normalizePrecision normalizePrecision}.\n *\n * Dinero.js uses `number`s under the hood, so it's constrained by the [double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format). Using values over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) will yield unpredictable results.\n * Same goes with performing calculations: once the internal `amount` value exceeds those limits, precision is no longer guaranteed.\n *\n * @module Dinero\n * @param {Number} [options.amount=0] - The amount in minor currency units (as an integer).\n * @param {String} [options.currency='USD'] - An ISO 4217 currency code.\n * @param {String} [options.precision=2] - The number of decimal places to represent.\n *\n * @throws {TypeError} If `amount` or `precision` is invalid. Integers over [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MAX_SAFE_INTEGER) or below [`Number.MIN_SAFE_INTEGER`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/MIN_SAFE_INTEGER) are considered valid, even though they can lead to imprecise amounts.\n *\n * @return {Object}\n */\n\nvar Dinero = function Dinero(options) {\n var _Object$assign = Object.assign({}, {\n amount: Dinero.defaultAmount,\n currency: Dinero.defaultCurrency,\n precision: Dinero.defaultPrecision\n }, options),\n amount = _Object$assign.amount,\n currency = _Object$assign.currency,\n precision = _Object$assign.precision;\n\n assertInteger(amount);\n assertInteger(precision);\n var globalLocale = Dinero.globalLocale,\n globalFormat = Dinero.globalFormat,\n globalRoundingMode = Dinero.globalRoundingMode,\n globalFormatRoundingMode = Dinero.globalFormatRoundingMode;\n var globalExchangeRatesApi = Object.assign({}, Dinero.globalExchangeRatesApi);\n /**\n * Uses ES5 function notation so `this` can be passed through call, apply and bind\n * @ignore\n */\n\n var create = function create(options) {\n var obj = Object.assign({}, Object.assign({}, {\n amount: amount,\n currency: currency,\n precision: precision\n }, options), Object.assign({}, {\n locale: this.locale\n }, options));\n return Object.assign(Dinero({\n amount: obj.amount,\n currency: obj.currency,\n precision: obj.precision\n }), {\n locale: obj.locale\n });\n };\n /**\n * Uses ES5 function notation so `this` can be passed through call, apply and bind\n * @ignore\n */\n\n\n var assertSameCurrency = function assertSameCurrency(comparator) {\n assert(this.hasSameCurrency(comparator), 'You must provide a Dinero instance with the same currency.', TypeError);\n };\n\n return {\n /**\n * Returns the amount.\n *\n * @example\n * // returns 500\n * Dinero({ amount: 500 }).getAmount()\n *\n * @return {Number}\n */\n getAmount: function getAmount() {\n return amount;\n },\n\n /**\n * Returns the currency.\n *\n * @example\n * // returns 'EUR'\n * Dinero({ currency: 'EUR' }).getCurrency()\n *\n * @return {String}\n */\n getCurrency: function getCurrency() {\n return currency;\n },\n\n /**\n * Returns the locale.\n *\n * @example\n * // returns 'fr-FR'\n * Dinero().setLocale('fr-FR').getLocale()\n *\n * @return {String}\n */\n getLocale: function getLocale() {\n return this.locale || globalLocale;\n },\n\n /**\n * Returns a new Dinero object with an embedded locale.\n *\n * @param {String} newLocale - The new locale as an {@link http://tools.ietf.org/html/rfc5646 BCP 47 language tag}.\n *\n * @example\n * // Returns a Dinero object with locale 'ja-JP'\n * Dinero().setLocale('ja-JP')\n *\n * @return {Dinero}\n */\n setLocale: function setLocale(newLocale) {\n return create.call(this, {\n locale: newLocale\n });\n },\n\n /**\n * Returns the precision.\n *\n * @example\n * // returns 3\n * Dinero({ precision: 3 }).getPrecision()\n *\n * @return {Number}\n */\n getPrecision: function getPrecision() {\n return precision;\n },\n\n /**\n * Returns a new Dinero object with a new precision and a converted amount.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n * This can be necessary when you need to convert objects to a smaller precision.\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent conversions for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {Number} newPrecision - The new precision.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // Returns a Dinero object with precision 3 and amount 1000\n * Dinero({ amount: 100, precision: 2 }).convertPrecision(3)\n *\n * @throws {TypeError} If `newPrecision` is invalid.\n *\n * @return {Dinero}\n */\n convertPrecision: function convertPrecision(newPrecision) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n assertInteger(newPrecision);\n var precision = this.getPrecision();\n var isNewPrecisionLarger = newPrecision > precision;\n var operation = isNewPrecisionLarger ? calculator$1.multiply : calculator$1.divide;\n var terms = isNewPrecisionLarger ? [newPrecision, precision] : [precision, newPrecision];\n var factor = Math.pow(10, calculator$1.subtract.apply(calculator$1, terms));\n return create.call(this, {\n amount: calculator$1.round(operation(this.getAmount(), factor), roundingMode),\n precision: newPrecision\n });\n },\n\n /**\n * Returns a new Dinero object that represents the sum of this and an other Dinero object.\n *\n * If Dinero objects have a different `precision`, they will be first converted to the highest.\n *\n * @param {Dinero} addend - The Dinero object to add.\n *\n * @example\n * // returns a Dinero object with amount 600\n * Dinero({ amount: 400 }).add(Dinero({ amount: 200 }))\n * @example\n * // returns a Dinero object with amount 144545 and precision 4\n * Dinero({ amount: 400 }).add(Dinero({ amount: 104545, precision: 4 }))\n *\n * @throws {TypeError} If `addend` has a different currency.\n *\n * @return {Dinero}\n */\n add: function add(addend) {\n assertSameCurrency.call(this, addend);\n var addends = Dinero.normalizePrecision([this, addend]);\n return create.call(this, {\n amount: calculator$1.add(addends[0].getAmount(), addends[1].getAmount()),\n precision: addends[0].getPrecision()\n });\n },\n\n /**\n * Returns a new Dinero object that represents the difference of this and an other Dinero object.\n *\n * If Dinero objects have a different `precision`, they will be first converted to the highest.\n *\n * @param {Dinero} subtrahend - The Dinero object to subtract.\n *\n * @example\n * // returns a Dinero object with amount 200\n * Dinero({ amount: 400 }).subtract(Dinero({ amount: 200 }))\n * @example\n * // returns a Dinero object with amount 64545 and precision 4\n * Dinero({ amount: 104545, precision: 4 }).subtract(Dinero({ amount: 400 }))\n *\n * @throws {TypeError} If `subtrahend` has a different currency.\n *\n * @return {Dinero}\n */\n subtract: function subtract(subtrahend) {\n assertSameCurrency.call(this, subtrahend);\n var subtrahends = Dinero.normalizePrecision([this, subtrahend]);\n return create.call(this, {\n amount: calculator$1.subtract(subtrahends[0].getAmount(), subtrahends[1].getAmount()),\n precision: subtrahends[0].getPrecision()\n });\n },\n\n /**\n * Returns a new Dinero object that represents the multiplied value by the given factor.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {Number} multiplier - The factor to multiply by.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 1600\n * Dinero({ amount: 400 }).multiply(4)\n * @example\n * // returns a Dinero object with amount 800\n * Dinero({ amount: 400 }).multiply(2.001)\n * @example\n * // returns a Dinero object with amount 801\n * Dinero({ amount: 400 }).multiply(2.00125, 'HALF_UP')\n *\n * @return {Dinero}\n */\n multiply: function multiply(multiplier) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n return create.call(this, {\n amount: calculator$1.round(calculator$1.multiply(this.getAmount(), multiplier), roundingMode)\n });\n },\n\n /**\n * Returns a new Dinero object that represents the divided value by the given factor.\n *\n * By default, fractional minor currency units are rounded using the **half to even** rule ([banker's rounding](http://wiki.c2.com/?BankersRounding)).\n *\n * Rounding *can* lead to accuracy issues as you chain many times. Consider a minimal amount of subsequent calculations for safer results.\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.\n *\n * @param {Number} divisor - The factor to divide by.\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 100\n * Dinero({ amount: 400 }).divide(4)\n * @example\n * // returns a Dinero object with amount 52\n * Dinero({ amount: 105 }).divide(2)\n * @example\n * // returns a Dinero object with amount 53\n * Dinero({ amount: 105 }).divide(2, 'HALF_UP')\n *\n * @return {Dinero}\n */\n divide: function divide(divisor) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n return create.call(this, {\n amount: calculator$1.round(calculator$1.divide(this.getAmount(), divisor), roundingMode)\n });\n },\n\n /**\n * Returns a new Dinero object that represents a percentage of this.\n *\n * As rounding is applied, precision may be lost in the process. If you want to accurately split a Dinero object, use {@link module:Dinero~allocate allocate} instead.\n *\n * @param {Number} percentage - The percentage to extract (between 0 and 100).\n * @param {String} [roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns a Dinero object with amount 5000\n * Dinero({ amount: 10000 }).percentage(50)\n * @example\n * // returns a Dinero object with amount 29\n * Dinero({ amount: 57 }).percentage(50, \"HALF_ODD\")\n *\n * @throws {RangeError} If `percentage` is out of range.\n *\n * @return {Dinero}\n */\n percentage: function percentage(_percentage) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalRoundingMode;\n assertPercentage(_percentage);\n return this.multiply(calculator$1.divide(_percentage, 100), roundingMode);\n },\n\n /**\n * Allocates the amount of a Dinero object according to a list of ratios.\n *\n * Sometimes you need to split monetary values but percentages can't cut it without adding or losing pennies.\n * A good example is invoicing: let's say you need to bill $1,000.03 and you want a 50% downpayment.\n * If you use {@link module:Dinero~percentage percentage}, you'll get an accurate Dinero object but the amount won't be billable: you can't split a penny.\n * If you round it, you'll bill a penny extra.\n * With {@link module:Dinero~allocate allocate}, you can split a monetary amount then distribute the remainder as evenly as possible.\n *\n * You can use percentage style or ratio style for `ratios`: `[25, 75]` and `[1, 3]` will do the same thing.\n *\n * Since v1.8.0, you can use zero ratios (such as [0, 50, 50]). If there's a remainder to distribute, zero ratios are skipped and return a Dinero object with amount zero.\n *\n * @param {Number[]} ratios - The ratios to allocate the money to.\n *\n * @example\n * // returns an array of two Dinero objects\n * // the first one with an amount of 502\n * // the second one with an amount of 501\n * Dinero({ amount: 1003 }).allocate([50, 50])\n * @example\n * // returns an array of two Dinero objects\n * // the first one with an amount of 25\n * // the second one with an amount of 75\n * Dinero({ amount: 100 }).allocate([1, 3])\n * @example\n * // since version 1.8.0\n * // returns an array of three Dinero objects\n * // the first one with an amount of 0\n * // the second one with an amount of 502\n * // the third one with an amount of 501\n * Dinero({ amount: 1003 }).allocate([0, 50, 50])\n *\n * @throws {TypeError} If ratios are invalid.\n *\n * @return {Dinero[]}\n */\n allocate: function allocate(ratios) {\n var _this = this;\n\n assertValidRatios(ratios);\n var total = ratios.reduce(function (a, b) {\n return calculator$1.add(a, b);\n });\n var remainder = this.getAmount();\n var shares = ratios.map(function (ratio) {\n var share = Math.floor(calculator$1.divide(calculator$1.multiply(_this.getAmount(), ratio), total));\n remainder = calculator$1.subtract(remainder, share);\n return create.call(_this, {\n amount: share\n });\n });\n var i = 0;\n\n while (remainder > 0) {\n if (ratios[i] > 0) {\n shares[i] = shares[i].add(create.call(this, {\n amount: 1\n }));\n remainder = calculator$1.subtract(remainder, 1);\n }\n\n i += 1;\n }\n\n return shares;\n },\n\n /**\n * Returns a Promise containing a new Dinero object converted to another currency.\n *\n * You have two options to provide the exchange rates:\n *\n * 1. **Use an exchange rate REST API, and let Dinero handle the fetching and conversion.**\n * This is a simple option if you have access to an exchange rate REST API and want Dinero to do the rest.\n * 2. **Fetch the exchange rates on your own and provide them directly.**\n * This is useful if you're fetching your rates from somewhere else (a file, a database), use a different protocol or query language than REST (SOAP, GraphQL) or want to fetch rates once and cache them instead of making new requests every time.\n *\n * **If you want to use a REST API**, you must provide a third-party endpoint yourself. Dinero doesn't come bundled with an exchange rates endpoint.\n *\n * Here are some exchange rate APIs you can use:\n *\n * * [Fixer](https://fixer.io)\n * * [Open Exchange Rates](https://openexchangerates.org)\n * * [Coinbase](https://api.coinbase.com/v2/exchange-rates)\n * * More [foreign](https://github.com/toddmotto/public-apis#currency-exchange) and [crypto](https://github.com/toddmotto/public-apis#cryptocurrency) exchange rate APIs.\n *\n * **If you want to fetch your own rates and provide them directly**, you need to pass a promise that resolves to the exchanges rates.\n *\n * In both cases, you need to specify at least:\n *\n * * a **destination currency**: the currency in which you want to convert your Dinero object. You can specify it with `currency`.\n * * an **endpoint**: the API URL to query exchange rates, with parameters, or a promise that resolves to the exchange rates. You can specify it with `options.endpoint`.\n * * a **property path**: the path to access the wanted rate in your API's JSON response (or the custom promise's payload). For example, with a response of:\n * ```json\n * {\n * \"data\": {\n * \"base\": \"USD\",\n * \"destination\": \"EUR\",\n * \"rate\": \"0.827728919\"\n * }\n * }\n * ```\n * Then the property path is `'data.rate'`. You can specify it with `options.propertyPath`.\n *\n * The base currency (the one of your Dinero object) and the destination currency can be used as \"merge tags\" with the mustache syntax, respectively `{{from}}` and `{{to}}`.\n * You can use these tags to refer to these values in `options.endpoint` and `options.propertyPath`.\n *\n * For example, if you need to specify the base currency as a query parameter, you can do the following:\n *\n * ```js\n * {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}'\n * }\n * ```\n *\n * @param {String} currency - The destination currency, expressed as an {@link https://en.wikipedia.org/wiki/ISO_4217#Active_codes ISO 4217 currency code}.\n * @param {(String|Promise)} options.endpoint - The API endpoint to retrieve exchange rates. You can substitute this with a promise that resolves to the exchanges rates if you already have them.\n * @param {String} [options.propertyPath='rates.{{to}}'] - The property path to the rate.\n * @param {Object} [options.headers] - The HTTP headers to provide, if needed.\n * @param {String} [options.roundingMode='HALF_EVEN'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // your global API parameters\n * Dinero.globalExchangeRatesApi = { ... }\n *\n * // returns a Promise containing a Dinero object with the destination currency\n * // and the initial amount converted to the new currency.\n * Dinero({ amount: 500 }).convert('EUR')\n * @example\n * // returns a Promise containing a Dinero object,\n * // with specific API parameters and rounding mode for this specific instance.\n * Dinero({ amount: 500 })\n * .convert('XBT', {\n * endpoint: 'https://yourexchangerates.api/latest?base={{from}}',\n * propertyPath: 'data.rates.{{to}}',\n * headers: {\n * 'user-key': 'xxxxxxxxx'\n * },\n * roundingMode: 'HALF_UP'\n * })\n * @example\n * // usage with exchange rates provided as a custom promise\n * // using the default `propertyPath` format (so it doesn't have to be specified)\n * const rates = {\n * rates: {\n * EUR: 0.81162\n * }\n * }\n *\n * Dinero({ amount: 500 })\n * .convert('EUR', {\n * endpoint: new Promise(resolve => resolve(rates))\n * })\n * @example\n * // usage with Promise.prototype.then and Promise.prototype.catch\n * Dinero({ amount: 500 })\n * .convert('EUR')\n * .then(dinero => {\n * dinero.getCurrency() // returns 'EUR'\n * })\n * .catch(err => {\n * // handle errors\n * })\n * @example\n * // usage with async/await\n * (async () => {\n * const price = await Dinero({ amount: 500 }).convert('EUR')\n * price.getCurrency() // returns 'EUR'\n * })()\n *\n * @return {Promise}\n */\n convert: function convert(currency) {\n var _this2 = this;\n\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$endpoint = _ref.endpoint,\n endpoint = _ref$endpoint === void 0 ? globalExchangeRatesApi.endpoint : _ref$endpoint,\n _ref$propertyPath = _ref.propertyPath,\n propertyPath = _ref$propertyPath === void 0 ? globalExchangeRatesApi.propertyPath || 'rates.{{to}}' : _ref$propertyPath,\n _ref$headers = _ref.headers,\n headers = _ref$headers === void 0 ? globalExchangeRatesApi.headers : _ref$headers,\n _ref$roundingMode = _ref.roundingMode,\n roundingMode = _ref$roundingMode === void 0 ? globalRoundingMode : _ref$roundingMode;\n\n var options = Object.assign({}, {\n endpoint: endpoint,\n propertyPath: propertyPath,\n headers: headers,\n roundingMode: roundingMode\n });\n return CurrencyConverter(options).getExchangeRate(this.getCurrency(), currency).then(function (rate) {\n assert(!isUndefined(rate), \"No rate was found for the destination currency \\\"\".concat(currency, \"\\\".\"), TypeError);\n return create.call(_this2, {\n amount: calculator$1.round(calculator$1.multiply(_this2.getAmount(), parseFloat(rate)), options.roundingMode),\n currency: currency\n });\n });\n },\n\n /**\n * Checks whether the value represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'EUR' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 500, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 500, currency: 'USD' }).equalsTo(Dinero({ amount: 800, currency: 'EUR' }))\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).equalsTo(Dinero({ amount: 10000, currency: 'EUR', precision: 3 }))\n *\n * @return {Boolean}\n */\n equalsTo: function equalsTo(comparator) {\n return this.hasSameAmount(comparator) && this.hasSameCurrency(comparator);\n },\n\n /**\n * Checks whether the value represented by this object is less than the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThan(Dinero({ amount: 800 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 500 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThan(Dinero({ amount: 800 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThan(Dinero({ amount: 5000, precision: 3 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n lessThan: function lessThan(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() < comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is less than or equal to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 500 }).lessThanOrEqual(Dinero({ amount: 300 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 5000, precision: 3 }).lessThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 800 }).lessThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n lessThanOrEqual: function lessThanOrEqual(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() <= comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is greater than the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns false\n * Dinero({ amount: 500 }).greaterThan(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 500 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThan(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 5000, precision: 3 }).greaterThan(Dinero({ amount: 800 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n greaterThan: function greaterThan(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() > comparators[1].getAmount();\n },\n\n /**\n * Checks whether the value represented by this object is greater than or equal to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 300 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 500 }))\n * @example\n * // returns false\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 800 }))\n * @example\n * // returns true\n * Dinero({ amount: 800 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns true\n * Dinero({ amount: 500 }).greaterThanOrEqual(Dinero({ amount: 5000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 5000, precision: 3 }).greaterThanOrEqual(Dinero({ amount: 800 }))\n *\n * @throws {TypeError} If `comparator` has a different currency.\n *\n * @return {Boolean}\n */\n greaterThanOrEqual: function greaterThanOrEqual(comparator) {\n assertSameCurrency.call(this, comparator);\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() >= comparators[1].getAmount();\n },\n\n /**\n * Checks if the value represented by this object is zero.\n *\n * @example\n * // returns true\n * Dinero({ amount: 0 }).isZero()\n * @example\n * // returns false\n * Dinero({ amount: 100 }).isZero()\n *\n * @return {Boolean}\n */\n isZero: function isZero() {\n return this.getAmount() === 0;\n },\n\n /**\n * Checks if the value represented by this object is positive.\n *\n * @example\n * // returns false\n * Dinero({ amount: -10 }).isPositive()\n * @example\n * // returns true\n * Dinero({ amount: 10 }).isPositive()\n * @example\n * // returns true\n * Dinero({ amount: 0 }).isPositive()\n *\n * @return {Boolean}\n */\n isPositive: function isPositive() {\n return this.getAmount() >= 0;\n },\n\n /**\n * Checks if the value represented by this object is negative.\n *\n * @example\n * // returns true\n * Dinero({ amount: -10 }).isNegative()\n * @example\n * // returns false\n * Dinero({ amount: 10 }).isNegative()\n * @example\n * // returns false\n * Dinero({ amount: 0 }).isNegative()\n *\n * @return {Boolean}\n */\n isNegative: function isNegative() {\n return this.getAmount() < 0;\n },\n\n /**\n * Checks if this has minor currency units.\n * Deprecates {@link module:Dinero~hasCents hasCents}.\n *\n * @example\n * // returns false\n * Dinero({ amount: 1100 }).hasSubUnits()\n * @example\n * // returns true\n * Dinero({ amount: 1150 }).hasSubUnits()\n *\n * @return {Boolean}\n */\n hasSubUnits: function hasSubUnits() {\n return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;\n },\n\n /**\n * Checks if this has minor currency units.\n *\n * @deprecated since version 1.4.0, will be removed in 2.0.0\n * Use {@link module:Dinero~hasSubUnits hasSubUnits} instead.\n *\n * @example\n * // returns false\n * Dinero({ amount: 1100 }).hasCents()\n * @example\n * // returns true\n * Dinero({ amount: 1150 }).hasCents()\n *\n * @return {Boolean}\n */\n hasCents: function hasCents() {\n return calculator$1.modulo(this.getAmount(), Math.pow(10, precision)) !== 0;\n },\n\n /**\n * Checks whether the currency represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 2000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'EUR' }))\n * @example\n * // returns false\n * Dinero({ amount: 1000, currency: 'EUR' }).hasSameCurrency(Dinero({ amount: 1000, currency: 'USD' }))\n *\n * @return {Boolean}\n */\n hasSameCurrency: function hasSameCurrency(comparator) {\n return this.getCurrency() === comparator.getCurrency();\n },\n\n /**\n * Checks whether the amount represented by this object equals to the other.\n *\n * @param {Dinero} comparator - The Dinero object to compare to.\n *\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000 }))\n * @example\n * // returns false\n * Dinero({ amount: 2000, currency: 'EUR' }).hasSameAmount(Dinero({ amount: 1000, currency: 'EUR' }))\n * @example\n * // returns true\n * Dinero({ amount: 1000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))\n * @example\n * // returns false\n * Dinero({ amount: 10000, currency: 'EUR', precision: 2 }).hasSameAmount(Dinero({ amount: 10000, precision: 3 }))\n *\n * @return {Boolean}\n */\n hasSameAmount: function hasSameAmount(comparator) {\n var comparators = Dinero.normalizePrecision([this, comparator]);\n return comparators[0].getAmount() === comparators[1].getAmount();\n },\n\n /**\n * Returns this object formatted as a string.\n *\n * The format is a mask which defines how the output string will be formatted.\n * It defines whether to display a currency, in what format, how many fraction digits to display and whether to use grouping separators.\n * The output is formatted according to the applying locale.\n *\n * Object | Format | String\n * :--------------------------- | :---------------- | :---\n * `Dinero({ amount: 500050 })` | `'$0,0.00'` | $5,000.50\n * `Dinero({ amount: 500050 })` | `'$0,0'` | $5,001\n * `Dinero({ amount: 500050 })` | `'$0'` | $5001\n * `Dinero({ amount: 500050 })` | `'$0.0'` | $5000.5\n * `Dinero({ amount: 500050 })` | `'USD0,0.0'` | USD5,000.5\n * `Dinero({ amount: 500050 })` | `'0,0.0 dollar'` | 5,000.5 dollars\n *\n * Don't try to substitute the `$` sign or the `USD` code with your target currency, nor adapt the format string to the exact format you want.\n * The format is a mask which defines a pattern and returns a valid, localized currency string.\n * If you want to display the object in a custom way, either use {@link module:Dinero~getAmount getAmount}, {@link module:Dinero~toUnit toUnit} or {@link module:Dinero~toRoundedUnit toRoundedUnit} and manipulate the output string as you wish.\n *\n * {@link module:Dinero~toFormat toFormat} wraps around `Number.prototype.toLocaleString`. For that reason, **format will vary depending on how it's implemented in the end user's environment**.\n *\n * You can also use `toLocaleString` directly:\n * `Dinero().toRoundedUnit(digits, roundingMode).toLocaleString(locale, options)`.\n *\n * By default, amounts are rounded using the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @param {String} [format='$0,0.00'] - The format mask to format to.\n * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @example\n * // returns $2,000\n * Dinero({ amount: 200000 }).toFormat('$0,0')\n * @example\n * // returns €50.5\n * Dinero({ amount: 5050, currency: 'EUR' }).toFormat('$0,0.0')\n * @example\n * // returns 100 euros\n * Dinero({ amount: 10000, currency: 'EUR' }).setLocale('fr-FR').toFormat('0,0 dollar')\n * @example\n * // returns 2000\n * Dinero({ amount: 200000, currency: 'EUR' }).toFormat()\n * @example\n * // returns $10\n * Dinero({ amount: 1050 }).toFormat('$0', 'HALF_EVEN')\n *\n * @return {String}\n */\n toFormat: function toFormat() {\n var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : globalFormat;\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n var formatter = Format(format);\n return this.toRoundedUnit(formatter.getMinimumFractionDigits(), roundingMode).toLocaleString(this.getLocale(), {\n currencyDisplay: formatter.getCurrencyDisplay(),\n useGrouping: formatter.getUseGrouping(),\n minimumFractionDigits: formatter.getMinimumFractionDigits(),\n style: formatter.getStyle(),\n currency: this.getCurrency()\n });\n },\n\n /**\n * Returns the amount represented by this object in units.\n *\n * @example\n * // returns 10.5\n * Dinero({ amount: 1050 }).toUnit()\n * @example\n * // returns 10.545\n * Dinero({ amount: 10545, precision: 3 }).toUnit()\n *\n * @return {Number}\n */\n toUnit: function toUnit() {\n return calculator$1.divide(this.getAmount(), Math.pow(10, precision));\n },\n\n /**\n * Returns the amount represented by this object in rounded units.\n *\n * By default, the method uses the **half away from zero** rule ([commercial rounding](https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero)).\n * You can also specify a different `roundingMode` to better fit your needs.\n *\n * @example\n * // returns 10.6\n * Dinero({ amount: 1055 }).toRoundedUnit(1)\n * @example\n * // returns 10\n * Dinero({ amount: 1050 }).toRoundedUnit(0, 'HALF_EVEN')\n *\n * @param {Number} digits - The number of fraction digits to round to.\n * @param {String} [roundingMode='HALF_AWAY_FROM_ZERO'] - The rounding mode to use: `'HALF_ODD'`, `'HALF_EVEN'`, `'HALF_UP'`, `'HALF_DOWN'`, `'HALF_TOWARDS_ZERO'`, `'HALF_AWAY_FROM_ZERO'` or `'DOWN'`.\n *\n * @return {Number}\n */\n toRoundedUnit: function toRoundedUnit(digits) {\n var roundingMode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalFormatRoundingMode;\n var factor = Math.pow(10, digits);\n return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);\n },\n\n /**\n * Returns the object's data as an object literal.\n *\n * @example\n * // returns { amount: 500, currency: 'EUR', precision: 2 }\n * Dinero({ amount: 500, currency: 'EUR', precision: 2 }).toObject()\n *\n * @return {Object}\n */\n toObject: function toObject() {\n return {\n amount: amount,\n currency: currency,\n precision: precision\n };\n },\n\n /**\n * Returns the object's data as an object literal.\n *\n * Alias of {@link module:Dinero~toObject toObject}.\n * It is defined so that calling `JSON.stringify` on a Dinero object will automatically extract the relevant data.\n *\n * @example\n * // returns '{\"amount\":500,\"currency\":\"EUR\",\"precision\":2}'\n * JSON.stringify(Dinero({ amount: 500, currency: 'EUR', precision: 2 }))\n *\n * @return {Object}\n */\n toJSON: function toJSON() {\n return this.toObject();\n }\n };\n};\n\nvar dinero = Object.assign(Dinero, Defaults, Globals, Static);\n\nexport default dinero;\n","import {inDollars} from './Teller'\n\n\nclass Product {\n // $originalData: object;\n // $id: number;\n // $name: string;\n // $price: number;\n // $sku: string;\n // $created_at: any;\n // $updated_at: any;\n // $session_types: any[];\n // $purchase_instructions: string;\n // $services: any[];\n // $allow_partial_payment: boolean;\n // $deposit_required: boolean;\n // $deposit_type: string;\n // $deposit_amount: number;\n // $minimum_payment_amount: number;\n\n constructor(data) {\n this.$originalData = Object.assign({}, data);\n const {id, name, description, price, sku, created_at, updated_at, purchase_instructions, sessiontypes, coursetypes, allow_partial_payment, deposit_required, deposit_type,\n deposit_amount, minimum_payment_amount} = data;\n this.$id = id;\n this.$name = name;\n this.$description = description;\n this.$price = price;\n this.$sku = sku;\n this.$created_at = created_at;\n this.$updated_at = updated_at;\n this.$session_types = sessiontypes || [];\n this.$course_types = coursetypes || [];\n this.$purchase_instructions = purchase_instructions;\n this.$services = [];\n\n this.$allow_partial_payment = allow_partial_payment || false;\n this.$deposit_required = deposit_required || null;\n this.$deposit_type = deposit_type || null;\n this.$deposit_amount = deposit_amount || null;\n this.$minimum_payment_amount = minimum_payment_amount || null;\n }\n\n id() {\n return this.$id;\n }\n\n description(){\n return this.$description;\n }\n\n sessiontypes(){\n return this.$session_types;\n }\n\n coursetypes(){\n return this.$course_types;\n }\n\n name() {\n return this.$name;\n }\n\n price() {\n return this.$price;\n }\n\n priceInDollars(){\n return inDollars(this.price());\n }\n\n sku() {\n return this.$sku;\n }\n\n created_at() {\n return this.$created_at;\n }\n\n updated_at() {\n return this.$updated_at;\n }\n\n purchaseInstructions() {\n return this.$purchase_instructions;\n }\n\n services()\n {\n return this.$services;\n }\n\n setServices(services = [])\n {\n this.$services = services;\n }\n\n allowsPayLater()\n {\n return this.$allow_partial_payment\n }\n\n requiresDeposit()\n {\n return this.$deposit_required;\n }\n\n depositType()\n {\n return this.$deposit_type;\n }\n\n depositAmount()\n {\n return this.$deposit_amount;\n }\n\n minimumPaymentAmount()\n {\n return this.$minimum_payment_amount;\n }\n\n\n // calculateMinimumDepositRequired(amount:number)\n calculateMinimumDepositRequired(amount)\n {\n if (this.allowsPayLater() === false) {\n return amount;\n }\n\n if (this.requiresDeposit() === false) {\n return 0;\n }\n\n if (this.depositType() === 'fixed') {\n amount = this.depositAmount();\n }\n if (this.depositType() === 'percentage') {\n amount = Math.round(amount * (this.depositAmount() / 100));\n }\n\n return amount;\n }\n\n toJSON()\n {\n return this.$originalData;\n }\n\n}\n\nexport { Product }","import Dinero from 'dinero.js'\n\nconst inCents = function (dollars = 0) {\n const price = Dinero({ amount: dollars * 100, currency: 'USD' })\n return price.getAmount();\n}\n\nconst inDollars = function (cents = 0) {\n const price = Dinero({ amount: cents, currency: 'USD' })\n return price.toFormat('$0,0.00')\n}\n\nconst percentageOfXInCents = function (amount, percent) {\n return Dinero({ amount: amount, currency: 'USD' })\n .percentage(percent)\n .getAmount()\n}\n\nexport { inCents, inDollars, percentageOfXInCents }","import { Product } from '@drivescout/drivescout-vue/src/assets/js/Product.js'\r\njQuery(document).ready(function($){\r\n\r\n let buttons = $('.add-to-cart-wrapper');\r\n let cart_hash = 'drivescout-cart-' + window.drivescout_config.shop.info.id;\r\n\r\n for (let i = 0; i < buttons.length; i++) {\r\n let button = jQuery(buttons[i]).find('.add-to-cart');\r\n let product_id = button.data('product_id');\r\n let alert = jQuery(buttons[i]).find('.add-to-cart-alert');\r\n button[0].addEventListener('click', function(event){\r\n event.preventDefault();\r\n if (window.drivescout_buttons_config.cacheCompatibility == \"1\") {\r\n jQuery.get(window.drivescout_buttons_config.shopUrl, {'action':'get-product', 'product_id': product_id})\r\n .then(response => {\r\n let cart = JSON.parse(window.localStorage.getItem(cart_hash));\r\n if (!cart) {\r\n cart = {products: []}\r\n }\r\n const products = [...cart.products].concat(new Product(response.product));\r\n cart.products = products;\r\n window.localStorage.setItem(cart_hash, JSON.stringify(cart));\r\n window.location = window.drivescout_buttons_config.urls.checkout;\r\n })\r\n } else {\r\n jQuery.get(window.drivescout_buttons_config.shopUrl, {'action' : 'add-to-cart', 'product_id' : product_id},\r\n function(data, status){\r\n window.location = window.drivescout_buttons_config.urls.checkout;\r\n /*\r\n let html = '

' + data.message + '

';\r\n html += '

Checkout

';\r\n alert[0].innerHTML = html;\r\n window.setTimeout(function(){\r\n alert[0].innerHTML = '';\r\n }, 6000)\r\n */\r\n }, 'json').fail(function(Error){\r\n console.log(Error)\r\n alert[0].innerHTML = '

There was an error adding your product to your cart.

';\r\n alert[0].innerHTML = '

' + Error.resopnseJSON.message + '

';\r\n window.setTimeout(function(){\r\n alert[0].innerHTML = '';\r\n }, 6000)\r\n });\r\n }\r\n\r\n \r\n });\r\n }\r\n});"],"names":["Globals","globalLocale","globalFormat","globalRoundingMode","globalFormatRoundingMode","globalExchangeRatesApi","endpoint","undefined","headers","propertyPath","_typeof","obj","Symbol","iterator","constructor","prototype","_toArray","arr","Array","isArray","_arrayWithHoles","iter","Object","from","_iterableToArray","o","minLen","_arrayLikeToArray","n","toString","call","slice","name","test","_unsupportedIterableToArray","TypeError","_nonIterableRest","len","length","i","arr2","Static","normalizePrecision","objects","highestPrecision","reduce","a","b","Math","max","getPrecision","map","object","convertPrecision","minimum","_objects","firstObject","tailObjects","currentMinimum","forEach","lessThan","maximum","_objects2","currentMaximum","greaterThan","isNumeric","value","isNaN","parseInt","isFinite","isEven","isFloat","Number","isInteger","isHalf","number","abs","getJSON","url","options","arguments","Promise","resolve","reject","request","assign","XMLHttpRequest","onreadystatechange","readyState","status","JSON","parse","responseText","Error","statusText","onerror","open","xhr","header","setRequestHeader","setXHRHeaders","send","isUndefined","flattenObject","separator","finalObject","entries","item","flatObject","node","Calculator","floatMultiply","getFactor","pow","stringRepresentation","indexOf","split","fractionDigits","countFractionDigits","factor","round","roundingModes","HALF_ODD","rounded","HALF_EVEN","HALF_UP","HALF_DOWN","floor","HALF_TOWARDS_ZERO","sign","HALF_AWAY_FROM_ZERO","ceil","DOWN","add","subtract","multiply","divide","modulo","calculator","CurrencyConverter","mergeTags","string","tags","tag","replace","concat","getExchangeRate","to","Boolean","then","getRatesFromRestApi","data","assert","condition","errorMessage","ErrorType","assertPercentage","percentage","isPercentage","RangeError","assertInteger","calculator$1","Dinero","_Object$assign","amount","defaultAmount","currency","defaultCurrency","precision","defaultPrecision","create","locale","this","assertSameCurrency","comparator","hasSameCurrency","getAmount","getCurrency","getLocale","setLocale","newLocale","newPrecision","roundingMode","isNewPrecisionLarger","operation","terms","apply","addend","addends","subtrahend","subtrahends","multiplier","divisor","_percentage","allocate","ratios","_this","every","ratio","some","areValidRatios","assertValidRatios","total","remainder","shares","share","convert","_this2","_ref","_ref$endpoint","_ref$propertyPath","_ref$headers","_ref$roundingMode","rate","parseFloat","equalsTo","hasSameAmount","comparators","lessThanOrEqual","greaterThanOrEqual","isZero","isPositive","isNegative","hasSubUnits","hasCents","toFormat","formatter","format","matches","exec","getMatches","filter","match","getMinimumFractionDigits","decimalPosition","find","findIndex","getCurrencyDisplay","USD","dollar","$","getStyle","getUseGrouping","Format","toRoundedUnit","toLocaleString","currencyDisplay","useGrouping","minimumFractionDigits","style","toUnit","digits","toObject","toJSON","Product","$originalData","id","description","price","sku","created_at","updated_at","purchase_instructions","sessiontypes","coursetypes","allow_partial_payment","deposit_required","deposit_type","deposit_amount","minimum_payment_amount","$id","$name","$description","$price","$sku","$created_at","$updated_at","$session_types","$course_types","$purchase_instructions","$services","$allow_partial_payment","$deposit_required","$deposit_type","$deposit_amount","$minimum_payment_amount","priceInDollars","cents","inDollars","purchaseInstructions","services","setServices","allowsPayLater","requiresDeposit","depositType","depositAmount","minimumPaymentAmount","calculateMinimumDepositRequired","jQuery","document","ready","buttons","cart_hash","window","drivescout_config","shop","info","_loop","button","product_id","alert","addEventListener","event","preventDefault","drivescout_buttons_config","cacheCompatibility","get","shopUrl","response","cart","localStorage","getItem","products","_toConsumableArray","product","setItem","stringify","location","urls","checkout","fail","console","log","innerHTML","resopnseJSON","message","setTimeout"],"sourceRoot":""}