import { a as l, b as f, c as D, _ } from "./tslib.9321cfe3.js";
import { l as A, D as k, n as q, o as S, q as K } from "./@formatjs.55cb3330.js";
import { i as U } from "./intl-messageformat.19e56593.js";
import "./hoist-non-react-statics.5d83aeee.js";
const R = window.React;
function I(e) {
  A(e, "[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.");
}
var w = l(l({}, k), { textComponent: R.Fragment });
function Z(e) {
  return function(t) {
    return e(R.Children.toArray(t));
  };
}
function h(e, t) {
  if (e === t)
    return !0;
  if (!e || !t)
    return !1;
  var a = Object.keys(e), n = Object.keys(t), o = a.length;
  if (n.length !== o)
    return !1;
  for (var r = 0; r < o; r++) {
    var s = a[r];
    if (e[s] !== t[s] || !Object.prototype.hasOwnProperty.call(t, s))
      return !1;
  }
  return !0;
}
const z = window.React;
var M = z.createContext(null), G = M.Provider, V = G, W = M;
const X = window.React;
function P() {
  var e = X.useContext(W);
  return I(e), e;
}
const x = window.React;
var g;
(function(e) {
  e.formatDate = "FormattedDate", e.formatTime = "FormattedTime", e.formatNumber = "FormattedNumber", e.formatList = "FormattedList", e.formatDisplayName = "FormattedDisplayName";
})(g || (g = {}));
var E;
(function(e) {
  e.formatDate = "FormattedDateParts", e.formatTime = "FormattedTimeParts", e.formatNumber = "FormattedNumberParts", e.formatList = "FormattedListParts";
})(E || (E = {}));
function c(e) {
  var t = function(a) {
    var n = P(), o = a.value, r = a.children, s = f(
      a,
      ["value", "children"]
    ), i = n[e](o, s);
    if (typeof r == "function")
      return r(i);
    var d = n.textComponent || x.Fragment;
    return x.createElement(d, null, i);
  };
  return t.displayName = g[e], t;
}
const F = window.React;
function v(e) {
  return {
    locale: e.locale,
    timeZone: e.timeZone,
    fallbackOnEmptyString: e.fallbackOnEmptyString,
    formats: e.formats,
    textComponent: e.textComponent,
    messages: e.messages,
    defaultLocale: e.defaultLocale,
    defaultFormats: e.defaultFormats,
    onError: e.onError,
    onWarn: e.onWarn,
    wrapRichTextChunksInFragment: e.wrapRichTextChunksInFragment,
    defaultRichTextElements: e.defaultRichTextElements
  };
}
function L(e) {
  return e && Object.keys(e).reduce(function(t, a) {
    var n = e[a];
    return t[a] = U(n) ? Z(n) : n, t;
  }, {});
}
var H = function(e, t, a, n) {
  for (var o = [], r = 4; r < arguments.length; r++)
    o[r - 4] = arguments[r];
  var s = L(n), i = K.apply(void 0, _([
    e,
    t,
    a,
    s
  ], o, !1));
  return Array.isArray(i) ? F.Children.toArray(i) : i;
}, T = function(e, t) {
  var a = e.defaultRichTextElements, n = f(e, ["defaultRichTextElements"]), o = L(a), r = S(l(l(l({}, w), n), { defaultRichTextElements: o }), t);
  return l(l({}, r), { formatMessage: H.bind(null, {
    locale: r.locale,
    timeZone: r.timeZone,
    fallbackOnEmptyString: r.fallbackOnEmptyString,
    formats: r.formats,
    defaultLocale: r.defaultLocale,
    defaultFormats: r.defaultFormats,
    messages: r.messages,
    onError: r.onError,
    defaultRichTextElements: o
  }, r.formatters) });
}, J = function(e) {
  D(t, e);
  function t() {
    var a = e !== null && e.apply(this, arguments) || this;
    return a.cache = q(), a.state = {
      cache: a.cache,
      intl: T(v(a.props), a.cache),
      prevConfig: v(a.props)
    }, a;
  }
  return t.getDerivedStateFromProps = function(a, n) {
    var o = n.prevConfig, r = n.cache, s = v(a);
    return h(o, s) ? null : {
      intl: T(s, r),
      prevConfig: s
    };
  }, t.prototype.render = function() {
    return I(this.state.intl), F.createElement(V, { value: this.state.intl }, this.props.children);
  }, t.displayName = "IntlProvider", t.defaultProps = w, t;
}(F.PureComponent);
const te = J, m = window.React;
function Q(e, t) {
  var a = e.values, n = f(e, ["values"]), o = t.values, r = f(t, ["values"]);
  return h(o, a) && h(n, r);
}
function N(e) {
  var t = P(), a = t.formatMessage, n = t.textComponent, o = n === void 0 ? m.Fragment : n, r = e.id, s = e.description, i = e.defaultMessage, d = e.values, p = e.children, C = e.tagName, y = C === void 0 ? o : C, b = e.ignoreTag, $ = { id: r, description: s, defaultMessage: i }, u = a($, d, {
    ignoreTag: b
  });
  return typeof p == "function" ? p(Array.isArray(u) ? u : [u]) : y ? m.createElement(y, null, m.Children.toArray(u)) : m.createElement(m.Fragment, null, u);
}
N.displayName = "FormattedMessage";
var O = m.memo(N, Q);
O.displayName = "MemoizedFormattedMessage";
const re = O;
var ae = c("formatDate");
c("formatTime");
c("formatNumber");
c("formatList");
c("formatDisplayName");
export {
  re as F,
  te as I,
  ae as a,
  P as u
};
//# sourceMappingURL=react-intl.d3464ae9.js.map
