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CAAC,kBAAkB,CAAyC,aAAa,EAAE;QAChF,MAAM;QACN,eAAe;QACf,KAAK;KACL,CAAC,CAAC;AACJ,CAAC;AAoBD,MAAM,oBAAoB,KAAa,EAAE,eAAiD,EAAE,MAAe;IAC1G,MAAM,CAAC,kBAAkB,CAAyC,QAAQ,EAAE;QAC3E,MAAM;QACN,eAAe;QACf,KAAK;KACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import 'globalize';\nimport 'globalize/dist/globalize/currency';\nimport 'globalize/dist/globalize/number';\nimport 'globalize/dist/globalize/plural';\nimport { globalizeDelegator } from './util/globalize';\n\nexport type CurrencyStyleOption = 'accounting' | 'code' | 'name' | 'symbol';\nexport type NumberStyleOption = 'decimal' | 'percent';\nexport type PluralGroup = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';\nexport type PluralTypeOption = 'cardinal' | 'ordinal';\nexport type RoundNumberOption = 'ceil' | 'floor' | 'round' | 'truncate';\n\nexport interface CommonNumberFormatterOptions {\n\t/**\n\t * Non-negative integer Number value indicating the minimum integer digits to be used. Numbers will be padded with\n\t * leading zeroes if necessary.\n\t */\n\tminimumIntegerDigits?: number;\n\n\t/**\n\t * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used.\n\t * Numbers will be rounded or padded with trailing zeroes if necessary.\n\t * Either one or both of these properties must be present.\n\t * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns.\n\t */\n\tminimumFractionDigits?: number;\n\n\t/**\n\t * Non-negative integer Number values indicating the minimum and maximum fraction digits to be used.\n\t * Numbers will be rounded or padded with trailing zeroes if necessary.\n\t * Either one or both of these properties must be present.\n\t * If they are, they will override minimum and maximum fraction digits derived from the CLDR patterns.\n\t */\n\tmaximumFractionDigits?: number;\n\n\t/**\n\t * Positive integer Number values indicating the minimum and maximum fraction digits to be shown.\n\t * Either none or both of these properties are present\n\t * If they are, they override minimum and maximum integer and fraction digits.\n\t * The formatter uses however many integer and fraction digits are required to display the specified number of\n\t * significant digits.\n\t */\n\tminimumSignificantDigits?: number;\n\n\t/**\n\t * Positive integer Number values indicating the minimum and maximum fraction digits to be shown.\n\t * Either none or both of these properties are present.\n\t * If they are, they override minimum and maximum integer and fraction digits.\n\t * The formatter uses however many integer and fraction digits are required to display the specified number of\n\t * significant digits.\n\t */\n\tmaximumSignificantDigits?: number;\n\n\t/**\n\t * String with rounding method ceil, floor, round (default), or truncate.\n\t */\n\tround?: RoundNumberOption;\n\n\t/**\n\t * Boolean (default is true) value indicating whether a grouping separator should be used.\n\t */\n\tuseGrouping?: boolean;\n}\n\nexport type CurrencyFormatterOptions = CommonNumberFormatterOptions & {\n\t/**\n\t * symbol (default), accounting, code or name.\n\t */\n\tstyle?: CurrencyStyleOption;\n};\n\nexport interface NumberFormatter {\n\t/**\n\t * Any function that formats a number as string.\n\t */\n\t(value: number): string;\n}\n\nexport type NumberFormatterOptions = CommonNumberFormatterOptions & {\n\t/**\n\t * decimal (default), or percent\n\t */\n\tstyle?: NumberStyleOption;\n};\n\nexport interface NumberParser {\n\t/**\n\t * Any function that parses a number value from a string.\n\t */\n\t(value: string): number;\n}\n\nexport type NumberParserOptions = {\n\t/**\n\t * decimal (default), or percent.\n\t */\n\tstyle?: NumberStyleOption;\n};\n\nexport type PluralGeneratorOptions = {\n\t/**\n\t * cardinal (default), or ordinal.\n\t */\n\ttype?: PluralTypeOption;\n};\n\n/**\n * Format a number as the specified currency, according to the specified configuration and or locale.\n *\n * @param value\n * The number to format.\n *\n * @param currency\n * The currency to which the number should be converted.\n *\n * @param options\n * An optional configuration of settings that determine how the currency string will be formatted.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * The formatted currency string.\n */\nexport function formatCurrency(\n\tvalue: number,\n\tcurrency: string,\n\toptions?: CurrencyFormatterOptions,\n\tlocale?: string\n): string;\nexport function formatCurrency(value: number, currency: string, locale?: string): string;\nexport function formatCurrency(\n\tvalue: number,\n\tcurrency: string,\n\toptionsOrLocale?: CurrencyFormatterOptions | string,\n\tlocale?: string\n): string {\n\treturn globalizeDelegator<number, CurrencyFormatterOptions, string>('formatCurrency', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tunit: currency,\n\t\tvalue\n\t});\n}\n\n/**\n * Format a number according to the specified configuration and or locale.\n *\n * @param value\n * The number to format.\n *\n * @param options\n * An optional configuration of settings that determine how the number string will be formatted.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * The formatted number string.\n */\nexport function formatNumber(value: number, options?: NumberFormatterOptions, locale?: string): string;\nexport function formatNumber(value: number, locale?: string): string;\nexport function formatNumber(\n\tvalue: number,\n\toptionsOrLocale?: NumberFormatterOptions | string,\n\tlocale?: string\n): string {\n\treturn globalizeDelegator<number, NumberFormatterOptions, string>('formatNumber', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tvalue\n\t});\n}\n\n/**\n * Return a function that formats a number as the specified currency, according to the specified configuration\n * and or locale.\n *\n * @param currency\n * The currency to which the number should be converted.\n *\n * @param options\n * An optional configuration of settings that determine how the currency string will be formatted.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * A function that accepts a number and returns a formatted currency string.\n */\nexport function getCurrencyFormatter(\n\tcurrency: string,\n\toptions?: CurrencyFormatterOptions,\n\tlocale?: string\n): NumberFormatter;\nexport function getCurrencyFormatter(currency: string, locale?: string): NumberFormatter;\nexport function getCurrencyFormatter(\n\tcurrency: string,\n\toptionsOrLocale?: CurrencyFormatterOptions | string,\n\tlocale?: string\n): NumberFormatter {\n\treturn globalizeDelegator<string, CurrencyFormatterOptions, NumberFormatter>('currencyFormatter', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tunit: currency\n\t});\n}\n\n/**\n * Return a function that formats a number according to the specified configuration and or locale.\n *\n * @param options\n * An optional configuration of settings that determine how the number string will be formatted.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * A function that accepts a number and returns a formatted string.\n */\nexport function getNumberFormatter(options?: NumberFormatterOptions, locale?: string): NumberFormatter;\nexport function getNumberFormatter(locale?: string): NumberFormatter;\nexport function getNumberFormatter(\n\toptionsOrLocale?: NumberFormatterOptions | string,\n\tlocale?: string\n): NumberFormatter {\n\treturn globalizeDelegator<NumberFormatterOptions, NumberFormatter>('numberFormatter', {\n\t\tlocale,\n\t\toptionsOrLocale\n\t});\n}\n\n/**\n * Parse a number from a string based on the provided configuration and or locale.\n *\n * @param options\n * An optional config that describes the format of the string.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * The parsed number.\n */\nexport function getNumberParser(options?: NumberFormatterOptions, locale?: string): NumberParser;\nexport function getNumberParser(locale?: string): NumberParser;\nexport function getNumberParser(optionsOrLocale?: NumberFormatterOptions | string, locale?: string): NumberParser {\n\treturn globalizeDelegator<NumberFormatterOptions, NumberParser>('numberParser', {\n\t\tlocale,\n\t\toptionsOrLocale\n\t});\n}\n\n/**\n * Return a function that accepts a number and returns that number's plural group.\n *\n * @param options\n * An optional configuration that determines whether the numerical value should be treated as a cardinal\n * or ordinal number.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * A function that accepts a number and returns the corresponding plural group.\n */\nexport function getPluralGenerator(options?: PluralGeneratorOptions, locale?: string): NumberFormatter;\nexport function getPluralGenerator(locale?: string): NumberFormatter;\nexport function getPluralGenerator(\n\toptionsOrLocale?: PluralGeneratorOptions | string,\n\tlocale?: string\n): NumberFormatter {\n\treturn globalizeDelegator<PluralGeneratorOptions, NumberFormatter>('pluralGenerator', {\n\t\tlocale,\n\t\toptionsOrLocale\n\t});\n}\n\n/**\n * Return a function that parses a number from a string based on the provided configuration and or locale.\n *\n * @param value\n * The string to parse.\n *\n * @param options\n * An optional config that describes the format of the string.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * A function that accepts a string and returns a number.\n */\nexport function parseNumber(value: string, options?: NumberFormatterOptions, locale?: string): number;\nexport function parseNumber(value: string, locale?: string): number;\nexport function parseNumber(value: string, optionsOrLocale?: NumberFormatterOptions | string, locale?: string): number {\n\treturn globalizeDelegator<string, NumberFormatterOptions, number>('parseNumber', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tvalue\n\t});\n}\n\n/**\n * Return the plural group from a number.\n *\n * @param value\n * The number.\n *\n * @param options\n * An optional configuration that determines whether the numerical value should be treated as a cardinal\n * or ordinal number.\n *\n * @param locale\n * An optional locale. Defaults to the root locale.\n *\n * @return\n * The plural group.\n */\nexport function pluralize(value: number, options?: PluralGeneratorOptions, locale?: string): string;\nexport function pluralize(value: number, locale?: string): string;\nexport function pluralize(value: number, optionsOrLocale?: PluralGeneratorOptions | string, locale?: string): string {\n\treturn globalizeDelegator<number, PluralGeneratorOptions, string>('plural', {\n\t\tlocale,\n\t\toptionsOrLocale,\n\t\tvalue\n\t});\n}\n"]}