import share_tool_en_default from "./locales/share-tool.en.js";
import share_tool_zh_default from "./locales/share-tool.zh.js";
import { formatI18n } from "./format.js";
import { normalizeServerLocale, serverLocaleOrFallback } from "./locale.js";
//#region src/i18n/share-tool-bundle.ts
const byLocale = {
	en: share_tool_en_default,
	zh: share_tool_zh_default
};
function shareToolMessages(locale) {
	return byLocale[serverLocaleOrFallback(locale)];
}
/**
* Best-effort locale resolution for tools that don't yet receive an explicit
* locale signal. Order: explicit arg → env (LANG / LC_ALL / LANGUAGE) → default.
*/
function resolveToolLocale(explicit) {
	if (explicit) {
		const n = normalizeServerLocale(explicit);
		if (n) return n;
	}
	for (const key of [
		"LC_ALL",
		"LANG",
		"LANGUAGE"
	]) {
		const v = process.env[key];
		if (!v) continue;
		const n = normalizeServerLocale(v.split(".")[0].replace(/_/g, "-"));
		if (n) return n;
	}
	return "en";
}
function shareToolSuccessLines(locale, vars) {
	const m = shareToolMessages(locale).success;
	return [
		formatI18n(m.headline, {
			kind: vars.kind,
			shareUrl: vars.shareUrl
		}),
		vars.isPublic ? "" : formatI18n(m.reachabilityWarning, {
			reachability: vars.reachability,
			hint: vars.reachabilityHint
		}),
		formatI18n(m.title, { title: vars.title }),
		formatI18n(m.expiresAt, { expiresAt: vars.expiresAt }),
		formatI18n(m.thumbnail, { thumbnailUrl: vars.thumbnailUrl })
	];
}
function shareToolErrorLine(locale, message) {
	return formatI18n(shareToolMessages(locale).error.prefix, { message });
}
//#endregion
export { resolveToolLocale, shareToolErrorLine, shareToolMessages, shareToolSuccessLines };

//# sourceMappingURL=share-tool-bundle.js.map