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 { uniqueId as v } from "../../../utils/random/uniqueId.js"; import { isFunction as x } from "../../../utils/value/is.js"; const h = (t) => x(t) ? t : () => t, q = ({ count: t, defaultFill: u, fills: e, translationKey: c }) => { const { i18n: l } = g(), p = F(() => { const n = h(u); return e !== void 0 ? (...r) => { const [s, i] = r; for (const m of [s, i]) { const o = h(e[m])(...r); if (o != null) return o; } return n(...r); } : n; }, [e, u]); return F(() => { const n = [], r = v("translation"), s = (...o) => (n.push(p(...o) ?? null), r), [i, ...m] = l.get(c, { count: t, values: s }).split(r); return /* @__PURE__ */ f(d, { children: [ i, m.map((o, a) => /* @__PURE__ */ f(d, { children: [ n[a], o ] }, `${r}__${a}`)) ] }); }, [l, t, p, c]); }; export { q as Translation, q as default };