UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

34 lines (33 loc) 1.22 kB
import { jsx as f } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js"; import g from "../../../core/Context/useCoreContext.js"; import { Fragment as d } from "../../../external/preact/dist/preact.module.js"; import { useMemo as F } from "../../../external/preact/hooks/dist/hooks.module.js"; import { isFunction as x } from "../../../utils/value/is.js"; import { uniqueId as _ } from "../../../utils/random/uniqueId.js"; const h = (t) => x(t) ? t : () => t, v = ({ count: t, defaultFill: m, fills: e, translationKey: c }) => { const { i18n: l } = g(), p = F(() => { const o = h(m); return e !== void 0 ? (...r) => { const [s, i] = r; for (const u of [s, i]) { const n = h(e[u])(...r); if (n != null) return n; } return o(...r); } : o; }, [e, m]); return F(() => { const o = [], r = _("translation"), s = (...n) => (o.push(p(...n) ?? null), r), [i, ...u] = l.get(c, { count: t, values: s }).split(r); return /* @__PURE__ */ f(d, { children: [ i, u.map((n, a) => /* @__PURE__ */ f(d, { children: [ o[a], n ] }, `${r}__${a}`)) ] }); }, [l, t, p, c]); }; export { v as Translation, v as default };