//#region src/parse.d.ts type MessageNode = { kind: 'text'; value: string; } | { kind: 'hash'; } | ParamNode; interface ParamNode { kind: 'param'; name: string; format?: string; arg?: string; ordinal?: boolean; variants?: [string, MessageNode[]][]; } type IcuParser = (message: string) => MessageNode[]; declare function parse(message: string, icu?: IcuParser): MessageNode[]; //#endregion //#region src/types.d.ts type MessageValue = string | MessageTree; interface MessageTree { [key: string]: MessageValue; } type DictionaryInput = Record; type Params = Record; interface FormatInfo { param: string; key?: string; } type Formatter = (value: unknown, locale: string, arg?: string, info?: FormatInfo) => string; type LocaleLoader = () => Promise; type FlatKeys = T extends string ? never : { [K in keyof T & string]: T[K] extends string ? K : `${K}.${FlatKeys}`; }[keyof T & string]; type KeysOf = string extends keyof D ? string : [FlatKeys] extends [never] ? string : FlatKeys; type MessageAt = LookupPath; type LookupPath = T extends MessageTree ? K extends `${infer Head}.${infer Rest}` ? Head extends keyof T ? LookupPath : never : K extends keyof T ? T[K] extends string ? T[K] : never : never : never; type ParamNames = string extends S ? string : Scan>; type StripDoubles = S extends `${infer A}{{${infer B}` ? `${A}\u0000${StripDoubles}` : S; type Scan = S extends `${string}{${infer Rest}` ? CleanName> | Scan : never; type NameOf = Trim, ':'>, '|'>>; type Take = S extends `${infer A}${D}${string}` ? A : S; type Trim = S extends ` ${infer R}` ? Trim : S extends `${infer R} ` ? Trim : S; type CleanName = N extends '' ? never : N extends `${string}{${string}` ? never : N extends `${string}\u0000${string}` ? never : N; type TArgs = [S] extends [never] ? [params?: Params] : string extends S ? [params?: Params] : [ParamNames] extends [never] ? [] : [params: { [N in ParamNames & string]: unknown; }]; interface TFunction { >(key: K, ...args: TArgs>): string; (strings: TemplateStringsArray, ...values: unknown[]): string; id(key: string): (strings: TemplateStringsArray, ...values: unknown[]) => string; } type ResolveStatus = 'hit' | 'fallback' | 'miss'; interface ResolveInfo { key: string; locale: string; value: string; status: ResolveStatus; from?: string; } interface VerbalyOptions { locale?: string; fallback?: string | string[]; messages?: D; loaders?: Record; formatters?: Record; icu?: IcuParser; onMissing?: (key: string, locale: string) => string | void; onResolve?: (info: ResolveInfo) => void; partial?: string[]; } interface AddMessagesOptions { partial?: boolean; } interface Verbaly { readonly locale: string; readonly locales: string[]; readonly version: number; t: TFunction; setLocale(locale: string): void; loadLocale(locale: string): Promise; addMessages(locale: string, messages: MessageTree, options?: AddMessagesOptions): void; subscribe(listener: () => void): () => void; has(key: string): boolean; inspect(key: string): { from: string; source: string; } | undefined; } //#endregion export { parse as S, Verbaly as _, Formatter as a, MessageNode as b, MessageAt as c, ParamNames as d, Params as f, TFunction as g, TArgs as h, FormatInfo as i, MessageTree as l, ResolveStatus as m, DictionaryInput as n, KeysOf as o, ResolveInfo as p, FlatKeys as r, LocaleLoader as s, AddMessagesOptions as t, MessageValue as u, VerbalyOptions as v, ParamNode as x, IcuParser as y }; //# sourceMappingURL=types-BFlL6yDe.d.ts.map