UNPKG

@connectycube/chat-widget

Version:

A React component that seamlessly integrates ConnectyCube's real-time chat capabilities into your web applications. This widget offers an out-of-the-box solution for embedding chat features—such as instant messaging, user presence, and file sharing—withou

1,325 lines (1,323 loc) 1.01 MB
import * as V from "react"; import z, { createContext as xu, useContext as Vu, useCallback as un, useState as De, useRef as Ue, useEffect as ye, useLayoutEffect as Su, useMemo as nt, forwardRef as Bu, createElement as ri, memo as Ps } from "react"; import fe from "connectycube"; import * as Pu from "react-dom"; import Ti from "react-dom"; function vt(e, t) { for (var r = 0; r < t.length; r++) { const n = t[r]; if (typeof n != "string" && !Array.isArray(n)) { for (const o in n) if (o !== "default" && !(o in e)) { const s = Object.getOwnPropertyDescriptor(n, o); s && Object.defineProperty(e, o, s.get ? s : { enumerable: !0, get: () => n[o] }); } } } return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })); } var ea = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function ut(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function Up(e) { if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e; var t = e.default; if (typeof t == "function") { var r = function n() { return this instanceof n ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments); }; r.prototype = t.prototype; } else r = {}; return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) { var o = Object.getOwnPropertyDescriptor(e, n); Object.defineProperty(r, n, o.get ? o : { enumerable: !0, get: function() { return e[n]; } }); }), r; } var lo = { exports: {} }, xn = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var FA; function Kp() { if (FA) return xn; FA = 1; var e = z, t = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: !0, ref: !0, __self: !0, __source: !0 }; function a(i, l, c) { var d, A = {}, f = null, v = null; c !== void 0 && (f = "" + c), l.key !== void 0 && (f = "" + l.key), l.ref !== void 0 && (v = l.ref); for (d in l) n.call(l, d) && !s.hasOwnProperty(d) && (A[d] = l[d]); if (i && i.defaultProps) for (d in l = i.defaultProps, l) A[d] === void 0 && (A[d] = l[d]); return { $$typeof: t, type: i, key: f, ref: v, props: A, _owner: o.current }; } return xn.Fragment = r, xn.jsx = a, xn.jsxs = a, xn; } var Vn = {}, jA; function Fp() { if (jA) return Vn; jA = 1; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ return "production".NODE_ENV !== "production" && function() { var e = z, t = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), a = Symbol.for("react.provider"), i = Symbol.for("react.context"), l = Symbol.for("react.forward_ref"), c = Symbol.for("react.suspense"), d = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), v = Symbol.for("react.offscreen"), w = Symbol.iterator, y = "@@iterator"; function I(R) { if (R === null || typeof R != "object") return null; var _ = w && R[w] || R[y]; return typeof _ == "function" ? _ : null; } var b = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function h(R) { { for (var _ = arguments.length, Ae = new Array(_ > 1 ? _ - 1 : 0), pe = 1; pe < _; pe++) Ae[pe - 1] = arguments[pe]; m("error", R, Ae); } } function m(R, _, Ae) { { var pe = b.ReactDebugCurrentFrame, Me = pe.getStackAddendum(); Me !== "" && (_ += "%s", Ae = Ae.concat([Me])); var Te = Ae.map(function(Se) { return String(Se); }); Te.unshift("Warning: " + _), Function.prototype.apply.call(console[R], console, Te); } } var g = !1, u = !1, C = !1, E = !1, S = !1, M; M = Symbol.for("react.module.reference"); function K(R) { return !!(typeof R == "string" || typeof R == "function" || R === n || R === s || S || R === o || R === c || R === d || E || R === v || g || u || C || typeof R == "object" && R !== null && (R.$$typeof === f || R.$$typeof === A || R.$$typeof === a || R.$$typeof === i || R.$$typeof === l || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. R.$$typeof === M || R.getModuleId !== void 0)); } function N(R, _, Ae) { var pe = R.displayName; if (pe) return pe; var Me = _.displayName || _.name || ""; return Me !== "" ? Ae + "(" + Me + ")" : Ae; } function q(R) { return R.displayName || "Context"; } function D(R) { if (R == null) return null; if (typeof R.tag == "number" && h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof R == "function") return R.displayName || R.name || null; if (typeof R == "string") return R; switch (R) { case n: return "Fragment"; case r: return "Portal"; case s: return "Profiler"; case o: return "StrictMode"; case c: return "Suspense"; case d: return "SuspenseList"; } if (typeof R == "object") switch (R.$$typeof) { case i: var _ = R; return q(_) + ".Consumer"; case a: var Ae = R; return q(Ae._context) + ".Provider"; case l: return N(R, R.render, "ForwardRef"); case A: var pe = R.displayName || null; return pe !== null ? pe : D(R.type) || "Memo"; case f: { var Me = R, Te = Me._payload, Se = Me._init; try { return D(Se(Te)); } catch { return null; } } } return null; } var P = Object.assign, x = 0, O, X, F, T, k, U, W; function Z() { } Z.__reactDisabledLog = !0; function $() { { if (x === 0) { O = console.log, X = console.info, F = console.warn, T = console.error, k = console.group, U = console.groupCollapsed, W = console.groupEnd; var R = { configurable: !0, enumerable: !0, value: Z, writable: !0 }; Object.defineProperties(console, { info: R, log: R, warn: R, error: R, group: R, groupCollapsed: R, groupEnd: R }); } x++; } } function ie() { { if (x--, x === 0) { var R = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: P({}, R, { value: O }), info: P({}, R, { value: X }), warn: P({}, R, { value: F }), error: P({}, R, { value: T }), group: P({}, R, { value: k }), groupCollapsed: P({}, R, { value: U }), groupEnd: P({}, R, { value: W }) }); } x < 0 && h("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var re = b.ReactCurrentDispatcher, ne; function L(R, _, Ae) { { if (ne === void 0) try { throw Error(); } catch (Me) { var pe = Me.stack.trim().match(/\n( *(at )?)/); ne = pe && pe[1] || ""; } return ` ` + ne + R; } } var Q = !1, Y; { var H = typeof WeakMap == "function" ? WeakMap : Map; Y = new H(); } function j(R, _) { if (!R || Q) return ""; { var Ae = Y.get(R); if (Ae !== void 0) return Ae; } var pe; Q = !0; var Me = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var Te; Te = re.current, re.current = null, $(); try { if (_) { var Se = function() { throw Error(); }; if (Object.defineProperty(Se.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(Se, []); } catch (pt) { pe = pt; } Reflect.construct(R, [], Se); } else { try { Se.call(); } catch (pt) { pe = pt; } R.call(Se.prototype); } } else { try { throw Error(); } catch (pt) { pe = pt; } R(); } } catch (pt) { if (pt && pe && typeof pt.stack == "string") { for (var xe = pt.stack.split(` `), At = pe.stack.split(` `), je = xe.length - 1, Ye = At.length - 1; je >= 1 && Ye >= 0 && xe[je] !== At[Ye]; ) Ye--; for (; je >= 1 && Ye >= 0; je--, Ye--) if (xe[je] !== At[Ye]) { if (je !== 1 || Ye !== 1) do if (je--, Ye--, Ye < 0 || xe[je] !== At[Ye]) { var Vt = ` ` + xe[je].replace(" at new ", " at "); return R.displayName && Vt.includes("<anonymous>") && (Vt = Vt.replace("<anonymous>", R.displayName)), typeof R == "function" && Y.set(R, Vt), Vt; } while (je >= 1 && Ye >= 0); break; } } } finally { Q = !1, re.current = Te, ie(), Error.prepareStackTrace = Me; } var _r = R ? R.displayName || R.name : "", qr = _r ? L(_r) : ""; return typeof R == "function" && Y.set(R, qr), qr; } function se(R, _, Ae) { return j(R, !1); } function ge(R) { var _ = R.prototype; return !!(_ && _.isReactComponent); } function Be(R, _, Ae) { if (R == null) return ""; if (typeof R == "function") return j(R, ge(R)); if (typeof R == "string") return L(R); switch (R) { case c: return L("Suspense"); case d: return L("SuspenseList"); } if (typeof R == "object") switch (R.$$typeof) { case l: return se(R.render); case A: return Be(R.type, _, Ae); case f: { var pe = R, Me = pe._payload, Te = pe._init; try { return Be(Te(Me), _, Ae); } catch { } } } return ""; } var ve = Object.prototype.hasOwnProperty, Ee = {}, ze = b.ReactDebugCurrentFrame; function qe(R) { if (R) { var _ = R._owner, Ae = Be(R.type, R._source, _ ? _.type : null); ze.setExtraStackFrame(Ae); } else ze.setExtraStackFrame(null); } function er(R, _, Ae, pe, Me) { { var Te = Function.call.bind(ve); for (var Se in R) if (Te(R, Se)) { var xe = void 0; try { if (typeof R[Se] != "function") { var At = Error((pe || "React class") + ": " + Ae + " type `" + Se + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof R[Se] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw At.name = "Invariant Violation", At; } xe = R[Se](_, Se, pe, Ae, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (je) { xe = je; } xe && !(xe instanceof Error) && (qe(Me), h("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", pe || "React class", Ae, Se, typeof xe), qe(null)), xe instanceof Error && !(xe.message in Ee) && (Ee[xe.message] = !0, qe(Me), h("Failed %s type: %s", Ae, xe.message), qe(null)); } } } var Qt = Array.isArray; function B(R) { return Qt(R); } function G(R) { { var _ = typeof Symbol == "function" && Symbol.toStringTag, Ae = _ && R[Symbol.toStringTag] || R.constructor.name || "Object"; return Ae; } } function J(R) { try { return ae(R), !1; } catch { return !0; } } function ae(R) { return "" + R; } function oe(R) { if (J(R)) return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", G(R)), ae(R); } var te = b.ReactCurrentOwner, le = { key: !0, ref: !0, __self: !0, __source: !0 }, Ie, Pe; function Ke(R) { if (ve.call(R, "ref")) { var _ = Object.getOwnPropertyDescriptor(R, "ref").get; if (_ && _.isReactWarning) return !1; } return R.ref !== void 0; } function Ut(R) { if (ve.call(R, "key")) { var _ = Object.getOwnPropertyDescriptor(R, "key").get; if (_ && _.isReactWarning) return !1; } return R.key !== void 0; } function Rr(R, _) { typeof R.ref == "string" && te.current; } function kr(R, _) { { var Ae = function() { Ie || (Ie = !0, h("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _)); }; Ae.isReactWarning = !0, Object.defineProperty(R, "key", { get: Ae, configurable: !0 }); } } function Hr(R, _) { { var Ae = function() { Pe || (Pe = !0, h("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", _)); }; Ae.isReactWarning = !0, Object.defineProperty(R, "ref", { get: Ae, configurable: !0 }); } } var Or = function(R, _, Ae, pe, Me, Te, Se) { var xe = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: R, key: _, ref: Ae, props: Se, // Record the component responsible for creating this element. _owner: Te }; return xe._store = {}, Object.defineProperty(xe._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(xe, "_self", { configurable: !1, enumerable: !1, writable: !1, value: pe }), Object.defineProperty(xe, "_source", { configurable: !1, enumerable: !1, writable: !1, value: Me }), Object.freeze && (Object.freeze(xe.props), Object.freeze(xe)), xe; }; function In(R, _, Ae, pe, Me) { { var Te, Se = {}, xe = null, At = null; Ae !== void 0 && (oe(Ae), xe = "" + Ae), Ut(_) && (oe(_.key), xe = "" + _.key), Ke(_) && (At = _.ref, Rr(_, Me)); for (Te in _) ve.call(_, Te) && !le.hasOwnProperty(Te) && (Se[Te] = _[Te]); if (R && R.defaultProps) { var je = R.defaultProps; for (Te in je) Se[Te] === void 0 && (Se[Te] = je[Te]); } if (xe || At) { var Ye = typeof R == "function" ? R.displayName || R.name || "Unknown" : R; xe && kr(Se, Ye), At && Hr(Se, Ye); } return Or(R, xe, At, Me, pe, te.current, Se); } } var Kt = b.ReactCurrentOwner, Rt = b.ReactDebugCurrentFrame; function hr(R) { if (R) { var _ = R._owner, Ae = Be(R.type, R._source, _ ? _.type : null); Rt.setExtraStackFrame(Ae); } else Rt.setExtraStackFrame(null); } var Cn; Cn = !1; function Zr(R) { return typeof R == "object" && R !== null && R.$$typeof === t; } function En() { { if (Kt.current) { var R = D(Kt.current.type); if (R) return ` Check the render method of \`` + R + "`."; } return ""; } } function we(R) { return ""; } var Fe = {}; function $e(R) { { var _ = En(); if (!_) { var Ae = typeof R == "string" ? R : R.displayName || R.name; Ae && (_ = ` Check the top-level render call using <` + Ae + ">."); } return _; } } function et(R, _) { { if (!R._store || R._store.validated || R.key != null) return; R._store.validated = !0; var Ae = $e(_); if (Fe[Ae]) return; Fe[Ae] = !0; var pe = ""; R && R._owner && R._owner !== Kt.current && (pe = " It was passed a child from " + D(R._owner.type) + "."), hr(R), h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Ae, pe), hr(null); } } function Dr(R, _) { { if (typeof R != "object") return; if (B(R)) for (var Ae = 0; Ae < R.length; Ae++) { var pe = R[Ae]; Zr(pe) && et(pe, _); } else if (Zr(R)) R._store && (R._store.validated = !0); else if (R) { var Me = I(R); if (typeof Me == "function" && Me !== R.entries) for (var Te = Me.call(R), Se; !(Se = Te.next()).done; ) Zr(Se.value) && et(Se.value, _); } } } function He(R) { { var _ = R.type; if (_ == null || typeof _ == "string") return; var Ae; if (typeof _ == "function") Ae = _.propTypes; else if (typeof _ == "object" && (_.$$typeof === l || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. _.$$typeof === A)) Ae = _.propTypes; else return; if (Ae) { var pe = D(_); er(Ae, R.props, "prop", pe, R); } else if (_.PropTypes !== void 0 && !Cn) { Cn = !0; var Me = D(_); h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Me || "Unknown"); } typeof _.getDefaultProps == "function" && !_.getDefaultProps.isReactClassApproved && h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ft(R) { { for (var _ = Object.keys(R.props), Ae = 0; Ae < _.length; Ae++) { var pe = _[Ae]; if (pe !== "children" && pe !== "key") { hr(R), h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", pe), hr(null); break; } } R.ref !== null && (hr(R), h("Invalid attribute `ref` supplied to `React.Fragment`."), hr(null)); } } var Tr = {}; function gt(R, _, Ae, pe, Me, Te) { { var Se = K(R); if (!Se) { var xe = ""; (R === void 0 || typeof R == "object" && R !== null && Object.keys(R).length === 0) && (xe += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var At = we(); At ? xe += At : xe += En(); var je; R === null ? je = "null" : B(R) ? je = "array" : R !== void 0 && R.$$typeof === t ? (je = "<" + (D(R.type) || "Unknown") + " />", xe = " Did you accidentally export a JSX literal instead of a component?") : je = typeof R, h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", je, xe); } var Ye = In(R, _, Ae, Me, Te); if (Ye == null) return Ye; if (Se) { var Vt = _.children; if (Vt !== void 0) if (pe) if (B(Vt)) { for (var _r = 0; _r < Vt.length; _r++) Dr(Vt[_r], R); Object.freeze && Object.freeze(Vt); } else h("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else Dr(Vt, R); } if (ve.call(_, "key")) { var qr = D(R), pt = Object.keys(_).filter(function(Qp) { return Qp !== "key"; }), $s = pt.length > 0 ? "{key: someKey, " + pt.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Tr[qr + $s]) { var Np = pt.length > 0 ? "{" + pt.join(": ..., ") + ": ...}" : "{}"; h(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, $s, qr, Np, qr), Tr[qr + $s] = !0; } } return R === n ? ft(Ye) : He(Ye), Ye; } } function It(R, _, Ae) { return gt(R, _, Ae, !0); } function Ao(R, _, Ae) { return gt(R, _, Ae, !1); } var tr = Ao, KA = It; Vn.Fragment = n, Vn.jsx = tr, Vn.jsxs = KA; }(), Vn; } var GA; function jp() { return GA || (GA = 1, "production".NODE_ENV === "production" ? lo.exports = Kp() : lo.exports = Fp()), lo.exports; } var p = jp(); const he = (e) => typeof e == "string", Sn = () => { let e, t; const r = new Promise((n, o) => { e = n, t = o; }); return r.resolve = e, r.reject = t, r; }, zA = (e) => e == null ? "" : "" + e, Gp = (e, t, r) => { e.forEach((n) => { t[n] && (r[n] = t[n]); }); }, zp = /###/g, YA = (e) => e && e.indexOf("###") > -1 ? e.replace(zp, ".") : e, WA = (e) => !e || he(e), Nn = (e, t, r) => { const n = he(t) ? t.split(".") : t; let o = 0; for (; o < n.length - 1; ) { if (WA(e)) return {}; const s = YA(n[o]); !e[s] && r && (e[s] = new r()), Object.prototype.hasOwnProperty.call(e, s) ? e = e[s] : e = {}, ++o; } return WA(e) ? {} : { obj: e, k: YA(n[o]) }; }, JA = (e, t, r) => { const { obj: n, k: o } = Nn(e, t, Object); if (n !== void 0 || t.length === 1) { n[o] = r; return; } let s = t[t.length - 1], a = t.slice(0, t.length - 1), i = Nn(e, a, Object); for (; i.obj === void 0 && a.length; ) s = `${a[a.length - 1]}.${s}`, a = a.slice(0, a.length - 1), i = Nn(e, a, Object), i != null && i.obj && typeof i.obj[`${i.k}.${s}`] < "u" && (i.obj = void 0); i.obj[`${i.k}.${s}`] = r; }, Yp = (e, t, r, n) => { const { obj: o, k: s } = Nn(e, t, Object); o[s] = o[s] || [], o[s].push(r); }, Ko = (e, t) => { const { obj: r, k: n } = Nn(e, t); if (r && Object.prototype.hasOwnProperty.call(r, n)) return r[n]; }, Wp = (e, t, r) => { const n = Ko(e, r); return n !== void 0 ? n : Ko(t, r); }, Mu = (e, t, r) => { for (const n in t) n !== "__proto__" && n !== "constructor" && (n in e ? he(e[n]) || e[n] instanceof String || he(t[n]) || t[n] instanceof String ? r && (e[n] = t[n]) : Mu(e[n], t[n], r) : e[n] = t[n]); return e; }, $r = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); var Jp = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;", "/": "&#x2F;" }; const Xp = (e) => he(e) ? e.replace(/[&<>"'\/]/g, (t) => Jp[t]) : e; class Hp { constructor(t) { this.capacity = t, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = []; } getRegExp(t) { const r = this.regExpMap.get(t); if (r !== void 0) return r; const n = new RegExp(t); return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(t, n), this.regExpQueue.push(t), n; } } const Zp = [" ", ",", "?", "!", ";"], _p = new Hp(20), $p = (e, t, r) => { t = t || "", r = r || ""; const n = Zp.filter((a) => t.indexOf(a) < 0 && r.indexOf(a) < 0); if (n.length === 0) return !0; const o = _p.getRegExp(`(${n.map((a) => a === "?" ? "\\?" : a).join("|")})`); let s = !o.test(e); if (!s) { const a = e.indexOf(r); a > 0 && !o.test(e.substring(0, a)) && (s = !0); } return s; }, ni = function(e, t) { let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "."; if (!e) return; if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0; const n = t.split(r); let o = e; for (let s = 0; s < n.length; ) { if (!o || typeof o != "object") return; let a, i = ""; for (let l = s; l < n.length; ++l) if (l !== s && (i += r), i += n[l], a = o[i], a !== void 0) { if (["string", "number", "boolean"].indexOf(typeof a) > -1 && l < n.length - 1) continue; s += l - s + 1; break; } o = a; } return o; }, Fo = (e) => e == null ? void 0 : e.replace("_", "-"), eh = { type: "logger", log(e) { this.output("log", e); }, warn(e) { this.output("warn", e); }, error(e) { this.output("error", e); }, output(e, t) { var r, n; (n = (r = console == null ? void 0 : console[e]) == null ? void 0 : r.apply) == null || n.call(r, console, t); } }; class jo { constructor(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.init(t, r); } init(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.prefix = r.prefix || "i18next:", this.logger = t || eh, this.options = r, this.debug = r.debug; } log() { for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n]; return this.forward(r, "log", "", !0); } warn() { for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n]; return this.forward(r, "warn", "", !0); } error() { for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n]; return this.forward(r, "error", ""); } deprecate() { for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++) r[n] = arguments[n]; return this.forward(r, "warn", "WARNING DEPRECATED: ", !0); } forward(t, r, n, o) { return o && !this.debug ? null : (he(t[0]) && (t[0] = `${n}${this.prefix} ${t[0]}`), this.logger[r](t)); } create(t) { return new jo(this.logger, { prefix: `${this.prefix}:${t}:`, ...this.options }); } clone(t) { return t = t || this.options, t.prefix = t.prefix || this.prefix, new jo(this.logger, t); } } var Wt = new jo(); class Ms { constructor() { this.observers = {}; } on(t, r) { return t.split(" ").forEach((n) => { this.observers[n] || (this.observers[n] = /* @__PURE__ */ new Map()); const o = this.observers[n].get(r) || 0; this.observers[n].set(r, o + 1); }), this; } off(t, r) { if (this.observers[t]) { if (!r) { delete this.observers[t]; return; } this.observers[t].delete(r); } } emit(t) { for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), o = 1; o < r; o++) n[o - 1] = arguments[o]; this.observers[t] && Array.from(this.observers[t].entries()).forEach((a) => { let [i, l] = a; for (let c = 0; c < l; c++) i(...n); }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach((a) => { let [i, l] = a; for (let c = 0; c < l; c++) i.apply(i, [t, ...n]); }); } } class XA extends Ms { constructor(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { ns: ["translation"], defaultNS: "translation" }; super(), this.data = t || {}, this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0); } addNamespaces(t) { this.options.ns.indexOf(t) < 0 && this.options.ns.push(t); } removeNamespaces(t) { const r = this.options.ns.indexOf(t); r > -1 && this.options.ns.splice(r, 1); } getResource(t, r, n) { var c, d; let o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; const s = o.keySeparator !== void 0 ? o.keySeparator : this.options.keySeparator, a = o.ignoreJSONStructure !== void 0 ? o.ignoreJSONStructure : this.options.ignoreJSONStructure; let i; t.indexOf(".") > -1 ? i = t.split(".") : (i = [t, r], n && (Array.isArray(n) ? i.push(...n) : he(n) && s ? i.push(...n.split(s)) : i.push(n))); const l = Ko(this.data, i); return !l && !r && !n && t.indexOf(".") > -1 && (t = i[0], r = i[1], n = i.slice(2).join(".")), l || !a || !he(n) ? l : ni((d = (c = this.data) == null ? void 0 : c[t]) == null ? void 0 : d[r], n, s); } addResource(t, r, n, o) { let s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : { silent: !1 }; const a = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator; let i = [t, r]; n && (i = i.concat(a ? n.split(a) : n)), t.indexOf(".") > -1 && (i = t.split("."), o = r, r = i[1]), this.addNamespaces(r), JA(this.data, i, o), s.silent || this.emit("added", t, r, n, o); } addResources(t, r, n) { let o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : { silent: !1 }; for (const s in n) (he(n[s]) || Array.isArray(n[s])) && this.addResource(t, r, s, n[s], { silent: !0 }); o.silent || this.emit("added", t, r, n); } addResourceBundle(t, r, n, o, s) { let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : { silent: !1, skipCopy: !1 }, i = [t, r]; t.indexOf(".") > -1 && (i = t.split("."), o = n, n = r, r = i[1]), this.addNamespaces(r); let l = Ko(this.data, i) || {}; a.skipCopy || (n = JSON.parse(JSON.stringify(n))), o ? Mu(l, n, s) : l = { ...l, ...n }, JA(this.data, i, l), a.silent || this.emit("added", t, r, n); } removeResourceBundle(t, r) { this.hasResourceBundle(t, r) && delete this.data[t][r], this.removeNamespaces(r), this.emit("removed", t, r); } hasResourceBundle(t, r) { return this.getResource(t, r) !== void 0; } getResourceBundle(t, r) { return r || (r = this.options.defaultNS), this.getResource(t, r); } getDataByLanguage(t) { return this.data[t]; } hasLanguageSomeTranslations(t) { const r = this.getDataByLanguage(t); return !!(r && Object.keys(r) || []).find((o) => r[o] && Object.keys(r[o]).length > 0); } toJSON() { return this.data; } } var Ru = { processors: {}, addPostProcessor(e) { this.processors[e.name] = e; }, handle(e, t, r, n, o) { return e.forEach((s) => { var a; t = ((a = this.processors[s]) == null ? void 0 : a.process(t, r, n, o)) ?? t; }), t; } }; const HA = {}, ZA = (e) => !he(e) && typeof e != "boolean" && typeof e != "number"; class Go extends Ms { constructor(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; super(), Gp(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], t, this), this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Wt.create("translator"); } changeLanguage(t) { t && (this.language = t); } exists(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { interpolation: {} }; if (t == null) return !1; const n = this.resolve(t, r); return (n == null ? void 0 : n.res) !== void 0; } extractFromKey(t, r) { let n = r.nsSeparator !== void 0 ? r.nsSeparator : this.options.nsSeparator; n === void 0 && (n = ":"); const o = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator; let s = r.ns || this.options.defaultNS || []; const a = n && t.indexOf(n) > -1, i = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !$p(t, n, o); if (a && !i) { const l = t.match(this.interpolator.nestingRegexp); if (l && l.length > 0) return { key: t, namespaces: he(s) ? [s] : s }; const c = t.split(n); (n !== o || n === o && this.options.ns.indexOf(c[0]) > -1) && (s = c.shift()), t = c.join(o); } return { key: t, namespaces: he(s) ? [s] : s }; } translate(t, r, n) { if (typeof r != "object" && this.options.overloadTranslationOptionHandler && (r = this.options.overloadTranslationOptionHandler(arguments)), typeof options == "object" && (r = { ...r }), r || (r = {}), t == null) return ""; Array.isArray(t) || (t = [String(t)]); const o = r.returnDetails !== void 0 ? r.returnDetails : this.options.returnDetails, s = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator, { key: a, namespaces: i } = this.extractFromKey(t[t.length - 1], r), l = i[i.length - 1], c = r.lng || this.language, d = r.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode; if ((c == null ? void 0 : c.toLowerCase()) === "cimode") { if (d) { const N = r.nsSeparator || this.options.nsSeparator; return o ? { res: `${l}${N}${a}`, usedKey: a, exactUsedKey: a, usedLng: c, usedNS: l, usedParams: this.getUsedParamsDetails(r) } : `${l}${N}${a}`; } return o ? { res: a, usedKey: a, exactUsedKey: a, usedLng: c, usedNS: l, usedParams: this.getUsedParamsDetails(r) } : a; } const A = this.resolve(t, r); let f = A == null ? void 0 : A.res; const v = (A == null ? void 0 : A.usedKey) || a, w = (A == null ? void 0 : A.exactUsedKey) || a, y = ["[object Number]", "[object Function]", "[object RegExp]"], I = r.joinArrays !== void 0 ? r.joinArrays : this.options.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, h = r.count !== void 0 && !he(r.count), m = Go.hasDefaultValue(r), g = h ? this.pluralResolver.getSuffix(c, r.count, r) : "", u = r.ordinal && h ? this.pluralResolver.getSuffix(c, r.count, { ordinal: !1 }) : "", C = h && !r.ordinal && r.count === 0, E = C && r[`defaultValue${this.options.pluralSeparator}zero`] || r[`defaultValue${g}`] || r[`defaultValue${u}`] || r.defaultValue; let S = f; b && !f && m && (S = E); const M = ZA(S), K = Object.prototype.toString.apply(S); if (b && S && M && y.indexOf(K) < 0 && !(he(I) && Array.isArray(S))) { if (!r.returnObjects && !this.options.returnObjects) { this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!"); const N = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(v, S, { ...r, ns: i }) : `key '${a} (${this.language})' returned an object instead of string.`; return o ? (A.res = N, A.usedParams = this.getUsedParamsDetails(r), A) : N; } if (s) { const N = Array.isArray(S), q = N ? [] : {}, D = N ? w : v; for (const P in S) if (Object.prototype.hasOwnProperty.call(S, P)) { const x = `${D}${s}${P}`; m && !f ? q[P] = this.translate(x, { ...r, defaultValue: ZA(E) ? E[P] : void 0, joinArrays: !1, ns: i }) : q[P] = this.translate(x, { ...r, joinArrays: !1, ns: i }), q[P] === x && (q[P] = S[P]); } f = q; } } else if (b && he(I) && Array.isArray(f)) f = f.join(I), f && (f = this.extendTranslation(f, t, r, n)); else { let N = !1, q = !1; !this.isValidLookup(f) && m && (N = !0, f = E), this.isValidLookup(f) || (q = !0, f = a); const P = (r.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && q ? void 0 : f, x = m && E !== f && this.options.updateMissing; if (q || N || x) { if (this.logger.log(x ? "updateKey" : "missingKey", c, l, a, x ? E : f), s) { const T = this.resolve(a, { ...r, keySeparator: !1 }); T && T.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format."); } let O = []; const X = this.languageUtils.getFallbackCodes(this.options.fallbackLng, r.lng || this.language); if (this.options.saveMissingTo === "fallback" && X && X[0]) for (let T = 0; T < X.length; T++) O.push(X[T]); else this.options.saveMissingTo === "all" ? O = this.languageUtils.toResolveHierarchy(r.lng || this.language) : O.push(r.lng || this.language); const F = (T, k, U) => { var Z; const W = m && U !== f ? U : P; this.options.missingKeyHandler ? this.options.missingKeyHandler(T, l, k, W, x, r) : (Z = this.backendConnector) != null && Z.saveMissing && this.backendConnector.saveMissing(T, l, k, W, x, r), this.emit("missingKey", T, l, k, f); }; this.options.saveMissing && (this.options.saveMissingPlurals && h ? O.forEach((T) => { const k = this.pluralResolver.getSuffixes(T, r); C && r[`defaultValue${this.options.pluralSeparator}zero`] && k.indexOf(`${this.options.pluralSeparator}zero`) < 0 && k.push(`${this.options.pluralSeparator}zero`), k.forEach((U) => { F([T], a + U, r[`defaultValue${U}`] || E); }); }) : F(O, a, E)); } f = this.extendTranslation(f, t, r, A, n), q && f === a && this.options.appendNamespaceToMissingKey && (f = `${l}:${a}`), (q || N) && this.options.parseMissingKeyHandler && (f = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}:${a}` : a, N ? f : void 0)); } return o ? (A.res = f, A.usedParams = this.getUsedParamsDetails(r), A) : f; } extendTranslation(t, r, n, o, s) { var c, d; var a = this; if ((c = this.i18nFormat) != null && c.parse) t = this.i18nFormat.parse(t, { ...this.options.interpolation.defaultVariables, ...n }, n.lng || this.language || o.usedLng, o.usedNS, o.usedKey, { resolved: o }); else if (!n.skipInterpolation) { n.interpolation && this.interpolator.init({ ...n, interpolation: { ...this.options.interpolation, ...n.interpolation } }); const A = he(t) && (((d = n == null ? void 0 : n.interpolation) == null ? void 0 : d.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables); let f; if (A) { const w = t.match(this.interpolator.nestingRegexp); f = w && w.length; } let v = n.replace && !he(n.replace) ? n.replace : n; if (this.options.interpolation.defaultVariables && (v = { ...this.options.interpolation.defaultVariables, ...v }), t = this.interpolator.interpolate(t, v, n.lng || this.language || o.usedLng, n), A) { const w = t.match(this.interpolator.nestingRegexp), y = w && w.length; f < y && (n.nest = !1); } !n.lng && o && o.res && (n.lng = this.language || o.usedLng), n.nest !== !1 && (t = this.interpolator.nest(t, function() { for (var w = arguments.length, y = new Array(w), I = 0; I < w; I++) y[I] = arguments[I]; return (s == null ? void 0 : s[0]) === y[0] && !n.context ? (a.logger.warn(`It seems you are nesting recursively key: ${y[0]} in key: ${r[0]}`), null) : a.translate(...y, r); }, n)), n.interpolation && this.interpolator.reset(); } const i = n.postProcess || this.options.postProcess, l = he(i) ? [i] : i; return t != null && (l != null && l.length) && n.applyPostProcessor !== !1 && (t = Ru.handle(l, t, r, this.options && this.options.postProcessPassResolved ? { i18nResolved: { ...o, usedParams: this.getUsedParamsDetails(n) }, ...n } : n, this)), t; } resolve(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n, o, s, a, i; return he(t) && (t = [t]), t.forEach((l) => { if (this.isValidLookup(n)) return; const c = this.extractFromKey(l, r), d = c.key; o = d; let A = c.namespaces; this.options.fallbackNS && (A = A.concat(this.options.fallbackNS)); const f = r.count !== void 0 && !he(r.count), v = f && !r.ordinal && r.count === 0, w = r.context !== void 0 && (he(r.context) || typeof r.context == "number") && r.context !== "", y = r.lngs ? r.lngs : this.languageUtils.toResolveHierarchy(r.lng || this.language, r.fallbackLng); A.forEach((I) => { var b, h; this.isValidLookup(n) || (i = I, !HA[`${y[0]}-${I}`] && ((b = this.utils) != null && b.hasLoadedNamespace) && !((h = this.utils) != null && h.hasLoadedNamespace(i)) && (HA[`${y[0]}-${I}`] = !0, this.logger.warn(`key "${o}" for languages "${y.join(", ")}" won't get resolved as namespace "${i}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), y.forEach((m) => { var C; if (this.isValidLookup(n)) return; a = m; const g = [d]; if ((C = this.i18nFormat) != null && C.addLookupKeys) this.i18nFormat.addLookupKeys(g, d, m, I, r); else { let E; f && (E = this.pluralResolver.getSuffix(m, r.count, r)); const S = `${this.options.pluralSeparator}zero`, M = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`; if (f && (g.push(d + E), r.ordinal && E.indexOf(M) === 0 && g.push(d + E.replace(M, this.options.pluralSeparator)), v && g.push(d + S)), w) { const K = `${d}${this.options.contextSeparator}${r.context}`; g.push(K), f && (g.push(K + E), r.ordinal && E.indexOf(M) === 0 && g.push(K + E.replace(M, this.options.pluralSeparator)), v && g.push(K + S)); } } let u; for (; u = g.pop(); ) this.isValidLookup(n) || (s = u, n = this.getResource(m, I, u, r)); })); }); }), { res: n, usedKey: o, exactUsedKey: s, usedLng: a, usedNS: i }; } isValidLookup(t) { return t !== void 0 && !(!this.options.returnNull && t === null) && !(!this.options.returnEmptyString && t === ""); } getResource(t, r, n) { var s; let o = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}; return (s = this.i18nFormat) != null && s.getResource ? this.i18nFormat.getResource(t, r, n, o) : this.resourceStore.getResource(t, r, n, o); } getUsedParamsDetails() { let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; const r = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], n = t.replace && !he(t.replace); let o = n ? t.replace : t; if (n && typeof t.count < "u" && (o.count = t.count), this.options.interpolation.defaultVariables && (o = { ...this.options.interpolation.defaultVariables, ...o }), !n) { o = { ...o }; for (const s of r) delete o[s]; } return o; } static hasDefaultValue(t) { const r = "defaultValue"; for (const n in t) if (Object.prototype.hasOwnProperty.call(t, n) && r === n.substring(0, r.length) && t[n] !== void 0) return !0; return !1; } } class _A { constructor(t) { this.options = t, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Wt.create("languageUtils"); } getScriptPartFromCode(t) { if (t = Fo(t), !t || t.indexOf("-") < 0) return null; const r = t.split("-"); return r.length === 2 || (r.pop(), r[r.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(r.join("-")); } getLanguagePartFromCode(t) { if (t = Fo(t), !t || t.indexOf("-") < 0) return t; const r = t.split("-"); return this.formatLanguageCode(r[0]); } formatLanguageCode(t) { if (he(t) && t.indexOf("-") > -1) { let r; try { r = Intl.getCanonicalLocales(t)[0]; } catch { } return r && this.options.lowerCaseLng && (r = r.toLowerCase()), r || (this.options.lowerCaseLng ? t.toLowerCase() : t); } return this.options.cleanCode || this.options.lowerCaseLng ? t.toLowerCase() : t; } isSupportedCode(t) { return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (t = this.getLanguagePartFromCode(t)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(t) > -1; } getBestMatchFromCodes(t) { if (!t) return null; let r; return t.forEach((n) => { if (r) return; const o = this.formatLanguageCode(n); (!this.options.supportedLngs || this.isSupportedCode(o)) && (r = o); }), !r && this.options.supportedLngs && t.forEach((n) => { if (r) return; const o = this.getScriptPartFromCode(n); if (this.isSupportedCode(o)) return r = o; const s = this.getLanguagePartFromCode(n); if (this.isSupportedCode(s)) return r = s; r = this.options.supportedLngs.find((a) => { if (a === s) return a; if (!(a.indexOf("-") < 0 && s.indexOf("-") < 0) && (a.indexOf("-") > 0 && s.indexOf("-") < 0 && a.substring(0, a.indexOf("-")) === s || a.indexOf(s) === 0 && s.length > 1)) return a; }); }), r || (r = this.getFallbackCodes(this.options.fallbackLng)[0]), r; } getFallbackCodes(t, r) { if (!t) return []; if (typeof t == "function" && (t = t(r)), he(t) && (t = [t]), Array.isArray(t)) return t; if (!r) return t.default || []; let n = t[r]; return n || (n = t[this.getScriptPartFromCode(r)]), n || (n = t[this.formatLanguageCode(r)]), n || (n = t[this.getLanguagePartFromCode(r)]), n || (n = t.default), n || []; } toResolveHierarchy(t, r) { const n = this.getFallbackCodes(r || this.options.fallbackLng || [], t), o = [], s = (a) => { a && (this.isSupportedCode(a) ? o.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`)); }; return he(t) && (t.indexOf("-") > -1 || t.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && s(this.formatLanguageCode(t)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && s(this.getScriptPartFromCode(t)), this.options.load !== "currentOnly" && s(this.getLanguagePartFromCode(t))) : he(t) && s(this.formatLanguageCode(t)), n.forEach((a) => { o.indexOf(a) < 0 && s(this.formatLanguageCode(a)); }), o; } } const $A = { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }, el = { select: (e) => e === 1 ? "one" : "other", resolvedOptions: () => ({ pluralCategories: ["one", "other"] }) }; class th { constructor(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; this.languageUtils = t, this.options = r, this.logger = Wt.create("pluralResolver"), this.pluralRulesCache = {}; } addRule(t, r) { this.rules[t] = r; } clearCache() { this.pluralRulesCache = {}; } getRule(t) { let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; const n = Fo(t === "dev" ? "en" : t), o = r.ordinal ? "ordinal" : "cardinal", s = JSON.stringify({ cleanedCode: n, type: o }); if (s in this.pluralRulesCache) return this.pluralRulesCache[s]; let a; try { a = new Intl.PluralRules(n, { type: o }); } catch { if (!Intl) return this.logger.error("No Intl support, please use