@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
39 lines (38 loc) • 1.09 kB
JavaScript
import { isString as u } from "../../../utils/isString.js";
import { isUndefined as i } from "../../../utils/tools.js";
import { globalDefaultLanguage as p } from "../default.js";
import { createFluentBundle as f } from "./createFluentBundle.js";
const g = (e) => u(e) && e !== "" && e.trim() === "", c = (e, t) => !!e && Object.prototype.hasOwnProperty.call(e, t) && u(e[t]) && e[t] === "", a = (e, t) => ({
message: "",
bundle: e ?? f(p.fullCode)
}), l = (e, t) => {
const r = e.getMessage(t);
if (r)
return r.value ?? "";
}, O = (e, t, r, n, s) => {
if (c(n, e))
return a(t);
if (t) {
const o = l(t, e);
if (!i(o))
return { message: o, bundle: t };
}
if (c(s, e))
return a(r);
if (r) {
const o = l(r, e);
if (!i(o))
return { message: o, bundle: r };
}
}, E = (e, t, r) => {
if (e) {
const { message: n, bundle: s } = e, o = t(n, s);
if (!(g(n) && o === "")) return o;
}
return r();
};
export {
O as getMessageWithFallback,
E as resolveLocalizedMessageValue
};
//# sourceMappingURL=fluentMessageResolution.js.map