{
  "version": 3,
  "sources": ["../../src/i18n/locales/sv/r-common.json", "../../src/i18n/locales/sv/r-pipes.json", "../../src/i18n/locales/sv/r-validation.json", "../../src/i18n/icu.ts", "../../src/i18n/catalogue.ts", "../../src/i18n/locales/en/r-common.json", "../../src/i18n/locales/en/r-pipes.json", "../../src/i18n/locales/en/r-validation.json", "../../src/i18n/builtins.ts", "../../src/i18n/i18n.ts", "../../src/pipes.ts", "../../src/tools.ts", "../../src/SequentialId.ts", "../../src/errors.ts"],
  "sourcesContent": ["{\r\n    \"greeting\": \"Hej, {name}!\",\r\n    \"items\": \"{count, plural, one {# sak} other {# saker}}\"\r\n}\r\n", "{\r\n    \"today\": \"idag\",\r\n    \"yesterday\": \"ig\u00E5r\",\r\n    \"daysAgo\": \"{count, plural, one {# dag sedan} other {# dagar sedan}}\",\r\n    \"pieces\": \"{count, plural, =0 {inga} one {en} other {# st}}\"\r\n}\r\n", "{\r\n    \"required\": \"Detta f\u00E4lt \u00E4r obligatoriskt.\",\r\n    \"range\": \"Talet m\u00E5ste vara mellan {min} och {max}, var {actual}.\",\r\n    \"digits\": \"Ange endast siffror.\"\r\n}\r\n", "/**\r\n * @module icu\r\n * ICU message format support for internationalization.\r\n * Provides pluralization, select, and value interpolation.\r\n *\r\n * @example\r\n * // Simple interpolation\r\n * formatICU('Hello, {name}!', { name: 'World' });\r\n * // Returns: 'Hello, World!'\r\n *\r\n * @example\r\n * // Pluralization\r\n * formatICU('{count, plural, one {# item} other {# items}}', { count: 5 });\r\n * // Returns: '5 items'\r\n *\r\n * @example\r\n * // Select\r\n * formatICU('{gender, select, male {He} female {She} other {They}}', { gender: 'female' });\r\n * // Returns: 'She'\r\n */\r\n\r\nconst pluralRulesCache = new Map<string, Intl.PluralRules>();\r\n\r\n/**\r\n * Function type for message formatters.\r\n * Implement this to provide custom message formatting.\r\n */\r\nexport type MessageFormatter = (\r\n    message: string,\r\n    values?: Record<string, any>,\r\n    locale?: string\r\n) => string;\r\n\r\n\r\nfunction getPluralRule(locale: string): Intl.PluralRules {\r\n    if (!pluralRulesCache.has(locale)) {\r\n        pluralRulesCache.set(locale, new Intl.PluralRules(locale));\r\n    }\r\n    return pluralRulesCache.get(locale)!;\r\n}\r\n\r\nfunction escapeRegex(s: string): string {\r\n    return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n}\r\n\r\n/**\r\n * Default ICU message formatter implementation.\r\n * Supports simple interpolation, pluralization with exact matches, and select.\r\n *\r\n * @param message - ICU format message string\r\n * @param values - Values to interpolate\r\n * @param locale - Locale for plural rules (default: 'en')\r\n * @returns Formatted message string\r\n *\r\n * @example\r\n * defaultFormatICU('{n, plural, =0 {none} one {# item} other {# items}}', { n: 0 }, 'en');\r\n * // Returns: 'none'\r\n *\r\n * @example\r\n * defaultFormatICU('{role, select, admin {Full access} other {Limited access}}', { role: 'admin' });\r\n * // Returns: 'Full access'\r\n */\r\nexport function defaultFormatICU(\r\n    message: string,\r\n    values?: Record<string, any>,\r\n    locale: string = 'en'\r\n): string {\r\n    return message.replace(\r\n        /\\{(\\w+)(?:, (plural|select),((?:[^{}]*\\{[^{}]*\\})+))?\\}/g,\r\n        (_, key, type, categoriesPart) => {\r\n            const value = values?.[key];\r\n\r\n            if (type === 'plural') {\r\n                const exact = new RegExp(\r\n                    `=${escapeRegex(String(value))}\\\\s*\\\\{([^{}]*)\\\\}`\r\n                ).exec(categoriesPart);\r\n                if (exact) {\r\n                    return exact[1]\r\n                        .replace(`{${key}}`, String(value))\r\n                        .replace('#', String(value));\r\n                }\r\n\r\n                const rules = getPluralRule(locale);\r\n                const category = rules.select(value);\r\n                const match =\r\n                    new RegExp(`${category}\\\\s*\\\\{([^{}]*)\\\\}`).exec(categoriesPart) ||\r\n                    new RegExp(`other\\\\s*\\\\{([^{}]*)\\\\}`).exec(categoriesPart);\r\n                if (match) {\r\n                    return match[1]\r\n                        .replace(`{${key}}`, String(value))\r\n                        .replace('#', String(value));\r\n                }\r\n                return String(value);\r\n            }\r\n\r\n            if (type === 'select') {\r\n                const escaped = escapeRegex(String(value));\r\n                const match =\r\n                    new RegExp(`\\\\b${escaped}\\\\s*\\\\{([^{}]*)\\\\}`).exec(categoriesPart) ||\r\n                    new RegExp(`\\\\bother\\\\s*\\\\{([^{}]*)\\\\}`).exec(categoriesPart);\r\n                return match ? match[1] : String(value);\r\n            }\r\n\r\n            return value !== undefined ? String(value) : `{${key}}`;\r\n        },\r\n    );\r\n}\r\n\r\n/**\r\n * The active message formatter. Defaults to `defaultFormatICU`.\r\n * Can be replaced with `setMessageFormatter` for custom formatting.\r\n */\r\nexport let formatICU: MessageFormatter = defaultFormatICU;\r\n\r\n/**\r\n * Replaces the default message formatter with a custom implementation.\r\n * Use this to integrate with external i18n libraries like FormatJS.\r\n *\r\n * @param formatter - The custom formatter function\r\n *\r\n * @example\r\n * // Use FormatJS IntlMessageFormat\r\n * import { IntlMessageFormat } from 'intl-messageformat';\r\n *\r\n * setMessageFormatter((message, values, locale) => {\r\n *     const fmt = new IntlMessageFormat(message, locale);\r\n *     return fmt.format(values);\r\n * });\r\n */\r\nexport function setMessageFormatter(formatter: MessageFormatter) {\r\n    formatICU = formatter;\r\n}", "/**\n * @module i18n/catalogue\n * Registry of translation files, filled by the application at startup.\n *\n * A bundler resolves import paths relative to the file that contains them, so a\n * library can never discover translation files that live in an application. The\n * application therefore hands its files to the library instead.\n *\n * @example\n * // Vite\n * import { registerCatalogue } from '@relax.js/core/i18n';\n * registerCatalogue(import.meta.glob('./locales/*\\/*.json', { eager: true }));\n *\n * @example\n * // Any bundler, or no bundler at all\n * import { registerNamespace } from '@relax.js/core/i18n';\n * import shellEn from './locales/en/shell.json';\n * registerNamespace('en', 'shell', shellEn);\n */\n\nexport type TranslationMap = Record<string, string>;\n\n/**\n * Loads a namespace the first time it is used, so translations for locales\n * nobody selects stay out of the initial download.\n */\nexport type NamespaceLoader = () => Promise<TranslationMap | { default: TranslationMap }>;\n\n/**\n * A namespace given either as ready messages or as a loader that fetches them.\n */\nexport type NamespaceSource = TranslationMap | NamespaceLoader;\n\nconst catalogue: Record<string, Record<string, NamespaceSource>> = {};\n\n/**\n * Reduces `en-US` to `en`, so a browser language matches a translation folder.\n */\nexport function normalizeLocale(locale: string): string {\n    return locale.toLowerCase().split('-')[0];\n}\n\nfunction unwrapModule(value: TranslationMap | { default: TranslationMap }): TranslationMap {\n    const candidate = (value as { default?: TranslationMap }).default;\n    return candidate && typeof candidate === 'object' ? candidate : (value as TranslationMap);\n}\n\n/**\n * Adds a single namespace to the catalogue.\n *\n * Registering the same locale and namespace twice replaces the previous entry,\n * which lets an application override a built-in namespace such as `r-validation`.\n *\n * @param locale - Locale code, normalized the same way as `setLocale()`\n * @param namespace - Namespace name used in front of the colon in `t('shell:title')`\n * @param source - The messages, or a function that loads them on first use\n *\n * @example\n * import shellEn from './locales/en/shell.json';\n * registerNamespace('en', 'shell', shellEn);\n *\n * @example\n * registerNamespace('sv', 'shell', () => import('./locales/sv/shell.json'));\n */\nexport function registerNamespace(\n    locale: string,\n    namespace: string,\n    source: NamespaceSource,\n): void {\n    const normalized = normalizeLocale(locale);\n    if (!catalogue[normalized]) catalogue[normalized] = {};\n    catalogue[normalized][namespace] = source;\n}\n\n/**\n * Adds every namespace in a path-keyed record, so a whole `locales/` folder is\n * registered in one call.\n *\n * The locale and namespace are read from the last two segments of each key, so\n * `./locales/en/shell.json` becomes locale `en` and namespace `shell`. Values may\n * be the messages, a module with the messages as its default export, or a\n * function returning either. That covers Vite's eager and lazy `import.meta.glob`,\n * webpack's `require.context`, and a plain object written by hand.\n *\n * @param modules - Record keyed by file path\n *\n * @example\n * // Vite, everything in the first download\n * registerCatalogue(import.meta.glob('./locales/*\\/*.json', { eager: true }));\n *\n * @example\n * // Vite, each locale downloaded when it is first selected\n * registerCatalogue(import.meta.glob('./locales/*\\/*.json'));\n *\n * @example\n * // No bundler\n * registerCatalogue({\n *     './locales/en/shell.json': { title: 'Dashboard' },\n *     './locales/sv/shell.json': { title: 'Instrumentpanel' },\n * });\n */\nexport function registerCatalogue(modules: Record<string, unknown>): void {\n    for (const path of Object.keys(modules)) {\n        const segments = path.replace(/\\.json$/i, '').split('/').filter(Boolean);\n        if (segments.length < 2) {\n            console.warn(\n                `i18n: skipped catalogue entry '${path}' because it has no {locale}/{namespace} part.`,\n            );\n            continue;\n        }\n        const namespace = segments[segments.length - 1];\n        const locale = segments[segments.length - 2];\n        registerNamespace(locale, namespace, modules[path] as NamespaceSource);\n    }\n}\n\n/**\n * Returns the messages for a namespace, or `undefined` when it was never registered.\n *\n * Rejects when a registered loader fails, so a network error is reported rather\n * than mistaken for a namespace nobody registered.\n */\nexport async function resolveNamespace(\n    locale: string,\n    namespace: string,\n): Promise<TranslationMap | undefined> {\n    const source = catalogue[normalizeLocale(locale)]?.[namespace];\n    if (!source) return undefined;\n    if (typeof source === 'function') return unwrapModule(await source());\n    return unwrapModule(source);\n}\n", "{\r\n    \"greeting\": \"Hello, {name}!\",\r\n    \"items\": \"{count, plural, one {# item} other {# items}}\"\r\n}\r\n", "{\r\n    \"today\": \"today\",\r\n    \"yesterday\": \"yesterday\",\r\n    \"daysAgo\": \"{count, plural, one {# day ago} other {# days ago}}\",\r\n    \"pieces\": \"{count, plural, =0 {none} one {one} other {# pcs}}\"\r\n}\r\n", "{\r\n    \"required\": \"This field is required.\",\r\n    \"range\": \"Number must be between {min} and {max}, was {actual}.\",\r\n    \"digits\": \"Please enter only digits.\"\r\n}\r\n", "/**\n * @module i18n/builtins\n * Registers the namespaces that ship with Relaxjs.\n *\n * English is imported directly so it is always present in the bundle and can act\n * as the fallback for every other locale. The remaining locales are loaded the\n * first time they are selected.\n */\n\nimport { registerNamespace } from './catalogue';\nimport enCommon from './locales/en/r-common.json';\nimport enPipes from './locales/en/r-pipes.json';\nimport enValidation from './locales/en/r-validation.json';\n\n/**\n * Fills the catalogue with `r-common`, `r-pipes`, and `r-validation`.\n *\n * Called once when the i18n module loads. An application may replace any of these\n * afterwards by registering the same locale and namespace again.\n */\nexport function registerBuiltinNamespaces(): void {\n    registerNamespace('en', 'r-common', enCommon);\n    registerNamespace('en', 'r-pipes', enPipes);\n    registerNamespace('en', 'r-validation', enValidation);\n\n    registerNamespace('sv', 'r-common', () => import('./locales/sv/r-common.json'));\n    registerNamespace('sv', 'r-pipes', () => import('./locales/sv/r-pipes.json'));\n    registerNamespace('sv', 'r-validation', () => import('./locales/sv/r-validation.json'));\n}\n", "/**\r\n * @module i18n\r\n * Internationalization support with namespace-based translations.\r\n * Uses ICU message format for pluralization, select, and formatting.\r\n *\r\n * @example\r\n * // Initialize locale\r\n * await setLocale('sv');\r\n *\r\n * // Use translations\r\n * const greeting = t('r-common:greeting', { name: 'John' });\r\n * const items = t('shop:items', { count: 5 });\r\n */\r\n\r\nimport { formatICU } from './icu';\r\nimport { registerBuiltinNamespaces } from './builtins';\r\nimport { normalizeLocale, resolveNamespace, TranslationMap } from './catalogue';\r\n\r\ntype Locale = string;\r\ntype Namespace = string;\r\ntype Translations = Record<Namespace, TranslationMap>;\r\n\r\n/**\r\n * Extra behaviour for a single `t()` call.\r\n */\r\nexport interface TranslateOptions {\r\n    /**\r\n     * Text to show when the key is missing, instead of the key itself.\r\n     *\r\n     * Use it for wording that must never be absent, such as a legally required\r\n     * notice. The fallback goes through the same formatter, so it can contain\r\n     * placeholders.\r\n     */\r\n    fallback?: string;\r\n}\r\n\r\nexport type MissingTranslationHandler = (\r\n    key: string,\r\n    namespace: string,\r\n    locale: string,\r\n) => void;\r\n\r\n/**\r\n * Dispatched on `document` after `setLocale()` completes.\r\n * The `locale` property contains the new normalized locale code.\r\n *\r\n * @example\r\n * document.addEventListener('localechange', (e) => {\r\n *     console.log(`Locale changed to ${e.locale}`);\r\n *     this.render();\r\n * });\r\n */\r\nexport class LocaleChangeEvent extends Event {\r\n    readonly locale: string;\r\n    constructor(locale: string) {\r\n        super('localechange', { bubbles: false });\r\n        this.locale = locale;\r\n    }\r\n}\r\n\r\ndeclare global {\r\n    interface DocumentEventMap {\r\n        localechange: LocaleChangeEvent;\r\n    }\r\n}\r\n\r\nconst fallbackLocale: Locale = 'en';\r\nlet currentLocale: Locale = fallbackLocale;\r\nconst loadedNamespaces = new Set<Namespace>();\r\nconst translations: Translations = {};\r\nlet missingHandler: MissingTranslationHandler | null = null;\r\n\r\nregisterBuiltinNamespaces();\r\n\r\n/**\r\n * Sets the current locale and loads the common namespace.\r\n * Clears previously loaded translations and dispatches a `localechange` event.\r\n *\r\n * @param locale - The locale code (e.g., 'en', 'sv', 'en-US')\r\n *\r\n * @example\r\n * await setLocale('sv');\r\n */\r\nexport async function setLocale(locale: string): Promise<void> {\r\n    const normalized = normalizeLocale(locale);\r\n    currentLocale = normalized;\r\n    loadedNamespaces.clear();\r\n    Object.keys(translations).forEach(ns => delete translations[ns]);\r\n    await loadNamespace('r-common');\r\n    if (typeof document !== 'undefined') {\r\n        document.dispatchEvent(new LocaleChangeEvent(normalized));\r\n    }\r\n}\r\n\r\nasync function tryResolve(\r\n    locale: Locale,\r\n    namespace: Namespace,\r\n): Promise<TranslationMap | undefined> {\r\n    try {\r\n        return await resolveNamespace(locale, namespace);\r\n    } catch (err) {\r\n        console.warn(\r\n            `i18n: could not load namespace '${namespace}' for locale '${locale}'.`,\r\n            err,\r\n        );\r\n        return undefined;\r\n    }\r\n}\r\n\r\n/**\r\n * Loads a translation namespace from the catalogue.\r\n * Falls back to the default locale when the namespace is not translated yet.\r\n *\r\n * Never rejects. A namespace nobody registered is reported as a warning so that\r\n * one forgotten file cannot stop the application from starting.\r\n *\r\n * @param namespace - The namespace to load (e.g., 'shop', 'errors')\r\n *\r\n * @example\r\n * await loadNamespace('shop');\r\n * const price = t('shop:priceLabel');\r\n */\r\nexport async function loadNamespace(namespace: Namespace): Promise<void> {\r\n    if (loadedNamespaces.has(namespace)) return;\r\n\r\n    let messages = await tryResolve(currentLocale, namespace);\r\n    if (!messages && currentLocale !== fallbackLocale) {\r\n        messages = await tryResolve(fallbackLocale, namespace);\r\n    }\r\n\r\n    if (!messages) {\r\n        console.warn(\r\n            `i18n: namespace '${namespace}' is not registered for locale '${currentLocale}'. ` +\r\n            `Register it during startup with registerCatalogue() or registerNamespace().`,\r\n        );\r\n        return;\r\n    }\r\n\r\n    translations[namespace] = messages;\r\n    loadedNamespaces.add(namespace);\r\n}\r\n\r\n/**\r\n * Loads multiple translation namespaces in parallel.\r\n *\r\n * @param namespaces - Array of namespace names to load\r\n *\r\n * @example\r\n * await loadNamespaces(['r-pipes', 'r-validation']);\r\n */\r\nexport async function loadNamespaces(namespaces: Namespace[]): Promise<void> {\r\n    await Promise.all(namespaces.map(ns => loadNamespace(ns)));\r\n}\r\n\r\n/**\r\n * Translates a key with optional value interpolation.\r\n * Supports ICU message format for pluralization and select.\r\n *\r\n * @param fullKey - Translation key in format 'namespace:key' or just 'key' (uses 'r-common')\r\n * @param values - Values to interpolate into the message\r\n * @param options - Set `fallback` for text that must never be missing\r\n * @returns The translated string, the fallback, or the key if neither is available\r\n *\r\n * @example\r\n * // Simple translation\r\n * t('greeting'); // Uses r-common:greeting\r\n *\r\n * // With namespace\r\n * t('errors:notFound');\r\n *\r\n * // With interpolation\r\n * t('welcome', { name: 'John' }); // \"Welcome, John!\"\r\n *\r\n * // With pluralization (ICU format)\r\n * t('items', { count: 5 }); // \"5 items\" or \"5 f\u00F6rem\u00E5l\"\r\n *\r\n * // Wording that must never render as a raw key\r\n * t('shell:aiDisclosure', undefined, {\r\n *     fallback: 'You are interacting with an AI system.',\r\n * });\r\n */\r\nexport function t(\r\n    fullKey: string,\r\n    values?: Record<string, any>,\r\n    options?: TranslateOptions,\r\n): string {\r\n    const [namespace, key] = fullKey.includes(':')\r\n        ? fullKey.split(':')\r\n        : ['r-common', fullKey];\r\n    const message = translations[namespace]?.[key];\r\n\r\n    if (!message) {\r\n        if (missingHandler) missingHandler(key, namespace, currentLocale);\r\n        if (options?.fallback === undefined) return fullKey;\r\n        return format(options.fallback, values, options.fallback);\r\n    }\r\n\r\n    return format(message, values, options?.fallback ?? fullKey);\r\n}\r\n\r\nfunction format(message: string, values: Record<string, any> | undefined, onError: string): string {\r\n    try {\r\n        return formatICU(message, values, currentLocale) as string;\r\n    } catch {\r\n        return onError;\r\n    }\r\n}\r\n\r\n/**\r\n * Returns the current locale code.\r\n *\r\n * @returns The normalized locale code (e.g., 'en', 'sv')\r\n */\r\nexport function getCurrentLocale(): string {\r\n    return currentLocale;\r\n}\r\n\r\n/**\r\n * Registers a handler called when `t()` encounters a missing translation key.\r\n * Pass `null` to remove the handler.\r\n *\r\n * @param handler - Callback receiving the key, namespace, and locale\r\n *\r\n * @example\r\n * onMissingTranslation((key, ns, locale) => {\r\n *     console.warn(`Missing: ${ns}:${key} [${locale}]`);\r\n * });\r\n */\r\nexport function onMissingTranslation(handler: MissingTranslationHandler | null): void {\r\n    missingHandler = handler;\r\n}\r\n", "/**\r\n * @module pipes\r\n * Data transformation functions (pipes) for use in template expressions.\r\n * Pipes transform values for display, like formatting dates, currencies, or text.\r\n *\r\n * Locale-aware pipes (currency, date, daysAgo, pieces) use the i18n system\r\n * for formatting and translations. Call `setLocale()` before using these pipes.\r\n *\r\n * Pipes can be chained in templates: `{{value | uppercase | shorten:20}}`\r\n *\r\n * @example\r\n * // In templates\r\n * <span>{{user.name | uppercase}}</span>\r\n * <span>{{price | currency}}</span>\r\n * <span>{{createdAt | daysAgo}}</span>\r\n *\r\n * @example\r\n * // Programmatic usage\r\n * import { applyPipes, defaultPipes } from 'relaxjs';\r\n * const result = applyPipes('hello world', ['uppercase', 'shorten:8']);\r\n * // Returns: 'HELLO...'\r\n */\r\n\r\nimport { getCurrentLocale, t } from './i18n/i18n';\r\n\r\n/**\r\n * Type definition for pipe transformation functions.\r\n * Pipes take a value and optional arguments, returning a transformed value.\r\n *\r\n * @example\r\n * // Define a custom pipe\r\n * const reversePipe: PipeFunction = (value: string) => {\r\n *     return value.split('').reverse().join('');\r\n * };\r\n */\r\nexport type PipeFunction = (value: any, ...args: any[]) => any;\r\n\r\n\r\n//  =============================== Text manipulation pipes  ===========================\r\n\r\n\r\n\r\n/**\r\n * Converts a string to uppercase\r\n * @param value The string to convert\r\n * @returns The uppercase string\r\n */\r\nexport function uppercasePipe(value: string): string {\r\n    return String(value).toUpperCase();\r\n}\r\n\r\n/**\r\n * Converts a string to uppercase\r\n * @param value The string to convert\r\n * @returns The uppercase string\r\n */\r\nexport function trimPipe(value: string): string {\r\n    return String(value).trimEnd().trimStart();\r\n}\r\n\r\n\r\n/**\r\n * Converts a string to lowercase\r\n * @param value The string to convert\r\n * @returns The lowercase string\r\n */\r\nexport function lowercasePipe(value: string): string {\r\n    return String(value).toLowerCase();\r\n}\r\n\r\n/**\r\n * Capitalizes the first character of a string\r\n * @param value The string to capitalize\r\n * @returns The capitalized string\r\n */\r\nexport function capitalizePipe(value: string): string {\r\n    const str = String(value);\r\n    return str.charAt(0).toUpperCase() + str.slice(1);\r\n}\r\n\r\n/**\r\n * Shortens a string to a specified length and adds ellipsis.\r\n * @param value The string to shorten\r\n * @param length Maximum length including ellipsis\r\n * @returns The shortened string with ellipsis if needed\r\n */\r\nexport function shortenPipe(value: string, length: string): string {\r\n    const str = String(value);\r\n    const maxLength = parseInt(length, 10);\r\n    return str.length > maxLength\r\n        ? str.substring(0, maxLength - 3) + '...'\r\n        : str;\r\n}\r\n\r\n// Formatting pipes\r\n/**\r\n * Formats a number as currency using the current locale.\r\n * Uses the i18n system's current locale for formatting.\r\n *\r\n * @param value The number to format\r\n * @param currency Currency code (defaults to USD)\r\n * @returns Formatted currency string\r\n *\r\n * @example\r\n * // In template: {{price | currency}} or {{price | currency:EUR}}\r\n * currencyPipe(1234.56);        // \"$1,234.56\" (en) or \"1 234,56 $\" (sv)\r\n * currencyPipe(1234.56, 'SEK'); // \"SEK 1,234.56\" (en) or \"1 234,56 kr\" (sv)\r\n */\r\nexport function currencyPipe(value: number, currency: string = 'USD'): string {\r\n    const locale = getCurrentLocale();\r\n    return new Intl.NumberFormat(locale, {\r\n        style: 'currency',\r\n        currency\r\n    }).format(value);\r\n}\r\n\r\n/**\r\n * Formats a date value according to the specified format.\r\n * Uses the i18n system's current locale for formatting.\r\n *\r\n * @param value Date value (string, number, or Date object)\r\n * @param format Format type: 'short', 'long', or default (ISO)\r\n * @returns Formatted date string\r\n *\r\n * @example\r\n * // In template: {{date | date:short}} or {{date | date:long}}\r\n * datePipe(new Date(), 'short'); // \"1/15/2024\" (en) or \"2024-01-15\" (sv)\r\n * datePipe(new Date(), 'long');  // \"Monday, January 15, 2024\" (en) or \"m\u00E5ndag 15 januari 2024\" (sv)\r\n */\r\nexport function datePipe(value: string | number | Date, format?: string): string {\r\n    const date = new Date(value);\r\n    const locale = getCurrentLocale();\r\n    if (format === 'short') {\r\n        return date.toLocaleDateString(locale);\r\n    } else if (format === 'long') {\r\n        return date.toLocaleDateString(locale, {\r\n            weekday: 'long',\r\n            year: 'numeric',\r\n            month: 'long',\r\n            day: 'numeric'\r\n        });\r\n    }\r\n    return date.toISOString();\r\n}\r\n\r\n/**\r\n * Prints today, yesterday or X days ago.\r\n * Uses the i18n system for translations (requires pipes namespace loaded).\r\n *\r\n * @param value Date value (string, number, or Date object)\r\n * @returns Formatted relative date string\r\n *\r\n * @example\r\n * // In template: {{createdAt | daysAgo}}\r\n * // English: \"today\", \"yesterday\", \"3 days ago\"\r\n * // Swedish: \"idag\", \"ig\u00E5r\", \"3 dagar sedan\"\r\n */\r\nexport function daysAgoPipe(value: string | number | Date): string {\r\n    if (!value) {\r\n        return 'n/a';\r\n    }\r\n\r\n    const inputDate = new Date(value);\r\n    const today = new Date();\r\n\r\n    // Normalize times to midnight to compare only dates\r\n    inputDate.setHours(0, 0, 0, 0);\r\n    today.setHours(0, 0, 0, 0);\r\n\r\n    const diffTime = today.getTime() - inputDate.getTime();\r\n    const diffDays = Math.round(diffTime / (1000 * 60 * 60 * 24));\r\n\r\n    if (diffDays === 0) return t('r-pipes:today');\r\n    if (diffDays === 1) return t('r-pipes:yesterday');\r\n    return t('r-pipes:daysAgo', { count: diffDays });\r\n}\r\n\r\n/**\r\n * Formats a count as pieces/items.\r\n * Uses the i18n system for translations (requires pipes namespace loaded).\r\n *\r\n * @param value Count value\r\n * @returns Formatted piece count string\r\n *\r\n * @example\r\n * // In template: {{quantity | pieces}}\r\n * // English: \"none\", \"one\", \"3 pcs\"\r\n * // Swedish: \"inga\", \"en\", \"3 st\"\r\n */\r\nexport function piecesPipe(value: string | number): string {\r\n    if (value === null || value === undefined) {\r\n        return 'n/a';\r\n    }\r\n\r\n    const count = Number(value);\r\n    return t('r-pipes:pieces', { count });\r\n}\r\n\r\n\r\n\r\n//  =============================== Array operation pipes  ===========================\r\n\r\n\r\n\r\n/**\r\n * Joins array elements with the specified separator\r\n * @param value Array to join\r\n * @param separator Character(s) to use between elements (defaults to comma)\r\n * @returns Joined string or original value if not an array\r\n */\r\nexport function joinPipe(value: any[], separator: string = ','): string | any {\r\n    if (!Array.isArray(value)) return value;\r\n    return value.join(separator);\r\n}\r\n\r\n/**\r\n * Returns the first element of an array\r\n * @param value Array to extract from\r\n * @returns First element or empty string if array is empty/invalid\r\n */\r\nexport function firstPipe(value: any[]): any {\r\n    if (!Array.isArray(value) || value.length === 0) return '';\r\n    return value[0];\r\n}\r\n\r\n/**\r\n * Returns the last element of an array\r\n * @param value Array to extract from\r\n * @returns Last element or empty string if array is empty/invalid\r\n */\r\nexport function lastPipe(value: any[]): any {\r\n    if (!Array.isArray(value) || value.length === 0) return '';\r\n    return value[value.length - 1];\r\n}\r\n\r\n// Object operation pipes\r\n/**\r\n * Returns the keys of an object\r\n * @param value Object to extract keys from\r\n * @returns Array of object keys or empty array if not an object\r\n */\r\nexport function keysPipe(value: object): string[] {\r\n    if (typeof value !== 'object' || value === null) return [];\r\n    return Object.keys(value);\r\n}\r\n\r\n// Conditional pipes\r\n/**\r\n * Returns a default value if the input is falsy\r\n * @param value Input value to check\r\n * @param defaultValue Value to return if input is falsy\r\n * @returns Original value or default value\r\n */\r\nexport function defaultPipe(value: any, defaultValue: string): any {\r\n    return value || defaultValue;\r\n}\r\n\r\n/**\r\n * Implements ternary operator as a pipe\r\n * @param value Condition to evaluate\r\n * @param trueValue Value to return if condition is truthy\r\n * @param falseValue Value to return if condition is falsy\r\n * @returns Selected value based on condition\r\n */\r\nexport function ternaryPipe(value: any, trueValue: string, falseValue: string): string {\r\n    return value ? trueValue : falseValue;\r\n}\r\n\r\n\r\n\r\n//  =============================== Pipe registry and application  ===========================\r\n\r\n\r\n/**\r\n * Interface for a collection of pipe functions.\r\n * Use this to look up pipes by name for template processing.\r\n *\r\n * @example\r\n * // Check if a pipe exists before using\r\n * if (registry.has('currency')) {\r\n *     const formatted = registry.get('currency')(price);\r\n * }\r\n */\r\nexport interface PipeRegistry {\r\n    /**\r\n     * Looks up a pipe by name, returning null if not found.\r\n     */\r\n    lookup(name: string): PipeFunction | null;\r\n\r\n    /**\r\n     * Gets a pipe by name, throwing if not found.\r\n     */\r\n    get(name: string): PipeFunction;\r\n\r\n    /**\r\n     * Checks if a pipe with the given name exists.\r\n     */\r\n    has(name: string): boolean;\r\n}\r\n\r\n\r\n/**\r\n * Creates a new pipe registry with all built-in pipes registered.\r\n * Built-in pipes include:\r\n *\r\n * **Text:** uppercase, lowercase, capitalize, trim, shorten\r\n * **Formatting:** currency, date, daysAgo, pieces\r\n * **Arrays:** join, first, last\r\n * **Objects:** keys\r\n * **Conditionals:** default, ternary\r\n *\r\n * @returns A new pipe registry instance\r\n *\r\n * @example\r\n * const registry = createPipeRegistry();\r\n * const upperPipe = registry.get('uppercase');\r\n * console.log(upperPipe('hello')); // 'HELLO'\r\n */\r\nexport function createPipeRegistry(): PipeRegistry {\r\n    const pipes = new Map<string, PipeFunction>();\r\n\r\n    // Text manipulation\r\n    pipes.set('uppercase', uppercasePipe);\r\n    pipes.set('lowercase', lowercasePipe);\r\n    pipes.set('capitalize', capitalizePipe);\r\n    pipes.set('trim', trimPipe);\r\n    pipes.set('shorten', shortenPipe);\r\n\r\n    // Formatting\r\n    pipes.set('currency', currencyPipe);\r\n    pipes.set('date', datePipe);\r\n    pipes.set('daysAgo', daysAgoPipe);\r\n    pipes.set('pieces', piecesPipe);\r\n\r\n    // Array operations\r\n    pipes.set('join', joinPipe);\r\n    pipes.set('first', firstPipe);\r\n    pipes.set('last', lastPipe);\r\n\r\n    // Object operations\r\n    pipes.set('keys', keysPipe);\r\n\r\n    // Conditional formatting\r\n    pipes.set('default', defaultPipe);\r\n    pipes.set('ternary', ternaryPipe);\r\n\r\n    return {\r\n        lookup(name) {\r\n            return pipes.get(name) ?? null;\r\n        },\r\n        get(name) {\r\n            var pipe = pipes.get(name);\r\n            if (!pipe) {\r\n                throw Error(\"Pipe '\" + name + \"' not found.\");\r\n            }\r\n            return pipe;\r\n        },\r\n        has(name) {\r\n            return pipes.has(name);\r\n        },\r\n    };\r\n}\r\n\r\n/**\r\n * Default pipe registry instance with all built-in pipes.\r\n * Used by template engines unless a custom registry is provided.\r\n *\r\n * @example\r\n * import { defaultPipes } from 'relaxjs';\r\n *\r\n * if (defaultPipes.has('uppercase')) {\r\n *     const result = defaultPipes.get('uppercase')('hello');\r\n * }\r\n */\r\nexport const defaultPipes = createPipeRegistry();\r\n\r\n/**\r\n * Applies a series of pipes to a value sequentially.\r\n * Each pipe transforms the output of the previous pipe.\r\n *\r\n * Pipe arguments are specified after a colon: `shorten:20`\r\n *\r\n * @param value - Initial value to transform\r\n * @param pipes - Array of pipe strings (name and optional arguments separated by ':')\r\n * @param registry - Optional custom pipe registry (uses defaultPipes if not provided)\r\n * @returns The transformed value after applying all pipes\r\n *\r\n * @example\r\n * // Apply single pipe\r\n * applyPipes('hello', ['uppercase']); // 'HELLO'\r\n *\r\n * @example\r\n * // Chain multiple pipes\r\n * applyPipes('hello world', ['uppercase', 'shorten:8']); // 'HELLO...'\r\n *\r\n * @example\r\n * // With pipe arguments\r\n * applyPipes(1234.56, ['currency']); // '$1,234.56'\r\n */\r\nexport function applyPipes(\r\n    value: any,\r\n    pipes: string[],\r\n    registry: PipeRegistry = defaultPipes\r\n): any {\r\n\r\n    return pipes.reduce((currentValue, pipe) => {\r\n        const [pipeName, ...args] = pipe.split(':').map((p) => p.trim());\r\n\r\n        if (!registry.has(pipeName)) {\r\n            return `[Pipe ${pipeName} not found]`;\r\n        }\r\n\r\n        try {\r\n            return registry.get(pipeName)(currentValue, ...args);\r\n        } catch (error) {\r\n            return `[Pipe ${pipeName}, value: ${value}, error: ${error}]`;\r\n        }\r\n    }, value);\r\n}", "/**\r\n * Resolves a deeply nested value from an object using a path array.\r\n * Safely navigates through the object tree, returning undefined if any\r\n * segment in the path is null or undefined.\r\n *\r\n * Used internally by template engines to access data properties,\r\n * but also useful for general-purpose deep property access.\r\n *\r\n * @param path - Array of property names forming the path to the value\r\n * @param context - The object to resolve the value from\r\n * @returns The resolved value, or undefined if path cannot be resolved\r\n *\r\n * @example\r\n * // Access nested property\r\n * const user = { address: { city: 'Stockholm' } };\r\n * const city = resolveValue(['address', 'city'], user);\r\n * // Returns: 'Stockholm'\r\n *\r\n * @example\r\n * // Safe access with missing properties\r\n * const data = { user: null };\r\n * const name = resolveValue(['user', 'name'], data);\r\n * // Returns: undefined (doesn't throw)\r\n *\r\n * @example\r\n * // Use with template expression paths\r\n * const path = 'user.profile.avatar'.split('.');\r\n * const avatar = resolveValue(path, context);\r\n */\r\nexport function resolveValue(\r\n    path: string[],\r\n    context: Record<string, any>\r\n): any | undefined {\r\n    let value = context;\r\n\r\n    for (const key of path) {\r\n        if (value === undefined || value === null) {\r\n            return undefined;\r\n        }\r\n\r\n        value = value[key];\r\n    }\r\n\r\n    return value !== undefined && value !== null ? value : undefined;\r\n}\r\n  ", "/**\r\n * @module SequentialId\r\n * Generates compact, time-ordered unique identifiers suitable for distributed systems.\r\n *\r\n * IDs are structured to be:\r\n * - Unique across multiple clients (via baseId)\r\n * - Time-sortable (timestamp is the most significant bits)\r\n * - Compact (Base36 encoding produces short strings)\r\n *\r\n * Bit allocation (58 bits total):\r\n * - 30 bits for timestamp (seconds since January 1, 2025)\r\n * - 8 bits for per-second counter (supports 256 IDs/second)\r\n * - 20 bits for client/endpoint identifier (supports ~1M unique sources)\r\n */\r\n\r\nconst TIMESTAMP_BITS = 30;\r\nconst COUNTER_BITS = 8;\r\nconst BASEID_BITS = 20;\r\n\r\nconst MAX_TIMESTAMP = (1 << TIMESTAMP_BITS) - 1;\r\nconst MAX_COUNTER = (1 << COUNTER_BITS) - 1;\r\nconst MAX_BASEID = (1 << BASEID_BITS) - 1;\r\n\r\nconst EPOCH = Math.floor(new Date('2025-01-01T00:00:00Z').getTime() / 1000);\r\n\r\nlet lastTimestamp = 0;\r\nlet counter = 0;\r\n\r\n/**\r\n * Generates a unique, time-ordered sequential ID.\r\n *\r\n * The ID combines a timestamp, per-second counter, and client identifier\r\n * into a compact Base36 string. IDs generated later will sort after earlier IDs,\r\n * making them suitable for ordered collections.\r\n *\r\n * @param baseId - Unique identifier for the client/endpoint (0 to 1,048,575).\r\n *                 Use different baseIds for different servers or processes to\r\n *                 avoid collisions.\r\n * @returns Base36 encoded string representing the unique ID\r\n * @throws Error if baseId is out of valid range\r\n * @throws Error if more than 256 IDs are generated in a single second\r\n * @throws Error if timestamp exceeds range (after year 2045)\r\n *\r\n * @example\r\n * // Generate ID for server instance 1\r\n * const id1 = generateSequentialId(1);\r\n * // Returns something like: 'k2j8m3n5p'\r\n *\r\n * @example\r\n * // Different servers use different baseIds\r\n * const SERVER_ID = parseInt(process.env.SERVER_ID || '0');\r\n * const orderId = generateSequentialId(SERVER_ID);\r\n *\r\n * @example\r\n * // IDs are time-sortable\r\n * const id1 = generateSequentialId(0);\r\n * await delay(1000);\r\n * const id2 = generateSequentialId(0);\r\n * console.log(id1 < id2); // true (lexicographic comparison works)\r\n */\r\nexport function generateSequentialId(baseId: number): string {\r\n    if (baseId < 0 || baseId > MAX_BASEID) {\r\n        throw new Error(`baseId must be between 0 and ${MAX_BASEID}`);\r\n    }\r\n\r\n    const now = Math.floor(Date.now() / 1000);\r\n    if (now === lastTimestamp) {\r\n        counter++;\r\n        if (counter > MAX_COUNTER) {\r\n            throw new Error('Too many IDs generated in one second');\r\n        }\r\n    } else {\r\n        lastTimestamp = now;\r\n        counter = 0;\r\n    }\r\n\r\n    const timestamp = now - EPOCH;\r\n    if (timestamp > MAX_TIMESTAMP) {\r\n        throw new Error('Timestamp exceeds allowed range (beyond 2045-01-01)');\r\n    }\r\n\r\n    const ts = BigInt(timestamp);\r\n    const cnt = BigInt(counter);\r\n    const uid = BigInt(baseId);\r\n\r\n    // [ timestamp (30 bits) | counter (8 bits) | baseId (20 bits) ]\r\n    const id =\r\n        (ts << BigInt(COUNTER_BITS + BASEID_BITS)) |\r\n        (cnt << BigInt(BASEID_BITS)) |\r\n        uid;\r\n\r\n    return id.toString(36).toLowerCase();\r\n}\r\n", "/**\r\n * Global error handling for Relaxjs.\r\n * Register a handler with `onError()` to intercept errors before they throw.\r\n * Call `ctx.suppress()` in the handler to prevent the error from being thrown.\r\n *\r\n * @example\r\n * import { onError } from 'relaxjs';\r\n *\r\n * onError((error, ctx) => {\r\n *     logToService(error.message, error.context);\r\n *     showToast(error.message);\r\n *     ctx.suppress();\r\n * });\r\n */\r\n\r\n/**\r\n * Passed to error handlers to control error behavior.\r\n * Call `suppress()` to prevent the error from being thrown.\r\n */\r\nexport interface ErrorContext {\r\n    suppress(): void;\r\n}\r\n\r\n/**\r\n * Error with structured context for debugging.\r\n * The `context` record contains details like route name, component tag, route data.\r\n *\r\n * @example\r\n * onError((error, ctx) => {\r\n *     console.log(error.context.route);\r\n *     console.log(error.context.componentTagName);\r\n * });\r\n */\r\nexport class RelaxError extends Error {\r\n    constructor(\r\n        message: string,\r\n        public context: Record<string, unknown>,\r\n    ) {\r\n        super(message);\r\n    }\r\n}\r\n\r\n/** @internal */\r\ntype ErrorHandler = (error: RelaxError, ctx: ErrorContext) => void;\r\n\r\nlet handler: ErrorHandler | null = null;\r\n\r\n/**\r\n * Registers a global error handler for Relaxjs errors.\r\n * The handler receives the error and an `ErrorContext`.\r\n * Call `ctx.suppress()` to prevent the error from being thrown.\r\n * Only one handler can be active at a time; subsequent calls replace the previous handler.\r\n *\r\n * @example\r\n * onError((error, ctx) => {\r\n *     if (error.context.route === 'optional-panel') {\r\n *         ctx.suppress();\r\n *         return;\r\n *     }\r\n *     showErrorDialog(error.message);\r\n * });\r\n */\r\nexport function onError(fn: ErrorHandler) {\r\n    handler = fn;\r\n}\r\n\r\n/**\r\n * Reports an error through the global handler.\r\n * Returns the `RelaxError` if it should be thrown, or `null` if the handler suppressed it.\r\n * The caller is responsible for throwing the returned error.\r\n *\r\n * @param message - Human-readable error description\r\n * @param context - Structured data for debugging (route, component, params, cause, etc.)\r\n * @returns The error to throw, or `null` if suppressed\r\n *\r\n * @example\r\n * const error = reportError('Failed to load route component', {\r\n *     route: 'user',\r\n *     componentTagName: 'user-profile',\r\n *     routeData: { id: 123 },\r\n * });\r\n * if (error) throw error;\r\n */\r\nexport function reportError(message: string, context: Record<string, unknown>): RelaxError | null {\r\n    const error = new RelaxError(message, context);\r\n    if (handler) {\r\n        let suppressed = false;\r\n        const ctx: ErrorContext = {\r\n            suppress() { suppressed = true; },\r\n        };\r\n        handler(error, ctx);\r\n        if (suppressed) {\r\n            return null;\r\n        }\r\n    }\r\n    return error;\r\n}\r\n\r\n/**\r\n * Wraps an async function into a synchronous callback suitable for addEventListener.\r\n * Catches promise rejections and reports them through the global error handler.\r\n *\r\n * @param fn - Async function to wrap\r\n * @returns Synchronous function that can be passed to addEventListener\r\n *\r\n * @example\r\n * button.addEventListener('click', asyncHandler(async (e) => {\r\n *     await saveData();\r\n * }));\r\n *\r\n * @example\r\n * form.addEventListener('submit', asyncHandler(async (e) => {\r\n *     e.preventDefault();\r\n *     await submitForm();\r\n * }));\r\n */\r\nexport function asyncHandler<TArgs extends unknown[]>(\r\n    fn: (...args: TArgs) => Promise<void>,\r\n): (...args: TArgs) => void {\r\n    return function (this: any, ...args: TArgs) {\r\n        fn.call(this, ...args).catch((cause: unknown) => {\r\n            const error = reportError('Async callback failed', { cause });\r\n            if (error) throw error;\r\n        });\r\n    };\r\n}\r\n"],
  "mappings": "ygBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAAAA,EAAA,SACI,SAAY,eACZ,MAAS,8CACb,ICHA,IAAAC,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAAAA,EAAA,SACI,MAAS,OACT,UAAa,UACb,QAAW,2DACX,OAAU,kDACd,ICLA,IAAAC,EAAAC,EAAA,CAAAC,GAAAC,IAAA,CAAAA,EAAA,SACI,SAAY,qCACZ,MAAS,4DACT,OAAU,sBACd,ICiBA,IAAMC,EAAmB,IAAI,IAa7B,SAASC,EAAcC,EAAkC,CACrD,OAAKF,EAAiB,IAAIE,CAAM,GAC5BF,EAAiB,IAAIE,EAAQ,IAAI,KAAK,YAAYA,CAAM,CAAC,EAEtDF,EAAiB,IAAIE,CAAM,CACtC,CAEA,SAASC,EAAYC,EAAmB,CACpC,OAAOA,EAAE,QAAQ,sBAAuB,MAAM,CAClD,CAmBO,SAASC,EACZC,EACAC,EACAL,EAAiB,KACX,CACN,OAAOI,EAAQ,QACX,2DACA,CAACE,EAAGC,EAAKC,EAAMC,IAAmB,CAC9B,IAAMC,EAAQL,IAASE,CAAG,EAE1B,GAAIC,IAAS,SAAU,CACnB,IAAMG,EAAQ,IAAI,OACd,IAAIV,EAAY,OAAOS,CAAK,CAAC,CAAC,oBAClC,EAAE,KAAKD,CAAc,EACrB,GAAIE,EACA,OAAOA,EAAM,CAAC,EACT,QAAQ,IAAIJ,CAAG,IAAK,OAAOG,CAAK,CAAC,EACjC,QAAQ,IAAK,OAAOA,CAAK,CAAC,EAInC,IAAME,EADQb,EAAcC,CAAM,EACX,OAAOU,CAAK,EAC7BG,EACF,IAAI,OAAO,GAAGD,CAAQ,oBAAoB,EAAE,KAAKH,CAAc,GAC/D,IAAI,OAAO,yBAAyB,EAAE,KAAKA,CAAc,EAC7D,OAAII,EACOA,EAAM,CAAC,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CACvC,CC3DO,IAAMC,EAAN,cAAyB,KAAM,CAClC,YACIC,EACOC,EACT,CACE,MAAMD,CAAO,EAFN,aAAAC,CAGX,CACJ,EAKIC,EAA+B,KAiB5B,SAASC,GAAQC,EAAkB,CACtCF,EAAUE,CACd,CAmBO,SAASC,EAAYL,EAAiBC,EAAqD,CAC9F,IAAMK,EAAQ,IAAIP,EAAWC,EAASC,CAAO,EAC7C,GAAIC,EAAS,CACT,IAAIK,EAAa,GAKjB,GADAL,EAAQI,EAHkB,CACtB,UAAW,CAAEC,EAAa,EAAM,CACpC,CACkB,EACdA,EACA,OAAO,IAEf,CACA,OAAOD,CACX,CAoBO,SAASE,GACZJ,EACwB,CACxB,OAAO,YAAwBK,EAAa,CACxCL,EAAG,KAAK,KAAM,GAAGK,CAAI,EAAE,MAAOC,GAAmB,CAC7C,IAAMJ,EAAQD,EAAY,wBAAyB,CAAE,MAAAK,CAAM,CAAC,EAC5D,GAAIJ,EAAO,MAAMA,CACrB,CAAC,CACL,CACJ",
  "names": ["require_r_common", "__commonJSMin", "exports", "module", "require_r_pipes", "__commonJSMin", "exports", "module", "require_r_validation", "__commonJSMin", "exports", "module", "pluralRulesCache", "getPluralRule", "locale", "escapeRegex", "s", "defaultFormatICU", "message", "values", "_", "key", "type", "categoriesPart", "value", "exact", "category", "match", "escaped", "formatICU", "catalogue", "normalizeLocale", "locale", "registerNamespace", "locale", "namespace", "source", "normalized", "normalizeLocale", "catalogue", "r_common_default", "r_pipes_default", "r_validation_default", "registerBuiltinNamespaces", "registerNamespace", "r_common_default", "r_pipes_default", "r_validation_default", "fallbackLocale", "currentLocale", "translations", "missingHandler", "registerBuiltinNamespaces", "t", "fullKey", "values", "options", "namespace", "key", "message", "translations", "format", "missingHandler", "currentLocale", "onError", "formatICU", "getCurrentLocale", "uppercasePipe", "value", "trimPipe", "lowercasePipe", "capitalizePipe", "str", "shortenPipe", "length", "maxLength", "currencyPipe", "currency", "locale", "getCurrentLocale", "datePipe", "format", "date", "daysAgoPipe", "inputDate", "today", "diffTime", "diffDays", "t", "piecesPipe", "count", "joinPipe", "separator", "firstPipe", "lastPipe", "keysPipe", "defaultPipe", "defaultValue", "ternaryPipe", "trueValue", "falseValue", "createPipeRegistry", "pipes", "name", "pipe", "defaultPipes", "applyPipes", "registry", "currentValue", "pipeName", "args", "p", "error", "resolveValue", "path", "context", "value", "key", "EPOCH", "lastTimestamp", "counter", "generateSequentialId", "baseId", "now", "timestamp", "ts", "cnt", "uid", "RelaxError", "message", "context", "handler", "onError", "fn", "reportError", "error", "suppressed", "asyncHandler", "args", "cause"]
}
