import { N as NajmTranslate } from './paginationLabels-dZLSNxfo.js';
import 'react';
/**
* Locale-aware value formatting.
*
* Pure functions with no React and no DOM: every input arrives through
* `NajmFormatConfig`. `NajmFormatProvider` binds them to the live locale and
* time zone, and is what an application normally uses — these are exported for
* the server, where there is no context to read.
*/
/** Rendered in place of a value that is absent or not formattable. */
declare const DEFAULT_PLACEHOLDER = "\u2014";
interface NajmFormatConfig {
/** BCP 47 tag handed to `Intl`, e.g. `"fr-MA"`. */
locale: string;
/**
* IANA zone every date is rendered in. Omitted means the host zone, which is
* the runtime's guess rather than the user's preference — supply it.
*/
timeZone?: string;
/** ISO 4217 code for `formatCurrency`, e.g. `"MAD"`. */
currency?: string;
/** Defaults to an em dash. */
placeholder?: string;
}
/**
* Formats an integer count of minor units — cents, centimes — as currency.
*
* Minor units are the input because money that survives a round trip is an
* integer; a major-unit float cannot represent 0.1 exactly and has no business
* in a ledger. A non-integer input is refused rather than rounded, since at
* this layer it means the caller has already lost precision upstream.
*/
declare function formatCurrency(minorUnits: number | null | undefined, { locale, currency, placeholder }: NajmFormatConfig): string;
declare function formatNumber(value: number | null | undefined, { locale, placeholder }: NajmFormatConfig, options?: Intl.NumberFormatOptions): string;
declare function formatPercent(value: number | null | undefined, config: NajmFormatConfig, fractionDigits?: number): string;
declare function formatDate(value: Date | number | string | null | undefined, { locale, timeZone, placeholder, }: NajmFormatConfig, options?: Intl.DateTimeFormatOptions): string;
declare function formatDateTime(value: Date | number | string | null | undefined, config: NajmFormatConfig, options?: Intl.DateTimeFormatOptions): string;
declare function formatTime(value: Date | number | string | null | undefined, config: NajmFormatConfig): string;
/**
* Renders a timestamp as distance from now — "3 days ago", "in 2 hours".
*
* Time zone is not a parameter: an elapsed duration is the same in every zone.
*/
declare function formatRelativeTime(value: Date | number | string | null | undefined, { locale, placeholder }: NajmFormatConfig, now?: Date | number): string;
/**
* Turns a machine token into readable text: `out_for_delivery` → `Out For
* Delivery`.
*
* The fallback for a value with no catalog entry, not a substitute for one.
* Anything user-visible and known in advance belongs in the translations.
*/
declare function humanizeToken(value: string): string;
/**
* Today as `YYYY-MM-DD` in the host's zone, for ``.
*
* Not `toISOString().slice(0, 10)`, which is the same line everyone writes and
* is wrong west of UTC for the first hours of the day: it converts to UTC
* first, so a date picker in Casablanca opens on tomorrow. The parts are read
* off the local calendar instead.
*
* Deliberately host-zone rather than preference-zone. This produces the value a
* date *input* round-trips, and that control is bound to the machine the user
* is typing on; `formatDate` is what renders a date for reading.
*/
declare function localDateInput(date?: Date): string;
interface SlugifyOptions {
/** Uppercases the result, for an identifier conventionally read in caps. */
upperCase?: boolean;
/** Longest slug produced, before the case change. Defaults to 160. */
maxLength?: number;
}
/**
* Turns a label into a URL- and identifier-safe token: `Épicerie Fine` →
* `epicerie-fine`.
*
* Accents are folded rather than dropped. Stripping them outright is the usual
* one-liner and it silently eats letters — `Épicerie` becomes `picerie` — which
* is a poor slug in exactly the languages most likely to need one.
*
* A value with nothing to transliterate — Arabic or CJK, where folding has no
* ASCII to fall back to — yields a random token rather than an empty string.
* Empty is never a usable slug, and returning one pushes the failure to a
* uniqueness constraint far from the cause.
*/
declare function slugify(value: string, { upperCase, maxLength }?: SlugifyOptions): string;
/**
* Catalog prefix the conventional lookup uses: `status.`.
*
* The same shape as `common.pagination` and `common.table` — a prefix rather
* than a per-token map, because the map is the boilerplate this replaces.
*/
declare const DEFAULT_STATUS_KEY_PREFIX = "status";
/** English, because a label nobody can read is worse than an English one. */
declare const DEFAULT_STATUS_LABEL_LANGUAGE = "en";
/**
* Packaged labels for the vocabulary in `NAJM_STATUS_COLORS`, in the four
* languages the Najm applications ship.
*
* Language-major so adding a language is one block rather than a line inside
* fifty entries. Deliberately generic: `in_preparation` is "In preparation",
* not one application's "Purchasing and preparation" — an application whose
* wording is its own keeps it in its own catalog, which wins over this table.
*
* Tokens with no entry here are not errors. They humanize, exactly as an
* unknown token always has.
*/
declare const NAJM_STATUS_LABELS: Record>;
/**
* The packaged language a tag resolves to: `fr-MA` and `FR` both reach `fr`.
*
* Base-language resolution rather than exact matching, because the language an
* application holds is whatever it declared — some ship `ar`, some ship `ar-MA`
* — and the label is the same either way. An unpackaged language falls back to
* English rather than to the raw tag.
*/
declare function resolveStatusLabelLanguage(language?: string): string;
/** The packaged label for a token, or `undefined` when it is not packaged. */
declare function findPackagedStatusLabel(status: string, language?: string): string | undefined;
/**
* The application's side of status labelling: its catalog, its overrides, and
* the language it is currently rendering in.
*
* Every field is optional. A caller with none of them still gets the packaged
* English, which is what makes a standalone `` — no
* auth, no Query, no app-wide i18n — render real text.
*/
interface NajmStatusLabelOptions {
/** Active language. A regional tag resolves to its base language. */
language?: string;
/** Token to finished label text. Wins over every other source. */
labels?: Record;
/** Token to catalog key, resolved through `t`. Wins over the convention. */
labelKeys?: Record;
/** The application's translator. */
t?: NajmTranslate;
/** Catalog prefix for the conventional lookup. Defaults to `"status"`. */
keyPrefix?: string;
}
/**
* The label for a status, or `undefined` when nothing claims it.
*
* Most specific first, and the order is the contract:
*
* 1. an application literal in `labels`,
* 2. an application catalog key in `labelKeys`,
* 3. the conventional `status.` entry, including a camelCase catalog
* key for a snake_case status, when the catalog has one,
* 4. the packaged label for the active language.
*
* Steps 2 and 3 are what let an application delete its token-to-key table: a
* catalog already keyed `status.delivered` is found without being described.
* An application whose keys use another prefix or naming rule can keep
* `labelKeys`, which still wins over the conventional lookup.
*/
declare function findStatusLabel(status: string, options?: NajmStatusLabelOptions): string | undefined;
/**
* The displayed text for a status, for plain text rather than a badge.
*
* The same vocabulary, normalization, precedence and locale fallback `NBadge`
* uses, so a status named in a sentence and the badge beside it cannot drift.
* Server-safe: exported from `najm-kit/format`, pure, and it reads no context.
*/
declare function formatStatusLabel(status: string, options?: NajmStatusLabelOptions): string;
export { DEFAULT_PLACEHOLDER, DEFAULT_STATUS_KEY_PREFIX, DEFAULT_STATUS_LABEL_LANGUAGE, NAJM_STATUS_LABELS, type NajmFormatConfig, type NajmStatusLabelOptions, type SlugifyOptions, findPackagedStatusLabel, findStatusLabel, formatCurrency, formatDate, formatDateTime, formatNumber, formatPercent, formatRelativeTime, formatStatusLabel, formatTime, humanizeToken, localDateInput, resolveStatusLabelLanguage, slugify };