import { MessageFormatElement, ParserOptions, parse } from "@formatjs/icu-messageformat-parser"; //#region packages/ecma402-abstract/types/number.d.ts type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact"; type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision"; type RoundingModeType = "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven"; type UseGroupingType = "min2" | "auto" | "always" | boolean; interface NumberFormatDigitOptions { minimumIntegerDigits?: number; minimumSignificantDigits?: number; maximumSignificantDigits?: number; minimumFractionDigits?: number; maximumFractionDigits?: number; roundingPriority?: RoundingPriorityType; roundingIncrement?: number; roundingMode?: RoundingModeType; trailingZeroDisplay?: TrailingZeroDisplay; } type NumberFormatOptionsLocaleMatcher = "lookup" | "best fit"; type NumberFormatOptionsStyle = "decimal" | "percent" | "currency" | "unit"; type NumberFormatOptionsCompactDisplay = "short" | "long"; type NumberFormatOptionsCurrencyDisplay = "symbol" | "code" | "name" | "narrowSymbol"; type NumberFormatOptionsCurrencySign = "standard" | "accounting"; type NumberFormatOptionsNotation = NumberFormatNotation; type NumberFormatOptionsSignDisplay = "auto" | "always" | "never" | "exceptZero" | "negative"; type NumberFormatOptionsUnitDisplay = "long" | "short" | "narrow"; type TrailingZeroDisplay = "auto" | "stripIfInteger"; type NumberFormatOptions = Omit & NumberFormatDigitOptions & { localeMatcher?: NumberFormatOptionsLocaleMatcher; style?: NumberFormatOptionsStyle; compactDisplay?: NumberFormatOptionsCompactDisplay; currencyDisplay?: NumberFormatOptionsCurrencyDisplay; currencySign?: NumberFormatOptionsCurrencySign; notation?: NumberFormatOptionsNotation; signDisplay?: NumberFormatOptionsSignDisplay; unit?: string; unitDisplay?: NumberFormatOptionsUnitDisplay; numberingSystem?: string; trailingZeroDisplay?: TrailingZeroDisplay; roundingPriority?: RoundingPriorityType; roundingIncrement?: number; roundingMode?: RoundingModeType; useGrouping?: UseGroupingType; }; //#endregion //#region packages/intl-messageformat/formatters.d.ts declare global { namespace FormatjsIntl { interface Message {} interface IntlConfig {} interface Formats {} } } type Format = Source extends keyof FormatjsIntl.Formats ? FormatjsIntl.Formats[Source] : string; export interface Formats { number: Record, NumberFormatOptions>; date: Record, Intl.DateTimeFormatOptions>; time: Record, Intl.DateTimeFormatOptions>; } export interface FormatterCache { number: Record; dateTime: Record; pluralRules: Record; } export interface Formatters { getNumberFormat(locals?: string | string[], opts?: NumberFormatOptions): Intl.NumberFormat; getDateTimeFormat(...args: ConstructorParameters): Intl.DateTimeFormat; getPluralRules(...args: ConstructorParameters): Intl.PluralRules; } export declare enum PART_TYPE { literal = 0, object = 1 } export interface LiteralPart { type: PART_TYPE.literal; value: string; } export interface ObjectPart { type: PART_TYPE.object; value: T; } export type MessageFormatPart = LiteralPart | ObjectPart; export type PrimitiveType = string | number | bigint | boolean | null | undefined | Date; export declare function isFormatXMLElementFn(el: PrimitiveType | T | FormatXMLElementFn): el is FormatXMLElementFn; export declare function formatToParts(els: MessageFormatElement[], locales: string | string[], formatters: Formatters, formats: Formats, values?: Record>, currentPluralValue?: number, originalMessage?: string): MessageFormatPart[]; export type FormatXMLElementFn = (parts: Array) => R; //#endregion //#region packages/intl-messageformat/message-types.d.ts declare const formattedTextBrand: unique symbol; /** Formatter-produced text, including fallbacks; not a translation or safety guarantee. */ type FormattedText = string & { readonly [formattedTextBrand]: true; }; declare const messageValues: unique symbol; declare const messageTag: unique symbol; /** An unformatted ICU argument, before framework-specific rich values are added. */ type MessageValue = PrimitiveType; /** A tag placeholder whose callback type is supplied by the formatter. */ interface MessageTag { readonly [messageTag]: true; } /** A message contract with no arguments. */ type NoMessageValues = Record; type MessageValues = Record; /** Type-only argument metadata shared by formatter integrations. */ interface MessageContract { readonly [messageValues]: V; } type MessageValuesOf> = D[typeof messageValues]; interface UntypedMessageContract { readonly [messageValues]?: never; } type ResolveMessageValues = { [K in keyof V]: [V[K]] extends [undefined] ? V[K] : Exclude extends MessageTag ? FormatXMLElementFn> : MessageValue extends V[K] ? V[K] | T : Extract; }; type MessageKeys = V extends unknown ? keyof V : never; type TypedMessageValues = (V extends unknown ? (values: ResolveMessageValues) => void : never) extends ((values: infer Values) => void) ? Values : never; type MessageFormatArguments = MessageKeys extends never ? [values?: Record, ...extra: Extra] : {} extends TypedMessageValues ? [values?: TypedMessageValues, ...extra: Extra] : [values: TypedMessageValues, ...extra: Extra]; type UntypedMessageFormat = (values?: Record>) => string | T | (string | T)[]; type UntypedMessageFormatToParts = (values?: Record>) => MessageFormatPart[]; type MessageFormatFunction = [V] extends [MessageValues] ? (...args: MessageFormatArguments, T>) => string | T | (string | T)[] : UntypedMessageFormat; type MessageFormatToPartsFunction = [V] extends [MessageValues] ? (...args: MessageFormatArguments, T>) => MessageFormatPart[] : UntypedMessageFormatToParts; //#endregion //#region packages/intl-messageformat/core.d.ts export interface Options extends Omit { formatters?: Formatters; } export declare class IntlMessageFormat { private readonly ast; private readonly locales; private readonly resolvedLocale?; private readonly formatters; private readonly formats; private readonly message; private readonly formatterCache; constructor(message: string | MessageFormatElement[], locales?: string | string[], overrideFormats?: Partial, opts?: Options); format: MessageFormatFunction; formatToParts: MessageFormatToPartsFunction; resolvedOptions: () => { locale: string; }; getAst: () => MessageFormatElement[]; private static memoizedDefaultLocale; static get defaultLocale(): string; static resolveLocale: (locales: string | string[]) => Intl.Locale | undefined; static __parse: typeof parse | undefined; static formats: Formats; } //#endregion //#region packages/intl-messageformat/error.d.ts export declare enum ErrorCode { MISSING_VALUE = "MISSING_VALUE", INVALID_VALUE = "INVALID_VALUE", MISSING_INTL_API = "MISSING_INTL_API" } export declare class FormatError extends Error { readonly code: ErrorCode; /** * Original message we're trying to format * `undefined` if we're only dealing w/ AST * * @type {(string | undefined)} * @memberof FormatError */ readonly originalMessage: string | undefined; constructor(msg: string, code: ErrorCode, originalMessage?: string); toString(): string; } export declare class InvalidValueError extends FormatError { constructor(variableId: string, value: any, options: string[], originalMessage?: string); } export declare class InvalidValueTypeError extends FormatError { constructor(value: any, type: string, originalMessage?: string); } export declare class MissingValueError extends FormatError { constructor(variableId: string, originalMessage?: string); } //#endregion export { type FormattedText, IntlMessageFormat as default, type MessageContract, type MessageFormatArguments, type MessageFormatFunction, type MessageFormatToPartsFunction, type MessageTag, type MessageValue, type MessageValues, type MessageValuesOf, type NoMessageValues, type TypedMessageValues, type UntypedMessageContract }; //# sourceMappingURL=index.d.ts.map